VTK  9.2.20230320
vtkExtractHistogram2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkExtractHistogram2D.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 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2011 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
48 #ifndef vtkExtractHistogram2D_h
49 #define vtkExtractHistogram2D_h
50 
51 #include "vtkFiltersImagingModule.h" // For export macro
52 #include "vtkStatisticsAlgorithm.h"
53 
54 VTK_ABI_NAMESPACE_BEGIN
56 class vtkImageData;
57 class vtkIdTypeArray;
59 
60 class VTKFILTERSIMAGING_EXPORT vtkExtractHistogram2D : public vtkStatisticsAlgorithm
61 {
62 public:
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
68  {
69  HISTOGRAM_IMAGE = 3
70  };
71 
73 
76  vtkSetVector2Macro(NumberOfBins, int);
77  vtkGetVector2Macro(NumberOfBins, int);
79 
81 
85  vtkSetVector2Macro(ComponentsToProcess, int);
86  vtkGetVector2Macro(ComponentsToProcess, int);
88 
90 
94  vtkSetVector4Macro(CustomHistogramExtents, double);
95  vtkGetVector4Macro(CustomHistogramExtents, double);
97 
99 
103  vtkSetMacro(UseCustomHistogramExtents, vtkTypeBool);
104  vtkGetMacro(UseCustomHistogramExtents, vtkTypeBool);
105  vtkBooleanMacro(UseCustomHistogramExtents, vtkTypeBool);
107 
109 
114  vtkSetMacro(ScalarType, int);
115  void SetScalarTypeToUnsignedInt() { this->SetScalarType(VTK_UNSIGNED_INT); }
116  void SetScalarTypeToUnsignedLong() { this->SetScalarType(VTK_UNSIGNED_LONG); }
117  void SetScalarTypeToUnsignedShort() { this->SetScalarType(VTK_UNSIGNED_SHORT); }
118  void SetScalarTypeToUnsignedChar() { this->SetScalarType(VTK_UNSIGNED_CHAR); }
119  void SetScalarTypeToFloat() { this->SetScalarType(VTK_FLOAT); }
120  void SetScalarTypeToDouble() { this->SetScalarType(VTK_DOUBLE); }
121  vtkGetMacro(ScalarType, int);
123 
125 
129  vtkGetMacro(MaximumBinCount, double);
131 
136  int GetBinRange(vtkIdType binX, vtkIdType binY, double range[4]);
137 
142  int GetBinRange(vtkIdType bin, double range[4]);
143 
148  void GetBinWidth(double bw[2]);
149 
155 
161 
162  vtkSetMacro(SwapColumns, vtkTypeBool);
163  vtkGetMacro(SwapColumns, vtkTypeBool);
164  vtkBooleanMacro(SwapColumns, vtkTypeBool);
165 
167 
170  virtual void SetRowMask(vtkDataArray*);
171  vtkGetObjectMacro(RowMask, vtkDataArray);
173 
178 
179 protected:
182 
184  int NumberOfBins[2];
185  double HistogramExtents[4];
186  double CustomHistogramExtents[4];
188  int ComponentsToProcess[2];
192 
194 
199  void Learn(vtkTable* inData, vtkTable* inParameters, vtkMultiBlockDataSet* outMeta) override;
200 
204  void Derive(vtkMultiBlockDataSet*) override {}
205 
209  void Test(vtkTable*, vtkMultiBlockDataSet*, vtkTable*) override { return; }
210 
214  void Assess(vtkTable*, vtkMultiBlockDataSet*, vtkTable*) override { return; }
215 
219  void SelectAssessFunctor(vtkTable* vtkNotUsed(outData), vtkDataObject* vtkNotUsed(inMeta),
220  vtkStringArray* vtkNotUsed(rowNames), AssessFunctor*& vtkNotUsed(dfunc)) override
221  {
222  }
223 
225 
230  vtkInformationVector* outputVector) override;
231 
236 
237 private:
239  void operator=(const vtkExtractHistogram2D&) = delete;
240 };
241 
242 VTK_ABI_NAMESPACE_END
243 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:166
maintain an unordered list of data objects
general representation of visualization data
represent and manipulate attribute data in a dataset
compute a 2D histogram between two columns of an input vtkTable.
void SetScalarTypeToUnsignedShort()
Control the scalar type of the output histogram.
int GetBinRange(vtkIdType bin, double range[4])
Get the range of the of the bin located at 1D position index bin in the 2D histogram array.
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Makes sure that the image data output port has up-to-date spacing/origin/etc.
void SelectAssessFunctor(vtkTable *vtkNotUsed(outData), vtkDataObject *vtkNotUsed(inMeta), vtkStringArray *vtkNotUsed(rowNames), AssessFunctor *&vtkNotUsed(dfunc)) override
Provide the appropriate assessment functor.
void Learn(vtkTable *inData, vtkTable *inParameters, vtkMultiBlockDataSet *outMeta) override
Execute the calculations required by the Learn option.
double * GetHistogramExtents()
Get the histogram extents currently in use, either computed or set by the user.
void SetScalarTypeToDouble()
Control the scalar type of the output histogram.
void SetScalarTypeToUnsignedInt()
Control the scalar type of the output histogram.
~vtkExtractHistogram2D() override
static vtkExtractHistogram2D * New()
void SetScalarTypeToFloat()
Control the scalar type of the output histogram.
virtual int ComputeBinExtents(vtkDataSetAttributes *dsa, vtkDataArray *col1, vtkDataArray *col2)
void SetScalarTypeToUnsignedLong()
Control the scalar type of the output histogram.
void GetBinWidth(double bw[2])
Get the width of all of the bins.
void Test(vtkTable *, vtkMultiBlockDataSet *, vtkTable *) override
Execute the calculations required by the Test option.
void SetScalarTypeToUnsignedChar()
Control the scalar type of the output histogram.
void Assess(vtkTable *, vtkMultiBlockDataSet *, vtkTable *) override
Execute the calculations required by the Assess option.
virtual void SetRowMask(vtkDataArray *)
Get/Set an optional mask that can ignore rows of the table.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
void Aggregate(vtkDataObjectCollection *, vtkMultiBlockDataSet *) override
Given a collection of models, calculate aggregate model.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetBinRange(vtkIdType binX, vtkIdType binY, double range[4])
Compute the range of the bin located at position (binX,binY) in the 2D histogram.
vtkImageData * GetOutputHistogramImage()
Gets the data object at the histogram image output port and casts it to a vtkImageData.
void Derive(vtkMultiBlockDataSet *) override
Execute the calculations required by the Derive option.
int GetInputArrays(vtkDataArray *&col1, vtkDataArray *&col2)
Get points to the arrays that live in the two input columns.
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
Definition: vtkImageData.h:164
a simple class to control print indentation
Definition: vtkIndent.h:120
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Composite dataset that organizes datasets into blocks.
A base class for a functor that assesses data.
Base class for statistics algorithms.
a vtkAbstractArray subclass for strings
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:184
@ info
Definition: vtkX3D.h:388
@ port
Definition: vtkX3D.h:459
@ range
Definition: vtkX3D.h:250
int vtkTypeBool
Definition: vtkABI.h:71
int vtkIdType
Definition: vtkType.h:327
#define VTK_UNSIGNED_INT
Definition: vtkType.h:51
#define VTK_DOUBLE
Definition: vtkType.h:55
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:47
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:49
#define VTK_FLOAT
Definition: vtkType.h:54
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:53