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

itkConstrainedRegionBasedLevelSetFunctionSharedData.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkConstrainedRegionBasedLevelSetFunctionSharedData.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-05-14 21:46:47 $
00007   Version:   $Revision: 1.1 $
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 
00018 #ifndef __itkConstrainedRegionBasedLevelSetFunctionSharedData_h
00019 #define __itkConstrainedRegionBasedLevelSetFunctionSharedData_h
00020 
00021 #include "itkRegionBasedLevelSetFunctionSharedData.h"
00022 
00023 namespace itk
00024 {
00025 
00060 template < class TInputImage, class TFeatureImage, class TSingleData >
00061 class ConstrainedRegionBasedLevelSetFunctionSharedData :
00062   public RegionBasedLevelSetFunctionSharedData< TInputImage, TFeatureImage, TSingleData >
00063 {
00064 public:
00065 
00066   typedef ConstrainedRegionBasedLevelSetFunctionSharedData       Self;
00067   typedef RegionBasedLevelSetFunctionSharedData< TInputImage, TFeatureImage, TSingleData >
00068     Superclass;
00069   typedef SmartPointer<Self>                                Pointer;
00070   typedef SmartPointer<const Self>                          ConstPointer;
00071 
00072   itkStaticConstMacro( ImageDimension, unsigned int, TFeatureImage::ImageDimension );
00073 
00075   itkNewMacro( Self );
00076 
00077   itkTypeMacro(ConstrainedRegionBasedLevelSetFunctionSharedData, RegionBasedLevelSetFunctionSharedData);
00078 
00079   typedef TInputImage                                   InputImageType;
00080   typedef typename Superclass::InputImagePointer        InputImagePointer;
00081   typedef typename Superclass::InputImageConstPointer   InputImageConstPointer;
00082   typedef typename Superclass::InputPixelType           InputPixelType;
00083   typedef typename Superclass::InputRegionType          InputRegionType;
00084   typedef typename Superclass::InputSizeType            InputSizeType;
00085   typedef typename Superclass::InputSizeValueType       InputSizeValueType;
00086   typedef typename Superclass::InputSpacingType         InputSpacingType;
00087   typedef typename Superclass::InputIndexType           InputIndexType;
00088   typedef typename Superclass::InputIndexValueType      InputIndexValueType;
00089   typedef typename Superclass::InputPointType           InputPointType;
00090 
00091   typedef TFeatureImage                                 FeatureImageType;
00092   typedef typename Superclass::FeatureImagePointer      FeatureImagePointer;
00093   typedef typename Superclass::FeatureImageConstPointer FeatureImageConstPointer;
00094   typedef typename Superclass::FeaturePixelType         FeaturePixelType;
00095   typedef typename Superclass::FeatureRegionType        FeatureRegionType;
00096   typedef typename Superclass::FeatureSizeType          FeatureSizeType;
00097   typedef typename Superclass::FeatureSizeValueType     FeatureSizeValueType;
00098   typedef typename Superclass::FeatureSpacingType       FeatureSpacingType;
00099   typedef typename Superclass::FeatureIndexType         FeatureIndexType;
00100   typedef typename Superclass::FeaturePointType         FeaturePointType;
00101 
00102   typedef typename Superclass::ListPixelType            ListPixelType;
00103   typedef typename Superclass::ListImageType            ListImageType;
00104   typedef typename Superclass::ListImagePointer         ListImagePointer;
00105   typedef typename Superclass::ListImageConstPointer    ListImageConstPointer;
00106   typedef typename Superclass::ListRegionType           ListRegionType;
00107   typedef typename Superclass::ListSizeType             ListSizeType;
00108   typedef typename Superclass::ListSizeValueType        ListSizeValueType;
00109   typedef typename Superclass::ListSpacingType          ListSpacingType;
00110   typedef typename Superclass::ListIndexType            ListIndexType;
00111   typedef typename Superclass::ListIndexValueType       ListIndexValueType;
00112   typedef typename Superclass::ListPointType            ListPointType;
00113   typedef typename Superclass::ListIteratorType         ListIteratorType;
00114 
00115   typedef typename Superclass::CentroidVectorType       CentroidVectorType;
00116   typedef typename Superclass::SampleType               SampleType;
00117   typedef typename Superclass::TreeGeneratorType        TreeGeneratorType;
00118   typedef typename Superclass::TreePointer              TreePointer;
00119   typedef typename Superclass::TreeType                 TreeType;
00120   typedef typename Superclass::KdTreePointer            KdTreePointer;
00121 
00122   typedef TSingleData                                             LevelSetDataType;
00123   typedef typename Superclass::LevelSetDataPointer                LevelSetDataPointer;
00124   typedef typename Superclass::LevelSetDataPointerVector          LevelSetDataPointerVector;
00125   typedef typename Superclass::LevelSetDataPointerVectorIterator  LevelSetDataPointerVectorIterator;
00126 
00127   void PopulateListImage()
00128     {
00129     ListSpacingType spacing = this->m_NearestNeighborListImage->GetSpacing();
00130 
00131     ListRegionType region = this->m_NearestNeighborListImage->GetLargestPossibleRegion();
00132 
00133     ListIteratorType lIt( this->m_NearestNeighborListImage, region );
00134 
00135     if ( this->m_KdTree.IsNotNull() )
00136       {
00137       for(lIt.GoToBegin(); !lIt.IsAtEnd(); ++lIt )
00138         {
00139         ListIndexType ind = lIt.GetIndex();
00140 
00141         float queryPoint[ImageDimension];
00142         for( unsigned int i = 0; i < ImageDimension; i++ )
00143           {
00144           queryPoint[i] = ind[i]*spacing[i];
00145           }
00146 
00147         typename TreeType::InstanceIdentifierVectorType neighbors;
00148         this->m_KdTree->Search( queryPoint, this->m_NumberOfNeighbors, neighbors );
00149 
00150         ListPixelType L;
00151         for( unsigned int i = 0; i < this->m_NumberOfNeighbors; i++ )
00152           {
00153           if( this->m_LevelSetDataPointerVector[i]->VerifyInsideRegion( ind ) )
00154             {
00155             L.push_back( neighbors[i] );
00156             }
00157           }
00158         lIt.Set( L );
00159         }
00160       }
00161     else
00162       {
00163       for(lIt.GoToBegin(); !lIt.IsAtEnd(); ++lIt )
00164         {
00165         ListIndexType ind = lIt.GetIndex();
00166         ListPixelType L;
00167         for( unsigned int i = 0; i < this->m_FunctionCount; i++ )
00168           {
00169           if( this->m_LevelSetDataPointerVector[i]->VerifyInsideRegion( ind ) )
00170             {
00171             L.push_back( i );
00172             }
00173           }
00174         lIt.Set( L );
00175         }
00176       }
00177     }
00178 
00179 protected:
00180   ConstrainedRegionBasedLevelSetFunctionSharedData() : Superclass( ){}
00181   ~ConstrainedRegionBasedLevelSetFunctionSharedData(){}
00182 
00183 private:
00184   ConstrainedRegionBasedLevelSetFunctionSharedData(const Self&); //purposely not implemented
00185   void operator=(const Self&); //purposely not implemented
00186 };
00187 
00188 } //end namespace itk
00189 
00190 #endif
00191 

Generated at Tue Sep 15 02:40:41 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000