102#ifndef vtkStatisticsAlgorithm_h
103#define vtkStatisticsAlgorithm_h
105#include "vtkFiltersStatisticsModule.h"
109#include <token/Singletons.h>
111VTK_ABI_NAMESPACE_BEGIN
440 const std::string& algorithmParameters);
451 template <
typename Algorithm>
503 vtkStringToken parameterName,
const std::string& algorithmParameters);
577 const std::string&
source, std::vector<std::vector<double>>& tuple);
579 const std::string&
source, std::map<std::string, std::vector<double>>& map);
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
Allocate and hold a VTK object.
Hold a reference to a vtkObjectBase instance.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
a base class for statistical modeling of other data
A base class for a functor that assesses data.
virtual void operator()(vtkDoubleArray *, vtkIdType)=0
virtual ~AssessFunctor()=default
static std::size_t ConsumeStringTuple(const std::string &source, std::vector< std::string > &tuple)
Turn a tuple of strings into a vtkStringArray, returning the number of bytes consumed.
bool CopyRequests(vtkStatisticsAlgorithmPrivate *requests)
Copy requests for analysis from another container into this algorithm.
static AlgorithmConstructorMap & GetConstructorMap()
Return a map of registered algorithm types.
static vtkSmartPointer< vtkStatisticsAlgorithm > NewFromAlgorithmParameters(const std::string &algorithmParameters)
Return a new instance of a subclass named and configured by the algorithmParameters.
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 void AppendAlgorithmParameters(std::string &algorithmParameters) const
Subclasses must override this method if they have any internal ivars that affect the behavior of Requ...
virtual int GetColumnForRequest(vtkIdType r, vtkIdType c, vtkStdString &columnName)
virtual vtkStatisticalModel * GetOutputModel()
A convenience method for fetching an output model that returns the proper type so downcasting is not ...
~vtkStatisticsAlgorithm() override
Return a new instance of a subclass named and configured by the algorithmParameters.
static std::size_t ConsumeString(const std::string &source, std::string &value)
Turn a quoted string value into std::string, returning the number of bytes consumed.
std::function< vtkSmartPointer< vtkStatisticsAlgorithm >()> AlgorithmConstructor
Return a new instance of a subclass named and configured by the algorithmParameters.
virtual void ResetAllColumnStates()
Set the status of each and every column in the current request to OFF (0).
static std::size_t ConsumeStringTuple(const std::string &source, vtkStringArray *tuple)
Return a new instance of a subclass named and configured by the algorithmParameters.
virtual std::string GetAlgorithmParameters() const
Provide a serialization of this object's internal state so it can be recreated by a vtkStatisticalMod...
virtual void SetInputModelConnection(vtkAlgorithmOutput *model)
A convenience method for setting the input model connection (if one is expected or allowed).
void Assess(vtkTable *, vtkStatisticalModel *, vtkTable *, int)
A convenience implementation for generic assessment with variable number of variables.
vtkIdType NumberOfPrimaryTables
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Return a new instance of a subclass named and configured by the algorithmParameters.
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
@ OUTPUT_TEST
Output 2 contains result of statistical test(s)
@ OUTPUT_MODEL
Output 1 contains any generated model.
@ OUTPUT_DATA
Output 0 mirrors the input data, plus optional assessment columns.
virtual void Learn(vtkTable *, vtkTable *, vtkStatisticalModel *)=0
Execute the calculations required by the Learn option, given some input Data.
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.
static std::size_t ConsumeDoubleTuple(const std::string &source, std::vector< double > &tuple)
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 bool ConfigureFromAlgorithmParameters(const std::string &algorithmParameters)
Loop over algorithmParameters until all are consumed or an error occurs.
static void RegisterAlgorithm()
Register a subclass of this algorithm.
virtual void Assess(vtkTable *, vtkStatisticalModel *, vtkTable *)=0
Execute the calculations required by the Assess option.
static std::size_t ConsumeDouble(const std::string &source, double &value)
Turn tuples (or respectively tuples of tuples) of numbers into a vector (or respectively a vector of ...
static std::size_t ConsumeInt(const std::string &source, int &value)
Turn a string holding an integer value into an integer, returning the number of bytes consumed by the...
virtual bool Aggregate(vtkDataObjectCollection *collection, vtkStatisticalModel *model)=0
Given a collection of models, calculate an aggregate model.
static std::size_t ConsumeDoubleTuples(const std::string &source, std::vector< std::vector< double > > &tuple)
unsigned char GhostsToSkip
virtual void SetLearnOptionParameterConnection(vtkAlgorithmOutput *params)
A convenience method for setting learn input parameters (if one is expected or allowed).
virtual int GetMaximumNumberOfColumnsPerRequest() const
Provide a limit on the number of columns per request for this algorithm subclass.
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...
std::unordered_map< vtkStringToken, AlgorithmConstructor > AlgorithmConstructorMap
Return a new instance of a subclass named and configured by the algorithmParameters.
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
Return a new instance of a subclass named and configured by the algorithmParameters.
virtual vtkIdType GetNumberOfColumnsForRequest(vtkIdType request)
Return the number of columns for a given request.
virtual void Test(vtkTable *, vtkStatisticalModel *, vtkTable *)=0
Execute the calculations required by the Test option.
static std::size_t ConsumeStringToDoublesMap(const std::string &source, std::map< std::string, std::vector< double > > &map)
vtkStatisticsAlgorithm()
Return a new instance of a subclass named and configured by the algorithmParameters.
virtual std::size_t ConsumeNextAlgorithmParameter(vtkStringToken parameterName, const std::string &algorithmParameters)
Consume a single parameter value, setting the value on this instance of the class.
virtual void Derive(vtkStatisticalModel *)=0
Execute the calculations required by the Derive option.
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...
vtkStringArray * AssessNames
int FillInputPortInformation(int port, vtkInformation *info) override
Return a new instance of a subclass named and configured by the algorithmParameters.
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.
@ INPUT_DATA
Port 0 is for learn data.
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
Represent a string by its integer hash.
void SetInputData(vtkDataObject *obj)
Assign a data object as input.
A table, which contains similar-typed columns of data.
An array holding vtkVariants.
A type representing the union of many types.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)