ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 00019 #ifndef __itkIntermodesThresholdImageFilter_h 00020 #define __itkIntermodesThresholdImageFilter_h 00021 00022 #include "itkHistogramThresholdImageFilter.h" 00023 #include "itkIntermodesThresholdCalculator.h" 00024 00025 namespace itk { 00026 00050 template<class TInputImage, class TOutputImage, class TMaskImage=TOutputImage> 00051 class ITK_EXPORT IntermodesThresholdImageFilter : 00052 public HistogramThresholdImageFilter<TInputImage, TOutputImage, TMaskImage> 00053 { 00054 public: 00056 typedef IntermodesThresholdImageFilter Self; 00057 typedef HistogramThresholdImageFilter<TInputImage,TOutputImage,TMaskImage> Superclass; 00058 typedef SmartPointer<Self> Pointer; 00059 typedef SmartPointer<const Self> ConstPointer; 00060 00062 itkNewMacro(Self); 00063 00065 itkTypeMacro(IntermodesThresholdImageFilter, HistogramThresholdImageFilter); 00066 00067 typedef TInputImage InputImageType; 00068 typedef TOutputImage OutputImageType; 00069 typedef TMaskImage MaskImageType; 00070 00072 typedef typename InputImageType::PixelType InputPixelType; 00073 typedef typename OutputImageType::PixelType OutputPixelType; 00074 typedef typename MaskImageType::PixelType MaskPixelType; 00075 00077 typedef typename InputImageType::Pointer InputImagePointer; 00078 typedef typename OutputImageType::Pointer OutputImagePointer; 00079 00080 typedef typename InputImageType::SizeType InputSizeType; 00081 typedef typename InputImageType::IndexType InputIndexType; 00082 typedef typename InputImageType::RegionType InputImageRegionType; 00083 typedef typename OutputImageType::SizeType OutputSizeType; 00084 typedef typename OutputImageType::IndexType OutputIndexType; 00085 typedef typename OutputImageType::RegionType OutputImageRegionType; 00086 typedef typename MaskImageType::SizeType MaskSizeType; 00087 typedef typename MaskImageType::IndexType MaskIndexType; 00088 typedef typename MaskImageType::RegionType MaskImageRegionType; 00089 00090 typedef typename Superclass::HistogramType HistogramType; 00091 typedef IntermodesThresholdCalculator< HistogramType, InputPixelType > CalculatorType; 00092 00093 void SetMaximumSmoothingIterations(unsigned long I) 00094 { 00095 m_IntermodesCalculator->SetMaximumSmoothingIterations(I); 00096 } 00097 00098 unsigned long GetMaximumSmoothingIterations() 00099 { 00100 return(m_IntermodesCalculator->GetMaximumSmoothingIterations()); 00101 } 00102 00105 void SetUseInterMode(unsigned long I) 00106 { 00107 m_IntermodesCalculator->SetUseInterMode(I); 00108 } 00109 00110 bool GetUseInterMode() 00111 { 00112 return(m_IntermodesCalculator->GetUseInterMode()); 00113 } 00114 00116 itkStaticConstMacro(InputImageDimension, unsigned int, 00117 InputImageType::ImageDimension ); 00118 itkStaticConstMacro(OutputImageDimension, unsigned int, 00119 OutputImageType::ImageDimension ); 00121 00122 protected: 00123 00124 IntermodesThresholdImageFilter() 00125 { 00126 m_IntermodesCalculator = CalculatorType::New(); 00127 this->SetCalculator( m_IntermodesCalculator ); 00128 m_IntermodesCalculator->SetMaximumSmoothingIterations(10000); 00129 m_IntermodesCalculator->SetUseInterMode(true); 00130 } 00131 ~IntermodesThresholdImageFilter(){}; 00132 00133 void PrintSelf(std::ostream & os, Indent indent) const 00134 { 00135 Superclass::PrintSelf(os, indent); 00136 os << indent << "MaximumSmoothingIterations: " << m_IntermodesCalculator->GetMaximumSmoothingIterations() << std::endl; 00137 os << indent << "UseInterMode: " << m_IntermodesCalculator->GetUseInterMode() << std::endl; 00138 } 00139 00140 private: 00141 IntermodesThresholdImageFilter(const Self&); //purposely not implemented 00142 void operator=(const Self&); //purposely not implemented 00143 00144 typename CalculatorType::Pointer m_IntermodesCalculator; 00145 00146 }; // end of class 00147 00148 } // end namespace itk 00149 00150 #endif 00151