ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkOtsuMultipleThresholdsImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 {
55 template< typename TInputImage, typename TOutputImage >
56 class ITK_TEMPLATE_EXPORT OtsuMultipleThresholdsImageFilter:
57  public ImageToImageFilter< TInputImage, TOutputImage >
58 {
59 public:
60  ITK_DISALLOW_COPY_AND_ASSIGN(OtsuMultipleThresholdsImageFilter);
61 
67 
69  itkNewMacro(Self);
70 
73 
75  using InputPixelType = typename TInputImage::PixelType;
76  using OutputPixelType = typename TOutputImage::PixelType;
77 
79  using InputImagePointer = typename TInputImage::Pointer;
80  using OutputImagePointer = typename TOutputImage::Pointer;
81 
88 
94 
96  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
97  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
98 
100  itkSetClampMacro( NumberOfHistogramBins, SizeValueType, 1, NumericTraits< SizeValueType >::max() );
101  itkGetConstMacro(NumberOfHistogramBins, SizeValueType);
103 
105  itkSetClampMacro( NumberOfThresholds, SizeValueType, 1, NumericTraits< SizeValueType >::max() );
106  itkGetConstMacro(NumberOfThresholds, SizeValueType);
108 
110  itkSetClampMacro( LabelOffset, OutputPixelType, NumericTraits< OutputPixelType >::ZeroValue(),
112  itkGetConstMacro(LabelOffset, OutputPixelType);
114 
116  itkSetMacro(ValleyEmphasis, bool);
117  itkGetConstReferenceMacro(ValleyEmphasis, bool);
118  itkBooleanMacro(ValleyEmphasis);
120 
123  itkSetMacro(ReturnBinMidpoint, bool);
124  itkGetConstReferenceMacro(ReturnBinMidpoint, bool);
125  itkBooleanMacro(ReturnBinMidpoint);
127 
130  {
131  return m_Thresholds;
132  }
133 
134 #ifdef ITK_USE_CONCEPT_CHECKING
135  // Begin concept checking
136  itkConceptMacro( OutputComparableCheck,
138  itkConceptMacro( OutputOStreamWritableCheck,
140  // End concept checking
141 #endif
142 
143 protected:
145  ~OtsuMultipleThresholdsImageFilter() override = default;
146  void PrintSelf(std::ostream & os, Indent indent) const override;
147 
148  void GenerateInputRequestedRegion() override;
149 
150  void GenerateData() override;
151 
152 private:
153  SizeValueType m_NumberOfHistogramBins{ 128 };
154  SizeValueType m_NumberOfThresholds{ 1 };
157  bool m_ValleyEmphasis{ false };
158 #if defined(ITKV4_COMPATIBILITY)
159  bool m_ReturnBinMidpoint{ true };
160 #else
161  bool m_ReturnBinMidpoint{ false };
162 #endif
163 };
164 } // end namespace itk
165 
166 #ifndef ITK_MANUAL_INSTANTIATION
167 #include "itkOtsuMultipleThresholdsImageFilter.hxx"
168 #endif
169 
170 #endif
typename OutputImageType::Pointer OutputImagePointer
Define numeric traits for std::vector.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
typename OtsuCalculatorType::OutputType ThresholdVectorType
Computes Otsu&#39;s multiple thresholds for a histogram.
Base class for all process objects that output image data.
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
Threshold an image using multiple Otsu Thresholds.
typename InputImageType::RegionType InputImageRegionType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename HistogramGeneratorType::HistogramType HistogramType
#define itkConceptMacro(name, concept)