VTK  9.4.20250130
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
26VTK_ABI_NAMESPACE_BEGIN
27class vtkDoubleArray;
28class vtkFieldData;
29class vtkIntArray;
30class vtkExtractHistogramInternal;
31
32class VTKFILTERSSTATISTICS_EXPORT vtkExtractHistogram : public vtkTableAlgorithm
33{
34public:
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
159protected:
162
170 virtual bool GetInputArrayRange(vtkInformationVector** inputVector, double range[2]);
171
172 int FillInputPortInformation(int port, vtkInformation* info) override;
173
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
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
205private:
206 void operator=(const vtkExtractHistogram&) = delete;
208
209 int GetInputFieldAssociation();
210 vtkFieldData* GetInputFieldData(vtkDataObject* input);
211};
212
213VTK_ABI_NAMESPACE_END
214#endif
abstract superclass for arrays of numeric data
general representation of visualization data
dynamic, self-adjusting array of double
Extract histogram data (binned values) from any dataset.
static vtkExtractHistogram * New()
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.
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
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Superclass for algorithms that produce only vtkTables as output.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:169
#define VTK_DOUBLE_MAX
Definition vtkType.h:154
#define VTK_INT_MAX
Definition vtkType.h:144
#define max(a, b)