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;
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
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:238
vtkImageHistogram::Sqrt
Definition: vtkImageHistogram.h:62
vtkImageHistogram::BinOrigin
double BinOrigin
Definition: vtkImageHistogram.h:237
vtkImageHistogram::GenerateHistogramImage
vtkTypeBool GenerateHistogramImage
Definition: vtkImageHistogram.h:234
vtkImageHistogram
Compute the histogram for an image.
Definition: vtkImageHistogram.h:48
vtkImageHistogram::ThreadData
vtkImageHistogramThreadData * ThreadData
Definition: vtkImageHistogram.h:244
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkImageHistogram::Log
Definition: vtkImageHistogram.h:61
vtkX3D::data
Definition: vtkX3D.h:315
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkImageHistogram::GetTotal
vtkIdType GetTotal()
Get the total count of the histogram.
Definition: vtkImageHistogram.h:192
vtkImageHistogram::SMPThreadData
vtkImageHistogramSMPThreadLocal * SMPThreadData
Definition: vtkImageHistogram.h:247
vtkImageHistogram::Histogram
vtkIdTypeArray * Histogram
Definition: vtkImageHistogram.h:240
vtkX3D::range
Definition: vtkX3D.h:238
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:43
vtkImageHistogram::SetHistogramImageScaleToSqrt
void SetHistogramImageScaleToSqrt()
Definition: vtkImageHistogram.h:176
vtkThreadedImageAlgorithm.h
vtkImageHistogram::Total
vtkIdType Total
Definition: vtkImageHistogram.h:241
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:236
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkImageHistogram::AutomaticBinning
vtkTypeBool AutomaticBinning
Definition: vtkImageHistogram.h:229
vtkImageHistogram::MaximumNumberOfBins
int MaximumNumberOfBins
Definition: vtkImageHistogram.h:230
vtkImageHistogram::HistogramImageScale
int HistogramImageScale
Definition: vtkImageHistogram.h:233
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkX3D::info
Definition: vtkX3D.h:376
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkImageHistogram::SetHistogramImageScaleToLog
void SetHistogramImageScaleToLog()
Definition: vtkImageHistogram.h:174
vtkImageHistogram::SetHistogramImageScaleToLinear
void SetHistogramImageScaleToLinear()
Definition: vtkImageHistogram.h:172
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:41
vtkImageHistogram::ActiveComponent
int ActiveComponent
Definition: vtkImageHistogram.h:228
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:60
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:39
vtkImageStencilData
efficient description of an image stencil
Definition: vtkImageStencilData.h:37
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