Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkRegionBasedLevelSetFunctionSharedData_h
00018 #define __itkRegionBasedLevelSetFunctionSharedData_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, class TSingleData >
00068 class RegionBasedLevelSetFunctionSharedData : public LightObject
00069 {
00070 public:
00071
00072 typedef RegionBasedLevelSetFunctionSharedData 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
00079 itkTypeMacro(RegionBasedLevelSetFunctionSharedData, LightObject);
00080
00081 typedef TInputImage InputImageType;
00082 typedef typename InputImageType::Pointer InputImagePointer;
00083 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00084 typedef typename InputImageType::PixelType InputPixelType;
00085 typedef typename InputImageType::RegionType InputRegionType;
00086 typedef typename InputImageType::SizeType InputSizeType;
00087 typedef typename InputSizeType::SizeValueType InputSizeValueType;
00088 typedef typename InputImageType::SpacingType InputSpacingType;
00089 typedef typename InputImageType::IndexType InputIndexType;
00090 typedef typename InputIndexType::IndexValueType InputIndexValueType;
00091 typedef typename InputImageType::PointType InputPointType;
00092
00093 typedef TFeatureImage FeatureImageType;
00094 typedef typename FeatureImageType::Pointer FeatureImagePointer;
00095 typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
00096 typedef typename FeatureImageType::PixelType FeaturePixelType;
00097 typedef typename FeatureImageType::RegionType FeatureRegionType;
00098 typedef typename FeatureImageType::SizeType FeatureSizeType;
00099 typedef typename FeatureSizeType::SizeValueType FeatureSizeValueType;
00100 typedef typename FeatureImageType::SpacingType FeatureSpacingType;
00101 typedef typename FeatureImageType::IndexType FeatureIndexType;
00102 typedef typename FeatureImageType::PointType FeaturePointType;
00103
00104 typedef std::list< unsigned int > ListPixelType;
00105 typedef Image< ListPixelType, itkGetStaticConstMacro(ImageDimension) >
00106 ListImageType;
00107 typedef typename ListImageType::Pointer ListImagePointer;
00108 typedef typename ListImageType::ConstPointer ListImageConstPointer;
00109 typedef typename ListImageType::RegionType ListRegionType;
00110 typedef typename ListImageType::SizeType ListSizeType;
00111 typedef typename ListSizeType::SizeValueType ListSizeValueType;
00112 typedef typename ListImageType::SpacingType ListSpacingType;
00113 typedef typename ListImageType::IndexType ListIndexType;
00114 typedef typename ListIndexType::IndexValueType ListIndexValueType;
00115 typedef typename ListImageType::PointType ListPointType;
00116 typedef ImageRegionIteratorWithIndex< ListImageType > ListIteratorType;
00117
00118 typedef Vector< float, itkGetStaticConstMacro(ImageDimension) >
00119 CentroidVectorType;
00120 typedef itk::Statistics::ListSample< CentroidVectorType > SampleType;
00121 typedef itk::Statistics::KdTreeGenerator< SampleType > TreeGeneratorType;
00122 typedef typename TreeGeneratorType::Pointer TreePointer;
00123 typedef typename TreeGeneratorType::KdTreeType TreeType;
00124 typedef typename TreeType::Pointer KdTreePointer;
00125
00126 typedef TSingleData LevelSetDataType;
00127 typedef typename LevelSetDataType::Pointer LevelSetDataPointer;
00128 typedef std::vector< LevelSetDataPointer > LevelSetDataPointerVector;
00129 typedef typename LevelSetDataPointerVector::iterator LevelSetDataPointerVectorIterator;
00130
00131 void SetFunctionCount( const unsigned int& n )
00132 {
00133 this->m_FunctionCount = n;
00134 this->m_LevelSetDataPointerVector.resize( n, 0 );
00135
00136 LevelSetDataPointerVectorIterator it = m_LevelSetDataPointerVector.begin();
00137 LevelSetDataPointerVectorIterator end = m_LevelSetDataPointerVector.end();
00138 while( it != end )
00139 {
00140 (*it) = LevelSetDataType::New();
00141 it++;
00142 }
00143 }
00144
00145 void SetNumberOfNeighbors( const unsigned int& n )
00146 {
00147 this->m_NumberOfNeighbors = n;
00148 }
00149
00150 void CreateHeavisideFunctionOfLevelSetImage( const unsigned int& j, const InputImageType * image )
00151 {
00152 m_LevelSetDataPointerVector[j]->CreateHeavisideFunctionOfLevelSetImage( image );
00153 }
00154
00155 void SetKdTree( KdTreePointer kdtree )
00156 {
00157 this->m_KdTree = kdtree;
00158 }
00159
00160 void AllocateListImage( const FeatureImageType * featureImage )
00161 {
00162 this->m_NearestNeighborListImage = ListImageType::New();
00163 this->m_NearestNeighborListImage->CopyInformation( featureImage );
00164 this->m_NearestNeighborListImage->SetRegions( featureImage->GetLargestPossibleRegion() );
00165 this->m_NearestNeighborListImage->Allocate();
00166 }
00167
00168 virtual void PopulateListImage() = 0;
00169
00170 LevelSetDataPointerVector m_LevelSetDataPointerVector;
00171
00172 unsigned int m_FunctionCount;
00173 unsigned int m_NumberOfNeighbors;
00174 ListImagePointer m_NearestNeighborListImage;
00175 KdTreePointer m_KdTree;
00176
00177 protected:
00178 RegionBasedLevelSetFunctionSharedData() : m_NumberOfNeighbors( 6 ), m_KdTree( 0 ){}
00179 ~RegionBasedLevelSetFunctionSharedData(){}
00180
00181 private:
00182 RegionBasedLevelSetFunctionSharedData(const Self&);
00183 void operator=(const Self&);
00184 };
00185
00186 }
00187
00188 #endif
00189