ITK  6.0.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 
21 #include "itkImageToImageFilter.h"
22 #include "itkFixedArray.h"
25 
26 namespace itk
27 {
60 template <typename TInputImage, typename TOutputImage>
61 class ITK_TEMPLATE_EXPORT OtsuMultipleThresholdsImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
62 {
63 public:
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);
114  itkSetClampMacro(LabelOffset, OutputPixelType, OutputPixelType{}, NumericTraits<OutputPixelType>::max());
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
140  itkConceptMacro(OutputComparableCheck, (Concept::Comparable<OutputPixelType>));
141  itkConceptMacro(OutputOStreamWritableCheck, (Concept::OStreamWritable<OutputPixelType>));
142  // End concept checking
143 #endif
144 
145 protected:
147  ~OtsuMultipleThresholdsImageFilter() override = default;
148  void
149  PrintSelf(std::ostream & os, Indent indent) const override;
150 
151  void
152  GenerateInputRequestedRegion() override;
153 
154  void
155  GenerateData() override;
156 
157 private:
158  SizeValueType m_NumberOfHistogramBins{ 128 };
159  SizeValueType m_NumberOfThresholds{ 1 };
160  OutputPixelType m_LabelOffset{};
161  ThresholdVectorType m_Thresholds{};
162  bool m_ValleyEmphasis{ false };
163  bool m_ReturnBinMidpoint{ false };
164 };
165 } // end namespace itk
166 
167 #ifndef ITK_MANUAL_INSTANTIATION
168 # include "itkOtsuMultipleThresholdsImageFilter.hxx"
169 #endif
170 
171 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::OtsuMultipleThresholdsImageFilter::GetThresholds
const ThresholdVectorType & GetThresholds() const
Definition: itkOtsuMultipleThresholdsImageFilter.h:133
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:638
itk::OtsuMultipleThresholdsImageFilter::OutputIndexType
typename TOutputImage::IndexType OutputIndexType
Definition: itkOtsuMultipleThresholdsImageFilter.h:90
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::OtsuMultipleThresholdsImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkOtsuMultipleThresholdsImageFilter.h:80
itk::Statistics::ScalarImageToHistogramGenerator
TODO.
Definition: itkScalarImageToHistogramGenerator.h:37
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::OtsuMultipleThresholdsImageFilter
Threshold an image using multiple Otsu Thresholds.
Definition: itkOtsuMultipleThresholdsImageFilter.h:61
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkOtsuMultipleThresholdsCalculator.h
itk::OtsuMultipleThresholdsCalculator::OutputType
std::vector< MeasurementType > OutputType
Definition: itkOtsuMultipleThresholdsCalculator.h:79
itkScalarImageToHistogramGenerator.h
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Statistics::Histogram
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkFixedArray.h
itk::OtsuMultipleThresholdsImageFilter::OutputSizeType
typename TOutputImage::SizeType OutputSizeType
Definition: itkOtsuMultipleThresholdsImageFilter.h:89
itkImageToImageFilter.h
itk::OtsuMultipleThresholdsImageFilter::ThresholdVectorType
typename OtsuCalculatorType::OutputType ThresholdVectorType
Definition: itkOtsuMultipleThresholdsImageFilter.h:97
itk::Concept::Comparable
Definition: itkConceptChecking.h:331
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::NumericTraits::max
static constexpr T max(const T &)
Definition: itkNumericTraits.h:169
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::OtsuMultipleThresholdsImageFilter::HistogramType
typename HistogramGeneratorType::HistogramType HistogramType
Definition: itkOtsuMultipleThresholdsImageFilter.h:95
itk::OtsuMultipleThresholdsImageFilter::InputIndexType
typename TInputImage::IndexType InputIndexType
Definition: itkOtsuMultipleThresholdsImageFilter.h:87
itk::OtsuMultipleThresholdsImageFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkOtsuMultipleThresholdsImageFilter.h:79
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86
itk::OtsuMultipleThresholdsCalculator
Computes Otsu's multiple thresholds for a histogram.
Definition: itkOtsuMultipleThresholdsCalculator.h:50
itk::OtsuMultipleThresholdsImageFilter::InputSizeType
typename TInputImage::SizeType InputSizeType
Definition: itkOtsuMultipleThresholdsImageFilter.h:86