ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkGeodesicActiveContourLevelSetFunction.h
Go to the documentation of this file.
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 __itkGeodesicActiveContourLevelSetFunction_h
00019 #define __itkGeodesicActiveContourLevelSetFunction_h
00020 
00021 #include "itkSegmentationLevelSetFunction.h"
00022 
00023 namespace itk
00024 {
00076 template< class TImageType, class TFeatureImageType = TImageType >
00077 class ITK_EXPORT GeodesicActiveContourLevelSetFunction:
00078   public SegmentationLevelSetFunction< TImageType, TFeatureImageType >
00079 {
00080 public:
00082   typedef GeodesicActiveContourLevelSetFunction Self;
00083   typedef SegmentationLevelSetFunction< TImageType, TFeatureImageType >
00084   Superclass;
00085   typedef SmartPointer< Self >       Pointer;
00086   typedef SmartPointer< const Self > ConstPointer;
00087   typedef TFeatureImageType          FeatureImageType;
00088 
00090   itkNewMacro(Self);
00091 
00093   itkTypeMacro(GeodesicActiveContourLevelSetFunction, SegmentationLevelSetFunction);
00094 
00096   typedef typename Superclass::ImageType         ImageType;
00097   typedef typename Superclass::NeighborhoodType  NeighborhoodType;
00098   typedef typename Superclass::ScalarValueType   ScalarValueType;
00099   typedef typename Superclass::FeatureScalarType FeatureScalarType;
00100   typedef typename Superclass::RadiusType        RadiusType;
00101   typedef typename Superclass::FloatOffsetType   FloatOffsetType;
00102   typedef typename Superclass::VectorImageType   VectorImageType;
00103   typedef typename Superclass::GlobalDataStruct  GlobalDataStruct;
00104 
00106   itkStaticConstMacro(ImageDimension, unsigned int,
00107                       Superclass::ImageDimension);
00108 
00110   virtual void CalculateSpeedImage();
00111 
00113   virtual void CalculateAdvectionImage();
00114 
00116   virtual ScalarValueType CurvatureSpeed(const NeighborhoodType & neighborhood,
00117                                          const FloatOffsetType & offset, GlobalDataStruct *gd) const
00118   {
00119     return this->PropagationSpeed(neighborhood, offset, gd);
00120   }
00121 
00124   void SetDerivativeSigma(const double v)
00125   { m_DerivativeSigma = v; }
00126   double GetDerivativeSigma()
00127   { return m_DerivativeSigma; }
00129 
00130   virtual void Initialize(const RadiusType & r)
00131   {
00132     Superclass::Initialize(r);
00133 
00134     this->SetAdvectionWeight(NumericTraits< ScalarValueType >::One);
00135     this->SetPropagationWeight(NumericTraits< ScalarValueType >::One);
00136     this->SetCurvatureWeight(NumericTraits< ScalarValueType >::One);
00137   }
00138 
00139 protected:
00140   GeodesicActiveContourLevelSetFunction()
00141   {
00142     this->SetAdvectionWeight(NumericTraits< ScalarValueType >::One);
00143     this->SetPropagationWeight(NumericTraits< ScalarValueType >::One);
00144     this->SetCurvatureWeight(NumericTraits< ScalarValueType >::One);
00145 
00146     m_DerivativeSigma = 1.0;
00147   }
00148 
00149   virtual ~GeodesicActiveContourLevelSetFunction() {}
00150 
00151   GeodesicActiveContourLevelSetFunction(const Self &); //purposely not
00152                                                        // implemented
00153   void operator=(const Self &);                        //purposely not
00154                                                        // implemented
00155 
00156   void PrintSelf(std::ostream & os, Indent indent) const
00157   {
00158     Superclass::PrintSelf(os, indent);
00159     os << indent << "DerivativeSigma: " << m_DerivativeSigma << std::endl;
00160   }
00161 
00162 private:
00163   double m_DerivativeSigma;
00164 };
00165 } // end namespace itk
00166 
00167 #ifndef ITK_MANUAL_INSTANTIATION
00168 #include "itkGeodesicActiveContourLevelSetFunction.hxx"
00169 #endif
00170 
00171 #endif
00172