go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkNDImageTemplate.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 __itkNDImageTemplate_h
16 #define __itkNDImageTemplate_h
17 
18 #include "itkNDImageBase.h"
19 #include "itkImageFileReader.h"
20 
21 namespace itk
22 {
23 
41 template< class TPixel, unsigned int VDimension >
42 class NDImageTemplate : public NDImageBase< TPixel >
43 {
44 public:
45 
49  typedef SmartPointer< Self > Pointer;
50  typedef SmartPointer< const Self > ConstPointer;
51 
53  itkNewMacro( Self );
54 
56  itkTypeMacro( NDImageTemplate, NDImageBase );
57 
62  itkStaticConstMacro( Dimension, unsigned int, VDimension );
63 
66 
68  typedef typename Superclass::PixelType PixelType;
69  typedef typename Superclass::ValueType ValueType;
75 
81 
83  typedef typename Superclass::IndexType IndexType;
84  typedef typename Superclass::SizeType SizeType;
86  typedef typename Superclass::PointType PointType;
88 
90  typedef Image< TPixel, VDimension > ImageType;
91  typedef typename ImageType::Pointer ImagePointer;
93  typedef typename WriterType::Pointer WriterPointer;
94  typedef ImageFileReader< ImageType > ReaderType;
95  typedef typename ReaderType::Pointer ReaderPointer;
96 
98  typedef typename ImageType::IndexType IndexTypeD;
99  typedef typename ImageType::SizeType SizeTypeD;
100  typedef typename ImageType::SpacingType SpacingTypeD;
101  typedef typename ImageType::PointType PointTypeD;
102  typedef typename ImageType::OffsetType OffsetTypeD;
103 
104  virtual void SetRegions( SizeType size );
105 
106  virtual void SetRequestedRegion( DataObject * data );
107 
108  virtual void Allocate( void );
109 
110  virtual void Initialize( void );
111 
112  virtual void FillBuffer( const TPixel & value );
113 
114  virtual void SetPixel( const IndexType & index, const TPixel & value );
115 
116  virtual const TPixel & GetPixel( const IndexType & index ) const;
117 
118  virtual TPixel & GetPixel( const IndexType & index );
119 
120  virtual TPixel * GetBufferPointer();
121 
122  virtual const TPixel * GetBufferPointer() const;
123 
124  virtual PixelContainer * GetPixelContainer();
125 
126  virtual const PixelContainer * GetPixelContainer() const;
127 
128  virtual void SetPixelContainer( PixelContainer * container );
129 
130  virtual AccessorType GetPixelAccessor( void );
131 
132  virtual const AccessorType GetPixelAccessor( void ) const;
133 
134  virtual void SetSpacing( const SpacingType & spacing );
135 
136  virtual void SetOrigin( const PointType & origin );
137 
138  virtual SpacingType GetSpacing( void );
139 
140  virtual PointType GetOrigin( void );
141 
144  virtual void CopyInformation( const DataObject * data );
145 
146  virtual const OffsetValueType * GetOffsetTable() const;
147 
148  virtual OffsetValueType ComputeOffset( const IndexType & ind ) const;
149 
150  virtual IndexType ComputeIndex( OffsetValueType offset ) const;
151 
155  virtual unsigned int ImageDimension( void );
156 
157  virtual unsigned int GetImageDimension( void );
158 
160  itkGetObjectMacro( Image, DataObject );
161  itkGetObjectMacro( Writer, ProcessObject );
162  itkGetObjectMacro( Reader, ProcessObject );
163 
165  virtual void Write( void );
166 
168  virtual void Read( void );
169 
171  virtual void CreateNewImage( void );
172 
173  virtual void SetImageIOWriter( ImageIOBase * _arg );
174 
175  virtual ImageIOBase * GetImageIOWriter( void );
176 
177  virtual void SetImageIOReader( ImageIOBase * _arg );
178 
179  virtual ImageIOBase * GetImageIOReader( void );
180 
182  virtual void SetOutputFileName( const char * name );
183 
184  virtual void SetInputFileName( const char * name );
185 
186  virtual const char * GetOutputFileName( void );
187 
188  virtual const char * GetInputFileName( void );
189 
190 protected:
191 
192  NDImageTemplate();
193  virtual ~NDImageTemplate(){}
194 
195  //virtual void PrintSelf(std::ostream& os, Indent indent) const;
196 
200 
201  template< class TIn, class TOut >
202  class ConvertToDynamicArray
203  {
204 public:
205 
206  inline static TOut DO( const TIn & in )
207  {
208  TOut out( VDimension );
209 
210  for( unsigned int i = 0; i < VDimension; i++ )
211  {
212  out[ i ] = in[ i ];
213  }
214  return out;
215  }
216 
217 
218  };
219 
220  template< class TIn, class TOut >
221  class ConvertToStaticArray
222  {
223 public:
224 
225  inline static TOut DO( const TIn & in )
226  {
227  TOut out;
228 
229  for( unsigned int i = 0; i < VDimension; i++ )
230  {
231  out[ i ] = in[ i ];
232  }
233  return out;
234  }
235 
236 
237  };
238 
239 private:
240 
241  NDImageTemplate( const Self & ); // purposely not implemented
242  void operator=( const Self & ); // purposely not implemented
243 
244 };
245 
246 } // end namespace itk
247 
248 #ifndef ITK_MANUAL_INSTANTIATION
249 #include "itkNDImageTemplate.hxx"
250 #endif
251 
252 #endif // end #ifndef __itkNDImageTemplate_h
Superclass::PixelContainerConstPointer PixelContainerConstPointer
Superclass::PixelContainerPointer PixelContainerPointer
Superclass::OffsetType OffsetType
virtual void SetImageIOReader(ImageIOBase *_arg)
Superclass::IndexValueType IndexValueType
virtual const char * GetInputFileName(void)
ImageType::SizeType SizeTypeD
virtual void FillBuffer(const TPixel &value)
Superclass::SizeValueType SizeValueType
Superclass::DataObjectType DataObjectType
void operator=(const Self &)
Array< PointValueType > PointType
virtual void Allocate(void)
ImageType::PointType PointTypeD
virtual OffsetValueType ComputeOffset(const IndexType &ind) const
virtual void SetPixelContainer(PixelContainer *container)
virtual void CreateNewImage(void)
virtual unsigned int ImageDimension(void)
ImageType::SpacingType SpacingTypeD
virtual IndexType ComputeIndex(OffsetValueType offset) const
DataObjectType::Pointer DataObjectPointer
This class is a specialization of the NDImageBase, which acts as a wrap around an itk::Image...
Superclass::AccessorType AccessorType
DataObject DataObjectType
ImageBase< 2 >::OffsetValueType OffsetValueType
virtual unsigned int GetImageDimension(void)
virtual PixelContainer * GetPixelContainer()
NDImageBase< TPixel > Superclass
Superclass::OffsetValueType OffsetValueType
Image< TPixel, VDimension > ImageType
virtual void Initialize(void)
virtual const char * GetOutputFileName(void)
virtual void SetRequestedRegion(DataObject *data)
Image< TPixel, 2 >::PixelContainerConstPointer PixelContainerConstPointer
Superclass::InternalPixelType InternalPixelType
SmartPointer< Self > Pointer
virtual AccessorType GetPixelAccessor(void)
Array< IndexValueType > IndexType
virtual ImageIOBase * GetImageIOReader(void)
ImageType::Pointer ImagePointer
virtual const OffsetValueType * GetOffsetTable() const
An image whose dimension can be specified at runtime.
Image< TPixel, 2 >::AccessorType AccessorType
Image< TPixel, 2 >::PixelType PixelType
ImageFileWriter< ImageType > WriterType
virtual void Write(void)
virtual void SetImageIOWriter(ImageIOBase *_arg)
virtual void Read(void)
virtual void SetPixel(const IndexType &index, const TPixel &value)
ImageFileReader< ImageType > ReaderType
Superclass::SpacingType SpacingType
Array< SizeValueType > SizeType
virtual void SetOrigin(const PointType &origin)
Array< OffsetValueType > OffsetType
virtual PointType GetOrigin(void)
Array< SpacingValueType > SpacingType
Image< TPixel, 2 >::PixelContainerPointer PixelContainerPointer
Superclass::SpacingValueType SpacingValueType
Point2DType::ValueType PointValueType
virtual void SetInputFileName(const char *name)
virtual const TPixel & GetPixel(const IndexType &index) const
virtual void SetRegions(SizeType size)
virtual ImageIOBase * GetImageIOWriter(void)
Superclass::DataObjectPointer DataObjectPointer
Spacing2DType::ValueType SpacingValueType
Superclass::SizeType SizeType
ImageBase< 2 >::IndexValueType IndexValueType
SmartPointer< const Self > ConstPointer
WriterType::Pointer WriterPointer
ImageBase< 2 >::SizeValueType SizeValueType
virtual void SetSpacing(const SpacingType &spacing)
Superclass::PointValueType PointValueType
itkStaticConstMacro(Dimension, unsigned int, VDimension)
Superclass::PointType PointType
Superclass::ValueType ValueType
ImageType::IndexType IndexTypeD
ReaderType::Pointer ReaderPointer
Superclass::PixelType PixelType
Superclass::IndexType IndexType
Superclass::PixelContainer PixelContainer
ImageType::OffsetType OffsetTypeD
virtual void CopyInformation(const DataObject *data)
virtual SpacingType GetSpacing(void)
Image< TPixel, 2 >::InternalPixelType InternalPixelType
Image< TPixel, 2 >::ValueType ValueType
virtual void SetOutputFileName(const char *name)
virtual TPixel * GetBufferPointer()
Image< TPixel, 2 >::PixelContainer PixelContainer


Generated on 11-03-2014 for elastix by doxygen 1.8.6 elastix logo