VTK  9.7.1
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
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 
36 VTK_ABI_NAMESPACE_BEGIN
37 class vtkTable;
38 
39 class VTKCOMMONDATAMODEL_EXPORT vtkStatisticalModel : public vtkDataObject
40 {
41 public:
42  static vtkStatisticalModel* New();
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
49  vtkMTimeType GetMTime() override;
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 
85  enum TableType
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 
108  static vtkStatisticalModel* GetData(vtkInformationVector* vv, int ii = 0);
110 
117  static int GetNumberOfTableTypes() { return 3; }
118 
122  int GetNumberOfTables();
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  }
200 
201 protected:
202  // Constructor with no model tables.
204  ~vtkStatisticalModel() override;
205 
206  using TableMap = std::map<int, std::vector<vtkSmartPointer<vtkTable>>>;
208 
209  char* AlgorithmParameters{ nullptr };
210 
211 private:
212  vtkStatisticalModel(const vtkStatisticalModel&) = delete;
213  void operator=(const vtkStatisticalModel&) = delete;
214 };
215 
216 VTK_ABI_NAMESPACE_END
217 #endif // vtkStatisticalModel_h
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
a base class for statistical modeling of other data
static vtkDataObject * New()
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
int GetDataObjectType() VTK_FUTURE_CONST override
Return the type of data object.
virtual void Initialize()
Restore data object to initial state,.
a simple class to control print indentation
Definition: vtkIndent.h:28
int Test(int argc, char *argv[], const char *dfile, const InitializationCallback &initCallback)
void SetAlgorithmParameters(const std::string &algorithmParameters)
Set/get a serialization of the statistical algorithm used to create the model tables in this instance...
virtual unsigned long GetActualMemorySize()
Return the actual size of the data in kibibytes (1024 bytes).
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:59
static int GetNumberOfTableTypes()
Get the number of table types.
std::map< int, std::vector< vtkSmartPointer< vtkTable >>> TableMap
Store zero or more vtkInformation instances.
vtkMTimeType GetMTime() override
Data objects are composite objects and need to check each part for MTime.
general representation of visualization data
Definition: vtkDataObject.h:55
virtual void DeepCopy(vtkDataObject *src)
The goal of the method is to copy the complete data from src into this object.
TableType
The types of tables that a model may store.
virtual void ShallowCopy(vtkDataObject *src)
The goal of the method is to copy the data up to the array pointers only.