VTK  9.4.20241217
vtkStatisticsAlgorithm.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2011 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
102#ifndef vtkStatisticsAlgorithm_h
103#define vtkStatisticsAlgorithm_h
104
105#include "vtkFiltersStatisticsModule.h" // For export macro
106#include "vtkTableAlgorithm.h"
107
108VTK_ABI_NAMESPACE_BEGIN
111class vtkStdString;
112class vtkStringArray;
113class vtkVariant;
114class vtkVariantArray;
115class vtkDoubleArray;
117
118class VTKFILTERSSTATISTICS_EXPORT vtkStatisticsAlgorithm : public vtkTableAlgorithm
119{
120public:
122 void PrintSelf(ostream& os, vtkIndent indent) override;
123
128 {
129 INPUT_DATA = 0,
130 LEARN_PARAMETERS = 1,
131 INPUT_MODEL = 2
132 };
133
138 {
139 OUTPUT_DATA = 0,
140 OUTPUT_MODEL = 1,
141 OUTPUT_TEST = 2
142 };
143
149 {
151 }
152
158 {
160 }
161
167 {
169 }
170
175 virtual void SetInputModel(vtkDataObject* model)
176 {
178 }
179
181
184 vtkSetMacro(LearnOption, bool);
185 vtkGetMacro(LearnOption, bool);
187
189
192 vtkSetMacro(DeriveOption, bool);
193 vtkGetMacro(DeriveOption, bool);
195
197
200 vtkSetMacro(AssessOption, bool);
201 vtkGetMacro(AssessOption, bool);
203
205
208 vtkSetMacro(TestOption, bool);
209 vtkGetMacro(TestOption, bool);
211
213
216 vtkSetMacro(NumberOfPrimaryTables, vtkIdType);
217 vtkGetMacro(NumberOfPrimaryTables, vtkIdType);
219
221
225 vtkGetObjectMacro(AssessNames, vtkStringArray);
227
229
233 {
234 public:
236 virtual ~AssessFunctor() = default;
237 };
239
253 virtual void SetColumnStatus(const char* namCol, int status);
254
258 virtual void ResetAllColumnStates();
259
265
269 virtual void ResetRequests();
270
279
284
298 virtual const char* GetColumnForRequest(vtkIdType r, vtkIdType c);
299
300 virtual int GetColumnForRequest(vtkIdType r, vtkIdType c, vtkStdString& columnName);
301
309 void AddColumn(const char* namCol);
310
321 void AddColumnPair(const char* namColX, const char* namColY);
322
330 virtual bool SetParameter(const char* parameter, int index, vtkVariant value);
331
336
337protected:
340
341 int FillInputPortInformation(int port, vtkInformation* info) override;
342 int FillOutputPortInformation(int port, vtkInformation* info) override;
343
345
350
354 virtual void Derive(vtkMultiBlockDataSet*) = 0;
355
360
365
370
375 vtkTable* outData, vtkDataObject* inMeta, vtkStringArray* rowNames, AssessFunctor*& dfunc) = 0;
376
384
385private:
387 void operator=(const vtkStatisticsAlgorithm&) = delete;
388};
389
390VTK_ABI_NAMESPACE_END
391#endif
Proxy object to connect input/output ports.
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
maintain an unordered list of data objects
general representation of visualization data
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Composite dataset that organizes datasets into blocks.
A base class for a functor that assesses data.
virtual void operator()(vtkDoubleArray *, vtkIdType)=0
Base class for statistics algorithms.
virtual void Assess(vtkTable *, vtkMultiBlockDataSet *, vtkTable *)=0
Execute the calculations required by the Assess option.
virtual void SetAssessNames(vtkStringArray *)
Set/get assessment names.
virtual void SetColumnStatus(const char *namCol, int status)
Add or remove a column from the current analysis request.
virtual int GetColumnForRequest(vtkIdType r, vtkIdType c, vtkStdString &columnName)
~vtkStatisticsAlgorithm() override
virtual void ResetAllColumnStates()
Set the status of each and every column in the current request to OFF (0).
virtual void SetInputModelConnection(vtkAlgorithmOutput *model)
A convenience method for setting the input model connection (if one is expected or allowed).
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
virtual const char * GetColumnForRequest(vtkIdType r, vtkIdType c)
Provide the name of the c-th column for the r-th request.
OutputIndices
enumeration values to specify output port types
virtual void ResetRequests()
Empty the list of current requests.
virtual void SelectAssessFunctor(vtkTable *outData, vtkDataObject *inMeta, vtkStringArray *rowNames, AssessFunctor *&dfunc)=0
A pure virtual method to select the appropriate assessment functor.
virtual vtkIdType GetNumberOfRequests()
Return the number of requests.
virtual void Aggregate(vtkDataObjectCollection *, vtkMultiBlockDataSet *)=0
Given a collection of models, calculate aggregate model.
void AddColumnPair(const char *namColX, const char *namColY)
Convenience method to create a request with a single column name pair (namColX, namColY) in a single ...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void Derive(vtkMultiBlockDataSet *)=0
Execute the calculations required by the Derive option.
virtual void SetLearnOptionParameterConnection(vtkAlgorithmOutput *params)
A convenience method for setting learn input parameters (if one is expected or allowed).
virtual void SetInputModel(vtkDataObject *model)
A convenience method for setting the input model (if one is expected or allowed).
vtkStatisticsAlgorithmPrivate * Internals
void AddColumn(const char *namCol)
Convenience method to create a request with a single column name namCol in a single call; this is the...
void Assess(vtkTable *, vtkMultiBlockDataSet *, vtkTable *, int)
A convenience implementation for generic assessment with variable number of variables.
virtual int RequestSelectedColumns()
Use the current column status values to produce a new request for statistics to be produced when Requ...
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
virtual vtkIdType GetNumberOfColumnsForRequest(vtkIdType request)
Return the number of columns for a given request.
virtual bool SetParameter(const char *parameter, int index, vtkVariant value)
A convenience method (in particular for access from other applications) to set parameter values of Le...
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
virtual void Learn(vtkTable *, vtkTable *, vtkMultiBlockDataSet *)=0
Execute the calculations required by the Learn option, given some input Data.
virtual void SetLearnOptionParameters(vtkDataObject *params)
A convenience method for setting learn input parameters (if one is expected or allowed).
InputPorts
enumeration values to specify input port types
@ LEARN_PARAMETERS
Port 1 is for learn parameters (initial guesses, etc.)
@ INPUT_MODEL
Port 2 is for a priori models.
virtual void Test(vtkTable *, vtkMultiBlockDataSet *, vtkTable *)=0
Execute the calculations required by the Test option.
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
Superclass for algorithms that produce only vtkTables as output.
void SetInputData(vtkDataObject *obj)
Assign a data object as input.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:169
An array holding vtkVariants.
A type representing the union of many types.
Definition vtkVariant.h:162
int vtkIdType
Definition vtkType.h:315