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