VTK
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 =========================================================================*/
31 #ifndef vtkImageHistogram_h
32 #define vtkImageHistogram_h
33 
34 #include "vtkImagingStatisticsModule.h" // For export macro
36 
38 class vtkIdTypeArray;
39 class vtkImageHistogramThreadData;
40 class vtkImageHistogramSMPThreadLocal;
41 
42 class VTKIMAGINGSTATISTICS_EXPORT vtkImageHistogram : public vtkThreadedImageAlgorithm
43 {
44 public:
45  static vtkImageHistogram *New();
47 
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
53  enum {
54  Linear = 0,
55  Log = 1,
56  Sqrt = 2
57  };
58 
60 
65  vtkSetMacro(ActiveComponent, int);
66  vtkGetMacro(ActiveComponent, int);
68 
70 
81  vtkSetMacro(AutomaticBinning, vtkTypeBool);
82  vtkBooleanMacro(AutomaticBinning, vtkTypeBool);
83  vtkGetMacro(AutomaticBinning, vtkTypeBool);
85 
87 
95  vtkSetMacro(MaximumNumberOfBins, int);
96  vtkGetMacro(MaximumNumberOfBins, int);
98 
100 
104  vtkSetMacro(NumberOfBins, int);
105  vtkGetMacro(NumberOfBins, int);
107 
109 
113  vtkSetMacro(BinOrigin, double);
114  vtkGetMacro(BinOrigin, double);
116 
118 
122  vtkSetMacro(BinSpacing, double);
123  vtkGetMacro(BinSpacing, double);
125 
127 
130  void SetStencilData(vtkImageStencilData *stencil);
131  vtkImageStencilData *GetStencil();
133 
137  void SetStencilConnection(vtkAlgorithmOutput* algOutput);
138 
140 
145  vtkSetMacro(GenerateHistogramImage, vtkTypeBool);
146  vtkBooleanMacro(GenerateHistogramImage, vtkTypeBool);
147  vtkGetMacro(GenerateHistogramImage, vtkTypeBool);
149 
151 
155  vtkSetVector2Macro(HistogramImageSize, int);
156  vtkGetVector2Macro(HistogramImageSize, int);
158 
160 
164  vtkSetClampMacro(HistogramImageScale, int,
167  this->SetHistogramImageScale(vtkImageHistogram::Linear); }
169  this->SetHistogramImageScale(vtkImageHistogram::Log); }
171  this->SetHistogramImageScale(vtkImageHistogram::Sqrt); }
172  vtkGetMacro(HistogramImageScale, int);
173  const char *GetHistogramImageScaleAsString();
175 
180  vtkIdTypeArray *GetHistogram();
181 
186  vtkIdType GetTotal() { return this->Total; }
187 
192  void ThreadedRequestData(vtkInformation *request,
193  vtkInformationVector **inputVector,
194  vtkInformationVector *outputVector,
195  vtkImageData ***inData,
196  vtkImageData **outData, int ext[6], int id) override;
197 
198 protected:
200  ~vtkImageHistogram() override;
201 
202  int RequestUpdateExtent(vtkInformation *vtkNotUsed(request),
203  vtkInformationVector **inInfo,
204  vtkInformationVector *vtkNotUsed(outInfo)) override;
205  int RequestInformation(vtkInformation *vtkNotUsed(request),
206  vtkInformationVector **inInfo,
207  vtkInformationVector *vtkNotUsed(outInfo)) override;
210  vtkInformationVector *) override;
211 
212  int FillInputPortInformation(int port, vtkInformation *info) override;
214 
220  void ComputeImageScalarRange(vtkImageData *data, double range[2]);
221 
225 
226  int HistogramImageSize[2];
229 
231  double BinOrigin;
232  double BinSpacing;
233 
236 
237  // Used for vtkMultiThreader operation.
238  vtkImageHistogramThreadData *ThreadData;
239 
240  // Used for vtkSMPTools operation.
241  vtkImageHistogramSMPThreadLocal *SMPThreadData;
242 
243 private:
244  vtkImageHistogram(const vtkImageHistogram&) = delete;
245  void operator=(const vtkImageHistogram&) = delete;
246 
247  friend class vtkImageHistogramFunctor;
248 };
249 
250 #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:347
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:33
efficient description of an image stencil
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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,...
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.