Orfeo Toolbox  3.16
itkSpecialCoordinatesImage.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkSpecialCoordinatesImage.h,v $
5  Language: C++
6  Date: $Date: 2009-03-03 15:09:37 $
7  Version: $Revision: 1.18 $
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 __itkSpecialCoordinatesImage_h
18 #define __itkSpecialCoordinatesImage_h
19 
20 #include "itkImageBase.h"
21 #include "itkImageRegion.h"
25 #include "itkPoint.h"
26 #include "itkContinuousIndex.h"
27 #include "itkFixedArray.h"
28 
29 namespace itk
30 {
31 
95 template <class TPixel, unsigned int VImageDimension=2>
96 class ITK_EXPORT SpecialCoordinatesImage : public ImageBase<VImageDimension>
97 {
98 public:
105 
107  itkNewMacro(Self);
108 
111 
114  typedef TPixel PixelType;
115 
117  typedef TPixel ValueType;
118 
123  typedef TPixel InternalPixelType;
124 
126 
130 
135 
140  itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
141 
144 
146  typedef typename Superclass::IndexType IndexType;
147 
149  typedef typename Superclass::OffsetType OffsetType;
150 
152  typedef typename Superclass::SizeType SizeType;
153 
155  typedef typename Superclass::RegionType RegionType;
156 
161  typedef typename Superclass::SpacingType SpacingType;
162 
165  typedef typename Superclass::PointType PointType;
166 
170 
173  void Allocate();
174 
178  void SetRegions(RegionType region)
179  {
180  this->SetLargestPossibleRegion(region);
181  this->SetBufferedRegion(region);
182  this->SetRequestedRegion(region);
183  };
184 
185  void SetRegions(SizeType size)
186  {
187  RegionType region; region.SetSize(size);
188  this->SetLargestPossibleRegion(region);
189  this->SetBufferedRegion(region);
190  this->SetRequestedRegion(region);
191  }
192 
195  virtual void Initialize();
196 
199  void FillBuffer (const TPixel& value);
200 
206  void SetPixel(const IndexType &index, const TPixel& value)
207  {
208  typename Superclass::OffsetValueType offset = this->ComputeOffset(index);
209  (*m_Buffer)[offset] = value;
210  }
211 
216  const TPixel& GetPixel(const IndexType &index) const
217  {
218  typename Superclass::OffsetValueType offset = this->ComputeOffset(index);
219  return ( (*m_Buffer)[offset] );
220  }
221 
226  TPixel& GetPixel(const IndexType &index)
227  {
228  typename Superclass::OffsetValueType offset = this->ComputeOffset(index);
229  return ( (*m_Buffer)[offset] );
230  }
231 
236  TPixel & operator[](const IndexType &index)
237  { return this->GetPixel(index); }
238 
243  const TPixel& operator[](const IndexType &index) const
244  { return this->GetPixel(index); }
245 
248  TPixel *GetBufferPointer()
249  { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; }
250  const TPixel *GetBufferPointer() const
251  { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; }
252 
254  PixelContainer* GetPixelContainer()
255  { return m_Buffer.GetPointer(); }
256 
257  const PixelContainer* GetPixelContainer() const
258  { return m_Buffer.GetPointer(); }
259 
262  void SetPixelContainer( PixelContainer *container );
263 
265  AccessorType GetPixelAccessor( void )
266  { return AccessorType(); }
267 
269  const AccessorType GetPixelAccessor( void ) const
270  { return AccessorType(); }
271 
277  virtual void SetSpacing( const SpacingType &) {}
278  virtual void SetSpacing( const double [VImageDimension] ) {}
279  virtual void SetSpacing( const float [VImageDimension] ) {}
280  virtual void SetOrigin( const PointType ) {}
281  virtual void SetOrigin( const double [VImageDimension] ) {}
282  virtual void SetOrigin( const float [VImageDimension] ) {}
283 
284  /* It is ILLEGAL in C++ to make a templated member function virtual! */
285  /* Therefore, we must just let templates take care of everything. */
286  /*
287  template<class TCoordRep>
288  virtual bool TransformPhysicalPointToContinuousIndex(
289  const Point<TCoordRep, VImageDimension>& point,
290  ContinuousIndex<TCoordRep, VImageDimension>& index ) const = 0;
291 
292  template<class TCoordRep>
293  virtual bool TransformPhysicalPointToIndex(
294  const Point<TCoordRep, VImageDimension>&,
295  IndexType & index ) const = 0;
296 
297  template<class TCoordRep>
298  virtual void TransformContinuousIndexToPhysicalPoint(
299  const ContinuousIndex<TCoordRep, VImageDimension>& index,
300  Point<TCoordRep, VImageDimension>& point ) const = 0;
301 
302  template<class TCoordRep>
303  virtual void TransformIndexToPhysicalPoint(
304  const IndexType & index,
305  Point<TCoordRep, VImageDimension>& point ) const = 0;
306  */
307 
308 protected:
310  void PrintSelf(std::ostream& os, Indent indent) const;
312 private:
313  SpecialCoordinatesImage(const Self&); //purposely not implemented
314  void operator=(const Self&); //purposely not implemented
315 
318 };
319 } // end namespace itk
320 
321 
322 // Define instantiation macro for this template.
323 #define ITK_TEMPLATE_SpecialCoordinatesImage(_, EXPORT, x, y) namespace itk { \
324  _(2(class EXPORT SpecialCoordinatesImage< ITK_TEMPLATE_2 x >)) \
325  namespace Templates { typedef SpecialCoordinatesImage< ITK_TEMPLATE_2 x > \
326  SpecialCoordinatesImage##y; } \
327  }
328 
329 #if ITK_TEMPLATE_EXPLICIT
330 # include "Templates/itkSpecialCoordinatesImage+-.h"
331 #endif
332 
333 #if ITK_TEMPLATE_TXX
335 #endif
336 
337 #endif

Generated at Sun Feb 3 2013 00:08:27 for Orfeo Toolbox with doxygen 1.8.1.1