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

itkRegionBasedLevelSetFunctionData.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkRegionBasedLevelSetFunctionData.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-06-08 04:36:32 $
00007   Version:   $Revision: 1.2 $
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 __itkRegionBasedLevelSetFunctionData_h
00018 #define __itkRegionBasedLevelSetFunctionData_h
00019 
00020 #include "itkLightObject.h"
00021 
00022 #include "itkVector.h"
00023 #include "itkListSample.h"
00024 #include "itkKdTree.h"
00025 #include "itkKdTreeGenerator.h"
00026 
00027 #include "itkImageRegionIterator.h"
00028 #include "itkImageRegionIteratorWithIndex.h"
00029 
00030 namespace itk
00031 {
00032 
00067 template < class TInputImage, class TFeatureImage >
00068 class RegionBasedLevelSetFunctionData : public LightObject
00069 {
00070 public:
00071 
00072   typedef RegionBasedLevelSetFunctionData                   Self;
00073   typedef LightObject                                       Superclass;
00074   typedef SmartPointer<Self>                                Pointer;
00075   typedef SmartPointer<const Self>                          ConstPointer;
00076 
00077   itkStaticConstMacro( ImageDimension, unsigned int, TFeatureImage::ImageDimension );
00078 
00080   itkNewMacro( Self );
00081 
00082   itkTypeMacro(RegionBasedLevelSetFunctionData, LightObject);
00083 
00084   typedef TInputImage                                   InputImageType;
00085   typedef typename InputImageType::Pointer              InputImagePointer;
00086   typedef typename InputImageType::ConstPointer         InputImageConstPointer;
00087   typedef typename InputImageType::PixelType            InputPixelType;
00088   typedef typename InputImageType::RegionType           InputRegionType;
00089   typedef typename InputImageType::SizeType             InputSizeType;
00090   typedef typename InputSizeType::SizeValueType         InputSizeValueType;
00091   typedef typename InputImageType::SpacingType          InputSpacingType;
00092   typedef typename InputImageType::IndexType            InputIndexType;
00093   typedef typename InputIndexType::IndexValueType       InputIndexValueType;
00094   typedef typename InputImageType::PointType            InputPointType;
00095 
00096   typedef TFeatureImage                                 FeatureImageType;
00097   typedef typename FeatureImageType::Pointer            FeatureImagePointer;
00098   typedef typename FeatureImageType::ConstPointer       FeatureImageConstPointer;
00099   typedef typename FeatureImageType::PixelType          FeaturePixelType;
00100   typedef typename FeatureImageType::RegionType         FeatureRegionType;
00101   typedef typename FeatureImageType::SizeType           FeatureSizeType;
00102   typedef typename FeatureSizeType::SizeValueType       FeatureSizeValueType;
00103   typedef typename FeatureImageType::SpacingType        FeatureSpacingType;
00104   typedef typename FeatureImageType::IndexType          FeatureIndexType;
00105   typedef typename FeatureImageType::PointType          FeaturePointType;
00106 
00107   // Allocates m_HeavisideFunctionOfLevelSetImage to have same origin, 
00108   // spacing and size as image. Also sets the m_Start and m_End indices.
00109   void CreateHeavisideFunctionOfLevelSetImage( const InputImageType * image );
00110 
00111   // Checks if the given index lies in the domain of the current
00112   // level-set function. The domain is defined by the start and end indices.
00113   template< class TIndex >
00114   bool VerifyInsideRegion( const TIndex& featureIndex )
00115     {
00116     for( unsigned int j = 0; j < ImageDimension; j++ )
00117       {
00118       if(  (featureIndex[j] < static_cast< InputIndexValueType >(this->m_Start[j]) )
00119         || (featureIndex[j] > static_cast< InputIndexValueType >(this->m_End[j]))  )
00120         {
00121         return false;
00122         }
00123       }
00124     return true;
00125     }
00126 
00127   // Get the index into the domain of the current level-set function
00128   InputIndexType GetIndex( const FeatureIndexType& featureIndex );
00129 
00130   // Get the index in the domain of the feature image
00131   FeatureIndexType GetFeatureIndex( const InputIndexType& inputIndex );
00132 
00133 
00134   double              m_WeightedNumberOfPixelsInsideLevelSet;
00135   double              m_WeightedNumberOfPixelsOutsideLevelSet;
00136 
00137   InputImagePointer   m_HeavisideFunctionOfLevelSetImage;
00138   InputIndexType      m_Start;
00139   InputIndexType      m_End;
00140 
00141 protected:
00142   RegionBasedLevelSetFunctionData();
00143   virtual ~RegionBasedLevelSetFunctionData() {}
00144 
00145 private:
00146   RegionBasedLevelSetFunctionData(const Self&); //purposely not implemented
00147   void operator=(const Self&); //purposely not implemented
00148 };
00149 
00150 } //end namespace itk
00151 
00152 #ifndef ITK_MANUAL_INSTANTIATION
00153 #include "itkRegionBasedLevelSetFunctionData.txx"
00154 #endif
00155 #endif
00156 

Generated at Tue Sep 15 04:38:59 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000