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=========================================================================*/
27#ifndef vtkExtractHistogram_h
28#define vtkExtractHistogram_h
29
30#include <memory> // for std::unique_ptr
31
32#include "vtkFiltersStatisticsModule.h" // For export macro
33#include "vtkTableAlgorithm.h"
34
35class vtkDoubleArray;
36class vtkFieldData;
37class vtkIntArray;
38class vtkExtractHistogramInternal;
39
40class VTKFILTERSSTATISTICS_EXPORT vtkExtractHistogram : public vtkTableAlgorithm
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48
54 vtkSetClampMacro(Component, int, 0, VTK_INT_MAX);
55 vtkGetMacro(Component, int);
57
59
63 vtkSetClampMacro(BinCount, int, 1, VTK_INT_MAX);
64 vtkGetMacro(BinCount, int);
66
68
73 vtkSetMacro(CenterBinsAroundMinAndMax, bool);
74 vtkGetMacro(CenterBinsAroundMinAndMax, bool);
75 vtkBooleanMacro(CenterBinsAroundMinAndMax, bool);
77
79
84 vtkSetVector2Macro(CustomBinRanges, double);
85 vtkGetVector2Macro(CustomBinRanges, double);
87
89
94 vtkSetMacro(UseCustomBinRanges, bool);
95 vtkGetMacro(UseCustomBinRanges, bool);
96 vtkBooleanMacro(UseCustomBinRanges, bool);
98
100
106 vtkSetMacro(CalculateAverages, bool);
107 vtkGetMacro(CalculateAverages, bool);
108 vtkBooleanMacro(CalculateAverages, bool);
110
112
116 vtkSetStringMacro(BinExtentsArrayName);
117 vtkGetStringMacro(BinExtentsArrayName);
119
121
125 vtkSetStringMacro(BinValuesArrayName);
126 vtkGetStringMacro(BinValuesArrayName);
128
130
135 vtkSetMacro(Normalize, bool);
136 vtkBooleanMacro(Normalize, bool);
137 vtkGetMacro(Normalize, bool);
139
141
146 vtkSetMacro(Accumulation, bool);
147 vtkBooleanMacro(Accumulation, bool);
148 vtkGetMacro(Accumulation, bool);
150
152
156 vtkSetStringMacro(BinAccumulationArrayName);
157 vtkGetStringMacro(BinAccumulationArrayName);
159
161
164 vtkGetVector2Macro(BinRange, double);
166
167protected:
170
178 virtual bool GetInputArrayRange(vtkInformationVector** inputVector, double range[2]);
179
180 int FillInputPortInformation(int port, vtkInformation* info) override;
181
183 vtkInformationVector* outputVector) override;
184
185 // Initialize the bin_extents using the data range for the selected
186 // array.
187 virtual bool InitializeBinExtents(vtkInformationVector** inputVector, vtkDoubleArray* binExtents);
188
190 vtkDataArray* dataArray, vtkIntArray* binValues, double min, double max, vtkFieldData* field);
191
193
194 void NormalizeBins(vtkTable* outputData);
195
196 void AccumulateBins(vtkTable* outputData);
197
198 double CustomBinRanges[2] = { 0, 100 };
199 double BinRange[2] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
200 bool CenterBinsAroundMinAndMax = false;
201 bool UseCustomBinRanges = false;
202 int Component = 0;
203 int BinCount = 10;
204 bool CalculateAverages = false;
205 char* BinExtentsArrayName = nullptr;
206 char* BinValuesArrayName = nullptr;
207 char* BinAccumulationArrayName = nullptr;
208 bool Normalize = false;
209 bool Accumulation = false;
210
211 std::unique_ptr<vtkExtractHistogramInternal> Internal;
212
213private:
214 void operator=(const vtkExtractHistogram&) = delete;
216
217 int GetInputFieldAssociation();
218 vtkFieldData* GetInputFieldData(vtkDataObject* input);
219};
220
221#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:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:40
Superclass for algorithms that produce only vtkTables as output.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:68
#define VTK_DOUBLE_MAX
Definition vtkType.h:165
#define VTK_INT_MAX
Definition vtkType.h:155
#define max(a, b)