VTK
vtkReduceTable.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkReduceTable.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
39 #ifndef vtkReduceTable_h
40 #define vtkReduceTable_h
41 
42 #include "vtkInfovisCoreModule.h" // For export macro
43 #include "vtkTableAlgorithm.h"
44 
45 #include <map> // For ivar
46 #include <set> // For ivar
47 #include <vector> // For ivar
48 
49 class vtkVariant;
50 
51 class VTKINFOVISCORE_EXPORT vtkReduceTable : public vtkTableAlgorithm
52 {
53 public:
54  static vtkReduceTable* New();
56  void PrintSelf(ostream& os, vtkIndent indent);
57 
59 
64  vtkGetMacro(IndexColumn, vtkIdType);
65  vtkSetMacro(IndexColumn, vtkIdType);
67 
69 
73  vtkGetMacro(NumericalReductionMethod, int);
74  vtkSetMacro(NumericalReductionMethod, int);
76 
78 
82  vtkGetMacro(NonNumericalReductionMethod, int);
83  vtkSetMacro(NonNumericalReductionMethod, int);
85 
92 
97  void SetReductionMethodForColumn(vtkIdType col, int method);
98 
102  enum
103  {
106  MODE
107  };
108 
109 protected:
112 
117 
122  void InitializeOutputTable(vtkTable *input, vtkTable *output);
123 
129 
134 
140  void PopulateDataColumn(vtkTable *input, vtkTable *output, vtkIdType col);
141 
146  void ReduceValuesToMean(vtkTable *input, vtkTable *output,
147  vtkIdType row, vtkIdType col,
148  std::vector<vtkIdType> oldRows);
149 
154  void ReduceValuesToMedian(vtkTable *input, vtkTable *output,
155  vtkIdType row, vtkIdType col,
156  std::vector<vtkIdType> oldRows);
157 
162  void ReduceValuesToMode(vtkTable *input, vtkTable *output,
163  vtkIdType row, vtkIdType col,
164  std::vector<vtkIdType> oldRows);
165 
167  std::set<vtkVariant> IndexValues;
168  std::map<vtkVariant, std::vector<vtkIdType> > NewRowToOldRowsMap;
169  std::map<vtkIdType, int> ColumnReductionMethods;
170 
173 
174 private:
175  vtkReduceTable(const vtkReduceTable&) VTK_DELETE_FUNCTION;
176  void operator=(const vtkReduceTable&) VTK_DELETE_FUNCTION;
177 };
178 
179 #endif
vtkReduceTable::SetReductionMethodForColumn
void SetReductionMethodForColumn(vtkIdType col, int method)
Set the method that should be used to combine the values within the specified column.
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:42
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
vtkReduceTable::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
vtkReduceTable::GetReductionMethodForColumn
int GetReductionMethodForColumn(vtkIdType col)
Get the method that should be used to combine the values within the specified column.
vtkReduceTable::ColumnReductionMethods
std::map< vtkIdType, int > ColumnReductionMethods
Definition: vtkReduceTable.h:169
vtkReduceTable::ReduceValuesToMean
void ReduceValuesToMean(vtkTable *input, vtkTable *output, vtkIdType row, vtkIdType col, std::vector< vtkIdType > oldRows)
Find the mean of a series of values from the input table and store it in the output table.
vtkReduceTable::PopulateDataColumn
void PopulateDataColumn(vtkTable *input, vtkTable *output, vtkIdType col)
Populate a non-index column of the output table.
vtkTableAlgorithm
Superclass for algorithms that produce only vtkTables as output.
Definition: vtkTableAlgorithm.h:49
vtkReduceTable::PopulateIndexColumn
void PopulateIndexColumn(vtkTable *output)
Populate the index column of the output table.
vtkReduceTable::ReduceValuesToMode
void ReduceValuesToMode(vtkTable *input, vtkTable *output, vtkIdType row, vtkIdType col, std::vector< vtkIdType > oldRows)
Find the mode of a series of values from the input table and store it in the output table.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkReduceTable
combine some of the rows of a table
Definition: vtkReduceTable.h:52
vtkReduceTable::MEAN
@ MEAN
Definition: vtkReduceTable.h:104
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:76
vtkReduceTable::ReduceValuesToMedian
void ReduceValuesToMedian(vtkTable *input, vtkTable *output, vtkIdType row, vtkIdType col, std::vector< vtkIdType > oldRows)
Find the median of a series of values from the input table and store it in the output table.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkReduceTable::AccumulateIndexValues
void AccumulateIndexValues(vtkTable *input)
Find the distinct values in the input table's index column.
vtkReduceTable::NumericalReductionMethod
int NumericalReductionMethod
Definition: vtkReduceTable.h:171
vtkReduceTable::NewRowToOldRowsMap
std::map< vtkVariant, std::vector< vtkIdType > > NewRowToOldRowsMap
Definition: vtkReduceTable.h:168
vtkReduceTable::~vtkReduceTable
~vtkReduceTable()
vtkReduceTable::IndexValues
std::set< vtkVariant > IndexValues
Definition: vtkReduceTable.h:167
vtkReduceTable::vtkReduceTable
vtkReduceTable()
vtkReduceTable::MEDIAN
@ MEDIAN
Definition: vtkReduceTable.h:105
vtkTableAlgorithm.h
vtkReduceTable::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkReduceTable::IndexColumn
vtkIdType IndexColumn
Definition: vtkReduceTable.h:166
vtkReduceTable::NonNumericalReductionMethod
int NonNumericalReductionMethod
Definition: vtkReduceTable.h:172
vtkReduceTable::InitializeOutputTable
void InitializeOutputTable(vtkTable *input, vtkTable *output)
Initialize the output table to have the same types of columns as the input table, but no rows.
vtkReduceTable::New
static vtkReduceTable * New()