| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkContinuousIndex.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:34 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 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 __itkContinuousIndex_h |
| 18 |
|
#define __itkContinuousIndex_h |
| 19 |
|
|
| 20 |
|
#include "itkPoint.h" |
| 21 |
|
#include "itkIndex.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
/** \class ContinuousIndex |
| 27 |
|
* \brief A templated class holding a point in n-Dimensional image space. |
| 28 |
|
* |
| 29 |
LEN |
* ContinuousIndex is a templated class that holds a set of coordinates (components). |
| 30 |
|
* The template parameter TCoordRep can |
| 31 |
|
* be any data type that behaves like a primitive (or atomic) data type (int, |
| 32 |
|
* short, float, complex). The VIndexDimension defines the number of |
| 33 |
|
* components in the continous index array. |
| 34 |
|
* |
| 35 |
|
* |
| 36 |
|
* \sa Point |
| 37 |
|
* \sa Index |
| 38 |
|
* |
| 39 |
|
* \ingroup ImageAccess |
| 40 |
|
* \ingroup ImageObjects |
| 41 |
|
* |
| 42 |
|
*/ |
| 43 |
|
|
| 44 |
|
template<class TCoordRep = double, unsigned int VIndexDimension=2> |
| 45 |
|
class ContinuousIndex : public Point< TCoordRep, VIndexDimension > |
| 46 |
|
{ |
| 47 |
|
public: |
| 48 |
|
/** Standard class typedefs. */ |
| 49 |
|
typedef ContinuousIndex Self; |
| 50 |
TDA |
typedef Point<TCoordRep,VIndexDimension> Superclass; |
| 51 |
|
|
| 52 |
|
/** ValueType can be used to declare a variable that is the same type |
| 53 |
|
* as a data element held in an Point. */ |
| 54 |
|
typedef TCoordRep ValueType; |
| 55 |
|
typedef TCoordRep CoordRepType; |
| 56 |
|
|
| 57 |
|
/** Dimension of the Space */ |
| 58 |
|
itkStaticConstMacro(IndexDimension, unsigned int, VIndexDimension); |
| 59 |
|
|
| 60 |
|
/** Corresponding discrete index type */ |
| 61 |
|
typedef Index<VIndexDimension> IndexType; |
| 62 |
|
|
| 63 |
|
/** The Array type from which this Vector is derived. */ |
| 64 |
|
typedef typename Superclass::BaseArray BaseArray; |
| 65 |
|
typedef typename BaseArray::Iterator Iterator; |
| 66 |
|
typedef typename BaseArray::ConstIterator ConstIterator; |
| 67 |
|
|
| 68 |
|
/** Default constructor has nothing to do. */ |
| 69 |
|
ContinuousIndex() {} |
| 70 |
|
|
| 71 |
|
/** Pass-through constructor to the Point base class. */ |
| 72 |
|
ContinuousIndex(const Self& r): Superclass(r) {} |
| 73 |
IND |
// ContinuousIndex(const Superclass& r) : Superclass(r) {} |
| 74 |
|
ContinuousIndex(const ValueType r[IndexDimension]): Superclass(r) {} |
| 75 |
|
|
| 76 |
|
/** Construct from discrete index type */ |
| 77 |
|
ContinuousIndex(const IndexType& index ) |
| 78 |
|
{ |
| 79 |
|
for( unsigned int i = 0; i < VIndexDimension; i++ ) |
| 80 |
|
{ |
| 81 |
|
(*this)[i] = TCoordRep( index[i] ); |
| 82 |
|
} |
| 83 |
|
} |
| 84 |
|
}; |
| 85 |
|
|
| 86 |
|
|
| 87 |
EML |
|
| 88 |
|
} // namespace itk |
| 89 |
|
|
| 90 |
|
#endif |
| 91 |
|
|