VTK  9.1.0
vtkStatisticsAlgorithm.h
Go to the documentation of this file.
1/*=========================================================================
2
3Program: Visualization Toolkit
4Module: vtkStatisticsAlgorithm.h
5
6Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7All rights reserved.
8See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10This software is distributed WITHOUT ANY WARRANTY; without even
11the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*-------------------------------------------------------------------------
16 Copyright 2011 Sandia Corporation.
17 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18 the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
75#ifndef vtkStatisticsAlgorithm_h
76#define vtkStatisticsAlgorithm_h
77
78#include "vtkFiltersStatisticsModule.h" // For export macro
79#include "vtkTableAlgorithm.h"
80
83class vtkStdString;
84class vtkStringArray;
85class vtkVariant;
86class vtkVariantArray;
87class vtkDoubleArray;
89
90class VTKFILTERSSTATISTICS_EXPORT vtkStatisticsAlgorithm : public vtkTableAlgorithm
91{
92public:
94 void PrintSelf(ostream& os, vtkIndent indent) override;
95
100 {
101 INPUT_DATA = 0,
102 LEARN_PARAMETERS = 1,
103 INPUT_MODEL = 2
104 };
105
110 {
111 OUTPUT_DATA = 0,
112 OUTPUT_MODEL = 1,
113 OUTPUT_TEST = 2
114 };
115
121 {
123 }
124
130 {
132 }
133
139 {
141 }
142
147 virtual void SetInputModel(vtkDataObject* model)
148 {
150 }
151
153
156 vtkSetMacro(LearnOption, bool);
157 vtkGetMacro(LearnOption, bool);
159
161
164 vtkSetMacro(DeriveOption, bool);
165 vtkGetMacro(DeriveOption, bool);
167
169
172 vtkSetMacro(AssessOption, bool);
173 vtkGetMacro(AssessOption, bool);
175
177
180 vtkSetMacro(TestOption, bool);
181 vtkGetMacro(TestOption, bool);
183
185
188 vtkSetMacro(NumberOfPrimaryTables, vtkIdType);
189 vtkGetMacro(NumberOfPrimaryTables, vtkIdType);
191
193
197 vtkGetObjectMacro(AssessNames, vtkStringArray);
199
201
205 {
206 public:
208 virtual ~AssessFunctor() = default;
209 };
211
225 virtual void SetColumnStatus(const char* namCol, int status);
226
230 virtual void ResetAllColumnStates();
231
237
241 virtual void ResetRequests();
242
251
256
270 virtual const char* GetColumnForRequest(vtkIdType r, vtkIdType c);
271
272 virtual int GetColumnForRequest(vtkIdType r, vtkIdType c, vtkStdString& columnName);
273
281 void AddColumn(const char* namCol);
282
293 void AddColumnPair(const char* namColX, const char* namColY);
294
302 virtual bool SetParameter(const char* parameter, int index, vtkVariant value);
303
308
309protected:
312
313 int FillInputPortInformation(int port, vtkInformation* info) override;
314 int FillOutputPortInformation(int port, vtkInformation* info) override;
315
317
322
326 virtual void Derive(vtkMultiBlockDataSet*) = 0;
327
332
337
342
347 vtkTable* outData, vtkDataObject* inMeta, vtkStringArray* rowNames, AssessFunctor*& dfunc) = 0;
348
356
357private:
359 void operator=(const vtkStatisticsAlgorithm&) = delete;
360};
361
362#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:113
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.
Definition: vtkStdString.h:105
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:172
An array holding vtkVariants.
A atomic type representing the union of many types.
Definition: vtkVariant.h:145
int vtkIdType
Definition: vtkType.h:332