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 
52  typedef SmartPointer< Self > Pointer;
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  void SetRegions( SizeType size ) override;
108 
109  void SetRequestedRegion( DataObject * data ) override;
110 
111  void Allocate( void ) override;
112 
113  void Initialize( void ) override;
114 
115  void FillBuffer( const TPixel & value ) override;
116 
117  void SetPixel( const IndexType & index, const TPixel & value ) override;
118 
119  const TPixel & GetPixel( const IndexType & index ) const override;
120 
121  TPixel & GetPixel( const IndexType & index ) override;
122 
123  TPixel * GetBufferPointer() override;
124 
125  const TPixel * GetBufferPointer() const override;
126 
128 
129  const PixelContainer * GetPixelContainer() const override;
130 
131  void SetPixelContainer( PixelContainer * container ) override;
132 
133  AccessorType GetPixelAccessor( void ) override;
134 
135  const AccessorType GetPixelAccessor( void ) const override;
136 
137  void SetSpacing( const SpacingType & spacing ) override;
138 
139  void SetOrigin( const PointType & origin ) override;
140 
141  SpacingType GetSpacing( void ) override;
142 
143  PointType GetOrigin( void ) override;
144 
147  void CopyInformation( const DataObject * data ) override;
148 
149  const OffsetValueType * GetOffsetTable() const override;
150 
151  OffsetValueType ComputeOffset( const IndexType & ind ) const override;
152 
153  IndexType ComputeIndex( OffsetValueType offset ) const override;
154 
158  unsigned int ImageDimension( void ) override;
159 
160  unsigned int GetImageDimension( void ) override;
161 
164  itkGetModifiableObjectMacro( Writer, ProcessObject );
165  itkGetModifiableObjectMacro( Reader, ProcessObject );
166 
168  void Write( void ) override;
169 
171  void Read( void ) override;
172 
174  void CreateNewImage( void ) override;
175 
176  void SetImageIOWriter( ImageIOBase * _arg ) override;
177 
178  ImageIOBase * GetImageIOWriter( void ) override;
179 
180  void SetImageIOReader( ImageIOBase * _arg ) override;
181 
182  ImageIOBase * GetImageIOReader( void ) override;
183 
185  void SetOutputFileName( const char * name ) override;
186 
187  void SetInputFileName( const char * name ) override;
188 
189  const char * GetOutputFileName( void ) override;
190 
191  const char * GetInputFileName( void ) override;
192 
193 protected:
194 
196  ~NDImageTemplate() override{}
197 
198  //virtual void PrintSelf(std::ostream& os, Indent indent) const;
199 
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
An image whose dimension can be specified at runtime.
Image< TPixel, 2 >::PixelContainerPointer PixelContainerPointer
Image< TPixel, 2 >::ValueType ValueType
Point2DType::ValueType PointValueType
DataObjectType::Pointer DataObjectPointer
Image< TPixel, 2 >::PixelContainer PixelContainer
Array< PointValueType > PointType
ImageBase< 2 >::SizeValueType SizeValueType
ImageBase< 2 >::OffsetValueType OffsetValueType
ImageBase< 2 >::IndexValueType IndexValueType
Array< OffsetValueType > OffsetType
Array< SpacingValueType > SpacingType
Image< TPixel, 2 >::PixelContainerConstPointer PixelContainerConstPointer
Image< TPixel, 2 >::InternalPixelType InternalPixelType
DataObject DataObjectType
Array< SizeValueType > SizeType
Image< TPixel, 2 >::AccessorType AccessorType
Spacing2DType::ValueType SpacingValueType
Array< IndexValueType > IndexType
This class is a specialization of the NDImageBase, which acts as a wrap around an itk::Image.
void Initialize(void) override
IndexType ComputeIndex(OffsetValueType offset) const override
TPixel & GetPixel(const IndexType &index) override
Superclass::OffsetType OffsetType
PointType GetOrigin(void) override
itkGetModifiableObjectMacro(Image, DataObject)
Superclass::SpacingValueType SpacingValueType
ImageType::IndexType IndexTypeD
ImageType::SpacingType SpacingTypeD
Superclass::PointValueType PointValueType
void SetImageIOWriter(ImageIOBase *_arg) override
Superclass::SizeType SizeType
const char * GetInputFileName(void) override
void SetOrigin(const PointType &origin) override
void SetOutputFileName(const char *name) override
TPixel * GetBufferPointer() override
void Write(void) override
void operator=(const Self &)
Superclass::DataObjectPointer DataObjectPointer
void FillBuffer(const TPixel &value) override
itkStaticConstMacro(Dimension, unsigned int, VDimension)
ImageType::SizeType SizeTypeD
const AccessorType GetPixelAccessor(void) const override
void CreateNewImage(void) override
Superclass::SpacingType SpacingType
Superclass::SizeValueType SizeValueType
void SetRegions(SizeType size) override
void Allocate(void) override
Superclass::DataObjectType DataObjectType
Superclass::OffsetValueType OffsetValueType
const TPixel & GetPixel(const IndexType &index) const override
const PixelContainer * GetPixelContainer() const override
Superclass::AccessorType AccessorType
void SetPixel(const IndexType &index, const TPixel &value) override
SmartPointer< Self > Pointer
itkGetModifiableObjectMacro(Writer, ProcessObject)
itkGetModifiableObjectMacro(Reader, ProcessObject)
Superclass::IndexValueType IndexValueType
unsigned int GetImageDimension(void) override
Superclass::PixelContainerConstPointer PixelContainerConstPointer
ImageFileReader< ImageType > ReaderType
Image< TPixel, VDimension > ImageType
Superclass::PointType PointType
Superclass::InternalPixelType InternalPixelType
PixelContainer * GetPixelContainer() override
Superclass::ValueType ValueType
void SetInputFileName(const char *name) override
NDImageTemplate(const Self &)
AccessorType GetPixelAccessor(void) override
ReaderType::Pointer ReaderPointer
WriterType::Pointer WriterPointer
void SetRequestedRegion(DataObject *data) override
ImageFileWriter< ImageType > WriterType
ImageType::OffsetType OffsetTypeD
NDImageBase< TPixel > Superclass
Superclass::PixelContainer PixelContainer
ImageIOBase * GetImageIOWriter(void) override
Superclass::PixelContainerPointer PixelContainerPointer
void SetPixelContainer(PixelContainer *container) override
void SetImageIOReader(ImageIOBase *_arg) override
SmartPointer< const Self > ConstPointer
void SetSpacing(const SpacingType &spacing) override
void Read(void) override
Superclass::IndexType IndexType
const OffsetValueType * GetOffsetTable() const override
ImageIOBase * GetImageIOReader(void) override
const char * GetOutputFileName(void) override
SpacingType GetSpacing(void) override
ImageType::Pointer ImagePointer
void CopyInformation(const DataObject *data) override
unsigned int ImageDimension(void) override
OffsetValueType ComputeOffset(const IndexType &ind) const override
const TPixel * GetBufferPointer() const override
ImageType::PointType PointTypeD


Generated on 1641078589 for elastix by doxygen 1.9.1 elastix logo