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 #ifndef __itkNDImageTemplate_h
19 #define __itkNDImageTemplate_h
20 
21 #include "itkNDImageBase.h"
22 #include "itkImageFileReader.h"
23 
24 namespace itk
25 {
26 
44 template< class TPixel, unsigned int VDimension >
45 class NDImageTemplate : public NDImageBase< TPixel >
46 {
47 public:
48 
53  typedef SmartPointer< const Self > ConstPointer;
54 
56  itkNewMacro( Self );
57 
59  itkTypeMacro( NDImageTemplate, NDImageBase );
60 
65  itkStaticConstMacro( Dimension, unsigned int, VDimension );
66 
69 
71  typedef typename Superclass::PixelType PixelType;
72  typedef typename Superclass::ValueType ValueType;
78 
84 
86  typedef typename Superclass::IndexType IndexType;
87  typedef typename Superclass::SizeType SizeType;
89  typedef typename Superclass::PointType PointType;
91 
94  typedef typename ImageType::Pointer ImagePointer;
96  typedef typename WriterType::Pointer WriterPointer;
97  typedef ImageFileReader< ImageType > ReaderType;
98  typedef typename ReaderType::Pointer ReaderPointer;
99 
101  typedef typename ImageType::IndexType IndexTypeD;
102  typedef typename ImageType::SizeType SizeTypeD;
103  typedef typename ImageType::SpacingType SpacingTypeD;
104  typedef typename ImageType::PointType PointTypeD;
105  typedef typename ImageType::OffsetType OffsetTypeD;
106 
107  virtual void SetRegions( SizeType size );
108 
109  virtual void SetRequestedRegion( DataObject * data );
110 
111  virtual void Allocate( void );
112 
113  virtual void Initialize( void );
114 
115  virtual void FillBuffer( const TPixel & value );
116 
117  virtual void SetPixel( const IndexType & index, const TPixel & value );
118 
119  virtual const TPixel & GetPixel( const IndexType & index ) const;
120 
121  virtual TPixel & GetPixel( const IndexType & index );
122 
123  virtual TPixel * GetBufferPointer();
124 
125  virtual const TPixel * GetBufferPointer() const;
126 
127  virtual PixelContainer * GetPixelContainer();
128 
129  virtual const PixelContainer * GetPixelContainer() const;
130 
131  virtual void SetPixelContainer( PixelContainer * container );
132 
133  virtual AccessorType GetPixelAccessor( void );
134 
135  virtual const AccessorType GetPixelAccessor( void ) const;
136 
137  virtual void SetSpacing( const SpacingType & spacing );
138 
139  virtual void SetOrigin( const PointType & origin );
140 
141  virtual SpacingType GetSpacing( void );
142 
143  virtual PointType GetOrigin( void );
144 
147  virtual void CopyInformation( const DataObject * data );
148 
149  virtual const OffsetValueType * GetOffsetTable() const;
150 
151  virtual OffsetValueType ComputeOffset( const IndexType & ind ) const;
152 
153  virtual IndexType ComputeIndex( OffsetValueType offset ) const;
154 
158  virtual unsigned int ImageDimension( void );
159 
160  virtual unsigned int GetImageDimension( void );
161 
163  itkGetObjectMacro( Image, DataObject );
164  itkGetObjectMacro( Writer, ProcessObject );
165  itkGetObjectMacro( Reader, ProcessObject );
166 
168  virtual void Write( void );
169 
171  virtual void Read( void );
172 
174  virtual void CreateNewImage( void );
175 
176  virtual void SetImageIOWriter( ImageIOBase * _arg );
177 
178  virtual ImageIOBase * GetImageIOWriter( void );
179 
180  virtual void SetImageIOReader( ImageIOBase * _arg );
181 
182  virtual ImageIOBase * GetImageIOReader( void );
183 
185  virtual void SetOutputFileName( const char * name );
186 
187  virtual void SetInputFileName( const char * name );
188 
189  virtual const char * GetOutputFileName( void );
190 
191  virtual const char * GetInputFileName( void );
192 
193 protected:
194 
195  NDImageTemplate();
196  virtual ~NDImageTemplate(){}
197 
198  //virtual void PrintSelf(std::ostream& os, Indent indent) const;
199 
200  ImagePointer m_Image;
201  WriterPointer m_Writer;
202  ReaderPointer m_Reader;
203 
204  template< class TIn, class TOut >
205  class ConvertToDynamicArray
206  {
207 public:
208 
209  inline static TOut DO( const TIn & in )
210  {
211  TOut out( VDimension );
212 
213  for( unsigned int i = 0; i < VDimension; i++ )
214  {
215  out[ i ] = in[ i ];
216  }
217  return out;
218  }
219 
220 
221  };
222 
223  template< class TIn, class TOut >
224  class ConvertToStaticArray
225  {
226 public:
227 
228  inline static TOut DO( const TIn & in )
229  {
230  TOut out;
231 
232  for( unsigned int i = 0; i < VDimension; i++ )
233  {
234  out[ i ] = in[ i ];
235  }
236  return out;
237  }
238 
239 
240  };
241 
242 private:
243 
244  NDImageTemplate( const Self & ); // purposely not implemented
245  void operator=( const Self & ); // purposely not implemented
246 
247 };
248 
249 } // end namespace itk
250 
251 #ifndef ITK_MANUAL_INSTANTIATION
252 #include "itkNDImageTemplate.hxx"
253 #endif
254 
255 #endif // end #ifndef __itkNDImageTemplate_h
Superclass::PixelContainerConstPointer PixelContainerConstPointer
virtual OffsetValueType ComputeOffset(const IndexType &ind) const
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 const TPixel & GetPixel(const IndexType &index) const
virtual void SetPixelContainer(PixelContainer *container)
virtual void CreateNewImage(void)
virtual unsigned int ImageDimension(void)
ImageType::SpacingType SpacingTypeD
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
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 void SetRegions(SizeType size)
virtual IndexType ComputeIndex(OffsetValueType offset) const
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 const OffsetValueType * GetOffsetTable() const
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 OURCE_DATE_EPOCH for elastix by doxygen 1.8.13 elastix logo