Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkNormalVectorDiffusionFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkNormalVectorDiffusionFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/09/10 14:28:53 $
00007   Version:   $Revision: 1.5 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016      =========================================================================*/
00017 #ifndef __itkNormalVectorDiffusionFunction_h_
00018 #define __itkNormalVectorDiffusionFunction_h_
00019 
00020 #include "itkNormalVectorFunctionBase.h"
00021 #include "itkNumericTraits.h"
00022 #include <math.h>
00023 
00024 namespace itk {
00025 
00057 template <class TSparseImageType>
00058 class ITK_EXPORT NormalVectorDiffusionFunction 
00059   :public NormalVectorFunctionBase <TSparseImageType>
00060 {
00061 public:
00063   typedef NormalVectorDiffusionFunction Self;
00064   typedef NormalVectorFunctionBase <TSparseImageType> Superclass;
00065   typedef SmartPointer<Self> Pointer;
00066   typedef SmartPointer<const Self> ConstPointer;
00067 
00069   itkTypeMacro( NormalVectorDiffusionFunction, NormalVectorFunctionBase);
00070    
00072   itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
00073 
00075   itkNewMacro(Self);
00076 
00078   typedef typename Superclass::TimeStepType     TimeStepType;
00079   typedef typename Superclass::RadiusType       RadiusType;
00080   typedef typename Superclass::NeighborhoodType NeighborhoodType;
00081   typedef typename Superclass::FloatOffsetType  FloatOffsetType;
00082   typedef typename Superclass::IndexType        IndexType;
00083   typedef typename Superclass::SparseImageType  SparseImageType;
00084   typedef typename Superclass::NodeType         NodeType;
00085   typedef typename Superclass::NodeValueType    NodeValueType;
00086   typedef typename Superclass::NormalVectorType NormalVectorType;
00087 
00092   void SetNormalProcessType( int npt )
00093   { m_NormalProcessType = npt; }
00094 
00096   int GetNormalProcessType() const 
00097   { return m_NormalProcessType; }
00098 
00104   void SetConductanceParameter( NodeValueType cp )
00105   {
00106     m_ConductanceParameter = cp + static_cast<NodeValueType> (0.001);
00107     // we add a minimum conductance to avoid divide by zero
00108     // can make this a parameter.
00109     m_FluxStopConstant = static_cast<NodeValueType>
00110       (-1.0/(m_ConductanceParameter*m_ConductanceParameter));
00111   }
00112 
00114   NodeValueType GetConductanceParameter() const
00115   { return m_ConductanceParameter; }
00116 
00118   NodeValueType GetFluxStopConstant() const
00119   { return m_FluxStopConstant; }
00120   
00125   virtual void PrecomputeSparseUpdate( NeighborhoodType &it ) const;
00126 
00128   virtual NormalVectorType ComputeSparseUpdate (NeighborhoodType &neighborhood,
00129                                                 void *globalData,
00130                                                 const FloatOffsetType &offset) const;
00131   
00132 private:
00134   NodeValueType m_ConductanceParameter;
00135 
00138   NodeValueType m_FluxStopConstant;
00139 
00140 protected:
00141   NormalVectorDiffusionFunction();
00142   ~NormalVectorDiffusionFunction() {}
00143   void PrintSelf(std::ostream& os, Indent indent) const;
00144 
00147   NodeValueType FluxStopFunction( const NodeValueType v ) const
00148   {
00149     // the slow ::exp function could be replaced with a lookup table
00150     if (v<=0.0) return NumericTraits<NodeValueType>::One;
00151     else return static_cast<NodeValueType>(::exp(m_FluxStopConstant*v));
00152   }
00153   
00154 private:
00156   int m_NormalProcessType; 
00157 
00158   NormalVectorDiffusionFunction(const Self&); //purposely not implemented
00159   void operator=(const Self&);                //purposely not implemented
00160 };
00161 
00162 } // end namespace itk
00163 
00164 #ifndef ITK_MANUAL_INSTANTIATION
00165 #include "itkNormalVectorDiffusionFunction.txx"
00166 #endif
00167 
00168 #endif

Generated at Wed May 24 23:47:41 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000