Orfeo Toolbox  4.0
itkSpecialCoordinatesImage.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 #ifndef __itkSpecialCoordinatesImage_h
19 #define __itkSpecialCoordinatesImage_h
20 
21 #include "itkImageBase.h"
25 #include "itkContinuousIndex.h"
26 
27 namespace itk
28 {
94 template< typename TPixel, unsigned int VImageDimension = 2 >
95 class SpecialCoordinatesImage:public ImageBase< VImageDimension >
96 {
97 public:
104 
106  itkNewMacro(Self);
107 
110 
113  typedef TPixel PixelType;
114 
116  typedef TPixel ValueType;
117 
122  typedef TPixel InternalPixelType;
123 
125 
129 
134 
139  itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
140 
143 
146 
148  typedef typename Superclass::SizeType SizeType;
149 
152 
156 
162 
166 
170 
173  void Allocate();
174 
177  virtual void Initialize();
178 
181  void FillBuffer(const TPixel & value);
182 
188  void SetPixel(const IndexType & index, const TPixel & value)
189  {
190  OffsetValueType offset = this->ComputeOffset(index);
191  ( *m_Buffer )[offset] = value;
192  }
193 
198  const TPixel & GetPixel(const IndexType & index) const
199  {
200  OffsetValueType offset = this->ComputeOffset(index);
201  return ( ( *m_Buffer )[offset] );
202  }
203 
208  TPixel & GetPixel(const IndexType & index)
209  {
210  OffsetValueType offset = this->ComputeOffset(index);
211  return ( ( *m_Buffer )[offset] );
212  }
213 
218  TPixel & operator[](const IndexType & index) { return this->GetPixel(index); }
219 
224  const TPixel & operator[](const IndexType & index) const { return this->GetPixel(index); }
225 
228  TPixel * GetBufferPointer() { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; }
229  const TPixel * GetBufferPointer() const { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; }
230 
233 
234  const PixelContainer * GetPixelContainer() const { return m_Buffer.GetPointer(); }
235 
238  void SetPixelContainer(PixelContainer *container);
239 
242 
244  const AccessorType GetPixelAccessor(void) const { return AccessorType(); }
245 
251  virtual void SetSpacing(const SpacingType &) {}
252  virtual void SetSpacing(const double[VImageDimension]) {}
253  virtual void SetSpacing(const float[VImageDimension]) {}
254  virtual void SetOrigin(const PointType) {}
255  virtual void SetOrigin(const double[VImageDimension]) {}
256  virtual void SetOrigin(const float[VImageDimension]) {}
257 
258  /* It is ILLEGAL in C++ to make a templated member function virtual! */
259  /* Therefore, we must just let templates take care of everything. */
260  /*
261  template<typename TCoordRep>
262  virtual bool TransformPhysicalPointToContinuousIndex(
263  const Point<TCoordRep, VImageDimension>& point,
264  ContinuousIndex<TCoordRep, VImageDimension>& index ) const = 0;
265 
266  template<typename TCoordRep>
267  virtual bool TransformPhysicalPointToIndex(
268  const Point<TCoordRep, VImageDimension>&,
269  IndexType & index ) const = 0;
270 
271  template<typename TCoordRep>
272  virtual void TransformContinuousIndexToPhysicalPoint(
273  const ContinuousIndex<TCoordRep, VImageDimension>& index,
274  Point<TCoordRep, VImageDimension>& point ) const = 0;
275 
276  template<typename TCoordRep>
277  virtual void TransformIndexToPhysicalPoint(
278  const IndexType & index,
279  Point<TCoordRep, VImageDimension>& point ) const = 0;
280  */
281 
282 protected:
284  void PrintSelf(std::ostream & os, Indent indent) const;
285 
287 
288 private:
289  SpecialCoordinatesImage(const Self &); //purposely not implemented
290  void operator=(const Self &); //purposely not implemented
291 
294 };
295 } // end namespace itk
296 
297 #ifndef ITK_MANUAL_INSTANTIATION
299 #endif
300 
301 #endif

Generated at Sat Mar 8 2014 15:35:00 for Orfeo Toolbox with doxygen 1.8.3.1