VTK  9.7.1
vtkExtractHistogram2D.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2011 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
32 #ifndef vtkExtractHistogram2D_h
33 #define vtkExtractHistogram2D_h
34 
35 #include "vtkFiltersImagingModule.h" // For export macro
36 #include "vtkStatisticsAlgorithm.h"
37 
38 VTK_ABI_NAMESPACE_BEGIN
40 class vtkImageData;
41 class vtkIdTypeArray;
42 
43 class VTKFILTERSIMAGING_EXPORT vtkExtractHistogram2D : public vtkStatisticsAlgorithm
44 {
45 public:
46  static vtkExtractHistogram2D* New();
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51  int GetMaximumNumberOfColumnsPerRequest() const override { return 2; }
52 
54  {
55  HISTOGRAM_IMAGE = 3
56  };
57 
59 
62  vtkSetVector2Macro(NumberOfBins, int);
63  vtkGetVector2Macro(NumberOfBins, int);
65 
67 
71  vtkSetVector2Macro(ComponentsToProcess, int);
72  vtkGetVector2Macro(ComponentsToProcess, int);
74 
76 
80  vtkSetVector4Macro(CustomHistogramExtents, double);
81  vtkGetVector4Macro(CustomHistogramExtents, double);
83 
85 
89  vtkSetMacro(UseCustomHistogramExtents, vtkTypeBool);
90  vtkGetMacro(UseCustomHistogramExtents, vtkTypeBool);
91  vtkBooleanMacro(UseCustomHistogramExtents, vtkTypeBool);
93 
95 
100  vtkSetMacro(ScalarType, int);
101  void SetScalarTypeToUnsignedInt() { this->SetScalarType(VTK_UNSIGNED_INT); }
102  void SetScalarTypeToUnsignedLong() { this->SetScalarType(VTK_UNSIGNED_LONG); }
103  void SetScalarTypeToUnsignedShort() { this->SetScalarType(VTK_UNSIGNED_SHORT); }
104  void SetScalarTypeToUnsignedChar() { this->SetScalarType(VTK_UNSIGNED_CHAR); }
105  void SetScalarTypeToFloat() { this->SetScalarType(VTK_FLOAT); }
106  void SetScalarTypeToDouble() { this->SetScalarType(VTK_DOUBLE); }
107  vtkGetMacro(ScalarType, int);
109 
111 
115  vtkGetMacro(MaximumBinCount, double);
117 
122  int GetBinRange(vtkIdType binX, vtkIdType binY, double range[4]);
123 
128  int GetBinRange(vtkIdType bin, double range[4]);
129 
134  void GetBinWidth(double bw[2]);
135 
140  vtkImageData* GetOutputHistogramImage();
141 
146  double* GetHistogramExtents();
147 
148  vtkSetMacro(SwapColumns, vtkTypeBool);
149  vtkGetMacro(SwapColumns, vtkTypeBool);
150  vtkBooleanMacro(SwapColumns, vtkTypeBool);
151 
153 
156  virtual void SetRowMask(vtkDataArray*);
157  vtkGetObjectMacro(RowMask, vtkDataArray);
159 
163  bool Aggregate(vtkDataObjectCollection*, vtkStatisticalModel*) override { return false; }
164 
165 protected:
167  ~vtkExtractHistogram2D() override;
168 
170  int NumberOfBins[2];
171  double HistogramExtents[4];
172  double CustomHistogramExtents[4];
174  int ComponentsToProcess[2];
178 
179  virtual int ComputeBinExtents(vtkDataSetAttributes* dsa, vtkDataArray* col1, vtkDataArray* col2);
180 
185  void Learn(vtkTable* inData, vtkTable* inParameters, vtkStatisticalModel* outMeta) override;
186 
190  void Derive(vtkStatisticalModel*) override {}
191 
195  void Test(vtkTable*, vtkStatisticalModel*, vtkTable*) override {}
196 
201 
205  void SelectAssessFunctor(vtkTable* vtkNotUsed(outData), vtkDataObject* vtkNotUsed(inMeta),
206  vtkStringArray* vtkNotUsed(rowNames), AssessFunctor*& vtkNotUsed(dfunc)) override
207  {
208  }
209 
211 
215  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
216  vtkInformationVector* outputVector) override;
217 
221  int GetInputArrays(vtkDataArray*& col1, vtkDataArray*& col2);
222 
223 private:
225  void operator=(const vtkExtractHistogram2D&) = delete;
226 };
227 
228 VTK_ABI_NAMESPACE_END
229 #endif
void SetScalarTypeToUnsignedChar()
Control the scalar type of the output histogram.
void SetScalarTypeToDouble()
Control the scalar type of the output histogram.
A base class for a functor that assesses data.
void SetScalarTypeToUnsignedShort()
Control the scalar type of the output histogram.
#define VTK_UNSIGNED_INT
Definition: vtkType.h:40
a base class for statistical modeling of other data
static vtkTableAlgorithm * New()
Store vtkAlgorithm input/output information.
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:38
maintain an unordered list of data objects
void Test(vtkTable *, vtkStatisticalModel *, vtkTable *) override
Execute the calculations required by the Test option.
a vtkAbstractArray subclass for strings
void SelectAssessFunctor(vtkTable *outData, vtkDataObject *inMeta, vtkStringArray *rowNames, AssessFunctor *&dfunc) override
Provide the appropriate assessment functor.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
void SetScalarTypeToUnsignedLong()
Control the scalar type of the output histogram.
void SetScalarTypeToUnsignedInt()
Control the scalar type of the output histogram.
virtual void Learn(vtkTable *, vtkTable *, vtkStatisticalModel *)=0
Execute the calculations required by the Learn option, given some input Data.
int vtkTypeBool
Definition: vtkABI.h:64
Base class for statistics algorithms.
#define VTK_DOUBLE
Definition: vtkType.h:44
#define VTK_FLOAT
Definition: vtkType.h:43
a simple class to control print indentation
Definition: vtkIndent.h:28
bool Aggregate(vtkDataObjectCollection *, vtkStatisticalModel *) override
Given a collection of models, calculate aggregate model.
void SetScalarTypeToFloat()
Control the scalar type of the output histogram.
compute a 2D histogram between two columns of an input vtkTable.
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
represent and manipulate attribute data in a dataset
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:59
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:36
int FillOutputPortInformation(int port, vtkInformation *info) override
Return a new instance of a subclass named and configured by the algorithmParameters.
Store zero or more vtkInformation instances.
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:42
int GetMaximumNumberOfColumnsPerRequest() const override
This filter requires bivariate requests.
void Derive(vtkStatisticalModel *) override
Execute the calculations required by the Derive option.
general representation of visualization data
Definition: vtkDataObject.h:55
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Assess(vtkTable *, vtkStatisticalModel *, vtkTable *) override
Execute the calculations required by the Assess option.