VTK  9.3.1
vtkExtractHistogram.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkExtractHistogram_h
19 #define vtkExtractHistogram_h
20 
21 #include <memory> // for std::unique_ptr
22 
23 #include "vtkFiltersStatisticsModule.h" // For export macro
24 #include "vtkTableAlgorithm.h"
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkDoubleArray;
28 class vtkFieldData;
29 class vtkIntArray;
30 class vtkExtractHistogramInternal;
31 
32 class VTKFILTERSSTATISTICS_EXPORT vtkExtractHistogram : public vtkTableAlgorithm
33 {
34 public:
35  static vtkExtractHistogram* New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
40 
46  vtkSetClampMacro(Component, int, 0, VTK_INT_MAX);
47  vtkGetMacro(Component, int);
49 
51 
55  vtkSetClampMacro(BinCount, int, 1, VTK_INT_MAX);
56  vtkGetMacro(BinCount, int);
58 
60 
65  vtkSetMacro(CenterBinsAroundMinAndMax, bool);
66  vtkGetMacro(CenterBinsAroundMinAndMax, bool);
67  vtkBooleanMacro(CenterBinsAroundMinAndMax, bool);
69 
71 
76  vtkSetVector2Macro(CustomBinRanges, double);
77  vtkGetVector2Macro(CustomBinRanges, double);
79 
81 
86  vtkSetMacro(UseCustomBinRanges, bool);
87  vtkGetMacro(UseCustomBinRanges, bool);
88  vtkBooleanMacro(UseCustomBinRanges, bool);
90 
92 
98  vtkSetMacro(CalculateAverages, bool);
99  vtkGetMacro(CalculateAverages, bool);
100  vtkBooleanMacro(CalculateAverages, bool);
102 
104 
108  vtkSetStringMacro(BinExtentsArrayName);
109  vtkGetStringMacro(BinExtentsArrayName);
111 
113 
117  vtkSetStringMacro(BinValuesArrayName);
118  vtkGetStringMacro(BinValuesArrayName);
120 
122 
127  vtkSetMacro(Normalize, bool);
128  vtkBooleanMacro(Normalize, bool);
129  vtkGetMacro(Normalize, bool);
131 
133 
138  vtkSetMacro(Accumulation, bool);
139  vtkBooleanMacro(Accumulation, bool);
140  vtkGetMacro(Accumulation, bool);
142 
144 
148  vtkSetStringMacro(BinAccumulationArrayName);
149  vtkGetStringMacro(BinAccumulationArrayName);
151 
153 
156  vtkGetVector2Macro(BinRange, double);
158 
159 protected:
161  ~vtkExtractHistogram() override;
162 
170  virtual bool GetInputArrayRange(vtkInformationVector** inputVector, double range[2]);
171 
172  int FillInputPortInformation(int port, vtkInformation* info) override;
173 
174  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
175  vtkInformationVector* outputVector) override;
176 
177  // Initialize the bin_extents using the data range for the selected
178  // array.
179  virtual bool InitializeBinExtents(vtkInformationVector** inputVector, vtkDoubleArray* binExtents);
180 
181  void BinAnArray(
182  vtkDataArray* dataArray, vtkIntArray* binValues, double min, double max, vtkFieldData* field);
183 
184  void FillBinExtents(vtkDoubleArray* binExtents);
185 
186  void NormalizeBins(vtkTable* outputData);
187 
188  void AccumulateBins(vtkTable* outputData);
189 
190  double CustomBinRanges[2] = { 0, 100 };
191  double BinRange[2] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
192  bool CenterBinsAroundMinAndMax = false;
193  bool UseCustomBinRanges = false;
194  int Component = 0;
195  int BinCount = 10;
196  bool CalculateAverages = false;
197  char* BinExtentsArrayName = nullptr;
198  char* BinValuesArrayName = nullptr;
199  char* BinAccumulationArrayName = nullptr;
200  bool Normalize = false;
201  bool Accumulation = false;
202 
203  std::unique_ptr<vtkExtractHistogramInternal> Internal;
204 
205 private:
206  void operator=(const vtkExtractHistogram&) = delete;
207  vtkExtractHistogram(const vtkExtractHistogram&) = delete;
208 
209  int GetInputFieldAssociation();
210  vtkFieldData* GetInputFieldData(vtkDataObject* input);
211 };
212 
213 VTK_ABI_NAMESPACE_END
214 #endif
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
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:144
std::unique_ptr< vtkExtractHistogramInternal > Internal
dynamic, self-adjusting array of double
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:34
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
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:58
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:54
#define max(a, b)
represent and manipulate fields of data
Definition: vtkFieldData.h:51