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: 2009-01-26 21:45:53 $
00007   Version:   $Revision: 1.11 $
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:
00148 
00150   typedef NarrowBandLevelSetImageFilter                        Self;
00151   typedef NarrowBandImageFilterBase<TInputImage, TOutputImage> Superclass;
00152   typedef SmartPointer<Self>                                   Pointer;
00153   typedef SmartPointer<const Self>                             ConstPointer;
00154 
00156   typedef typename Superclass::ValueType       ValueType;
00157   typedef typename Superclass::IndexType       IndexType;
00158   typedef typename Superclass::TimeStepType    TimeStepType;
00159   typedef typename Superclass::InputImageType  InputImageType;
00160 
00162   typedef TOutputImage   OutputImageType;
00163   typedef TFeatureImage  FeatureImageType;
00164 
00166   typedef SegmentationLevelSetFunction <OutputImageType, FeatureImageType>
00167   SegmentationFunctionType;
00168 
00170   typedef typename SegmentationFunctionType::VectorImageType VectorImageType;
00171 
00173   itkTypeMacro(NarrowBandLevelSetImageFilter, NarrowBandImageFilterBase);
00174 
00177   virtual void SetFeatureImage(const FeatureImageType *f)
00178     {
00179     this->ProcessObject::SetNthInput( 1, const_cast< FeatureImageType * >(f) );
00180     m_SegmentationFunction->SetFeatureImage(f);
00181     }
00182   virtual FeatureImageType * GetFeatureImage()
00183     {
00184     return ( static_cast< FeatureImageType *>(this->ProcessObject::GetInput(1)) );
00185     }
00187 
00190   virtual void SetInitialImage(InputImageType *f)
00191     {
00192     this->SetInput(f);
00193     }
00194 
00195   virtual const typename SegmentationFunctionType::ImageType *GetSpeedImage() const
00196   { return m_SegmentationFunction->GetSpeedImage(); }
00197 
00198   virtual const typename SegmentationFunctionType::VectorImageType *GetAdvectionImage() const
00199   { return m_SegmentationFunction->GetAdvectionImage(); }
00200 
00204   void SetUseNegativeFeaturesOn()
00205     {
00206     itkWarningMacro( << "SetUseNegativeFeaturesOn has been deprecated.  Please use ReverseExpansionDirectionOn() instead" );
00207     this->ReverseExpansionDirectionOn();
00208     }
00209   void SetUseNegativeFeaturesOff()
00210     {
00211     itkWarningMacro( << "SetUseNegativeFeaturesOff has been deprecated.  Please use ReverseExpansionDirectionOff() instead" );
00212     this->ReverseExpansionDirectionOff();
00213     }
00215 
00218   void SetUseNegativeFeatures( bool u )
00219     {
00220     itkWarningMacro( << "SetUseNegativeFeatures has been deprecated.  Please use SetReverseExpansionDirection instead" );
00221     if (u == true)
00222       {
00223       this->SetReverseExpansionDirection(false);
00224       }
00225     else
00226       {
00227       this->SetReverseExpansionDirection(true);
00228       }
00229     }
00230   bool GetUseNegativeFeatures() const
00231     {
00232     itkWarningMacro( << "GetUseNegativeFeatures has been deprecated.  Please use GetReverseExpansionDirection() instead" );
00233     if ( this->GetReverseExpansionDirection() == false)
00234       {
00235       return true;
00236       }
00237     else
00238       {
00239       return false;
00240       }
00241     }
00243 
00252   itkSetMacro(ReverseExpansionDirection, bool);
00253   itkGetConstMacro(ReverseExpansionDirection, bool);
00254   itkBooleanMacro(ReverseExpansionDirection);
00256 
00261   void SetFeatureScaling(ValueType v)
00262     {
00263     if (v != m_SegmentationFunction->GetPropagationWeight())
00264       {
00265       this->SetPropagationScaling(v);
00266       }
00267     if (v != m_SegmentationFunction->GetAdvectionWeight())
00268       {
00269       this->SetAdvectionScaling(v);
00270       }
00271     }
00273 
00276   void SetPropagationScaling(ValueType v)
00277     {
00278     if (v != m_SegmentationFunction->GetPropagationWeight())
00279       {
00280       m_SegmentationFunction->SetPropagationWeight(v);
00281       }
00282     }
00283   ValueType GetPropagationScaling() const
00284     {
00285     return m_SegmentationFunction->GetPropagationWeight();
00286     }
00288 
00291   void SetAdvectionScaling(ValueType v)
00292     {
00293     if (v != m_SegmentationFunction->GetAdvectionWeight())
00294       {
00295       m_SegmentationFunction->SetAdvectionWeight(v);
00296       }
00297     }
00298   ValueType GetAdvectionScaling() const
00299     {
00300     return m_SegmentationFunction->GetAdvectionWeight();
00301     }
00303 
00308   void SetCurvatureScaling(ValueType v)
00309     {
00310     if (v != m_SegmentationFunction->GetCurvatureWeight())
00311       {
00312       m_SegmentationFunction->SetCurvatureWeight(v);
00313       }
00314     }
00315   ValueType GetCurvatureScaling() const
00316     {
00317     return m_SegmentationFunction->GetCurvatureWeight();
00318     }
00320 
00323   virtual void SetSegmentationFunction(SegmentationFunctionType *s);
00324   virtual SegmentationFunctionType *GetSegmentationFunction()
00325     { return m_SegmentationFunction; }
00327 
00330   void SetMaximumIterations (unsigned int i)
00331     {
00332     itkWarningMacro("SetMaximumIterations is deprecated.  Please use SetNumberOfIterations instead.");
00333     this->SetNumberOfIterations(i);
00334     }
00335   unsigned int GetMaximumIterations()
00336     {
00337     itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
00338     return this->GetNumberOfIterations();
00339     }
00341 
00342   virtual void SetMaximumRMSError(const double)
00343     {
00344     itkWarningMacro("The current implmentation of this solver does not compute maximum RMS change. The maximum RMS error value will not be set or used.");
00345     }
00346 
00347 #ifdef ITK_USE_CONCEPT_CHECKING
00348 
00349   itkConceptMacro(OutputHasNumericTraitsCheck,
00350     (Concept::HasNumericTraits<typename TOutputImage::PixelType>));
00351 
00353 #endif
00354 
00355 protected:
00356   virtual ~NarrowBandLevelSetImageFilter() {}
00357   NarrowBandLevelSetImageFilter();
00358   NarrowBandLevelSetImageFilter(const Self &); //purposely not implemented
00359 
00360   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00361   void operator=(const Self&); //purposely not implemented
00362   
00364   virtual void InitializeIteration()
00365     {
00366     Superclass::InitializeIteration();
00367     // Estimate the progress of the filter
00368     this->SetProgress( (float) ((float)this->GetElapsedIterations()
00369                                 / (float)this->GetNumberOfIterations()) );
00370     }
00372 
00376   virtual void CreateNarrowBand ();
00377 
00380   void GenerateData();
00381 
00384   bool m_ReverseExpansionDirection;
00385 
00389   typedef IsoContourDistanceImageFilter<OutputImageType,OutputImageType>
00390           IsoFilterType;
00391   typedef FastChamferDistanceImageFilter<OutputImageType,OutputImageType>
00392           ChamferFilterType; 
00393 
00394   typename IsoFilterType::Pointer     m_IsoFilter;
00395   typename ChamferFilterType::Pointer m_ChamferFilter;
00396 
00397 private:
00398   SegmentationFunctionType *m_SegmentationFunction;
00399 };
00400 
00401 } // end namespace itk
00402 
00403 #ifndef ITK_MANUAL_INSTANTIATION
00404 #include "itkNarrowBandLevelSetImageFilter.txx"
00405 #endif
00406 
00407 #endif
00408 

Generated at Tue Sep 15 04:07:03 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000