00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkImageSpatialObject_h
00019 #define __itkImageSpatialObject_h
00020
00021 #include "itkImage.h"
00022 #include "itkExceptionObject.h"
00023 #include "itkSpatialObject.h"
00024 #include "itkInterpolateImageFunction.h"
00025 #include "itkNearestNeighborInterpolateImageFunction.h"
00026
00027 namespace itk
00028 {
00029
00039 template < unsigned int TDimension = 3,
00040 class TPixelType = unsigned char
00041 >
00042 class ITK_EXPORT ImageSpatialObject
00043 : public SpatialObject< TDimension >
00044 {
00045
00046 public:
00047
00048 typedef double ScalarType;
00049 typedef ImageSpatialObject< TDimension, TPixelType > Self;
00050 typedef SpatialObject< TDimension > Superclass;
00051 typedef SmartPointer< Self > Pointer;
00052 typedef SmartPointer< const Self > ConstPointer;
00053
00054 typedef TPixelType PixelType;
00055 typedef Image< PixelType, TDimension > ImageType;
00056 typedef typename ImageType::ConstPointer ImagePointer;
00057 typedef typename ImageType::IndexType IndexType;
00058 typedef typename ImageType::RegionType RegionType;
00059 typedef typename Superclass::TransformType TransformType;
00060 typedef typename Superclass::PointType PointType;
00061 typedef typename Superclass::BoundingBoxType BoundingBoxType;
00062 typedef InterpolateImageFunction<ImageType> InterpolatorType;
00063
00064 typedef NearestNeighborInterpolateImageFunction<ImageType>
00065 NNInterpolatorType;
00066
00067 typedef VectorContainer< unsigned long, PointType> PointContainerType;
00068 typedef typename PointContainerType::Pointer PointContainerPointer;
00069
00071 itkNewMacro( Self );
00072
00074 itkTypeMacro( ImageSpatialObject, SpatialObject );
00075
00077 void SetImage( const ImageType * image );
00078
00080 const ImageType * GetImage( void ) const;
00081
00084 bool IsEvaluableAt( const PointType & point,
00085 unsigned int depth=0, char *name=NULL) const;
00086
00090 bool ValueAt( const PointType & point, double & value,
00091 unsigned int depth=0, char *name=NULL) const;
00092
00093
00095 bool IsInside( const PointType & point,
00096 unsigned int depth, char *name) const;
00097
00101 bool IsInside( const PointType & point) const;
00102
00104 bool ComputeLocalBoundingBox() const;
00105
00107 unsigned long GetMTime( void ) const;
00108
00110 void SetSlicePosition(unsigned int dimension, int position);
00111
00113 int GetSlicePosition(unsigned int dimension)
00114 {return m_SlicePosition[dimension];}
00115
00116 const char* GetPixelType()
00117 {
00118 return m_PixelType.c_str();
00119 }
00120
00122 void SetInterpolator(InterpolatorType * interpolator);
00123 itkGetObjectMacro(Interpolator,InterpolatorType);
00125
00126 protected:
00127 ImageSpatialObject(const Self&);
00128 void operator=(const Self&);
00129
00130 ImagePointer m_Image;
00131
00132 ImageSpatialObject();
00133 virtual ~ImageSpatialObject();
00134
00135 void PrintSelf( std::ostream& os, Indent indent ) const;
00136
00137 int* m_SlicePosition;
00138 std::string m_PixelType;
00139
00140 typename InterpolatorType::Pointer m_Interpolator;
00141 };
00142
00143 }
00144
00145 #ifndef ITK_MANUAL_INSTANTIATION
00146 #include "itkImageSpatialObject.txx"
00147 #endif
00148
00149 #endif //__itkImageSpatialObject_h
00150