ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCurvatureFlowFunction.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 __itkCurvatureFlowFunction_h
00019 #define __itkCurvatureFlowFunction_h
00020 
00021 #include "itkFiniteDifferenceFunction.h"
00022 #include "itkMacro.h"
00023 
00024 namespace itk
00025 {
00042 template< class TImage >
00043 class ITK_EXPORT CurvatureFlowFunction:
00044   public FiniteDifferenceFunction< TImage >
00045 {
00046 public:
00048   typedef CurvatureFlowFunction              Self;
00049   typedef FiniteDifferenceFunction< TImage > Superclass;
00050   typedef SmartPointer< Self >               Pointer;
00051   typedef SmartPointer< const Self >         ConstPointer;
00052 
00054   itkNewMacro(Self);
00055 
00057   itkTypeMacro(CurvatureFlowFunction,
00058                FiniteDifferenceFunction);
00059 
00061   typedef typename Superclass::ImageType              ImageType;
00062   typedef typename Superclass::PixelType              PixelType;
00063   typedef typename Superclass::RadiusType             RadiusType;
00064   typedef PixelType                                   ScalarValueType;
00065   typedef typename Superclass::PixelRealType          PixelRealType;
00066   typedef typename Superclass::NeighborhoodType       NeighborhoodType;
00067   typedef typename Superclass::NeighborhoodScalesType NeighborhoodScalesType;
00068   typedef typename Superclass::FloatOffsetType        FloatOffsetType;
00069   typedef typename Superclass::TimeStepType           TimeStepType;
00070 
00072   itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
00073 
00084   virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const;
00085 
00091   virtual void * GetGlobalDataPointer() const
00092   {
00093     GlobalDataStruct *ans = new GlobalDataStruct();
00094 
00095     ans->m_MaxChange   = NumericTraits< ScalarValueType >::Zero;
00096     return ans;
00097   }
00098 
00103   virtual void ReleaseGlobalDataPointer(void *GlobalData) const
00104   { delete (GlobalDataStruct *)GlobalData; }
00105 
00107   void SetTimeStep(const TimeStepType & t)
00108   { m_TimeStep = t; }
00109 
00111   const TimeStepType & GetTimeStep() const
00112   { return m_TimeStep; }
00113 
00116   virtual PixelType ComputeUpdate(const NeighborhoodType & neighborhood,
00117                                   void *globalData,
00118                                   const FloatOffsetType & offset = FloatOffsetType(0.0)
00119                                   );
00120 
00121 protected:
00122 
00127   struct GlobalDataStruct {
00128     GlobalDataStruct()
00129     {
00130       m_MaxChange = NumericTraits< ScalarValueType >::Zero;
00131     }
00132 
00133     ~GlobalDataStruct() {}
00134 
00135     ScalarValueType m_MaxChange;
00136   };
00138 
00139   CurvatureFlowFunction();
00140   ~CurvatureFlowFunction() {}
00141 private:
00142   CurvatureFlowFunction(const Self &); //purposely not implemented
00143   void operator=(const Self &);        //purposely not implemented
00144 
00145   TimeStepType m_TimeStep;
00146 };
00147 } // end namespace itk
00148 
00149 #ifndef ITK_MANUAL_INSTANTIATION
00150 #include "itkCurvatureFlowFunction.hxx"
00151 #endif
00152 
00153 #endif
00154