ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCurvesLevelSetFunction.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 __itkCurvesLevelSetFunction_h
00019 #define __itkCurvesLevelSetFunction_h
00020 
00021 #include "itkSegmentationLevelSetFunction.h"
00022 
00023 namespace itk
00024 {
00061 template< class TImageType, class TFeatureImageType = TImageType >
00062 class ITK_EXPORT CurvesLevelSetFunction:
00063   public SegmentationLevelSetFunction< TImageType, TFeatureImageType >
00064 {
00065 public:
00067   typedef CurvesLevelSetFunction                     Self;
00068   typedef SegmentationLevelSetFunction< TImageType > Superclass;
00069   typedef LevelSetFunction< TImageType >             SuperSuperclass;
00070   typedef SmartPointer< Self >                       Pointer;
00071   typedef SmartPointer< const Self >                 ConstPointer;
00072   typedef TFeatureImageType                          FeatureImageType;
00073 
00075   itkNewMacro(Self);
00076 
00078   itkTypeMacro(CurvesLevelSetFunction, SegmentationLevelSetFunction);
00079 
00081   typedef typename SuperSuperclass::PixelType        PixelType;
00082   typedef typename Superclass::ImageType             ImageType;
00083   typedef typename Superclass::NeighborhoodType      NeighborhoodType;
00084   typedef typename Superclass::ScalarValueType       ScalarValueType;
00085   typedef typename Superclass::FeatureScalarType     FeatureScalarType;
00086   typedef typename Superclass::RadiusType            RadiusType;
00087   typedef typename SuperSuperclass::FloatOffsetType  FloatOffsetType;
00088   typedef typename SuperSuperclass::GlobalDataStruct GlobalDataStruct;
00089   typedef typename Superclass::VectorImageType       VectorImageType;
00090 
00092   itkStaticConstMacro(ImageDimension, unsigned int,
00093                       Superclass::ImageDimension);
00094 
00096   virtual void CalculateSpeedImage();
00097 
00099   virtual void CalculateAdvectionImage();
00100 
00102   virtual ScalarValueType CurvatureSpeed(const NeighborhoodType & neighborhood,
00103                                          const FloatOffsetType & offset, GlobalDataStruct *gd) const
00104   { return this->PropagationSpeed(neighborhood, offset, gd); }
00105 
00108   void SetDerivativeSigma(const double v)
00109   { m_DerivativeSigma = v; }
00110   double GetDerivativeSigma()
00111   { return m_DerivativeSigma; }
00113 
00114   virtual void Initialize(const RadiusType & r);
00115 
00116 protected:
00117   CurvesLevelSetFunction()
00118   {
00119     //Curvature term is the minimal curvature.
00120     this->UseMinimalCurvatureOn();
00121     this->SetAdvectionWeight(NumericTraits< ScalarValueType >::One);
00122     this->SetPropagationWeight(NumericTraits< ScalarValueType >::One);
00123     this->SetCurvatureWeight(NumericTraits< ScalarValueType >::One);
00124 
00125     m_DerivativeSigma = 1.0;
00126   }
00127 
00128   virtual ~CurvesLevelSetFunction() {}
00129 
00130   CurvesLevelSetFunction(const Self &); //purposely not implemented
00131   void operator=(const Self &);         //purposely not implemented
00132 
00133   void PrintSelf(std::ostream & os, Indent indent) const
00134   {
00135     Superclass::PrintSelf(os, indent);
00136     os << indent << "DerivativeSigma: " << m_DerivativeSigma << std::endl;
00137   }
00138 
00139 private:
00140 
00142   std::slice x_slice[ImageDimension];
00143 
00145   OffsetValueType m_Center;
00146 
00148   OffsetValueType m_xStride[ImageDimension];
00149 
00150   double m_DerivativeSigma;
00151 };
00152 } // end namespace itk
00153 
00154 #ifndef ITK_MANUAL_INSTANTIATION
00155 #include "itkCurvesLevelSetFunction.hxx"
00156 #endif
00157 
00158 #endif
00159