VTK  9.2.6
vtkImageHistogram.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageHistogram.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 =========================================================================*/
37 #ifndef vtkImageHistogram_h
38 #define vtkImageHistogram_h
39 
40 #include "vtkImagingStatisticsModule.h" // For export macro
42 
44 class vtkIdTypeArray;
45 class vtkImageHistogramThreadData;
46 class vtkImageHistogramSMPThreadLocal;
47 
48 class VTKIMAGINGSTATISTICS_EXPORT vtkImageHistogram : public vtkThreadedImageAlgorithm
49 {
50 public:
51  static vtkImageHistogram* New();
53 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
59  enum
60  {
61  Linear = 0,
62  Log = 1,
63  Sqrt = 2
64  };
65 
67 
72  vtkSetMacro(ActiveComponent, int);
73  vtkGetMacro(ActiveComponent, int);
75 
77 
88  vtkSetMacro(AutomaticBinning, vtkTypeBool);
89  vtkBooleanMacro(AutomaticBinning, vtkTypeBool);
90  vtkGetMacro(AutomaticBinning, vtkTypeBool);
92 
94 
102  vtkSetMacro(MaximumNumberOfBins, int);
103  vtkGetMacro(MaximumNumberOfBins, int);
105 
107 
111  vtkSetMacro(NumberOfBins, int);
112  vtkGetMacro(NumberOfBins, int);
114 
116 
120  vtkSetMacro(BinOrigin, double);
121  vtkGetMacro(BinOrigin, double);
123 
125 
129  vtkSetMacro(BinSpacing, double);
130  vtkGetMacro(BinSpacing, double);
132 
134 
137  void SetStencilData(vtkImageStencilData* stencil);
138  vtkImageStencilData* GetStencil();
140 
144  void SetStencilConnection(vtkAlgorithmOutput* algOutput);
145 
147 
152  vtkSetMacro(GenerateHistogramImage, vtkTypeBool);
153  vtkBooleanMacro(GenerateHistogramImage, vtkTypeBool);
154  vtkGetMacro(GenerateHistogramImage, vtkTypeBool);
156 
158 
162  vtkSetVector2Macro(HistogramImageSize, int);
163  vtkGetVector2Macro(HistogramImageSize, int);
165 
167 
171  vtkSetClampMacro(HistogramImageScale, int, vtkImageHistogram::Linear, vtkImageHistogram::Sqrt);
172  void SetHistogramImageScaleToLinear() { this->SetHistogramImageScale(vtkImageHistogram::Linear); }
173  void SetHistogramImageScaleToLog() { this->SetHistogramImageScale(vtkImageHistogram::Log); }
174  void SetHistogramImageScaleToSqrt() { this->SetHistogramImageScale(vtkImageHistogram::Sqrt); }
175  vtkGetMacro(HistogramImageScale, int);
176  const char* GetHistogramImageScaleAsString();
178 
183  vtkIdTypeArray* GetHistogram();
184 
189  vtkIdType GetTotal() { return this->Total; }
190 
195  void ThreadedRequestData(vtkInformation* request, vtkInformationVector** inputVector,
196  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
197  int id) override;
198 
199 protected:
201  ~vtkImageHistogram() override;
202 
203  int RequestUpdateExtent(vtkInformation* vtkNotUsed(request), vtkInformationVector** inInfo,
204  vtkInformationVector* vtkNotUsed(outInfo)) override;
205  int RequestInformation(vtkInformation* vtkNotUsed(request), vtkInformationVector** inInfo,
206  vtkInformationVector* vtkNotUsed(outInfo)) override;
208 
209  int FillInputPortInformation(int port, vtkInformation* info) override;
211 
217  void ComputeImageScalarRange(vtkImageData* data, double range[2]);
218 
222 
223  int HistogramImageSize[2];
226 
228  double BinOrigin;
229  double BinSpacing;
230 
233 
234  // Used for vtkMultiThreader operation.
235  vtkImageHistogramThreadData* ThreadData;
236 
237  // Used for vtkSMPTools operation.
238  vtkImageHistogramSMPThreadLocal* SMPThreadData;
239 
240 private:
241  vtkImageHistogram(const vtkImageHistogram&) = delete;
242  void operator=(const vtkImageHistogram&) = delete;
243 
244  friend class vtkImageHistogramFunctor;
245 };
246 
247 #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:332
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:69
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:39
efficient description of an image stencil
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
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.