Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkNarrowBandLevelSetImageFilter.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNarrowBandLevelSetImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:36 $ 00007 Version: $Revision: 1.5 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkNarrowBandLevelSetImageFilter_h_ 00018 #define __itkNarrowBandLevelSetImageFilter_h_ 00019 00020 #include "itkNarrowBandImageFilterBase.h" 00021 #include "itkSegmentationLevelSetFunction.h" 00022 #include "itkFastChamferDistanceImageFilter.h" 00023 #include "itkIsoContourDistanceImageFilter.h" 00024 00025 namespace itk { 00026 00139 template <class TInputImage, 00140 class TFeatureImage, 00141 class TOutputPixelType = float, 00142 class TOutputImage = Image<TOutputPixelType, 00143 ::itk::GetImageDimension<TInputImage>::ImageDimension> > 00144 class ITK_EXPORT NarrowBandLevelSetImageFilter 00145 : public NarrowBandImageFilterBase<TInputImage, TOutputImage> 00146 { 00147 public: 00149 typedef NarrowBandLevelSetImageFilter Self; 00150 typedef NarrowBandImageFilterBase<TInputImage, TOutputImage> Superclass; 00151 typedef SmartPointer<Self> Pointer; 00152 typedef SmartPointer<const Self> ConstPointer; 00153 00155 typedef typename Superclass::ValueType ValueType; 00156 typedef typename Superclass::IndexType IndexType; 00157 typedef typename Superclass::TimeStepType TimeStepType; 00158 typedef typename Superclass::InputImageType InputImageType; 00159 00161 typedef TOutputImage OutputImageType; 00162 typedef TFeatureImage FeatureImageType; 00163 00165 typedef SegmentationLevelSetFunction <OutputImageType, FeatureImageType> 00166 SegmentationFunctionType; 00167 00169 typedef typename SegmentationFunctionType::VectorImageType VectorImageType; 00170 00172 itkTypeMacro(NarrowBandLevelSetImageFilter, NarrowBandImageFilterBase); 00173 00176 itkSetMacro(MaximumRMSError, ValueType); 00177 itkGetMacro(MaximumRMSError, ValueType); 00178 00181 itkSetMacro(MaximumIterations, unsigned int); 00182 itkGetMacro(MaximumIterations, unsigned int); 00183 00186 virtual void SetFeatureImage(const FeatureImageType *f) 00187 { 00188 this->ProcessObject::SetNthInput( 1, const_cast< FeatureImageType * >(f) ); 00189 m_SegmentationFunction->SetFeatureImage(f); 00190 } 00191 virtual FeatureImageType * GetFeatureImage() 00192 { 00193 return ( static_cast< FeatureImageType *>(this->ProcessObject::GetInput(1)) ); 00194 } 00195 00198 virtual void SetInitialImage(InputImageType *f) 00199 { 00200 this->SetInput(f); 00201 } 00202 00203 virtual const typename SegmentationFunctionType::ImageType *GetSpeedImage() const 00204 { return m_SegmentationFunction->GetSpeedImage(); } 00205 00206 virtual const typename SegmentationFunctionType::VectorImageType *GetAdvectionImage() const 00207 { return m_SegmentationFunction->GetAdvectionImage(); } 00208 00212 void SetUseNegativeFeaturesOn() 00213 { 00214 itkWarningMacro( << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead" ); 00215 this->ReverseExpansionDirectionOn(); 00216 } 00217 void SetUseNegativeFeaturesOff() 00218 { 00219 itkWarningMacro( << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead" ); 00220 this->ReverseExpansionDirectionOff(); 00221 } 00222 00225 void SetUseNegativeFeatures( bool u ) 00226 { 00227 itkWarningMacro( << "SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead" ); 00228 if (u == true) 00229 { 00230 this->SetReverseExpansionDirection(false); 00231 } 00232 else 00233 { 00234 this->SetReverseExpansionDirection(true); 00235 } 00236 } 00237 bool GetUseNegativeFeatures() const 00238 { 00239 itkWarningMacro( << "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead" ); 00240 if ( this->GetUseNegativeFeatures() == false) 00241 { 00242 return true; 00243 } 00244 else 00245 { 00246 return false; 00247 } 00248 } 00249 00258 itkSetMacro(ReverseExpansionDirection, bool); 00259 itkGetMacro(ReverseExpansionDirection, bool); 00260 itkBooleanMacro(ReverseExpansionDirection); 00261 00266 void SetFeatureScaling(ValueType v) 00267 { 00268 if (v != m_SegmentationFunction->GetPropagationWeight()) 00269 { 00270 this->SetPropagationScaling(v); 00271 } 00272 if (v != m_SegmentationFunction->GetAdvectionWeight()) 00273 { 00274 this->SetAdvectionScaling(v); 00275 } 00276 } 00277 00280 void SetPropagationScaling(ValueType v) 00281 { 00282 if (v != m_SegmentationFunction->GetPropagationWeight()) 00283 { 00284 m_SegmentationFunction->SetPropagationWeight(v); 00285 } 00286 } 00287 ValueType GetPropagationScaling() const 00288 { 00289 return m_SegmentationFunction->GetPropagationWeight(); 00290 } 00291 00294 void SetAdvectionScaling(ValueType v) 00295 { 00296 if (v != m_SegmentationFunction->GetAdvectionWeight()) 00297 { 00298 m_SegmentationFunction->SetAdvectionWeight(v); 00299 } 00300 } 00301 ValueType GetAdvectionScaling() const 00302 { 00303 return m_SegmentationFunction->GetAdvectionWeight(); 00304 } 00305 00309 void SetCurvatureScaling(ValueType v) 00310 { 00311 if (v != m_SegmentationFunction->GetCurvatureWeight()) 00312 { 00313 m_SegmentationFunction->SetCurvatureWeight(v); 00314 } 00315 } 00316 ValueType GetCurvatureScaling() const 00317 { 00318 return m_SegmentationFunction->GetCurvatureWeight(); 00319 } 00320 00323 virtual void SetSegmentationFunction(SegmentationFunctionType *s); 00324 virtual SegmentationFunctionType *GetSegmentationFunction() 00325 { return m_SegmentationFunction; } 00326 00327 protected: 00328 virtual ~NarrowBandLevelSetImageFilter() {} 00329 NarrowBandLevelSetImageFilter(); 00330 NarrowBandLevelSetImageFilter(const Self &); //purposely not implemented 00331 00332 virtual void PrintSelf(std::ostream& os, Indent indent) const; 00333 void operator=(const Self&); //purposely not implemented 00334 00336 virtual void InitializeIteration() 00337 { 00338 Superclass::InitializeIteration(); 00339 // Estimate the progress of the filter 00340 this->SetProgress( (float) ((float)this->GetElapsedIterations() 00341 / (float)this->GetMaximumIterations()) ); 00342 } 00343 00347 virtual void CreateNarrowBand (); 00348 00351 void GenerateData(); 00352 00355 bool Halt(); 00356 00359 bool m_ReverseExpansionDirection; 00360 00363 typedef IsoContourDistanceImageFilter<OutputImageType,OutputImageType> 00364 IsoFilterType; 00365 typedef FastChamferDistanceImageFilter<OutputImageType,OutputImageType> 00366 ChamferFilterType; 00367 00368 typename IsoFilterType::Pointer m_IsoFilter; 00369 typename ChamferFilterType::Pointer m_ChamferFilter; 00370 00371 private: 00372 unsigned int m_MaximumIterations; 00373 SegmentationFunctionType *m_SegmentationFunction; 00374 ValueType m_MaximumRMSError; 00375 }; 00376 00377 } // end namespace itk 00378 00379 #ifndef ITK_MANUAL_INSTANTIATION 00380 #include "itkNarrowBandLevelSetImageFilter.txx" 00381 #endif 00382 00383 #endif 00384

Generated at Sat Mar 31 02:25:19 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000