go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkNDImageBase.h
Go to the documentation of this file.
1 /*======================================================================
2 
3  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 
15 #ifndef __itkNDImageBase_h
16 #define __itkNDImageBase_h
17 
18 #include "itkImage.h"
19 #include "itkArray.h"
20 #include <string>
21 #include "itkImageFileWriter.h"
22 
23 namespace itk
24 {
25 
53 template< class TPixel >
54 class NDImageBase : public Object
55 {
56 public:
57 
59  typedef NDImageBase Self;
60  typedef Object Superclass;
61  typedef SmartPointer< Self > Pointer;
62  typedef SmartPointer< const Self > ConstPointer;
63 
65  // itkNewMacro( Self );
66  // not declared, because instantiating an object of this
67  // (abstract) type makes no sense.
68 
70  itkTypeMacro( NDImageBase, Object );
71 
72  typedef DataObject DataObjectType;
73  typedef DataObjectType::Pointer DataObjectPointer;
74 
76  typedef typename Image< TPixel, 2 >::PixelType PixelType;
77  typedef typename Image< TPixel, 2 >::ValueType ValueType;
78  typedef typename Image< TPixel, 2 >::InternalPixelType InternalPixelType;
79  typedef typename Image< TPixel, 2 >::AccessorType AccessorType;
80  typedef typename Image< TPixel, 2 >::PixelContainer PixelContainer;
81  typedef typename Image< TPixel, 2 >::PixelContainerPointer PixelContainerPointer;
82  typedef typename Image< TPixel, 2 >::PixelContainerConstPointer PixelContainerConstPointer;
83 
84  typedef typename ImageBase< 2 >::SpacingType Spacing2DType;
85  typedef typename ImageBase< 2 >::PointType Point2DType;
86 
87  typedef typename Spacing2DType::ValueType SpacingValueType;
88  typedef typename Point2DType::ValueType PointValueType;
89  typedef typename ImageBase< 2 >::IndexValueType IndexValueType;
90  typedef typename ImageBase< 2 >::SizeValueType SizeValueType;
91  typedef typename ImageBase< 2 >::OffsetValueType OffsetValueType;
92 
98  typedef Array< IndexValueType > IndexType;
99  typedef Array< SizeValueType > SizeType;
100  typedef Array< SpacingValueType > SpacingType;
101  typedef Array< PointValueType > PointType;
102  typedef Array< OffsetValueType > OffsetType;
107  //typedef typename Superclass::RegionType RegionType;
108 
117  //void SetRegions(RegionType region) = 0;
118  virtual void SetRegions( SizeType size ) = 0;
119 
120  virtual void SetRequestedRegion( DataObject * data ) = 0;
121 
122  virtual void Allocate( void ) = 0;
123 
124  virtual void Initialize( void ) = 0;
125 
126  virtual void FillBuffer( const TPixel & value ) = 0;
127 
128  virtual void SetPixel( const IndexType & index, const TPixel & value ) = 0;
129 
130  virtual const TPixel & GetPixel( const IndexType & index ) const = 0;
131 
132  virtual TPixel & GetPixel( const IndexType & index ) = 0;
133 
134  TPixel & operator[]( const IndexType & index )
135  { return this->GetPixel( index ); }
136  const TPixel & operator[]( const IndexType & index ) const
137  { return this->GetPixel( index ); }
138 
139  virtual TPixel * GetBufferPointer() = 0;
140 
141  virtual const TPixel * GetBufferPointer() const = 0;
142 
143  virtual PixelContainer * GetPixelContainer() = 0;
144 
145  virtual const PixelContainer * GetPixelContainer() const = 0;
146 
147  virtual void SetPixelContainer( PixelContainer * container ) = 0;
148 
149  virtual AccessorType GetPixelAccessor( void ) = 0;
150 
151  virtual const AccessorType GetPixelAccessor( void ) const = 0;
152 
153  virtual void SetSpacing( const SpacingType & spacing ) = 0;
154 
155  virtual void SetOrigin( const PointType & origin ) = 0;
156 
157  /* Get Spacing/Origin return copies; not a const &, like
158  * itkImage; necessary because of the conversion to arrays */
159  virtual SpacingType GetSpacing( void ) = 0;
160 
161  virtual PointType GetOrigin( void ) = 0;
162 
165  virtual void CopyInformation( const DataObject * data ) = 0;
166 
167  virtual const OffsetValueType * GetOffsetTable() const = 0;
168 
169  virtual OffsetValueType ComputeOffset( const IndexType & ind ) const = 0;
170 
171  virtual IndexType ComputeIndex( OffsetValueType offset ) const = 0;
172 
176  virtual unsigned int ImageDimension( void ) = 0;
177 
178  virtual unsigned int GetImageDimension( void ) = 0;
179 
181  virtual DataObject * GetImage( void ) = 0;
182 
183  virtual ProcessObject * GetWriter( void ) = 0;
184 
185  virtual ProcessObject * GetReader( void ) = 0;
186 
187  virtual void SetImageIOWriter( ImageIOBase * _arg ) = 0;
188 
189  virtual ImageIOBase * GetImageIOWriter( void ) = 0;
190 
191  virtual void SetImageIOReader( ImageIOBase * _arg ) = 0;
192 
193  virtual ImageIOBase * GetImageIOReader( void ) = 0;
194 
196  virtual void Write( void ) = 0;
197 
199  virtual void Read( void ) = 0;
200 
202  virtual void CreateNewImage( void ) = 0;
203 
205  virtual void SetOutputFileName( const char * ) = 0;
206 
207  virtual void SetInputFileName( const char * ) = 0;
208 
209  virtual const char * GetOutputFileName( void ) = 0;
210 
211  virtual const char * GetInputFileName( void ) = 0;
212 
213  static Pointer NewNDImage( unsigned int dim );
214 
215 protected:
216 
218  virtual ~NDImageBase(){}
219 
220  //virtual void PrintSelf(std::ostream& os, Indent indent) const = 0;
221 
222 private:
223 
224  NDImageBase( const Self & ); // purposely not implemented
225  void operator=( const Self & ); // purposely not implemented
226 
227 };
228 
229 } // end namespace itk
230 
231 #include "itkNDImageTemplate.h"
232 
233 namespace itk
234 {
235 
236 template< class TPixel >
237 typename NDImageBase< TPixel >::Pointer
239 {
240  switch( dim )
241  {
242  case 1:
243  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 1 >::New().GetPointer() );
244  case 2:
245  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 2 >::New().GetPointer() );
246  case 3:
247  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 3 >::New().GetPointer() );
248  case 4:
249  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 4 >::New().GetPointer() );
250  case 5:
251  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 5 >::New().GetPointer() );
252  //add here more dimensions if needed...
253  // we could do this also with a recursive
254  //template and a #define MAXDIM,
255  // or something like that....
256  default:
257  return 0;
258  }
259 
260 }
261 
262 
263 } // end namespace itk
264 
265 #endif // end #ifndef __itkNDImageBase_h
virtual const OffsetValueType * GetOffsetTable() const =0
virtual AccessorType GetPixelAccessor(void)=0
virtual ImageIOBase * GetImageIOReader(void)=0
virtual void Write(void)=0
virtual PixelContainer * GetPixelContainer()=0
virtual unsigned int GetImageDimension(void)=0
virtual ProcessObject * GetWriter(void)=0
void operator=(const Self &)
virtual const TPixel & GetPixel(const IndexType &index) const =0
Array< PointValueType > PointType
TPixel & operator[](const IndexType &index)
virtual void SetOrigin(const PointType &origin)=0
virtual SpacingType GetSpacing(void)=0
virtual void SetPixel(const IndexType &index, const TPixel &value)=0
virtual void SetImageIOReader(ImageIOBase *_arg)=0
virtual void FillBuffer(const TPixel &value)=0
DataObjectType::Pointer DataObjectPointer
NDImageBase Self
DataObject DataObjectType
ImageBase< 2 >::OffsetValueType OffsetValueType
virtual void SetRequestedRegion(DataObject *data)=0
virtual void SetPixelContainer(PixelContainer *container)=0
virtual TPixel * GetBufferPointer()=0
virtual void Read(void)=0
virtual PointType GetOrigin(void)=0
Image< TPixel, 2 >::PixelContainerConstPointer PixelContainerConstPointer
virtual ~NDImageBase()
virtual void Initialize(void)=0
Array< IndexValueType > IndexType
const TPixel & operator[](const IndexType &index) const
static Pointer NewNDImage(unsigned int dim)
An image whose dimension can be specified at runtime.
Image< TPixel, 2 >::AccessorType AccessorType
Image< TPixel, 2 >::PixelType PixelType
virtual void SetSpacing(const SpacingType &spacing)=0
virtual void SetImageIOWriter(ImageIOBase *_arg)=0
virtual IndexType ComputeIndex(OffsetValueType offset) const =0
ImageBase< 2 >::PointType Point2DType
Array< SizeValueType > SizeType
Array< OffsetValueType > OffsetType
Array< SpacingValueType > SpacingType
Image< TPixel, 2 >::PixelContainerPointer PixelContainerPointer
Point2DType::ValueType PointValueType
virtual ProcessObject * GetReader(void)=0
ImageBase< 2 >::SpacingType Spacing2DType
SmartPointer< Self > Pointer
Spacing2DType::ValueType SpacingValueType
SmartPointer< const Self > ConstPointer
virtual ImageIOBase * GetImageIOWriter(void)=0
ImageBase< 2 >::IndexValueType IndexValueType
ImageBase< 2 >::SizeValueType SizeValueType
virtual DataObject * GetImage(void)=0
virtual void SetRegions(SizeType size)=0
virtual void SetOutputFileName(const char *)=0
virtual const char * GetInputFileName(void)=0
virtual unsigned int ImageDimension(void)=0
virtual void SetInputFileName(const char *)=0
virtual void CopyInformation(const DataObject *data)=0
virtual OffsetValueType ComputeOffset(const IndexType &ind) const =0
virtual const char * GetOutputFileName(void)=0
Image< TPixel, 2 >::InternalPixelType InternalPixelType
Image< TPixel, 2 >::ValueType ValueType
static Pointer New()
virtual void Allocate(void)=0
virtual void CreateNewImage(void)=0
Image< TPixel, 2 >::PixelContainer PixelContainer


Generated on 27-04-2014 for elastix by doxygen 1.8.6 elastix logo