VTK  9.2.6
vtkExtractHistogram.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkExtractHistogram.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 =========================================================================*/
30 #ifndef vtkExtractHistogram_h
31 #define vtkExtractHistogram_h
32 
33 #include <memory> // for std::unique_ptr
34 
35 #include "vtkFiltersStatisticsModule.h" // For export macro
36 #include "vtkTableAlgorithm.h"
37 
38 class vtkDoubleArray;
39 class vtkFieldData;
40 class vtkIntArray;
41 class vtkExtractHistogramInternal;
42 
43 class VTKFILTERSSTATISTICS_EXPORT vtkExtractHistogram : public vtkTableAlgorithm
44 {
45 public:
46  static vtkExtractHistogram* New();
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
57  vtkSetClampMacro(Component, int, 0, VTK_INT_MAX);
58  vtkGetMacro(Component, int);
60 
62 
66  vtkSetClampMacro(BinCount, int, 1, VTK_INT_MAX);
67  vtkGetMacro(BinCount, int);
69 
71 
76  vtkSetMacro(CenterBinsAroundMinAndMax, bool);
77  vtkGetMacro(CenterBinsAroundMinAndMax, bool);
78  vtkBooleanMacro(CenterBinsAroundMinAndMax, bool);
80 
82 
87  vtkSetVector2Macro(CustomBinRanges, double);
88  vtkGetVector2Macro(CustomBinRanges, double);
90 
92 
97  vtkSetMacro(UseCustomBinRanges, bool);
98  vtkGetMacro(UseCustomBinRanges, bool);
99  vtkBooleanMacro(UseCustomBinRanges, bool);
101 
103 
109  vtkSetMacro(CalculateAverages, bool);
110  vtkGetMacro(CalculateAverages, bool);
111  vtkBooleanMacro(CalculateAverages, bool);
113 
115 
119  vtkSetStringMacro(BinExtentsArrayName);
120  vtkGetStringMacro(BinExtentsArrayName);
122 
124 
128  vtkSetStringMacro(BinValuesArrayName);
129  vtkGetStringMacro(BinValuesArrayName);
131 
133 
138  vtkSetMacro(Normalize, bool);
139  vtkBooleanMacro(Normalize, bool);
140  vtkGetMacro(Normalize, bool);
142 
144 
149  vtkSetMacro(Accumulation, bool);
150  vtkBooleanMacro(Accumulation, bool);
151  vtkGetMacro(Accumulation, bool);
153 
155 
159  vtkSetStringMacro(BinAccumulationArrayName);
160  vtkGetStringMacro(BinAccumulationArrayName);
162 
164 
167  vtkGetVector2Macro(BinRange, double);
169 
170 protected:
172  ~vtkExtractHistogram() override;
173 
181  virtual bool GetInputArrayRange(vtkInformationVector** inputVector, double range[2]);
182 
183  int FillInputPortInformation(int port, vtkInformation* info) override;
184 
185  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
186  vtkInformationVector* outputVector) override;
187 
188  // Initialize the bin_extents using the data range for the selected
189  // array.
190  virtual bool InitializeBinExtents(vtkInformationVector** inputVector, vtkDoubleArray* binExtents);
191 
192  void BinAnArray(
193  vtkDataArray* dataArray, vtkIntArray* binValues, double min, double max, vtkFieldData* field);
194 
195  void FillBinExtents(vtkDoubleArray* binExtents);
196 
197  void NormalizeBins(vtkTable* outputData);
198 
199  void AccumulateBins(vtkTable* outputData);
200 
201  double CustomBinRanges[2] = { 0, 100 };
202  double BinRange[2] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
203  bool CenterBinsAroundMinAndMax = false;
204  bool UseCustomBinRanges = false;
205  int Component = 0;
206  int BinCount = 10;
207  bool CalculateAverages = false;
208  char* BinExtentsArrayName = nullptr;
209  char* BinValuesArrayName = nullptr;
210  char* BinAccumulationArrayName = nullptr;
211  bool Normalize = false;
212  bool Accumulation = false;
213 
214  std::unique_ptr<vtkExtractHistogramInternal> Internal;
215 
216 private:
217  void operator=(const vtkExtractHistogram&) = delete;
218  vtkExtractHistogram(const vtkExtractHistogram&) = delete;
219 
220  int GetInputFieldAssociation();
221  vtkFieldData* GetInputFieldData(vtkDataObject* input);
222 };
223 
224 #endif
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkTableAlgorithm * New()
Store vtkAlgorithm input/output information.
#define VTK_INT_MAX
Definition: vtkType.h:155
std::unique_ptr< vtkExtractHistogramInternal > Internal
dynamic, self-adjusting array of double
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:73
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Superclass for algorithms that produce only vtkTables as output.
Store zero or more vtkInformation instances.
Extract histogram data (binned values) from any dataset.
general representation of visualization data
Definition: vtkDataObject.h:65
#define max(a, b)
represent and manipulate fields of data
Definition: vtkFieldData.h:62