ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkLevelSetEquationCurvatureTerm.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 
00019 #ifndef __itkLevelSetEquationCurvatureTerm_h
00020 #define __itkLevelSetEquationCurvatureTerm_h
00021 
00022 #include "itkLevelSetEquationTermBase.h"
00023 #include "itkZeroFluxNeumannBoundaryCondition.h"
00024 #include "itkConstNeighborhoodIterator.h"
00025 #include "itkVector.h"
00026 #include "vnl/vnl_matrix_fixed.h"
00027 
00028 namespace itk
00029 {
00046 template< class TInput, // Input image or mesh
00047           class TLevelSetContainer,
00048           class TCurvatureImage = TInput >
00049 class LevelSetEquationCurvatureTerm :
00050     public LevelSetEquationTermBase< TInput, TLevelSetContainer >
00051 {
00052 public:
00053   typedef LevelSetEquationCurvatureTerm         Self;
00054   typedef SmartPointer< Self >                  Pointer;
00055   typedef SmartPointer< const Self >            ConstPointer;
00056   typedef LevelSetEquationTermBase< TInput, TLevelSetContainer >
00057                                                 Superclass;
00059 
00061   itkNewMacro( Self );
00062 
00064   itkTypeMacro( LevelSetEquationCurvatureTerm,
00065                 LevelSetEquationTermBase );
00066 
00067   typedef typename Superclass::InputImageType     InputImageType;
00068   typedef typename Superclass::InputImagePointer  InputImagePointer;
00069   typedef typename Superclass::InputPixelType     InputPixelType;
00070   typedef typename Superclass::InputPixelRealType InputPixelRealType;
00071 
00072   typedef typename Superclass::LevelSetContainerType      LevelSetContainerType;
00073   typedef typename Superclass::LevelSetContainerPointer   LevelSetContainerPointer;
00074   typedef typename Superclass::LevelSetType               LevelSetType;
00075   typedef typename Superclass::LevelSetPointer            LevelSetPointer;
00076   typedef typename Superclass::LevelSetOutputPixelType    LevelSetOutputPixelType;
00077   typedef typename Superclass::LevelSetOutputRealType     LevelSetOutputRealType;
00078   typedef typename Superclass::LevelSetInputIndexType     LevelSetInputIndexType;
00079   typedef typename Superclass::LevelSetGradientType       LevelSetGradientType;
00080   typedef typename Superclass::LevelSetHessianType        LevelSetHessianType;
00081   typedef typename Superclass::LevelSetIdentifierType     LevelSetIdentifierType;
00082 
00083   typedef typename Superclass::HeavisideType         HeavisideType;
00084   typedef typename Superclass::HeavisideConstPointer HeavisideConstPointer;
00085 
00086   typedef typename Superclass::LevelSetDataType LevelSetDataType;
00087 
00088   itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
00089 
00090   typedef TCurvatureImage                       CurvatureImageType;
00091   typedef typename CurvatureImageType::Pointer  CurvatureImagePointer;
00092 
00096   void SetCurvatureImage( CurvatureImageType* CurvatureImage );
00097   itkGetObjectMacro( CurvatureImage, CurvatureImageType );
00099 
00100   itkSetMacro( UseCurvatureImage, bool );
00101   itkGetMacro( UseCurvatureImage, bool );
00102   itkBooleanMacro( UseCurvatureImage );
00103 
00105   typedef ZeroFluxNeumannBoundaryCondition< InputImageType > DefaultBoundaryConditionType;
00106   typedef typename ConstNeighborhoodIterator< InputImageType >::RadiusType RadiusType;
00107   typedef ConstNeighborhoodIterator< InputImageType, DefaultBoundaryConditionType > NeighborhoodType;
00108 
00109   typedef Vector< LevelSetOutputRealType, itkGetStaticConstMacro(ImageDimension) > NeighborhoodScalesType;
00110 
00112   virtual void Update();
00113 
00115   virtual void InitializeParameters();
00116 
00118   virtual void Initialize( const LevelSetInputIndexType& );
00119 
00121   virtual void UpdatePixel( const LevelSetInputIndexType& iP,
00122                             const LevelSetOutputRealType& oldValue,
00123                             const LevelSetOutputRealType& newValue );
00124 
00125 protected:
00126   LevelSetEquationCurvatureTerm();
00127 
00128   virtual ~LevelSetEquationCurvatureTerm();
00129 
00132   virtual LevelSetOutputRealType Value( const LevelSetInputIndexType& iP );
00133 
00136   virtual LevelSetOutputRealType Value( const LevelSetInputIndexType& iP, const LevelSetDataType& iData );
00137 
00138   LevelSetOutputRealType  m_NeighborhoodScales[ImageDimension];
00139 
00140   CurvatureImagePointer m_CurvatureImage;
00141 
00142   bool m_UseCurvatureImage;
00143 
00144 private:
00145   LevelSetEquationCurvatureTerm( const Self& ); // purposely not implemented
00146   void operator = ( const Self& ); // purposely not implemented
00147 };
00148 
00149 }
00150 
00151 #ifndef ITK_MANUAL_INSTANTIATION
00152 #include "itkLevelSetEquationCurvatureTerm.hxx"
00153 #endif
00154 
00155 #endif
00156