VTK  9.6.2
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
63
64#include <map>
65
66VTK_ABI_NAMESPACE_BEGIN
67class vtkTable;
68
69class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALAUTO vtkStatisticalModel : public vtkDataObject
70{
71public:
74 void PrintSelf(ostream& os, vtkIndent indent) override;
75
80
84 void Initialize() override;
85
89 bool IsEmpty();
90
99 unsigned long GetActualMemorySize() override;
100
104 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_STATISTICAL_MODEL; }
105
107
110 void ShallowCopy(vtkDataObject* src) override;
111 void DeepCopy(vtkDataObject* src) override;
113
116 {
119 Test = 2
120 };
121
126 static const char* GetTableTypeName(int tableType);
131 static int GetTableTypeValue(const std::string& tableType);
132
134
140
147 static int GetNumberOfTableTypes() { return 3; }
148
153
159 int GetNumberOfTables(int type);
160
166 vtkTable* GetTable(int type, int index);
167
171 std::string GetTableName(int type, int index);
172
174
180 vtkTable* FindTableByName(int type, const std::string& tableName);
181 vtkTable* FindTableByName(int type, const std::string& tableName, int& index);
183
189 bool SetNumberOfTables(int type, int number);
190
196 bool SetTable(int type, int index, vtkTable* table, const std::string& tableName);
197
204 bool SetTableName(int type, int index, const std::string& name);
205
207
216 vtkSetStringMacro(AlgorithmParameters);
217 vtkGetStringMacro(AlgorithmParameters);
218 void SetAlgorithmParameters(const std::string& algorithmParameters)
219 {
220 if (algorithmParameters.empty())
221 {
222 this->SetAlgorithmParameters(nullptr);
223 }
224 else
225 {
226 this->SetAlgorithmParameters(algorithmParameters.c_str());
227 }
228 }
229
230
231protected:
232 // Constructor with no model tables.
235
236 using TableMap = std::map<int, std::vector<vtkSmartPointer<vtkTable>>>;
238
239 char* AlgorithmParameters{ nullptr };
240
241private:
243 void operator=(const vtkStatisticalModel&) = delete;
244};
245
246VTK_ABI_NAMESPACE_END
247#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:323
@ VTK_STATISTICAL_MODEL
Definition vtkType.h:166
#define VTK_MARSHALAUTO