VTK  9.6.20260305
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
34#include <map>
35
36VTK_ABI_NAMESPACE_BEGIN
37class vtkTable;
38
39class VTKCOMMONDATAMODEL_EXPORT vtkStatisticalModel : public vtkDataObject
40{
41public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
50
54 void Initialize() override;
55
59 bool IsEmpty();
60
69 unsigned long GetActualMemorySize() override;
70
74 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_STATISTICAL_MODEL; }
75
77
80 void ShallowCopy(vtkDataObject* src) override;
81 void DeepCopy(vtkDataObject* src) override;
83
86 {
87 Learned = 0,
88 Derived = 1,
89 Test = 2
90 };
91
96 static const char* GetTableTypeName(int tableType);
101 static int GetTableTypeValue(const std::string& tableType);
102
104
110
117 static int GetNumberOfTableTypes() { return 3; }
118
123
129 int GetNumberOfTables(int type);
130
136 vtkTable* GetTable(int type, int index);
137
141 std::string GetTableName(int type, int index);
142
144
150 vtkTable* FindTableByName(int type, const std::string& tableName);
151 vtkTable* FindTableByName(int type, const std::string& tableName, int& index);
153
159 bool SetNumberOfTables(int type, int number);
160
166 bool SetTable(int type, int index, vtkTable* table, const std::string& tableName);
167
174 bool SetTableName(int type, int index, const std::string& name);
175
177
186 vtkSetStringMacro(AlgorithmParameters);
187 vtkGetStringMacro(AlgorithmParameters);
188 void SetAlgorithmParameters(const std::string& algorithmParameters)
189 {
190 if (algorithmParameters.empty())
191 {
192 this->SetAlgorithmParameters(nullptr);
193 }
194 else
195 {
196 this->SetAlgorithmParameters(algorithmParameters.c_str());
197 }
198 }
199
200
201protected:
202 // Constructor with no model tables.
205
206 using TableMap = std::map<int, std::vector<vtkSmartPointer<vtkTable>>>;
208
209 char* AlgorithmParameters{ nullptr };
210
211private:
213 void operator=(const vtkStatisticalModel&) = delete;
214};
215
216VTK_ABI_NAMESPACE_END
217#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