ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMinMaxCurvatureFlowFunction.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 __itkMinMaxCurvatureFlowFunction_h
00019 #define __itkMinMaxCurvatureFlowFunction_h
00020 
00021 #include "itkCurvatureFlowFunction.h"
00022 #include "itkNeighborhoodOperator.h"
00023 
00024 namespace itk
00025 {
00041 template< class TImage >
00042 class ITK_EXPORT MinMaxCurvatureFlowFunction:
00043   public CurvatureFlowFunction< TImage >
00044 {
00045 public:
00047   typedef MinMaxCurvatureFlowFunction     Self;
00048   typedef CurvatureFlowFunction< TImage > Superclass;
00049   typedef SmartPointer< Self >            Pointer;
00050   typedef SmartPointer< const Self >      ConstPointer;
00051 
00053   itkNewMacro(Self);
00054 
00056   itkTypeMacro(MinMaxCurvatureFlowFunction,
00057                CurvatureFlowFunction);
00058 
00060   typedef typename Superclass::ImageType        ImageType;
00061   typedef typename Superclass::PixelType        PixelType;
00062   typedef typename Superclass::RadiusType       RadiusType;
00063   typedef typename Superclass::NeighborhoodType NeighborhoodType;
00064   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00065 
00067   itkStaticConstMacro(ImageDimension, unsigned int,
00068                       Superclass::ImageDimension);
00069 
00071   typedef typename RadiusType::SizeValueType RadiusValueType;
00072 
00074   void SetStencilRadius(const RadiusValueType radius);
00075 
00076   const RadiusValueType & GetRadiusValueType() const
00077   { return m_StencilRadius; }
00078 
00081   virtual PixelType ComputeUpdate(const NeighborhoodType & neighborhood,
00082                                   void *globalData,
00083                                   const FloatOffsetType & offset = FloatOffsetType(0.0)
00084                                   );
00085 
00086 protected:
00087   MinMaxCurvatureFlowFunction();
00088   ~MinMaxCurvatureFlowFunction() {}
00089 
00090   typedef Neighborhood< PixelType, itkGetStaticConstMacro(ImageDimension) > StencilOperatorType;
00091   StencilOperatorType m_StencilOperator;
00092 
00095   void InitializeStencilOperator();
00096 
00097 private:
00098   MinMaxCurvatureFlowFunction(const Self &); //purposely not implemented
00099   void operator=(const Self &);              //purposely not implemented
00100 
00101   RadiusValueType m_StencilRadius;
00102 
00103   // To control overloaded versions of ComputeThreshold
00104   struct DispatchBase {};
00105   template< signed int VDimension >
00106   struct Dispatch: public DispatchBase {};
00107 
00110   virtual PixelType ComputeThreshold(const Dispatch< 2 > &,
00111                                      const NeighborhoodType & neighborhood) const;
00112 
00113   virtual PixelType ComputeThreshold(const Dispatch< 3 > &,
00114                                      const NeighborhoodType & neighborhood) const;
00115 
00116   virtual PixelType ComputeThreshold(const DispatchBase &,
00117                                      const NeighborhoodType & neighborhood) const;
00118 };
00119 } // end namespace itk
00120 
00121 #ifndef ITK_MANUAL_INSTANTIATION
00122 #include "itkMinMaxCurvatureFlowFunction.hxx"
00123 #endif
00124 
00125 #endif
00126