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) VTK_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, int);
82  vtkBooleanMacro(AutomaticBinning, int);
83  vtkGetMacro(AutomaticBinning, int);
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, int);
146  vtkBooleanMacro(GenerateHistogramImage, int);
147  vtkGetMacro(GenerateHistogramImage, int);
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) VTK_OVERRIDE;
197 
198 protected:
200  ~vtkImageHistogram() VTK_OVERRIDE;
201 
202  int RequestUpdateExtent(vtkInformation *vtkNotUsed(request),
203  vtkInformationVector **inInfo,
204  vtkInformationVector *vtkNotUsed(outInfo)) VTK_OVERRIDE;
205  int RequestInformation(vtkInformation *vtkNotUsed(request),
206  vtkInformationVector **inInfo,
207  vtkInformationVector *vtkNotUsed(outInfo)) VTK_OVERRIDE;
208  int RequestData(vtkInformation *,
210  vtkInformationVector *) VTK_OVERRIDE;
211 
212  int FillInputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
213  int FillOutputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
214 
220  void ComputeImageScalarRange(vtkImageData *data, double range[2]);
221 
222  int ActiveComponent;
223  int AutomaticBinning;
224  int MaximumNumberOfBins;
225 
226  int HistogramImageSize[2];
227  int HistogramImageScale;
228  int GenerateHistogramImage;
229 
230  int NumberOfBins;
231  double BinOrigin;
232  double BinSpacing;
233 
234  vtkIdTypeArray *Histogram;
235  vtkIdType Total;
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&) VTK_DELETE_FUNCTION;
245  void operator=(const vtkImageHistogram&) VTK_DELETE_FUNCTION;
246 
247  friend class vtkImageHistogramFunctor;
248 };
249 
250 #endif
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:345
vtkIdType GetTotal()
Get the total count of the histogram.
Proxy object to connect input/output ports.
Generic filter that has one input.
void SetHistogramImageScaleToLog()
Set the scale to use for the histogram image.
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 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.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetHistogramImageScaleToLinear()
Set the scale to use for the histogram image.
Compute the histogram for an image.