ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLevelSetFunctionWithRefitTerm.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 __itkLevelSetFunctionWithRefitTerm_h
00019 #define __itkLevelSetFunctionWithRefitTerm_h
00020 
00021 #include "itkLevelSetFunction.h"
00022 #include "itkSparseImage.h"
00023 #include "itkNumericTraits.h"
00024 
00025 namespace itk
00026 {
00051 template< class TImageType, class TSparseImageType >
00052 class ITK_EXPORT LevelSetFunctionWithRefitTerm:
00053   public LevelSetFunction< TImageType >
00054 {
00055 public:
00056 
00058   typedef LevelSetFunctionWithRefitTerm  Self;
00059   typedef LevelSetFunction< TImageType > Superclass;
00060   typedef SmartPointer< Self >           Pointer;
00061   typedef SmartPointer< const Self >     ConstPointer;
00062 
00064   itkTypeMacro(LevelSetFunctionWithRefitTerm, LevelSetFunction);
00065 
00067   itkNewMacro (Self);
00068 
00070   typedef typename Superclass::ImageType              ImageType;
00071   typedef typename Superclass::FloatOffsetType        FloatOffsetType;
00072   typedef typename Superclass::ScalarValueType        ScalarValueType;
00073   typedef typename Superclass::GlobalDataStruct       GlobalDataStruct;
00074   typedef typename Superclass::NeighborhoodType       NeighborhoodType;
00075   typedef typename Superclass::NeighborhoodScalesType NeighborhoodScalesType;
00076   typedef typename Superclass::TimeStepType           TimeStepType;
00077 
00078   typedef typename NeighborhoodType::SizeValueType    NeighborhoodSizeValueType;
00079 
00081   typedef typename ImageType::IndexType IndexType;
00082 
00084   typedef TSparseImageType SparseImageType;
00085 
00087   typedef typename SparseImageType::NodeType NodeType;
00088 
00090   typedef typename NodeType::NodeDataType NormalVectorType;
00091 
00093   void SetRefitWeight(const ScalarValueType w)
00094   {
00095     m_RefitWeight = w;
00096   }
00097 
00100   void SetOtherPropagationWeight(const ScalarValueType w)
00101   {
00102     m_OtherPropagationWeight = w;
00103   }
00104 
00107   void SetSparseTargetImage(SparseImageType *im)
00108   { m_SparseTargetImage = im; }
00109 
00111   SparseImageType * GetSparseTargetImage() const
00112   { return m_SparseTargetImage; }
00113 
00118   virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const;
00119 
00120 protected:
00122   ScalarValueType m_RefitWeight;
00123 
00126   ScalarValueType m_OtherPropagationWeight;
00127 
00128   LevelSetFunctionWithRefitTerm ();
00129   void PrintSelf(std::ostream & os, Indent indent) const;
00130 
00133   ScalarValueType ComputeCurvature(const NeighborhoodType &) const;
00134 
00138   virtual ScalarValueType PropagationSpeed(const NeighborhoodType &,
00139                                            const FloatOffsetType &,
00140                                            GlobalDataStruct * = 0) const;
00141 
00145   virtual ScalarValueType OtherPropagationSpeed(const NeighborhoodType &,
00146                                                 const FloatOffsetType &,
00147                                                 GlobalDataStruct * = 0) const
00148   {
00149     return NumericTraits< ScalarValueType >::Zero;
00150   }
00151 
00152 private:
00153   LevelSetFunctionWithRefitTerm(const Self &); //purposely not implemented
00154   void operator=(const Self &);                //purposely not implemented
00155 
00157   typename SparseImageType::Pointer m_SparseTargetImage;
00158 
00160   ScalarValueType m_MinVectorNorm;
00161 
00163   static const NeighborhoodSizeValueType    m_NumVertex;
00164   static const ScalarValueType              m_DimConst;
00165 };
00166 } // end namespace itk
00167 
00168 #ifndef ITK_MANUAL_INSTANTIATION
00169 #include "itkLevelSetFunctionWithRefitTerm.hxx"
00170 #endif
00171 
00172 #endif
00173