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  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 
15 #ifndef __itkNDImageTemplate_h
16 #define __itkNDImageTemplate_h
17 
18 #include "itkNDImageBase.h"
19 #include "itkImageFileReader.h"
20 
21 
22 namespace itk
23 {
24 
42  template < class TPixel, unsigned int VDimension >
43  class NDImageTemplate : public NDImageBase<TPixel>
44  {
45  public:
46 
50  typedef SmartPointer<Self> Pointer;
51  typedef SmartPointer<const Self> ConstPointer;
52 
54  itkNewMacro( Self );
55 
57  itkTypeMacro( NDImageTemplate, NDImageBase );
58 
63  itkStaticConstMacro(Dimension, unsigned int, VDimension);
64 
67 
69  typedef typename Superclass::PixelType PixelType;
70  typedef typename Superclass::ValueType ValueType;
76 
82 
84  typedef typename Superclass::IndexType IndexType;
85  typedef typename Superclass::SizeType SizeType;
87  typedef typename Superclass::PointType PointType;
89 
91  typedef Image<TPixel, VDimension> ImageType;
92  typedef typename ImageType::Pointer ImagePointer;
94  typedef typename WriterType::Pointer WriterPointer;
95  typedef ImageFileReader<ImageType> ReaderType;
96  typedef typename ReaderType::Pointer ReaderPointer;
97 
99  typedef typename ImageType::IndexType IndexTypeD;
100  typedef typename ImageType::SizeType SizeTypeD;
101  typedef typename ImageType::SpacingType SpacingTypeD;
102  typedef typename ImageType::PointType PointTypeD;
103  typedef typename ImageType::OffsetType OffsetTypeD;
104 
105  virtual void SetRegions(SizeType size);
106  virtual void SetRequestedRegion(DataObject *data);
107 
108  virtual void Allocate(void);
109  virtual void Initialize(void);
110 
111  virtual void FillBuffer (const TPixel& value);
112 
113  virtual void SetPixel(const IndexType &index, const TPixel& value);
114  virtual const TPixel& GetPixel(const IndexType &index) const;
115  virtual TPixel& GetPixel(const IndexType &index);
116 
117  virtual TPixel *GetBufferPointer();
118  virtual const TPixel *GetBufferPointer() const;
120  virtual const PixelContainer* GetPixelContainer() const;
121  virtual void SetPixelContainer( PixelContainer *container );
122 
123  virtual AccessorType GetPixelAccessor( void );
124  virtual const AccessorType GetPixelAccessor( void ) const;
125 
126 
127  virtual void SetSpacing( const SpacingType & spacing );
128  virtual void SetOrigin( const PointType & origin );
129  virtual SpacingType GetSpacing(void);
130  virtual PointType GetOrigin(void);
131 
134  virtual void CopyInformation(const DataObject *data);
135  virtual const OffsetValueType *GetOffsetTable() const;
136  virtual OffsetValueType ComputeOffset(const IndexType &ind) const;
137  virtual IndexType ComputeIndex(OffsetValueType offset) const;
138 
142  virtual unsigned int ImageDimension(void);
143  virtual unsigned int GetImageDimension(void);
144 
146  itkGetObjectMacro(Image, DataObject);
147  itkGetObjectMacro(Writer, ProcessObject);
148  itkGetObjectMacro(Reader, ProcessObject);
149 
151  virtual void Write(void);
152 
154  virtual void Read(void);
155 
157  virtual void CreateNewImage(void);
158 
159  virtual void SetImageIOWriter (ImageIOBase *_arg);
160  virtual ImageIOBase * GetImageIOWriter(void);
161  virtual void SetImageIOReader (ImageIOBase *_arg);
162  virtual ImageIOBase * GetImageIOReader(void);
163 
165  virtual void SetOutputFileName(const char * name );
166  virtual void SetInputFileName(const char * name );
167  virtual const char * GetOutputFileName(void);
168  virtual const char * GetInputFileName(void);
169 
170  protected:
171 
172  NDImageTemplate();
173  virtual ~NDImageTemplate(){};
174 
175  //virtual void PrintSelf(std::ostream& os, Indent indent) const;
176 
180 
181 
182  template <class TIn, class TOut>
183  class ConvertToDynamicArray
184  {
185  public:
186  inline static TOut DO(const TIn & in)
187  {
188  TOut out(VDimension);
189 
190  for (unsigned int i=0; i< VDimension; i++)
191  {
192  out[i] = in[i];
193  }
194  return out;
195  }
196  };
197 
198 
199  template <class TIn, class TOut>
200  class ConvertToStaticArray
201  {
202  public:
203  inline static TOut DO(const TIn & in)
204  {
205  TOut out;
206 
207  for (unsigned int i=0; i< VDimension; i++)
208  {
209  out[i] = in[i];
210  }
211  return out;
212  }
213  };
214 
215 
216  private:
217 
218  NDImageTemplate( const Self& ); // purposely not implemented
219  void operator=( const Self& ); // purposely not implemented
220 
221 
222 
223  }; // end class NDImageTemplate
224 
225 
226 } // end namespace itk
227 
228 #ifndef ITK_MANUAL_INSTANTIATION
229 #include "itkNDImageTemplate.hxx"
230 #endif
231 
232 #endif // end #ifndef __itkNDImageTemplate_h
233 


Generated on 27-06-2013 for elastix by doxygen 1.8.3.1 elastix logo