VTK  9.6.20260422
vtkStatisticalModel.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
54
55#ifndef vtkStatisticalModel_h
56#define vtkStatisticalModel_h
57
58#include "vtkCommonDataModelModule.h" // For export macro
59#include "vtkDataObject.h"
60#include "vtkNew.h" // For vtkNew
61#include "vtkSmartPointer.h" // For vtkSmartPointer
62
63#include <map>
64
65VTK_ABI_NAMESPACE_BEGIN
66class vtkTable;
67
68class VTKCOMMONDATAMODEL_EXPORT vtkStatisticalModel : public vtkDataObject
69{
70public:
73 void PrintSelf(ostream& os, vtkIndent indent) override;
74
79
83 void Initialize() override;
84
88 bool IsEmpty();
89
98 unsigned long GetActualMemorySize() override;
99
103 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_STATISTICAL_MODEL; }
104
106
109 void ShallowCopy(vtkDataObject* src) override;
110 void DeepCopy(vtkDataObject* src) override;
112
115 {
118 Test = 2
119 };
120
125 static const char* GetTableTypeName(int tableType);
130 static int GetTableTypeValue(const std::string& tableType);
131
133
139
146 static int GetNumberOfTableTypes() { return 3; }
147
152
158 int GetNumberOfTables(int type);
159
165 vtkTable* GetTable(int type, int index);
166
170 std::string GetTableName(int type, int index);
171
173
179 vtkTable* FindTableByName(int type, const std::string& tableName);
180 vtkTable* FindTableByName(int type, const std::string& tableName, int& index);
182
188 bool SetNumberOfTables(int type, int number);
189
195 bool SetTable(int type, int index, vtkTable* table, const std::string& tableName);
196
203 bool SetTableName(int type, int index, const std::string& name);
204
206
215 vtkSetStringMacro(AlgorithmParameters);
216 vtkGetStringMacro(AlgorithmParameters);
217 void SetAlgorithmParameters(const std::string& algorithmParameters)
218 {
219 if (algorithmParameters.empty())
220 {
221 this->SetAlgorithmParameters(nullptr);
222 }
223 else
224 {
225 this->SetAlgorithmParameters(algorithmParameters.c_str());
226 }
227 }
228
229
230protected:
231 // Constructor with no model tables.
234
235 using TableMap = std::map<int, std::vector<vtkSmartPointer<vtkTable>>>;
237
238 char* AlgorithmParameters{ nullptr };
239
240private:
242 void operator=(const vtkStatisticalModel&) = delete;
243};
244
245VTK_ABI_NAMESPACE_END
246#endif // vtkStatisticalModel_h
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
a base class for statistical modeling of other data
bool SetTableName(int type, int index, const std::string &name)
Set the name of the specified table (if the table exists).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize() override
Restore data object to initial state.
static int GetNumberOfTableTypes()
Get the number of table types.
virtual void SetAlgorithmParameters(const char *)
Set/get a serialization of the statistical algorithm used to create the model tables in this instance...
std::map< int, std::vector< vtkSmartPointer< vtkTable > > > TableMap
void SetAlgorithmParameters(const std::string &algorithmParameters)
Set/get a serialization of the statistical algorithm used to create the model tables in this instance...
vtkTable * FindTableByName(int type, const std::string &tableName, int &index)
Find a table by its type and tableName.
int GetNumberOfTables()
Get the number of tables across all types.
static int GetTableTypeValue(const std::string &tableType)
Given a string value (a human-presentable enumerant), return a TableType enumerant integer matching i...
int GetNumberOfTables(int type)
Get the number of tables of the given type.
int GetDataObjectType() VTK_FUTURE_CONST override
Return the type of data object.
vtkTable * FindTableByName(int type, const std::string &tableName)
Find a table by its type and tableName.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
static vtkStatisticalModel * GetData(vtkInformationVector *vv, int ii=0)
Retrieve an instance of this class from an information object.
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
vtkMTimeType GetMTime() override
Models are composite objects and need to check each table for MTime.
bool IsEmpty()
Return true if the model is empty (i.e., has no tables).
bool SetNumberOfTables(int type, int number)
Set the number of model tables of the given type.
bool SetTable(int type, int index, vtkTable *table, const std::string &tableName)
Set a specified table at the given type and index.
vtkTable * GetTable(int type, int index)
Get the specified table.
static vtkStatisticalModel * New()
std::string GetTableName(int type, int index)
Get the name of the specified table (if any is set).
static vtkStatisticalModel * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
~vtkStatisticalModel() override
TableType
The types of tables that a model may store.
@ Learned
Raw model data accumulated from samples.
@ Test
Information summarizing a test of model fitness.
@ Derived
Quantities dependent on learned data.
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
static const char * GetTableTypeName(int tableType)
Given a numeric value (a TableType enumerant), return a human-presentable string describing it.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:169
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318
@ VTK_STATISTICAL_MODEL
Definition vtkType.h:161