ITK  5.4.0
Insight Toolkit
itkOtsuMultipleThresholdsImageFilter.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 itkOtsuMultipleThresholdsImageFilter_h
19#define itkOtsuMultipleThresholdsImageFilter_h
20
22#include "itkFixedArray.h"
25
26namespace itk
27{
60template <typename TInputImage, typename TOutputImage>
61class ITK_TEMPLATE_EXPORT OtsuMultipleThresholdsImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
62{
63public:
64 ITK_DISALLOW_COPY_AND_MOVE(OtsuMultipleThresholdsImageFilter);
65
71
73 itkNewMacro(Self);
74
76 itkOverrideGetNameOfClassMacro(OtsuMultipleThresholdsImageFilter);
77
79 using InputPixelType = typename TInputImage::PixelType;
80 using OutputPixelType = typename TOutputImage::PixelType;
81
85
92
98
100 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
101 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
102
104 itkSetClampMacro(NumberOfHistogramBins, SizeValueType, 1, NumericTraits<SizeValueType>::max());
105 itkGetConstMacro(NumberOfHistogramBins, SizeValueType);
109 itkSetClampMacro(NumberOfThresholds, SizeValueType, 1, NumericTraits<SizeValueType>::max());
110 itkGetConstMacro(NumberOfThresholds, SizeValueType);
115 itkGetConstMacro(LabelOffset, OutputPixelType);
119 itkSetMacro(ValleyEmphasis, bool);
120 itkGetConstReferenceMacro(ValleyEmphasis, bool);
121 itkBooleanMacro(ValleyEmphasis);
126 itkSetMacro(ReturnBinMidpoint, bool);
127 itkGetConstReferenceMacro(ReturnBinMidpoint, bool);
128 itkBooleanMacro(ReturnBinMidpoint);
132 const ThresholdVectorType &
134 {
135 return m_Thresholds;
136 }
137
138#ifdef ITK_USE_CONCEPT_CHECKING
139 // Begin concept checking
141 itkConceptMacro(OutputOStreamWritableCheck, (Concept::OStreamWritable<OutputPixelType>));
142 // End concept checking
143#endif
144
145protected:
148 void
149 PrintSelf(std::ostream & os, Indent indent) const override;
150
151 void
153
154 void
155 GenerateData() override;
156
157private:
158 SizeValueType m_NumberOfHistogramBins{ 128 };
159 SizeValueType m_NumberOfThresholds{ 1 };
160 OutputPixelType m_LabelOffset{};
161 ThresholdVectorType m_Thresholds{};
162 bool m_ValleyEmphasis{ false };
163#if defined(ITKV4_COMPATIBILITY)
164 bool m_ReturnBinMidpoint{ true };
165#else
166 bool m_ReturnBinMidpoint{ false };
167#endif
168};
169} // end namespace itk
170
171#ifndef ITK_MANUAL_INSTANTIATION
172# include "itkOtsuMultipleThresholdsImageFilter.hxx"
173#endif
174
175#endif
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
typename OutputImageType::Pointer OutputImagePointer
Base class for filters that take an image as input and produce an image as output.
typename InputImageType::Pointer InputImagePointer
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Define additional traits for native types such as int or float.
static constexpr T max(const T &)
Computes Otsu's multiple thresholds for a histogram.
Threshold an image using multiple Otsu Thresholds.
~OtsuMultipleThresholdsImageFilter() override=default
typename HistogramGeneratorType::HistogramType HistogramType
typename OtsuCalculatorType::OutputType ThresholdVectorType
void PrintSelf(std::ostream &os, Indent indent) const override
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:78
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:83