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 #ifndef __itkKappaSigmaThresholdImageFilter_h 00019 #define __itkKappaSigmaThresholdImageFilter_h 00020 00021 #include "itkImageToImageFilter.h" 00022 #include "itkKappaSigmaThresholdImageCalculator.h" 00023 00024 namespace itk 00025 { 00050 template< class TInputImage, 00051 class TMaskImage = Image< unsigned char, ::itk::GetImageDimension< TInputImage >::ImageDimension >, 00052 class TOutputImage = TInputImage > 00053 class ITK_EXPORT KappaSigmaThresholdImageFilter: 00054 public ImageToImageFilter< TInputImage, TOutputImage > 00055 { 00056 public: 00058 typedef KappaSigmaThresholdImageFilter Self; 00059 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass; 00060 typedef SmartPointer< Self > Pointer; 00061 typedef SmartPointer< const Self > ConstPointer; 00062 00064 itkNewMacro(Self); 00065 00067 itkTypeMacro(KappaSigmaThresholdImageFilter, ImageToImageFilter); 00068 00070 typedef TInputImage InputImageType; 00071 typedef TMaskImage MaskImageType; 00072 00074 typedef typename TInputImage::PixelType InputPixelType; 00075 typedef typename TOutputImage::PixelType OutputPixelType; 00076 typedef typename TMaskImage::PixelType MaskPixelType; 00077 00079 typedef typename TInputImage::Pointer InputImagePointer; 00080 typedef typename TOutputImage::Pointer OutputImagePointer; 00081 typedef typename TMaskImage::Pointer MaskImagePointer; 00082 00085 itkSetMacro(OutsideValue, OutputPixelType); 00086 00088 itkGetConstMacro(OutsideValue, OutputPixelType); 00089 00092 itkSetMacro(InsideValue, OutputPixelType); 00093 00095 itkGetConstMacro(InsideValue, OutputPixelType); 00096 00098 itkGetConstMacro(Threshold, InputPixelType); 00099 00100 itkSetMacro(MaskValue, MaskPixelType); 00101 itkGetConstMacro(MaskValue, MaskPixelType); 00102 00103 itkSetMacro(SigmaFactor, double); 00104 itkGetConstMacro(SigmaFactor, double); 00105 00106 itkSetMacro(NumberOfIterations, unsigned int); 00107 itkGetConstMacro(NumberOfIterations, unsigned int); 00108 00109 #ifdef ITK_USE_CONCEPT_CHECKING 00110 00111 itkConceptMacro( OutputComparableCheck, 00112 ( Concept::Comparable< OutputPixelType > ) ); 00113 itkConceptMacro( OutputOStreamWritableCheck, 00114 ( Concept::OStreamWritable< OutputPixelType > ) ); 00115 00117 #endif 00118 00120 void SetMaskImage(const MaskImageType *input) 00121 { 00122 // Process object is not const-correct so the const casting is required. 00123 this->SetNthInput( 1, const_cast< MaskImageType * >( input ) ); 00124 } 00125 00127 const MaskImageType * GetMaskImage() const 00128 { 00129 return static_cast< MaskImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) ); 00130 } 00131 00133 void SetInput1(const TInputImage *input) 00134 { 00135 this->SetInput(input); 00136 } 00137 00139 void SetInput2(const MaskImageType *input) 00140 { 00141 this->SetMaskImage(input); 00142 } 00143 00144 protected: 00145 KappaSigmaThresholdImageFilter(); 00146 ~KappaSigmaThresholdImageFilter(){} 00147 void PrintSelf(std::ostream & os, Indent indent) const; 00148 00149 void GenerateInputRequestedRegion(); 00150 00151 void GenerateData(); 00152 00153 typedef typename TInputImage::SizeType InputSizeType; 00154 typedef typename TInputImage::IndexType InputIndexType; 00155 typedef typename TInputImage::RegionType InputImageRegionType; 00156 typedef typename TOutputImage::SizeType OutputSizeType; 00157 typedef typename TOutputImage::IndexType OutputIndexType; 00158 typedef typename TOutputImage::RegionType OutputImageRegionType; 00159 00160 typedef KappaSigmaThresholdImageCalculator< TInputImage, TMaskImage > CalculatorType; 00161 00163 itkStaticConstMacro(InputImageDimension, unsigned int, 00164 TInputImage::ImageDimension); 00165 itkStaticConstMacro(OutputImageDimension, unsigned int, 00166 TOutputImage::ImageDimension); 00167 private: 00168 KappaSigmaThresholdImageFilter(const Self &); //purposely not implemented 00169 void operator=(const Self &); //purposely not implemented 00171 00172 MaskPixelType m_MaskValue; 00173 double m_SigmaFactor; 00174 unsigned int m_NumberOfIterations; 00175 InputPixelType m_Threshold; 00176 OutputPixelType m_InsideValue; 00177 OutputPixelType m_OutsideValue; 00178 }; // end of class 00179 } // end namespace itk 00180 00181 #ifndef ITK_MANUAL_INSTANTIATION 00182 #include "itkKappaSigmaThresholdImageFilter.hxx" 00183 #endif 00184 00185 #endif 00186