VTK  9.5.20251216
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
25
26#ifndef vtkStatisticalModel_h
27#define vtkStatisticalModel_h
28
29#include "vtkCommonDataModelModule.h" // For export macro
30#include "vtkDataObject.h"
31#include "vtkNew.h" // For vtkNew
32#include "vtkSmartPointer.h" // For vtkSmartPointer
33#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
34
35#include <map>
36
37VTK_ABI_NAMESPACE_BEGIN
38class vtkTable;
39
40class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALAUTO vtkStatisticalModel : public vtkDataObject
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
51
55 void Initialize() override;
56
60 bool IsEmpty();
61
70 unsigned long GetActualMemorySize() override;
71
75 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_STATISTICAL_MODEL; }
76
78
81 void ShallowCopy(vtkDataObject* src) override;
82 void DeepCopy(vtkDataObject* src) override;
84
87 {
88 Learned = 0,
89 Derived = 1,
90 Test = 2
91 };
92
97 static const char* GetTableTypeName(int tableType);
102 static int GetTableTypeValue(const std::string& tableType);
103
105
111
118 static int GetNumberOfTableTypes() { return 3; }
119
124
130 int GetNumberOfTables(int type);
131
137 vtkTable* GetTable(int type, int index);
138
142 std::string GetTableName(int type, int index);
143
145
151 vtkTable* FindTableByName(int type, const std::string& tableName);
152 vtkTable* FindTableByName(int type, const std::string& tableName, int& index);
154
160 bool SetNumberOfTables(int type, int number);
161
167 bool SetTable(int type, int index, vtkTable* table, const std::string& tableName);
168
175 bool SetTableName(int type, int index, const std::string& name);
176
178
187 vtkSetStringMacro(AlgorithmParameters);
188 vtkGetStringMacro(AlgorithmParameters);
189 void SetAlgorithmParameters(const std::string& algorithmParameters)
190 {
191 if (algorithmParameters.empty())
192 {
193 this->SetAlgorithmParameters(nullptr);
194 }
195 else
196 {
197 this->SetAlgorithmParameters(algorithmParameters.c_str());
198 }
199 }
200
201
202protected:
203 // Constructor with no model tables.
206
207 using TableMap = std::map<int, std::vector<vtkSmartPointer<vtkTable>>>;
209
210 char* AlgorithmParameters{ nullptr };
211
212private:
214 void operator=(const vtkStatisticalModel&) = delete;
215};
216
217VTK_ABI_NAMESPACE_END
218#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