00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkRegionBasedLevelSetFunctionData.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-05-14 21:46:48 $ 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 #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 void CreateHeavisideFunctionOfLevelSetImage( const InputImageType * image ); 00108 00109 template< class TIndex > 00110 bool VerifyInsideRegion( const TIndex& featureIndex ) 00111 { 00112 for( unsigned int j = 0; j < ImageDimension; j++ ) 00113 { 00114 if( (featureIndex[j] < static_cast< InputIndexValueType >(this->m_Start[j]) ) 00115 || (featureIndex[j] > static_cast< InputIndexValueType >(this->m_End[j])) ) 00116 { 00117 return false; 00118 } 00119 } 00120 return true; 00121 } 00122 00123 InputIndexType GetIndex( const FeatureIndexType& featureIndex ); 00124 00125 FeatureIndexType GetFeatureIndex( const InputIndexType& inputIndex ); 00126 00127 00128 double m_WeightedNumberOfPixelsInsideLevelSet; 00129 double m_WeightedNumberOfPixelsOutsideLevelSet; 00130 00131 InputImagePointer m_HeavisideFunctionOfLevelSetImage; 00132 InputIndexType m_Start; 00133 InputIndexType m_End; 00134 00135 protected: 00136 RegionBasedLevelSetFunctionData(); 00137 virtual ~RegionBasedLevelSetFunctionData() {} 00138 00139 private: 00140 RegionBasedLevelSetFunctionData(const Self&); //purposely not implemented 00141 void operator=(const Self&); //purposely not implemented 00142 }; 00143 00144 } //end namespace itk 00145 00146 #ifndef ITK_MANUAL_INSTANTIATION 00147 #include "itkRegionBasedLevelSetFunctionData.txx" 00148 #endif 00149 #endif 00150