ITK  4.13.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:
65 
67  itkNewMacro(Self);
68 
71 
73  typedef typename TInputImage::PixelType InputPixelType;
74  typedef typename TOutputImage::PixelType OutputPixelType;
75 
77  typedef typename TInputImage::Pointer InputImagePointer;
78  typedef typename TOutputImage::Pointer OutputImagePointer;
79 
82  typedef typename TInputImage::RegionType InputImageRegionType;
85  typedef typename TOutputImage::RegionType OutputImageRegionType;
86 
92 
94  itkStaticConstMacro(InputImageDimension, unsigned int,
95  TInputImage::ImageDimension);
96  itkStaticConstMacro(OutputImageDimension, unsigned int,
97  TOutputImage::ImageDimension);
99 
101  itkSetClampMacro( NumberOfHistogramBins, SizeValueType, 1, NumericTraits< SizeValueType >::max() );
102  itkGetConstMacro(NumberOfHistogramBins, SizeValueType);
104 
106  itkSetClampMacro( NumberOfThresholds, SizeValueType, 1, NumericTraits< SizeValueType >::max() );
107  itkGetConstMacro(NumberOfThresholds, SizeValueType);
109 
111  itkSetClampMacro( LabelOffset, OutputPixelType, NumericTraits< OutputPixelType >::ZeroValue(),
113  itkGetConstMacro(LabelOffset, OutputPixelType);
115 
117  itkSetMacro(ValleyEmphasis, bool);
118  itkGetConstReferenceMacro(ValleyEmphasis, bool);
119  itkBooleanMacro(ValleyEmphasis);
121 
124  {
125  return m_Thresholds;
126  }
127 
128 #ifdef ITK_USE_CONCEPT_CHECKING
129  // Begin concept checking
130  itkConceptMacro( OutputComparableCheck,
132  itkConceptMacro( OutputOStreamWritableCheck,
134  // End concept checking
135 #endif
136 
137 protected:
140  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
141 
142  void GenerateInputRequestedRegion() ITK_OVERRIDE;
143 
144  void GenerateData() ITK_OVERRIDE;
145 
146 private:
147  ITK_DISALLOW_COPY_AND_ASSIGN(OtsuMultipleThresholdsImageFilter);
148 
149  SizeValueType m_NumberOfHistogramBins;
150  SizeValueType m_NumberOfThresholds;
151  OutputPixelType m_LabelOffset;
152  ThresholdVectorType m_Thresholds;
153  bool m_ValleyEmphasis;
154 };
155 } // end namespace itk
156 
157 #ifndef ITK_MANUAL_INSTANTIATION
158 #include "itkOtsuMultipleThresholdsImageFilter.hxx"
159 #endif
160 
161 #endif
HistogramGeneratorType::HistogramType HistogramType
itk::Statistics::ScalarImageToHistogramGenerator< TInputImage > HistogramGeneratorType
ImageToImageFilter< TInputImage, TOutputImage > Superclass
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
OtsuMultipleThresholdsCalculator< HistogramType > OtsuCalculatorType
Computes Otsu&#39;s multiple thresholds for a histogram.
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Threshold an image using multiple Otsu Thresholds.
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
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)