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
vtkThreadedImageAlgorithm::ThreadedRequestData
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,...
vtkImageHistogram::BinSpacing
double BinSpacing
Definition: vtkImageHistogram.h:232
vtkImageHistogram::Sqrt
Definition: vtkImageHistogram.h:56
vtkImageHistogram::BinOrigin
double BinOrigin
Definition: vtkImageHistogram.h:231
vtkImageHistogram::GenerateHistogramImage
vtkTypeBool GenerateHistogramImage
Definition: vtkImageHistogram.h:228
vtkImageHistogram
Compute the histogram for an image.
Definition: vtkImageHistogram.h:42
vtkImageHistogram::ThreadData
vtkImageHistogramThreadData * ThreadData
Definition: vtkImageHistogram.h:238
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkImageHistogram::Log
Definition: vtkImageHistogram.h:55
vtkX3D::data
Definition: vtkX3D.h:315
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkImageHistogram::GetTotal
vtkIdType GetTotal()
Get the total count of the histogram.
Definition: vtkImageHistogram.h:186
vtkImageHistogram::SMPThreadData
vtkImageHistogramSMPThreadLocal * SMPThreadData
Definition: vtkImageHistogram.h:241
vtkImageHistogram::Histogram
vtkIdTypeArray * Histogram
Definition: vtkImageHistogram.h:234
vtkX3D::range
Definition: vtkX3D.h:238
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:37
vtkImageHistogram::SetHistogramImageScaleToSqrt
void SetHistogramImageScaleToSqrt()
Definition: vtkImageHistogram.h:170
vtkThreadedImageAlgorithm.h
vtkImageHistogram::Total
vtkIdType Total
Definition: vtkImageHistogram.h:235
vtkX3D::port
Definition: vtkX3D.h:447
vtkImageAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
vtkImageAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkThreadedImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageHistogram::NumberOfBins
int NumberOfBins
Definition: vtkImageHistogram.h:230
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkImageHistogram::AutomaticBinning
vtkTypeBool AutomaticBinning
Definition: vtkImageHistogram.h:223
vtkImageHistogram::MaximumNumberOfBins
int MaximumNumberOfBins
Definition: vtkImageHistogram.h:224
vtkImageHistogram::HistogramImageScale
int HistogramImageScale
Definition: vtkImageHistogram.h:227
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkX3D::info
Definition: vtkX3D.h:376
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkImageHistogram::SetHistogramImageScaleToLog
void SetHistogramImageScaleToLog()
Definition: vtkImageHistogram.h:168
vtkImageHistogram::SetHistogramImageScaleToLinear
void SetHistogramImageScaleToLinear()
Definition: vtkImageHistogram.h:166
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:35
vtkImageHistogram::ActiveComponent
int ActiveComponent
Definition: vtkImageHistogram.h:222
vtkImageAlgorithm::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
vtkImageHistogram::Linear
Definition: vtkImageHistogram.h:54
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:36
vtkImageStencilData
efficient description of an image stencil
Definition: vtkImageStencilData.h:34
vtkImageAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkThreadedImageAlgorithm::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69