VTK  9.3.0
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:
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:
162 
170  virtual bool GetInputArrayRange(vtkInformationVector** inputVector, double range[2]);
171 
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 
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
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:45
general representation of visualization data
Definition: vtkDataObject.h:55
dynamic, self-adjusting array of double
Extract histogram data (binned values) from any dataset.
std::unique_ptr< vtkExtractHistogramInternal > Internal
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool InitializeBinExtents(vtkInformationVector **inputVector, vtkDoubleArray *binExtents)
virtual bool GetInputArrayRange(vtkInformationVector **inputVector, double range[2])
Returns the data range for the input array to process.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
static vtkExtractHistogram * New()
void NormalizeBins(vtkTable *outputData)
void FillBinExtents(vtkDoubleArray *binExtents)
~vtkExtractHistogram() override
void AccumulateBins(vtkTable *outputData)
void BinAnArray(vtkDataArray *dataArray, vtkIntArray *binValues, double min, double max, vtkFieldData *field)
represent and manipulate fields of data
Definition: vtkFieldData.h:52
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:35
Superclass for algorithms that produce only vtkTables as output.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:59
@ field
Definition: vtkX3D.h:177
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ range
Definition: vtkX3D.h:238
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154
#define VTK_INT_MAX
Definition: vtkType.h:144
#define max(a, b)