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  * Copyright UMC Utrecht and contributors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef __itkNDImageTemplate_h
20 #define __itkNDImageTemplate_h
21 
22 #include "itkNDImageBase.h"
23 #include "itkImageFileReader.h"
24 
25 namespace itk
26 {
27 
45 template< class TPixel, unsigned int VDimension >
46 class NDImageTemplate : public NDImageBase< TPixel >
47 {
48 public:
49 
54  typedef SmartPointer< const Self > ConstPointer;
55 
57  itkNewMacro( Self );
58 
60  itkTypeMacro( NDImageTemplate, NDImageBase );
61 
66  itkStaticConstMacro( Dimension, unsigned int, VDimension );
67 
70 
72  typedef typename Superclass::PixelType PixelType;
73  typedef typename Superclass::ValueType ValueType;
79 
85 
87  typedef typename Superclass::IndexType IndexType;
88  typedef typename Superclass::SizeType SizeType;
90  typedef typename Superclass::PointType PointType;
92 
95  typedef typename ImageType::Pointer ImagePointer;
97  typedef typename WriterType::Pointer WriterPointer;
98  typedef ImageFileReader< ImageType > ReaderType;
99  typedef typename ReaderType::Pointer ReaderPointer;
100 
102  typedef typename ImageType::IndexType IndexTypeD;
103  typedef typename ImageType::SizeType SizeTypeD;
104  typedef typename ImageType::SpacingType SpacingTypeD;
105  typedef typename ImageType::PointType PointTypeD;
106  typedef typename ImageType::OffsetType OffsetTypeD;
107 
108  virtual void SetRegions( SizeType size );
109 
110  virtual void SetRequestedRegion( DataObject * data );
111 
112  virtual void Allocate( void );
113 
114  virtual void Initialize( void );
115 
116  virtual void FillBuffer( const TPixel & value );
117 
118  virtual void SetPixel( const IndexType & index, const TPixel & value );
119 
120  virtual const TPixel & GetPixel( const IndexType & index ) const;
121 
122  virtual TPixel & GetPixel( const IndexType & index );
123 
124  virtual TPixel * GetBufferPointer();
125 
126  virtual const TPixel * GetBufferPointer() const;
127 
128  virtual PixelContainer * GetPixelContainer();
129 
130  virtual const PixelContainer * GetPixelContainer() const;
131 
132  virtual void SetPixelContainer( PixelContainer * container );
133 
134  virtual AccessorType GetPixelAccessor( void );
135 
136  virtual const AccessorType GetPixelAccessor( void ) const;
137 
138  virtual void SetSpacing( const SpacingType & spacing );
139 
140  virtual void SetOrigin( const PointType & origin );
141 
142  virtual SpacingType GetSpacing( void );
143 
144  virtual PointType GetOrigin( void );
145 
148  virtual void CopyInformation( const DataObject * data );
149 
150  virtual const OffsetValueType * GetOffsetTable() const;
151 
152  virtual OffsetValueType ComputeOffset( const IndexType & ind ) const;
153 
154  virtual IndexType ComputeIndex( OffsetValueType offset ) const;
155 
159  virtual unsigned int ImageDimension( void );
160 
161  virtual unsigned int GetImageDimension( void );
162 
164  itkGetObjectMacro( Image, DataObject );
165  itkGetObjectMacro( Writer, ProcessObject );
166  itkGetObjectMacro( Reader, ProcessObject );
167 
169  virtual void Write( void );
170 
172  virtual void Read( void );
173 
175  virtual void CreateNewImage( void );
176 
177  virtual void SetImageIOWriter( ImageIOBase * _arg );
178 
179  virtual ImageIOBase * GetImageIOWriter( void );
180 
181  virtual void SetImageIOReader( ImageIOBase * _arg );
182 
183  virtual ImageIOBase * GetImageIOReader( void );
184 
186  virtual void SetOutputFileName( const char * name );
187 
188  virtual void SetInputFileName( const char * name );
189 
190  virtual const char * GetOutputFileName( void );
191 
192  virtual const char * GetInputFileName( void );
193 
194 protected:
195 
196  NDImageTemplate();
197  virtual ~NDImageTemplate(){}
198 
199  //virtual void PrintSelf(std::ostream& os, Indent indent) const;
200 
201  ImagePointer m_Image;
202  WriterPointer m_Writer;
203  ReaderPointer m_Reader;
204 
205  template< class TIn, class TOut >
206  class ConvertToDynamicArray
207  {
208 public:
209 
210  inline static TOut DO( const TIn & in )
211  {
212  TOut out( VDimension );
213 
214  for( unsigned int i = 0; i < VDimension; i++ )
215  {
216  out[ i ] = in[ i ];
217  }
218  return out;
219  }
220 
221 
222  };
223 
224  template< class TIn, class TOut >
225  class ConvertToStaticArray
226  {
227 public:
228 
229  inline static TOut DO( const TIn & in )
230  {
231  TOut out;
232 
233  for( unsigned int i = 0; i < VDimension; i++ )
234  {
235  out[ i ] = in[ i ];
236  }
237  return out;
238  }
239 
240 
241  };
242 
243 private:
244 
245  NDImageTemplate( const Self & ); // purposely not implemented
246  void operator=( const Self & ); // purposely not implemented
247 
248 };
249 
250 } // end namespace itk
251 
252 #ifndef ITK_MANUAL_INSTANTIATION
253 #include "itkNDImageTemplate.hxx"
254 #endif
255 
256 #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 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo