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
00025 namespace itk
00026 {
00027
00037 template < unsigned int TDimension = 3,
00038 class TPixelType = unsigned char
00039 >
00040 class ImageSpatialObject
00041 : public SpatialObject< TDimension >
00042 {
00043
00044 public:
00045
00046 typedef double ScalarType;
00047 typedef ImageSpatialObject< TDimension, TPixelType > Self;
00048 typedef SpatialObject< TDimension > Superclass;
00049 typedef SmartPointer< Self > Pointer;
00050 typedef SmartPointer< const Self > ConstPointer;
00051
00052 typedef TPixelType PixelType;
00053 typedef Image< PixelType, TDimension > ImageType;
00054 typedef typename ImageType::ConstPointer ImagePointer;
00055 typedef typename ImageType::IndexType IndexType;
00056 typedef typename ImageType::RegionType RegionType;
00057 typedef typename Superclass::TransformType TransformType;
00058 typedef typename Superclass::PointType PointType;
00059 typedef typename Superclass::BoundingBoxType BoundingBoxType;
00060
00061 typedef VectorContainer< unsigned long, PointType> PointContainerType;
00062 typedef typename PointContainerType::Pointer PointContainerPointer;
00063
00065 itkNewMacro( Self );
00066
00068 itkTypeMacro( ImageSpatialObject, SpatialObject );
00069
00071 void SetImage( const ImageType * image );
00072
00074 const ImageType * GetImage( void ) const;
00075
00078 bool IsEvaluableAt( const PointType & point,
00079 unsigned int depth=0, char *name=NULL) const;
00080
00084 bool ValueAt( const PointType & point, double & value,
00085 unsigned int depth=0, char *name=NULL) const;
00086
00087
00089 bool IsInside( const PointType & point,
00090 unsigned int depth, char *name) const;
00091
00095 bool IsInside( const PointType & point) const;
00096
00098 bool ComputeLocalBoundingBox() const;
00099
00101 unsigned long GetMTime( void ) const;
00102
00104 void SetSlicePosition(unsigned int dimension, int position);
00105
00107 int GetSlicePosition(unsigned int dimension)
00108 {return m_SlicePosition[dimension];}
00109
00110 const char* GetPixelType()
00111 {
00112 return m_PixelType.c_str();
00113 }
00114
00115 protected:
00116
00117 ImagePointer m_Image;
00118
00119 ImageSpatialObject();
00120 virtual ~ImageSpatialObject();
00121
00122 void PrintSelf( std::ostream& os, Indent indent ) const;
00123
00124 int* m_SlicePosition;
00125 std::string m_PixelType;
00126 };
00127
00128 }
00129
00130 #ifndef ITK_MANUAL_INSTANTIATION
00131 #include "itkImageSpatialObject.txx"
00132 #endif
00133
00134 #endif //__itkImageSpatialObject_h