VTK  9.2.5
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 
55 class vtkImageData;
56 class vtkIdTypeArray;
58 
59 class VTKFILTERSIMAGING_EXPORT vtkExtractHistogram2D : public vtkStatisticsAlgorithm
60 {
61 public:
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67  {
68  HISTOGRAM_IMAGE = 3
69  };
70 
72 
75  vtkSetVector2Macro(NumberOfBins, int);
76  vtkGetVector2Macro(NumberOfBins, int);
78 
80 
84  vtkSetVector2Macro(ComponentsToProcess, int);
85  vtkGetVector2Macro(ComponentsToProcess, int);
87 
89 
93  vtkSetVector4Macro(CustomHistogramExtents, double);
94  vtkGetVector4Macro(CustomHistogramExtents, double);
96 
98 
102  vtkSetMacro(UseCustomHistogramExtents, vtkTypeBool);
103  vtkGetMacro(UseCustomHistogramExtents, vtkTypeBool);
104  vtkBooleanMacro(UseCustomHistogramExtents, vtkTypeBool);
106 
108 
113  vtkSetMacro(ScalarType, int);
114  void SetScalarTypeToUnsignedInt() { this->SetScalarType(VTK_UNSIGNED_INT); }
115  void SetScalarTypeToUnsignedLong() { this->SetScalarType(VTK_UNSIGNED_LONG); }
116  void SetScalarTypeToUnsignedShort() { this->SetScalarType(VTK_UNSIGNED_SHORT); }
117  void SetScalarTypeToUnsignedChar() { this->SetScalarType(VTK_UNSIGNED_CHAR); }
118  void SetScalarTypeToFloat() { this->SetScalarType(VTK_FLOAT); }
119  void SetScalarTypeToDouble() { this->SetScalarType(VTK_DOUBLE); }
120  vtkGetMacro(ScalarType, int);
122 
124 
128  vtkGetMacro(MaximumBinCount, double);
130 
135  int GetBinRange(vtkIdType binX, vtkIdType binY, double range[4]);
136 
141  int GetBinRange(vtkIdType bin, double range[4]);
142 
147  void GetBinWidth(double bw[2]);
148 
154 
160 
161  vtkSetMacro(SwapColumns, vtkTypeBool);
162  vtkGetMacro(SwapColumns, vtkTypeBool);
163  vtkBooleanMacro(SwapColumns, vtkTypeBool);
164 
166 
169  virtual void SetRowMask(vtkDataArray*);
170  vtkGetObjectMacro(RowMask, vtkDataArray);
172 
177 
178 protected:
181 
183  int NumberOfBins[2];
184  double HistogramExtents[4];
185  double CustomHistogramExtents[4];
187  int ComponentsToProcess[2];
191 
193 
198  void Learn(vtkTable* inData, vtkTable* inParameters, vtkMultiBlockDataSet* outMeta) override;
199 
203  void Derive(vtkMultiBlockDataSet*) override {}
204 
208  void Test(vtkTable*, vtkMultiBlockDataSet*, vtkTable*) override { return; }
209 
213  void Assess(vtkTable*, vtkMultiBlockDataSet*, vtkTable*) override { return; }
214 
218  void SelectAssessFunctor(vtkTable* vtkNotUsed(outData), vtkDataObject* vtkNotUsed(inMeta),
219  vtkStringArray* vtkNotUsed(rowNames), AssessFunctor*& vtkNotUsed(dfunc)) override
220  {
221  }
222 
224 
229  vtkInformationVector* outputVector) override;
230 
235 
236 private:
238  void operator=(const vtkExtractHistogram2D&) = delete;
239 };
240 
241 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
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:163
a simple class to control print indentation
Definition: vtkIndent.h:119
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:183
@ 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:332
#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