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 
27 namespace itk
28 {
29 
57 template< class TPixel >
58 class NDImageBase : public Object
59 {
60 public:
61 
63  typedef NDImageBase Self;
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 
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 
147  virtual PixelContainer * GetPixelContainer() = 0;
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 
185  virtual DataObject * GetImage( void ) = 0;
186 
187  virtual ProcessObject * GetWriter( void ) = 0;
188 
189  virtual ProcessObject * GetReader( void ) = 0;
190 
191  virtual void SetImageIOWriter( ImageIOBase * _arg ) = 0;
192 
193  virtual ImageIOBase * GetImageIOWriter( void ) = 0;
194 
195  virtual void SetImageIOReader( ImageIOBase * _arg ) = 0;
196 
197  virtual ImageIOBase * GetImageIOReader( void ) = 0;
198 
200  virtual void Write( void ) = 0;
201 
203  virtual void Read( void ) = 0;
204 
206  virtual void CreateNewImage( void ) = 0;
207 
209  virtual void SetOutputFileName( const char * ) = 0;
210 
211  virtual void SetInputFileName( const char * ) = 0;
212 
213  virtual const char * GetOutputFileName( void ) = 0;
214 
215  virtual const char * GetInputFileName( void ) = 0;
216 
217  static Pointer NewNDImage( unsigned int dim );
218 
219 protected:
220 
222  virtual ~NDImageBase(){}
223 
224  //virtual void PrintSelf(std::ostream& os, Indent indent) const = 0;
225 
226 private:
227 
228  NDImageBase( const Self & ); // purposely not implemented
229  void operator=( const Self & ); // purposely not implemented
230 
231 };
232 
233 } // end namespace itk
234 
235 #include "itkNDImageTemplate.h"
236 
237 namespace itk
238 {
239 
240 template< class TPixel >
241 typename NDImageBase< TPixel >::Pointer
243 {
244  switch( dim )
245  {
246  case 1:
247  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 1 >::New().GetPointer() );
248  case 2:
249  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 2 >::New().GetPointer() );
250  case 3:
251  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 3 >::New().GetPointer() );
252  case 4:
253  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 4 >::New().GetPointer() );
254  case 5:
255  return dynamic_cast< NDImageBase< TPixel > * >( NDImageTemplate< TPixel, 5 >::New().GetPointer() );
256  //add here more dimensions if needed...
257  // we could do this also with a recursive
258  //template and a #define MAXDIM,
259  // or something like that....
260  default:
261  return 0;
262  }
263 
264 }
265 
266 
267 } // end namespace itk
268 
269 #endif // end #ifndef __itkNDImageBase_h
virtual const OffsetValueType * GetOffsetTable() const =0
virtual AccessorType GetPixelAccessor(void)=0
virtual ImageIOBase * GetImageIOReader(void)=0
virtual void Write(void)=0
virtual PixelContainer * GetPixelContainer()=0
virtual unsigned int GetImageDimension(void)=0
virtual ProcessObject * GetWriter(void)=0
void operator=(const Self &)
virtual const TPixel & GetPixel(const IndexType &index) const =0
Array< PointValueType > PointType
TPixel & operator[](const IndexType &index)
virtual void SetOrigin(const PointType &origin)=0
virtual SpacingType GetSpacing(void)=0
virtual void SetPixel(const IndexType &index, const TPixel &value)=0
virtual void SetImageIOReader(ImageIOBase *_arg)=0
virtual void FillBuffer(const TPixel &value)=0
DataObjectType::Pointer DataObjectPointer
NDImageBase Self
DataObject DataObjectType
ImageBase< 2 >::OffsetValueType OffsetValueType
virtual void SetRequestedRegion(DataObject *data)=0
virtual void SetPixelContainer(PixelContainer *container)=0
virtual TPixel * GetBufferPointer()=0
virtual void Read(void)=0
virtual PointType GetOrigin(void)=0
Image< TPixel, 2 >::PixelContainerConstPointer PixelContainerConstPointer
virtual ~NDImageBase()
virtual void Initialize(void)=0
Array< IndexValueType > IndexType
const TPixel & operator[](const IndexType &index) const
static Pointer NewNDImage(unsigned int dim)
An image whose dimension can be specified at runtime.
Image< TPixel, 2 >::AccessorType AccessorType
Image< TPixel, 2 >::PixelType PixelType
virtual void SetSpacing(const SpacingType &spacing)=0
virtual void SetImageIOWriter(ImageIOBase *_arg)=0
virtual IndexType ComputeIndex(OffsetValueType offset) const =0
ImageBase< 2 >::PointType Point2DType
Array< SizeValueType > SizeType
Array< OffsetValueType > OffsetType
Array< SpacingValueType > SpacingType
Image< TPixel, 2 >::PixelContainerPointer PixelContainerPointer
Point2DType::ValueType PointValueType
virtual ProcessObject * GetReader(void)=0
ImageBase< 2 >::SpacingType Spacing2DType
SmartPointer< Self > Pointer
Spacing2DType::ValueType SpacingValueType
SmartPointer< const Self > ConstPointer
virtual ImageIOBase * GetImageIOWriter(void)=0
ImageBase< 2 >::IndexValueType IndexValueType
ImageBase< 2 >::SizeValueType SizeValueType
virtual DataObject * GetImage(void)=0
virtual void SetRegions(SizeType size)=0
virtual void SetOutputFileName(const char *)=0
virtual const char * GetInputFileName(void)=0
virtual unsigned int ImageDimension(void)=0
virtual void SetInputFileName(const char *)=0
virtual void CopyInformation(const DataObject *data)=0
virtual OffsetValueType ComputeOffset(const IndexType &ind) const =0
virtual const char * GetOutputFileName(void)=0
Image< TPixel, 2 >::InternalPixelType InternalPixelType
Image< TPixel, 2 >::ValueType ValueType
static Pointer New()
virtual void Allocate(void)=0
virtual void CreateNewImage(void)=0
Image< TPixel, 2 >::PixelContainer PixelContainer


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo