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 =========================================================================*/
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  Linear = 0,
61  Log = 1,
62  Sqrt = 2
63  };
64 
66 
71  vtkSetMacro(ActiveComponent, int);
72  vtkGetMacro(ActiveComponent, int);
74 
76 
87  vtkSetMacro(AutomaticBinning, vtkTypeBool);
88  vtkBooleanMacro(AutomaticBinning, vtkTypeBool);
89  vtkGetMacro(AutomaticBinning, vtkTypeBool);
91 
93 
101  vtkSetMacro(MaximumNumberOfBins, int);
102  vtkGetMacro(MaximumNumberOfBins, int);
104 
106 
110  vtkSetMacro(NumberOfBins, int);
111  vtkGetMacro(NumberOfBins, int);
113 
115 
119  vtkSetMacro(BinOrigin, double);
120  vtkGetMacro(BinOrigin, double);
122 
124 
128  vtkSetMacro(BinSpacing, double);
129  vtkGetMacro(BinSpacing, double);
131 
133 
136  void SetStencilData(vtkImageStencilData *stencil);
137  vtkImageStencilData *GetStencil();
139 
143  void SetStencilConnection(vtkAlgorithmOutput* algOutput);
144 
146 
151  vtkSetMacro(GenerateHistogramImage, vtkTypeBool);
152  vtkBooleanMacro(GenerateHistogramImage, vtkTypeBool);
153  vtkGetMacro(GenerateHistogramImage, vtkTypeBool);
155 
157 
161  vtkSetVector2Macro(HistogramImageSize, int);
162  vtkGetVector2Macro(HistogramImageSize, int);
164 
166 
170  vtkSetClampMacro(HistogramImageScale, int,
173  this->SetHistogramImageScale(vtkImageHistogram::Linear); }
175  this->SetHistogramImageScale(vtkImageHistogram::Log); }
177  this->SetHistogramImageScale(vtkImageHistogram::Sqrt); }
178  vtkGetMacro(HistogramImageScale, int);
179  const char *GetHistogramImageScaleAsString();
181 
186  vtkIdTypeArray *GetHistogram();
187 
192  vtkIdType GetTotal() { return this->Total; }
193 
198  void ThreadedRequestData(vtkInformation *request,
199  vtkInformationVector **inputVector,
200  vtkInformationVector *outputVector,
201  vtkImageData ***inData,
202  vtkImageData **outData, int ext[6], int id) override;
203 
204 protected:
206  ~vtkImageHistogram() override;
207 
208  int RequestUpdateExtent(vtkInformation *vtkNotUsed(request),
209  vtkInformationVector **inInfo,
210  vtkInformationVector *vtkNotUsed(outInfo)) override;
211  int RequestInformation(vtkInformation *vtkNotUsed(request),
212  vtkInformationVector **inInfo,
213  vtkInformationVector *vtkNotUsed(outInfo)) override;
216  vtkInformationVector *) override;
217 
218  int FillInputPortInformation(int port, vtkInformation *info) override;
219  int FillOutputPortInformation(int port, vtkInformation *info) override;
220 
226  void ComputeImageScalarRange(vtkImageData *data, double range[2]);
227 
231 
232  int HistogramImageSize[2];
235 
237  double BinOrigin;
238  double BinSpacing;
239 
242 
243  // Used for vtkMultiThreader operation.
244  vtkImageHistogramThreadData *ThreadData;
245 
246  // Used for vtkSMPTools operation.
247  vtkImageHistogramSMPThreadLocal *SMPThreadData;
248 
249 private:
250  vtkImageHistogram(const vtkImageHistogram&) = delete;
251  void operator=(const vtkImageHistogram&) = delete;
252 
253  friend class vtkImageHistogramFunctor;
254 };
255 
256 #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:39
efficient description of an image stencil
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
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.