VTK  9.0.3
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 class vtkImageData;
55 class vtkIdTypeArray;
57 
58 class VTKFILTERSIMAGING_EXPORT vtkExtractHistogram2D : public vtkStatisticsAlgorithm
59 {
60 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66  {
67  HISTOGRAM_IMAGE = 3
68  };
69 
71 
74  vtkSetVector2Macro(NumberOfBins, int);
75  vtkGetVector2Macro(NumberOfBins, int);
77 
79 
83  vtkSetVector2Macro(ComponentsToProcess, int);
84  vtkGetVector2Macro(ComponentsToProcess, int);
86 
88 
92  vtkSetVector4Macro(CustomHistogramExtents, double);
93  vtkGetVector4Macro(CustomHistogramExtents, double);
95 
97 
101  vtkSetMacro(UseCustomHistogramExtents, vtkTypeBool);
102  vtkGetMacro(UseCustomHistogramExtents, vtkTypeBool);
103  vtkBooleanMacro(UseCustomHistogramExtents, vtkTypeBool);
105 
107 
112  vtkSetMacro(ScalarType, int);
113  void SetScalarTypeToUnsignedInt() { this->SetScalarType(VTK_UNSIGNED_INT); }
114  void SetScalarTypeToUnsignedLong() { this->SetScalarType(VTK_UNSIGNED_LONG); }
115  void SetScalarTypeToUnsignedShort() { this->SetScalarType(VTK_UNSIGNED_SHORT); }
116  void SetScalarTypeToUnsignedChar() { this->SetScalarType(VTK_UNSIGNED_CHAR); }
117  void SetScalarTypeToFloat() { this->SetScalarType(VTK_FLOAT); }
118  void SetScalarTypeToDouble() { this->SetScalarType(VTK_DOUBLE); }
119  vtkGetMacro(ScalarType, int);
121 
123 
127  vtkGetMacro(MaximumBinCount, double);
129 
134  int GetBinRange(vtkIdType binX, vtkIdType binY, double range[4]);
135 
140  int GetBinRange(vtkIdType bin, double range[4]);
141 
146  void GetBinWidth(double bw[2]);
147 
153 
159 
160  vtkSetMacro(SwapColumns, vtkTypeBool);
161  vtkGetMacro(SwapColumns, vtkTypeBool);
162  vtkBooleanMacro(SwapColumns, vtkTypeBool);
163 
165 
168  virtual void SetRowMask(vtkDataArray*);
169  vtkGetObjectMacro(RowMask, vtkDataArray);
171 
176 
177 protected:
180 
182  int NumberOfBins[2];
183  double HistogramExtents[4];
184  double CustomHistogramExtents[4];
186  int ComponentsToProcess[2];
190 
191  virtual int ComputeBinExtents(vtkDataArray* col1, vtkDataArray* col2);
192 
197  void Learn(vtkTable* inData, vtkTable* inParameters, vtkMultiBlockDataSet* inMeta) override;
198 
202  void Derive(vtkMultiBlockDataSet*) override {}
203 
207  void Test(vtkTable*, vtkMultiBlockDataSet*, vtkTable*) override { return; }
208 
212  void Assess(vtkTable*, vtkMultiBlockDataSet*, vtkTable*) override { return; }
213 
217  void SelectAssessFunctor(vtkTable* vtkNotUsed(outData), vtkDataObject* vtkNotUsed(inMeta),
218  vtkStringArray* vtkNotUsed(rowNames), AssessFunctor*& vtkNotUsed(dfunc)) override
219  {
220  }
221 
223 
228  vtkInformationVector* outputVector) override;
229 
234 
235 private:
237  void operator=(const vtkExtractHistogram2D&) = delete;
238 };
239 
240 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
maintain an unordered list of data objects
general representation of visualization data
Definition: vtkDataObject.h:60
compute a 2D histogram between two columns of an input vtkTable.
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.
virtual int ComputeBinExtents(vtkDataArray *col1, vtkDataArray *col2)
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.
double * GetHistogramExtents()
Get the histogram extents currently in use, either computed or set by the user.
void Learn(vtkTable *inData, vtkTable *inParameters, vtkMultiBlockDataSet *inMeta) override
Execute the calculations required by the Learn option.
~vtkExtractHistogram2D() override
static vtkExtractHistogram2D * New()
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 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:42
a simple class to control print indentation
Definition: vtkIndent.h:34
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:63
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ range
Definition: vtkX3D.h:244
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:338
#define VTK_UNSIGNED_INT
Definition: vtkType.h:49
#define VTK_DOUBLE
Definition: vtkType.h:53
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:45
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:47
#define VTK_FLOAT
Definition: vtkType.h:52
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:51