Orfeo Toolbox  3.16
itkImage.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkImage.h,v $
5  Language: C++
6  Date: $Date: 2010-04-09 23:22:45 $
7  Version: $Revision: 1.152 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkImage_h
18 #define __itkImage_h
19 
20 #include "itkImageBase.h"
21 #include "itkImageRegion.h"
25 #include "itkPoint.h"
26 #include "itkFixedArray.h"
27 #include "itkWeakPointer.h"
29 
30 namespace itk
31 {
80 template <class TPixel, unsigned int VImageDimension=2>
81 class ITK_EXPORT Image : public ImageBase<VImageDimension>
82 {
83 public:
85  typedef Image Self;
90 
92  itkNewMacro(Self);
93 
95  itkTypeMacro(Image, ImageBase);
96 
99  typedef TPixel PixelType;
100 
102  typedef TPixel ValueType;
103 
108  typedef TPixel InternalPixelType;
109 
111 
116 
120 
125  itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
126 
129 
131  typedef typename Superclass::IndexType IndexType;
132  typedef typename Superclass::IndexValueType IndexValueType;
133 
135  typedef typename Superclass::OffsetType OffsetType;
136 
138  typedef typename Superclass::SizeType SizeType;
139  typedef typename Superclass::SizeValueType SizeValueType;
140 
142  typedef typename Superclass::DirectionType DirectionType;
143 
145  typedef typename Superclass::RegionType RegionType;
146 
149  typedef typename Superclass::SpacingType SpacingType;
150 
153  typedef typename Superclass::PointType PointType;
154 
158 
160  typedef typename Superclass::OffsetValueType OffsetValueType;
161 
164  void Allocate();
165 
169  void SetRegions(RegionType region)
170  {
171  this->SetLargestPossibleRegion(region);
172  this->SetBufferedRegion(region);
173  this->SetRequestedRegion(region);
174  };
175 
176  void SetRegions(SizeType size)
177  {
178  RegionType region; region.SetSize(size);
179  this->SetLargestPossibleRegion(region);
180  this->SetBufferedRegion(region);
181  this->SetRequestedRegion(region);
182  }
183 
186  virtual void Initialize();
187 
190  void FillBuffer (const TPixel& value);
191 
197  void SetPixel(const IndexType &index, const TPixel& value)
198  {
199  typename Superclass::OffsetValueType offset = this->ComputeOffset(index);
200  (*m_Buffer)[offset] = value;
201  }
202 
207  const TPixel& GetPixel(const IndexType &index) const
208  {
209  typename Superclass::OffsetValueType offset = this->ComputeOffset(index);
210  return ( (*m_Buffer)[offset] );
211  }
212 
217  TPixel& GetPixel(const IndexType &index)
218  {
219  typename Superclass::OffsetValueType offset = this->ComputeOffset(index);
220  return ( (*m_Buffer)[offset] );
221  }
222 
227  TPixel & operator[](const IndexType &index)
228  { return this->GetPixel(index); }
229 
234  const TPixel& operator[](const IndexType &index) const
235  { return this->GetPixel(index); }
236 
239  TPixel *GetBufferPointer()
240  { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; }
241  const TPixel *GetBufferPointer() const
242  { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; }
243 
245  PixelContainer* GetPixelContainer()
246  { return m_Buffer.GetPointer(); }
247 
248  const PixelContainer* GetPixelContainer() const
249  { return m_Buffer.GetPointer(); }
250 
253  void SetPixelContainer( PixelContainer *container );
254 
265  virtual void Graft(const DataObject *data);
266 
267 
269  AccessorType GetPixelAccessor( void )
270  { return AccessorType(); }
271 
273  const AccessorType GetPixelAccessor( void ) const
274  { return AccessorType(); }
275 
277  NeighborhoodAccessorFunctorType GetNeighborhoodAccessor()
278  { return NeighborhoodAccessorFunctorType(); }
279 
281  const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const
282  { return NeighborhoodAccessorFunctorType(); }
283 
284 protected:
285  Image();
286  void PrintSelf(std::ostream& os, Indent indent) const;
287  virtual ~Image() {}
288 
294  virtual void ComputeIndexToPhysicalPointMatrices();
295 
296 private:
297  Image(const Self&); //purposely not implemented
298  void operator=(const Self&); //purposely not implemented
299 
302 
303 };
304 
305 } // end namespace itk
306 
307 // Define instantiation macro for this template.
308 #define ITK_TEMPLATE_Image(_, EXPORT, x, y) namespace itk { \
309  _(2(class EXPORT Image< ITK_TEMPLATE_2 x >)) \
310  namespace Templates { typedef Image< ITK_TEMPLATE_2 x > Image##y; } \
311  }
312 
313 #if ITK_TEMPLATE_EXPLICIT
314 # include "Templates/itkImage+-.h"
315 #endif
316 
317 #if ITK_TEMPLATE_TXX
318 # include "itkImage.txx"
319 #endif
320 
321 #endif

Generated at Sat Feb 2 2013 23:42:32 for Orfeo Toolbox with doxygen 1.8.1.1