ITK
4.0.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 00048 template<class TInputImage, class TOutputImage> 00049 class ITK_EXPORT IntermodesThresholdImageFilter : 00050 public HistogramThresholdImageFilter<TInputImage, TOutputImage> 00051 { 00052 public: 00054 typedef IntermodesThresholdImageFilter Self; 00055 typedef HistogramThresholdImageFilter<TInputImage,TOutputImage> Superclass; 00056 typedef SmartPointer<Self> Pointer; 00057 typedef SmartPointer<const Self> ConstPointer; 00058 00060 itkNewMacro(Self); 00061 00063 itkTypeMacro(IntermodesThresholdImageFilter, HistogramThresholdImageFilter); 00064 00065 typedef TInputImage InputImageType; 00066 typedef TOutputImage OutputImageType; 00067 00069 typedef typename InputImageType::PixelType InputPixelType; 00070 typedef typename OutputImageType::PixelType OutputPixelType; 00071 00073 typedef typename InputImageType::Pointer InputImagePointer; 00074 typedef typename OutputImageType::Pointer OutputImagePointer; 00075 00076 typedef typename InputImageType::SizeType InputSizeType; 00077 typedef typename InputImageType::IndexType InputIndexType; 00078 typedef typename InputImageType::RegionType InputImageRegionType; 00079 typedef typename OutputImageType::SizeType OutputSizeType; 00080 typedef typename OutputImageType::IndexType OutputIndexType; 00081 typedef typename OutputImageType::RegionType OutputImageRegionType; 00082 00083 typedef typename Superclass::HistogramType HistogramType; 00084 typedef IntermodesThresholdCalculator< HistogramType, InputPixelType > CalculatorType; 00085 00086 void SetMaximumSmoothingIterations(unsigned long I) 00087 { 00088 m_IntermodesCalculator->SetMaximumSmoothingIterations(I); 00089 } 00090 00091 unsigned long GetMaximumSmoothingIterations() 00092 { 00093 return(m_IntermodesCalculator->GetMaximumSmoothingIterations()); 00094 } 00095 00098 void SetUseInterMode(unsigned long I) 00099 { 00100 m_IntermodesCalculator->SetUseInterMode(I); 00101 } 00102 00103 bool GetUseInterMode() 00104 { 00105 return(m_IntermodesCalculator->GetUseInterMode()); 00106 } 00107 00109 itkStaticConstMacro(InputImageDimension, unsigned int, 00110 InputImageType::ImageDimension ); 00111 itkStaticConstMacro(OutputImageDimension, unsigned int, 00112 OutputImageType::ImageDimension ); 00114 00115 protected: 00116 00117 IntermodesThresholdImageFilter() 00118 { 00119 m_IntermodesCalculator = CalculatorType::New(); 00120 this->SetCalculator( m_IntermodesCalculator ); 00121 m_IntermodesCalculator->SetMaximumSmoothingIterations(10000); 00122 m_IntermodesCalculator->SetUseInterMode(true); 00123 } 00124 ~IntermodesThresholdImageFilter(){}; 00125 00126 void PrintSelf(std::ostream & os, Indent indent) const 00127 { 00128 Superclass::PrintSelf(os, indent); 00129 os << indent << "MaximumSmoothingIterations: " << m_IntermodesCalculator->GetMaximumSmoothingIterations() << std::endl; 00130 os << indent << "UseInterMode: " << m_IntermodesCalculator->GetUseInterMode() << std::endl; 00131 } 00132 00133 private: 00134 IntermodesThresholdImageFilter(const Self&); //purposely not implemented 00135 void operator=(const Self&); //purposely not implemented 00136 00137 typename CalculatorType::Pointer m_IntermodesCalculator; 00138 00139 }; // end of class 00140 00141 } // end namespace itk 00142 00143 #endif 00144