ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkImageToHistogramFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkImageToHistogramFilter_h
19#define itkImageToHistogramFilter_h
20
21#include <mutex>
22
23#include "itkHistogram.h"
24#include "itkImageSink.h"
26#include "itkProgressReporter.h"
27
28namespace itk::Statistics
29{
46
47template <typename TImage>
48class ITK_TEMPLATE_EXPORT ImageToHistogramFilter : public ImageSink<TImage>
49{
50public:
51 ITK_DISALLOW_COPY_AND_MOVE(ImageToHistogramFilter);
52
58
60 itkOverrideGetNameOfClassMacro(ImageToHistogramFilter);
61
63 itkNewMacro(Self);
64
65 using ImageType = TImage;
66 using PixelType = typename ImageType::PixelType;
67 using RegionType = typename ImageType::RegionType;
70
77
78public:
81 const HistogramType *
82 GetOutput() const;
88
91
95
98
105 itkSetGetDecoratedInputMacro(HistogramSize, HistogramSizeType);
106
110 itkSetGetDecoratedInputMacro(MarginalScale, HistogramMeasurementType);
111
115 itkSetGetDecoratedInputMacro(HistogramBinMinimum, HistogramMeasurementVectorType);
116 itkSetGetDecoratedInputMacro(HistogramBinMaximum, HistogramMeasurementVectorType);
122 itkSetGetDecoratedInputMacro(AutoMinimumMaximum, bool);
123 itkBooleanMacro(AutoMinimumMaximum);
127 virtual void
129
130
131 // Change the access from protected to public to expose streaming option, a using statement can not be used due to
132 // limitations of wrapping.
133 void
134 SetNumberOfStreamDivisions(const unsigned int n) override
135 {
137 }
138 [[nodiscard]] unsigned int
140 {
142 }
143
144protected:
146 ~ImageToHistogramFilter() override = default;
147 void
148 PrintSelf(std::ostream & os, Indent indent) const override;
149
150 void
151 StreamedGenerateData(unsigned int inputRequestedRegionNumber) override;
152
153 void
155 void
157
162
163 /* Override method to disable streaming when the minimum and
164 * maximum need to be computed. */
165 unsigned int
167
168 void
170 virtual void
171 ThreadedComputeMinimumAndMaximum(const RegionType & inputRegionForThread);
172
173
174 virtual void
176
177 std::mutex m_Mutex{};
178
180
183
184private:
185 void
188 HistogramSizeType & size);
189};
190} // namespace itk::Statistics
191
192#ifndef ITK_MANUAL_INSTANTIATION
193# include "itkImageToHistogramFilter.hxx"
194#endif
195
196#endif
SmartPointer< Self > Pointer
virtual void SetNumberOfStreamDivisions(unsigned int _arg)
virtual unsigned int GetNumberOfStreamDivisions() const
Control indentation during Print() invocation.
Definition itkIndent.h:50
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx)
Make a DataObject of the correct type to used as the specified output.
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Implements transparent reference counting.
This class stores measurement vectors in the context of n-dimensional histogram.
SmartPointer< const Self > ConstPointer
void SetNumberOfStreamDivisions(const unsigned int n) override
void PrintSelf(std::ostream &os, Indent indent) const override
typename HistogramType::MeasurementType HistogramMeasurementType
virtual void ThreadedMergeHistogram(HistogramPointer &&histogram)
typename HistogramType::SizeType HistogramSizeType
void StreamedGenerateData(unsigned int inputRequestedRegionNumber) override
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
SimpleDataObjectDecorator< bool > InputBooleanObjectType
typename HistogramType::MeasurementVectorType HistogramMeasurementVectorType
typename HistogramType::Pointer HistogramPointer
virtual void ThreadedComputeMinimumAndMaximum(const RegionType &inputRegionForThread)
void ThreadedStreamedGenerateData(const RegionType &) override
const HistogramType * GetOutput() const
unsigned int GetNumberOfStreamDivisions() const override
SimpleDataObjectDecorator< HistogramMeasurementVectorType > InputHistogramMeasurementVectorObjectType
SimpleDataObjectDecorator< HistogramMeasurementType > InputHistogramMeasurementObjectType
DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType) override
Make a DataObject of the correct type to used as the specified output.
typename NumericTraits< ValueType >::RealType ValueRealType
typename HistogramType::ConstPointer HistogramConstPointer
void ApplyMarginalScale(HistogramMeasurementVectorType &min, HistogramMeasurementVectorType &max, HistogramSizeType &size)
typename NumericTraits< PixelType >::ValueType ValueType
SimpleDataObjectDecorator< HistogramSizeType > InputHistogramSizeObjectType
virtual void GraftOutput(DataObject *graft)
unsigned int GetNumberOfInputRequestedRegions() override
Return the actual number of regions to request upstream.