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 =========================================================================*/
38 #ifndef vtkReduceTable_h
39 #define vtkReduceTable_h
40 
41 #include "vtkInfovisCoreModule.h" // For export macro
42 #include "vtkTableAlgorithm.h"
43 
44 #include <map> // For ivar
45 #include <set> // For ivar
46 #include <vector> // For ivar
47 
48 class vtkVariant;
49 
51 {
52 public:
53  static vtkReduceTable* New();
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
58 
61  vtkGetMacro(IndexColumn, vtkIdType);
62  vtkSetMacro(IndexColumn, vtkIdType);
64 
66 
67  vtkGetMacro(NumericalReductionMethod, int);
68  vtkSetMacro(NumericalReductionMethod, int);
70 
72 
74  vtkGetMacro(NonNumericalReductionMethod, int);
75  vtkSetMacro(NonNumericalReductionMethod, int);
77 
81  int GetReductionMethodForColumn(vtkIdType col);
82 
85  void SetReductionMethodForColumn(vtkIdType col, int method);
86 
87  //BTX
89 
90  enum
91  {
94  MODE
95  };
96  //ETX
98 
99 protected:
100  vtkReduceTable();
101  ~vtkReduceTable();
102 
103  int RequestData(
107 
110  void InitializeOutputTable(vtkTable *input, vtkTable *output);
111 
114  void AccumulateIndexValues(vtkTable *input);
115 
117  void PopulateIndexColumn(vtkTable *output);
118 
122  void PopulateDataColumn(vtkTable *input, vtkTable *output, vtkIdType col);
123 
125 
127  void ReduceValuesToMean(vtkTable *input, vtkTable *output,
128  vtkIdType row, vtkIdType col,
129  std::vector<vtkIdType> oldRows);
131 
133 
135  void ReduceValuesToMedian(vtkTable *input, vtkTable *output,
136  vtkIdType row, vtkIdType col,
137  std::vector<vtkIdType> oldRows);
139 
141 
143  void ReduceValuesToMode(vtkTable *input, vtkTable *output,
144  vtkIdType row, vtkIdType col,
145  std::vector<vtkIdType> oldRows);
147 
149  std::set<vtkVariant> IndexValues;
150  std::map<vtkVariant, std::vector<vtkIdType> > NewRowToOldRowsMap;
151  std::map<vtkIdType, int> ColumnReductionMethods;
152 
155 
156 private:
157  vtkReduceTable(const vtkReduceTable&); // Not implemented
158  void operator=(const vtkReduceTable&); // Not implemented
159 };
160 
161 #endif
std::set< vtkVariant > IndexValues
void PrintSelf(ostream &os, vtkIndent indent)
static vtkTableAlgorithm * New()
Store vtkAlgorithm input/output information.
int vtkIdType
Definition: vtkType.h:275
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
std::map< vtkVariant, std::vector< vtkIdType > > NewRowToOldRowsMap
std::map< vtkIdType, int > ColumnReductionMethods
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTKINFOVISCORE_EXPORT
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:67
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Superclass for algorithms that produce only vtkTables as output.
Store zero or more vtkInformation instances.
int NonNumericalReductionMethod
vtkIdType IndexColumn
combine some of the rows of a table
int NumericalReductionMethod