NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkImageAndArray.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkImageAndArray_h
16 #define itkImageAndArray_h
17 
18 #include <itkImage.h>
19 #include <itkArray.h>
20 
21 
22 namespace itk
23 {
31 template <class TPixel, unsigned int VImageDimension=2>
32 class ITK_EXPORT ImageAndArray : public Image<TPixel, VImageDimension>, public Array<TPixel>
33 {
34 public:
38  typedef SmartPointer<Self> Pointer;
39  typedef SmartPointer<const Self> ConstPointer;
40  typedef WeakPointer<const Self> ConstWeakPointer;
41 
43  itkNewMacro(Self);
44 
46  itkTypeMacro(ImageAndArray, Image);
47 
50  typedef TPixel PixelType;
51 
53  typedef TPixel ValueType;
54 
59  typedef TPixel InternalPixelType;
60 
61  typedef PixelType IOPixelType;
62 
65  typedef DefaultPixelAccessor< PixelType > AccessorType;
66  typedef DefaultPixelAccessorFunctor< Self > AccessorFunctorType;
67 
70  typedef NeighborhoodAccessorFunctor< Self > NeighborhoodAccessorFunctorType;
71 
76  itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
77 
79  typedef ImportImageContainer<unsigned long, PixelType> PixelContainer;
80 
82  typedef typename Superclass::IndexType IndexType;
83  typedef typename Superclass::IndexValueType IndexValueType;
84 
86  typedef typename Superclass::OffsetType OffsetType;
87 
89  typedef typename Superclass::SizeType SizeType;
90  typedef typename Superclass::SizeValueType SizeValueType;
91 
93  typedef typename Superclass::DirectionType DirectionType;
94 
97 
100  typedef typename Superclass::SpacingType SpacingType;
101 
104  typedef typename Superclass::PointType PointType;
105 
107  typedef typename PixelContainer::Pointer PixelContainerPointer;
108  typedef typename PixelContainer::ConstPointer PixelContainerConstPointer;
109 
111  typedef typename Superclass::OffsetValueType OffsetValueType;
112 
115  virtual void Initialize();
116 
119  virtual void SynchronizeArray();
120 
125  TPixel & operator[](const IndexType &index)
126  { return this->Image<TPixel, VImageDimension>::GetPixel(index); }
127 
132  const TPixel& operator[](const IndexType &index) const
133  { return this->Image<TPixel, VImageDimension>::GetPixel(index); }
134 
135 
136 protected:
137  ImageAndArray();
138  void PrintSelf(std::ostream& os, Indent indent) const;
139  virtual ~ImageAndArray() {};
140 
141 
142 private:
143  ImageAndArray(const Self&); //purposely not implemented
144  void operator=(const Self&); //purposely not implemented
145 
146 };
147 
148 } // end namespace itk
149 
150 // Define instantiation macro for this template.
151 #define ITK_TEMPLATE_ImageAndArray(_, EXPORT, x, y) namespace itk { \
152  _(2(class EXPORT ImageAndArray< ITK_TEMPLATE_2 x >)) \
153  namespace Templates { typedef ImageAndArray< ITK_TEMPLATE_2 x > ImageAndArray##y; } \
154  }
155 
156 #if ITK_TEMPLATE_EXPLICIT
157 # include "Templates/itkImageAndArray+-.h"
158 #endif
159 
160 #if ITK_TEMPLATE_TXX
161 # include "itkImageAndArray.txx"
162 #endif
163 
164 #endif
Superclass::OffsetType OffsetType
Definition: itkImageAndArray.h:86
ImageType::SizeType SizeType
Definition: niftkMakeLapUSProbeBasicModel.cxx:31
Superclass::SpacingType SpacingType
Definition: itkImageAndArray.h:100
Definition: itkImageAndArray.h:32
TPixel PixelType
Definition: itkImageAndArray.h:46
WeakPointer< const Self > ConstWeakPointer
Definition: itkImageAndArray.h:40
Image< TPixel, VImageDimension > Superclass
Definition: itkImageAndArray.h:37
Definition: niftkITKAffineResampleImage.cxx:74
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
Superclass::OffsetValueType OffsetValueType
Definition: itkImageAndArray.h:111
Superclass::DirectionType DirectionType
Definition: itkImageAndArray.h:93
Superclass::IndexValueType IndexValueType
Definition: itkImageAndArray.h:83
const TPixel & operator[](const IndexType &index) const
Access a pixel. This version can only be an rvalue.
Definition: itkImageAndArray.h:132
virtual ~ImageAndArray()
Definition: itkImageAndArray.h:139
Superclass::IndexType IndexType
Definition: itkImageAndArray.h:82
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
PixelContainer::ConstPointer PixelContainerConstPointer
Definition: itkImageAndArray.h:108
Superclass::SizeValueType SizeValueType
Definition: itkImageAndArray.h:90
DefaultPixelAccessor< PixelType > AccessorType
Definition: itkImageAndArray.h:65
Superclass::RegionType RegionType
Definition: itkImageAndArray.h:96
GLuint index
Definition: glew.h:1798
ImportImageContainer< unsigned long, PixelType > PixelContainer
Definition: itkImageAndArray.h:79
ImageAndArray Self
Definition: itkImageAndArray.h:36
PixelType IOPixelType
Definition: itkImageAndArray.h:61
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
SmartPointer< Self > Pointer
Definition: itkImageAndArray.h:38
TPixel & operator[](const IndexType &index)
Access a pixel. This version can be an lvalue.
Definition: itkImageAndArray.h:125
Superclass::SizeType SizeType
Definition: itkImageAndArray.h:89
NeighborhoodAccessorFunctor< Self > NeighborhoodAccessorFunctorType
Definition: itkImageAndArray.h:70
SmartPointer< const Self > ConstPointer
Definition: itkImageAndArray.h:39
TPixel ValueType
Definition: itkImageAndArray.h:53
DefaultPixelAccessorFunctor< Self > AccessorFunctorType
Definition: itkImageAndArray.h:66
TPixel InternalPixelType
Definition: itkImageAndArray.h:59
Superclass::PointType PointType
Definition: itkImageAndArray.h:104
PixelContainer::Pointer PixelContainerPointer
Definition: itkImageAndArray.h:107