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
38class vtkDoubleArray;
39class vtkFieldData;
40class vtkIntArray;
41class vtkExtractHistogramInternal;
42
43class VTKFILTERSSTATISTICS_EXPORT vtkExtractHistogram : public vtkTableAlgorithm
44{
45public:
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
170protected:
173
181 virtual bool GetInputArrayRange(vtkInformationVector** inputVector, double range[2]);
182
183 int FillInputPortInformation(int port, vtkInformation* info) override;
184
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
193 vtkDataArray* dataArray, vtkIntArray* binValues, double min, double max, vtkFieldData* field);
194
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
216private:
217 void operator=(const vtkExtractHistogram&) = delete;
219
220 int GetInputFieldAssociation();
221 vtkFieldData* GetInputFieldData(vtkDataObject* input);
222};
223
224#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:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:46
Superclass for algorithms that produce only vtkTables as output.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:74
#define VTK_DOUBLE_MAX
Definition vtkType.h:165
#define VTK_INT_MAX
Definition vtkType.h:155
#define max(a, b)