VTK  9.3.20240424
vtkImageHistogram.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
44#ifndef vtkImageHistogram_h
45#define vtkImageHistogram_h
46
47#include "vtkImagingStatisticsModule.h" // For export macro
49
50VTK_ABI_NAMESPACE_BEGIN
52class vtkIdTypeArray;
53class vtkImageHistogramThreadData;
54class vtkImageHistogramSMPThreadLocal;
55
56class VTKIMAGINGSTATISTICS_EXPORT vtkImageHistogram : public vtkThreadedImageAlgorithm
57{
58public:
61
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
67 enum
68 {
69 Linear = 0,
70 Log = 1,
71 Sqrt = 2
72 };
73
75
80 vtkSetMacro(ActiveComponent, int);
81 vtkGetMacro(ActiveComponent, int);
83
85
96 vtkSetMacro(AutomaticBinning, vtkTypeBool);
97 vtkBooleanMacro(AutomaticBinning, vtkTypeBool);
98 vtkGetMacro(AutomaticBinning, vtkTypeBool);
100
102
110 vtkSetMacro(MaximumNumberOfBins, int);
111 vtkGetMacro(MaximumNumberOfBins, int);
113
115
119 vtkSetMacro(NumberOfBins, int);
120 vtkGetMacro(NumberOfBins, int);
122
124
128 vtkSetMacro(BinOrigin, double);
129 vtkGetMacro(BinOrigin, double);
131
133
137 vtkSetMacro(BinSpacing, double);
138 vtkGetMacro(BinSpacing, double);
140
142
148
153
155
160 vtkSetMacro(GenerateHistogramImage, vtkTypeBool);
161 vtkBooleanMacro(GenerateHistogramImage, vtkTypeBool);
162 vtkGetMacro(GenerateHistogramImage, vtkTypeBool);
164
166
170 vtkSetVector2Macro(HistogramImageSize, int);
171 vtkGetVector2Macro(HistogramImageSize, int);
173
175
179 vtkSetClampMacro(HistogramImageScale, int, vtkImageHistogram::Linear, vtkImageHistogram::Sqrt);
180 void SetHistogramImageScaleToLinear() { this->SetHistogramImageScale(vtkImageHistogram::Linear); }
181 void SetHistogramImageScaleToLog() { this->SetHistogramImageScale(vtkImageHistogram::Log); }
182 void SetHistogramImageScaleToSqrt() { this->SetHistogramImageScale(vtkImageHistogram::Sqrt); }
183 vtkGetMacro(HistogramImageScale, int);
186
192
197 vtkIdType GetTotal() { return this->Total; }
198
204 vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
205 int id) override;
206
207protected:
210
211 int RequestUpdateExtent(vtkInformation* vtkNotUsed(request), vtkInformationVector** inInfo,
212 vtkInformationVector* vtkNotUsed(outInfo)) override;
213 int RequestInformation(vtkInformation* vtkNotUsed(request), vtkInformationVector** inInfo,
214 vtkInformationVector* vtkNotUsed(outInfo)) override;
216
217 int FillInputPortInformation(int port, vtkInformation* info) override;
218 int FillOutputPortInformation(int port, vtkInformation* info) override;
219
225 void ComputeImageScalarRange(vtkImageData* data, double range[2]);
226
230
231 int HistogramImageSize[2];
234
236 double BinOrigin;
238
241
242 // Used for vtkMultiThreader operation.
243 vtkImageHistogramThreadData* ThreadData;
244
245 // Used for vtkSMPTools operation.
246 vtkImageHistogramSMPThreadLocal* SMPThreadData;
247
248private:
249 vtkImageHistogram(const vtkImageHistogram&) = delete;
250 void operator=(const vtkImageHistogram&) = delete;
251
252 friend class vtkImageHistogramFunctor;
253};
254
255VTK_ABI_NAMESPACE_END
256#endif
Proxy object to connect input/output ports.
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
Compute the histogram for an image.
vtkTypeBool GenerateHistogramImage
void SetStencilData(vtkImageStencilData *stencil)
Use a stencil to compute the histogram for just a part of the image.
void SetHistogramImageScaleToLog()
Set the scale to use for the histogram image.
int RequestUpdateExtent(vtkInformation *vtkNotUsed(request), vtkInformationVector **inInfo, vtkInformationVector *vtkNotUsed(outInfo)) override
vtkIdTypeArray * GetHistogram()
Get the histogram as a vtkIdTypeArray.
static vtkImageHistogram * New()
const char * GetHistogramImageScaleAsString()
Set the scale to use for the histogram image.
vtkImageStencilData * GetStencil()
Use a stencil to compute the histogram for just a part of the image.
int FillInputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
vtkImageHistogramThreadData * ThreadData
vtkTypeBool AutomaticBinning
void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int ext[6], int id) override
This is part of the executive, but is public so that it can be accessed by non-member functions.
void ComputeImageScalarRange(vtkImageData *data, double range[2])
Compute the range of the data.
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() override
void SetHistogramImageScaleToLinear()
Set the scale to use for the histogram image.
void SetStencilConnection(vtkAlgorithmOutput *algOutput)
Equivalent to SetInputConnection(1, algOutput).
vtkImageHistogramSMPThreadLocal * SMPThreadData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called in response to a REQUEST_DATA request from the executive.
void SetHistogramImageScaleToSqrt()
Set the scale to use for the histogram image.
int RequestInformation(vtkInformation *vtkNotUsed(request), vtkInformationVector **inInfo, vtkInformationVector *vtkNotUsed(outInfo)) override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdTypeArray * Histogram
vtkIdType GetTotal()
Get the total count of the histogram.
efficient description of an image stencil
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Generic filter that has one input.
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315