VTK  9.3.1
vtkImageHistogram.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
25 #ifndef vtkImageHistogram_h
26 #define vtkImageHistogram_h
27 
28 #include "vtkImagingStatisticsModule.h" // For export macro
30 
31 VTK_ABI_NAMESPACE_BEGIN
33 class vtkIdTypeArray;
34 class vtkImageHistogramThreadData;
35 class vtkImageHistogramSMPThreadLocal;
36 
37 class VTKIMAGINGSTATISTICS_EXPORT vtkImageHistogram : public vtkThreadedImageAlgorithm
38 {
39 public:
40  static vtkImageHistogram* New();
42 
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
48  enum
49  {
50  Linear = 0,
51  Log = 1,
52  Sqrt = 2
53  };
54 
56 
61  vtkSetMacro(ActiveComponent, int);
62  vtkGetMacro(ActiveComponent, int);
64 
66 
77  vtkSetMacro(AutomaticBinning, vtkTypeBool);
78  vtkBooleanMacro(AutomaticBinning, vtkTypeBool);
79  vtkGetMacro(AutomaticBinning, vtkTypeBool);
81 
83 
91  vtkSetMacro(MaximumNumberOfBins, int);
92  vtkGetMacro(MaximumNumberOfBins, int);
94 
96 
100  vtkSetMacro(NumberOfBins, int);
101  vtkGetMacro(NumberOfBins, int);
103 
105 
109  vtkSetMacro(BinOrigin, double);
110  vtkGetMacro(BinOrigin, double);
112 
114 
118  vtkSetMacro(BinSpacing, double);
119  vtkGetMacro(BinSpacing, double);
121 
123 
126  void SetStencilData(vtkImageStencilData* stencil);
127  vtkImageStencilData* GetStencil();
129 
133  void SetStencilConnection(vtkAlgorithmOutput* algOutput);
134 
136 
141  vtkSetMacro(GenerateHistogramImage, vtkTypeBool);
142  vtkBooleanMacro(GenerateHistogramImage, vtkTypeBool);
143  vtkGetMacro(GenerateHistogramImage, vtkTypeBool);
145 
147 
151  vtkSetVector2Macro(HistogramImageSize, int);
152  vtkGetVector2Macro(HistogramImageSize, int);
154 
156 
160  vtkSetClampMacro(HistogramImageScale, int, vtkImageHistogram::Linear, vtkImageHistogram::Sqrt);
161  void SetHistogramImageScaleToLinear() { this->SetHistogramImageScale(vtkImageHistogram::Linear); }
162  void SetHistogramImageScaleToLog() { this->SetHistogramImageScale(vtkImageHistogram::Log); }
163  void SetHistogramImageScaleToSqrt() { this->SetHistogramImageScale(vtkImageHistogram::Sqrt); }
164  vtkGetMacro(HistogramImageScale, int);
165  const char* GetHistogramImageScaleAsString();
167 
172  vtkIdTypeArray* GetHistogram();
173 
178  vtkIdType GetTotal() { return this->Total; }
179 
184  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
185  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
186  int id) override;
187 
188 protected:
190  ~vtkImageHistogram() override;
191 
192  int RequestUpdateExtent(vtkInformation* vtkNotUsed(request), vtkInformationVector** inInfo,
193  vtkInformationVector* vtkNotUsed(outInfo)) override;
194  int RequestInformation(vtkInformation* vtkNotUsed(request), vtkInformationVector** inInfo,
195  vtkInformationVector* vtkNotUsed(outInfo)) override;
197 
198  int FillInputPortInformation(int port, vtkInformation* info) override;
200 
206  void ComputeImageScalarRange(vtkImageData* data, double range[2]);
207 
211 
212  int HistogramImageSize[2];
215 
217  double BinOrigin;
218  double BinSpacing;
219 
222 
223  // Used for vtkMultiThreader operation.
224  vtkImageHistogramThreadData* ThreadData;
225 
226  // Used for vtkSMPTools operation.
227  vtkImageHistogramSMPThreadLocal* SMPThreadData;
228 
229 private:
230  vtkImageHistogram(const vtkImageHistogram&) = delete;
231  void operator=(const vtkImageHistogram&) = delete;
232 
233  friend class vtkImageHistogramFunctor;
234 };
235 
236 VTK_ABI_NAMESPACE_END
237 #endif
Store vtkAlgorithm input/output information.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkIdType GetTotal()
Get the total count of the histogram.
vtkTypeBool GenerateHistogramImage
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:64
Generic filter that has one input.
vtkTypeBool AutomaticBinning
void SetHistogramImageScaleToLog()
Set the scale to use for the histogram image.
vtkImageHistogramSMPThreadLocal * SMPThreadData
void SetHistogramImageScaleToSqrt()
Set the scale to use for the histogram image.
a simple class to control print indentation
Definition: vtkIndent.h:28
efficient description of an image stencil
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
If the subclass does not define an Execute method, then the task will be broken up, multiple threads will be spawned, and each thread will call this method.
int FillInputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
int FillOutputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdTypeArray * Histogram
void SetHistogramImageScaleToLinear()
Set the scale to use for the histogram image.
vtkImageHistogramThreadData * ThreadData
Compute the histogram for an image.