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 * 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 __itkNDImageBase_h
20#define __itkNDImageBase_h
21
22#include "itkImage.h"
23#include "itkArray.h"
24#include <string>
25#include "itkImageFileWriter.h"
26
27namespace itk
28{
29
57template< class TPixel >
58class NDImageBase : public Object
59{
60public:
61
64 typedef Object Superclass;
66 typedef SmartPointer< const Self > ConstPointer;
67
69 // itkNewMacro( Self );
70 // not declared, because instantiating an object of this
71 // (abstract) type makes no sense.
72
74 itkTypeMacro( NDImageBase, Object );
75
76 typedef DataObject DataObjectType;
77 typedef DataObjectType::Pointer DataObjectPointer;
78
80 typedef typename Image< TPixel, 2 >::PixelType PixelType;
87
88 typedef typename ImageBase< 2 >::SpacingType Spacing2DType;
89 typedef typename ImageBase< 2 >::PointType Point2DType;
90
91 typedef typename Spacing2DType::ValueType SpacingValueType;
92 typedef typename Point2DType::ValueType PointValueType;
93 typedef typename ImageBase< 2 >::IndexValueType IndexValueType;
94 typedef typename ImageBase< 2 >::SizeValueType SizeValueType;
95 typedef typename ImageBase< 2 >::OffsetValueType OffsetValueType;
96
102 typedef Array< IndexValueType > IndexType;
103 typedef Array< SizeValueType > SizeType;
104 typedef Array< SpacingValueType > SpacingType;
105 typedef Array< PointValueType > PointType;
106 typedef Array< OffsetValueType > OffsetType;
111 //typedef typename Superclass::RegionType RegionType;
112
121 //void SetRegions(RegionType region) = 0;
122 virtual void SetRegions( SizeType size ) = 0;
123
124 virtual void SetRequestedRegion( DataObject * data ) = 0;
125
126 virtual void Allocate( void ) = 0;
127
128 virtual void Initialize( void ) = 0;
129
130 virtual void FillBuffer( const TPixel & value ) = 0;
131
132 virtual void SetPixel( const IndexType & index, const TPixel & value ) = 0;
133
134 virtual const TPixel & GetPixel( const IndexType & index ) const = 0;
135
136 virtual TPixel & GetPixel( const IndexType & index ) = 0;
137
138 TPixel & operator[]( const IndexType & index )
139 { return this->GetPixel( index ); }
140 const TPixel & operator[]( const IndexType & index ) const
141 { return this->GetPixel( index ); }
142
143 virtual TPixel * GetBufferPointer() = 0;
144
145 virtual const TPixel * GetBufferPointer() const = 0;
146
148
149 virtual const PixelContainer * GetPixelContainer() const = 0;
150
151 virtual void SetPixelContainer( PixelContainer * container ) = 0;
152
153 virtual AccessorType GetPixelAccessor( void ) = 0;
154
155 virtual const AccessorType GetPixelAccessor( void ) const = 0;
156
157 virtual void SetSpacing( const SpacingType & spacing ) = 0;
158
159 virtual void SetOrigin( const PointType & origin ) = 0;
160
161 /* Get Spacing/Origin return copies; not a const &, like
162 * itkImage; necessary because of the conversion to arrays */
163 virtual SpacingType GetSpacing( void ) = 0;
164
165 virtual PointType GetOrigin( void ) = 0;
166
169 virtual void CopyInformation( const DataObject * data ) = 0;
170
171 virtual const OffsetValueType * GetOffsetTable() const = 0;
172
173 virtual OffsetValueType ComputeOffset( const IndexType & ind ) const = 0;
174
175 virtual IndexType ComputeIndex( OffsetValueType offset ) const = 0;
176
180 virtual unsigned int ImageDimension( void ) = 0;
181
182 virtual unsigned int GetImageDimension( void ) = 0;
183
184 virtual void SetImageIOWriter( ImageIOBase * _arg ) = 0;
185
186 virtual ImageIOBase * GetImageIOWriter( void ) = 0;
187
188 virtual void SetImageIOReader( ImageIOBase * _arg ) = 0;
189
190 virtual ImageIOBase * GetImageIOReader( void ) = 0;
191
193 virtual void Write( void ) = 0;
194
196 virtual void Read( void ) = 0;
197
199 virtual void CreateNewImage( void ) = 0;
200
202 virtual void SetOutputFileName( const char * ) = 0;
203
204 virtual void SetInputFileName( const char * ) = 0;
205
206 virtual const char * GetOutputFileName( void ) = 0;
207
208 virtual const char * GetInputFileName( void ) = 0;
209
210 static Pointer NewNDImage( unsigned int dim );
211
212protected:
213
215 ~NDImageBase() override{}
216
217 //virtual void PrintSelf(std::ostream& os, Indent indent) const = 0;
218
219private:
220
221 NDImageBase( const Self & ); // purposely not implemented
222 void operator=( const Self & ); // purposely not implemented
223
224};
225
226} // end namespace itk
227
228#include "itkNDImageTemplate.h"
229
230namespace itk
231{
232
233template< class TPixel >
236{
237 switch( dim )
238 {
239 case 1:
240 return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 1 >::New().GetPointer() );
241 case 2:
242 return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 2 >::New().GetPointer() );
243 case 3:
244 return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 3 >::New().GetPointer() );
245 case 4:
246 return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 4 >::New().GetPointer() );
247 case 5:
248 return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 5 >::New().GetPointer() );
249 //add here more dimensions if needed...
250 // we could do this also with a recursive
251 //template and a #define MAXDIM,
252 // or something like that....
253 default:
254 // Return a default-constructed SmartPointer (null).
255 return typename NDImageBase< TPixel >::Pointer();
256 }
257
258}
259
260
261} // end namespace itk
262
263#endif // end #ifndef __itkNDImageBase_h
An image whose dimension can be specified at runtime.
virtual SpacingType GetSpacing(void)=0
virtual unsigned int GetImageDimension(void)=0
ImageBase< 2 >::OffsetValueType OffsetValueType
virtual const AccessorType GetPixelAccessor(void) const =0
ImageBase< 2 >::SpacingType Spacing2DType
virtual const TPixel * GetBufferPointer() const =0
virtual const char * GetInputFileName(void)=0
NDImageBase Self
Image< TPixel, 2 >::PixelContainerPointer PixelContainerPointer
virtual ImageIOBase * GetImageIOWriter(void)=0
virtual void SetSpacing(const SpacingType &spacing)=0
NDImageBase(const Self &)
const TPixel & operator[](const IndexType &index) const
Image< TPixel, 2 >::ValueType ValueType
void operator=(const Self &)
virtual void Initialize(void)=0
virtual void FillBuffer(const TPixel &value)=0
Point2DType::ValueType PointValueType
virtual ImageIOBase * GetImageIOReader(void)=0
DataObjectType::Pointer DataObjectPointer
virtual void SetImageIOWriter(ImageIOBase *_arg)=0
ImageBase< 2 >::IndexValueType IndexValueType
virtual TPixel & GetPixel(const IndexType &index)=0
virtual void CopyInformation(const DataObject *data)=0
virtual unsigned int ImageDimension(void)=0
virtual const TPixel & GetPixel(const IndexType &index) const =0
Array< PointValueType > PointType
~NDImageBase() override
Image< TPixel, 2 >::InternalPixelType InternalPixelType
virtual OffsetValueType ComputeOffset(const IndexType &ind) const =0
virtual void SetInputFileName(const char *)=0
virtual void SetRequestedRegion(DataObject *data)=0
virtual const OffsetValueType * GetOffsetTable() const =0
Image< TPixel, 2 >::PixelContainer PixelContainer
virtual void SetPixelContainer(PixelContainer *container)=0
virtual IndexType ComputeIndex(OffsetValueType offset) const =0
SmartPointer< Self > Pointer
static Pointer NewNDImage(unsigned int dim)
Array< OffsetValueType > OffsetType
virtual void SetImageIOReader(ImageIOBase *_arg)=0
Array< SpacingValueType > SpacingType
virtual PixelContainer * GetPixelContainer()=0
SmartPointer< const Self > ConstPointer
DataObject DataObjectType
virtual TPixel * GetBufferPointer()=0
ImageBase< 2 >::SizeValueType SizeValueType
virtual void SetOutputFileName(const char *)=0
Array< SizeValueType > SizeType
Spacing2DType::ValueType SpacingValueType
Image< TPixel, 2 >::AccessorType AccessorType
virtual PointType GetOrigin(void)=0
virtual void SetPixel(const IndexType &index, const TPixel &value)=0
Array< IndexValueType > IndexType
virtual void Write(void)=0
Image< TPixel, 2 >::PixelContainerConstPointer PixelContainerConstPointer
virtual void Read(void)=0
virtual AccessorType GetPixelAccessor(void)=0
TPixel & operator[](const IndexType &index)
virtual const PixelContainer * GetPixelContainer() const =0
virtual const char * GetOutputFileName(void)=0
virtual void SetRegions(SizeType size)=0
virtual void Allocate(void)=0
virtual void SetOrigin(const PointType &origin)=0
virtual void CreateNewImage(void)=0
ImageBase< 2 >::PointType Point2DType
static Pointer New()


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo