Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __itkNDImageTemplate_h
00016 #define __itkNDImageTemplate_h
00017
00018 #include "itkNDImageBase.h"
00019 #include "itkImageFileReader.h"
00020
00021
00022 namespace itk
00023 {
00024
00042 template < class TPixel, unsigned int VDimension >
00043 class NDImageTemplate : public NDImageBase<TPixel>
00044 {
00045 public:
00046
00048 typedef NDImageTemplate Self;
00049 typedef NDImageBase<TPixel> Superclass;
00050 typedef SmartPointer<Self> Pointer;
00051 typedef SmartPointer<const Self> ConstPointer;
00052
00054 itkNewMacro( Self );
00055
00057 itkTypeMacro( NDImageTemplate, NDImageBase );
00058
00063 itkStaticConstMacro(Dimension, unsigned int, VDimension);
00064
00065 typedef typename Superclass::DataObjectType DataObjectType;
00066 typedef typename Superclass::DataObjectPointer DataObjectPointer;
00067
00069 typedef typename Superclass::PixelType PixelType;
00070 typedef typename Superclass::ValueType ValueType;
00071 typedef typename Superclass::InternalPixelType InternalPixelType;
00072 typedef typename Superclass::AccessorType AccessorType;
00073 typedef typename Superclass::PixelContainer PixelContainer;
00074 typedef typename Superclass::PixelContainerPointer PixelContainerPointer;
00075 typedef typename Superclass::PixelContainerConstPointer PixelContainerConstPointer;
00076
00077 typedef typename Superclass::SpacingValueType SpacingValueType;
00078 typedef typename Superclass::PointValueType PointValueType;
00079 typedef typename Superclass::IndexValueType IndexValueType;
00080 typedef typename Superclass::SizeValueType SizeValueType;
00081 typedef typename Superclass::OffsetValueType OffsetValueType;
00082
00084 typedef typename Superclass::IndexType IndexType;
00085 typedef typename Superclass::SizeType SizeType;
00086 typedef typename Superclass::SpacingType SpacingType;
00087 typedef typename Superclass::PointType PointType;
00088 typedef typename Superclass::OffsetType OffsetType;
00089
00091 typedef Image<TPixel, VDimension> ImageType;
00092 typedef typename ImageType::Pointer ImagePointer;
00093 typedef ImageFileWriter<ImageType> WriterType;
00094 typedef typename WriterType::Pointer WriterPointer;
00095 typedef ImageFileReader<ImageType> ReaderType;
00096 typedef typename ReaderType::Pointer ReaderPointer;
00097
00099 typedef typename ImageType::IndexType IndexTypeD;
00100 typedef typename ImageType::SizeType SizeTypeD;
00101 typedef typename ImageType::SpacingType SpacingTypeD;
00102 typedef typename ImageType::PointType PointTypeD;
00103 typedef typename ImageType::OffsetType OffsetTypeD;
00104
00105 virtual void SetRegions(SizeType size);
00106 virtual void SetRequestedRegion(DataObject *data);
00107
00108 virtual void Allocate(void);
00109 virtual void Initialize(void);
00110
00111 virtual void FillBuffer (const TPixel& value);
00112
00113 virtual void SetPixel(const IndexType &index, const TPixel& value);
00114 virtual const TPixel& GetPixel(const IndexType &index) const;
00115 virtual TPixel& GetPixel(const IndexType &index);
00116
00117 virtual TPixel *GetBufferPointer();
00118 virtual const TPixel *GetBufferPointer() const;
00119 virtual PixelContainer* GetPixelContainer();
00120 virtual const PixelContainer* GetPixelContainer() const;
00121 virtual void SetPixelContainer( PixelContainer *container );
00122
00123 virtual AccessorType GetPixelAccessor( void );
00124 virtual const AccessorType GetPixelAccessor( void ) const;
00125
00126
00127 virtual void SetSpacing( const SpacingType & spacing );
00128 virtual void SetOrigin( const PointType & origin );
00129 virtual SpacingType GetSpacing(void);
00130 virtual PointType GetOrigin(void);
00131
00134 virtual void CopyInformation(const DataObject *data);
00135 virtual const OffsetValueType *GetOffsetTable() const;
00136 virtual OffsetValueType ComputeOffset(const IndexType &ind) const;
00137 virtual IndexType ComputeIndex(OffsetValueType offset) const;
00138
00142 virtual unsigned int ImageDimension(void);
00143 virtual unsigned int GetImageDimension(void);
00144
00146 itkGetObjectMacro(Image, DataObject);
00147 itkGetObjectMacro(Writer, ProcessObject);
00148 itkGetObjectMacro(Reader, ProcessObject);
00149
00151 virtual void Write(void);
00152
00154 virtual void Read(void);
00155
00157 virtual void CreateNewImage(void);
00158
00159 virtual void SetImageIOWriter (ImageIOBase *_arg);
00160 virtual ImageIOBase * GetImageIOWriter(void);
00161 virtual void SetImageIOReader (ImageIOBase *_arg);
00162 virtual ImageIOBase * GetImageIOReader(void);
00163
00165 virtual void SetOutputFileName(const char * name );
00166 virtual void SetInputFileName(const char * name );
00167 virtual const char * GetOutputFileName(void);
00168 virtual const char * GetInputFileName(void);
00169
00170 protected:
00171
00172 NDImageTemplate();
00173 virtual ~NDImageTemplate(){};
00174
00175
00176
00177 ImagePointer m_Image;
00178 WriterPointer m_Writer;
00179 ReaderPointer m_Reader;
00180
00181
00182 template <class TIn, class TOut>
00183 class ConvertToDynamicArray
00184 {
00185 public:
00186 inline static TOut DO(const TIn & in)
00187 {
00188 TOut out(VDimension);
00189
00190 for (unsigned int i=0; i< VDimension; i++)
00191 {
00192 out[i] = in[i];
00193 }
00194 return out;
00195 }
00196 };
00197
00198
00199 template <class TIn, class TOut>
00200 class ConvertToStaticArray
00201 {
00202 public:
00203 inline static TOut DO(const TIn & in)
00204 {
00205 TOut out;
00206
00207 for (unsigned int i=0; i< VDimension; i++)
00208 {
00209 out[i] = in[i];
00210 }
00211 return out;
00212 }
00213 };
00214
00215
00216 private:
00217
00218 NDImageTemplate( const Self& );
00219 void operator=( const Self& );
00220
00221
00222
00223 };
00224
00225
00226 }
00227
00228 #ifndef ITK_MANUAL_INSTANTIATION
00229 #include "itkNDImageTemplate.hxx"
00230 #endif
00231
00232 #endif // end #ifndef __itkNDImageTemplate_h
00233