31 template<
unsigned int VIndexDimension >
70 template<
unsigned int VIndexDimension = 2 >
82 itkStaticConstMacro(Dimension,
unsigned int, VIndexDimension);
103 for (
unsigned int i = 0; i < VIndexDimension; i++ )
104 { result[i] = m_Index[i] +
static_cast< IndexValueType
>( size[i] ); }
112 for (
unsigned int i = 0; i < VIndexDimension; i++ )
113 { m_Index[i] +=
static_cast< IndexValueType
>( size[i] ); }
125 for (
unsigned int i = 0; i < VIndexDimension; i++ )
126 { result[i] = m_Index[i] -
static_cast< IndexValueType
>( size[i] ); }
134 for (
unsigned int i = 0; i < VIndexDimension; i++ )
135 { m_Index[i] -=
static_cast< IndexValueType
>( size[i] ); }
146 for (
unsigned int i = 0; i < VIndexDimension; i++ )
147 { result[i] = m_Index[i] + offset[i]; }
155 for (
unsigned int i = 0; i < VIndexDimension; i++ )
156 { m_Index[i] += offset[i]; }
165 for (
unsigned int i = 0; i < VIndexDimension; i++ )
166 { m_Index[i] -= offset[i]; }
177 for (
unsigned int i = 0; i < VIndexDimension; i++ )
178 { result[i] = m_Index[i] - off.
m_Offset[i]; }
188 for (
unsigned int i = 0; i < VIndexDimension; i++ )
189 { result[i] = m_Index[i] - vec.
m_Index[i]; }
200 for (
unsigned int i = 0; i < VIndexDimension; i++ )
201 { result[i] = m_Index[i] *
static_cast< IndexValueType
>( vec.
m_Size[i] ); }
211 for (
unsigned int i = 0; i < VIndexDimension && same; i++ )
212 { same = ( m_Index[i] == vec.
m_Index[i] ); }
222 for (
unsigned int i = 0; i < VIndexDimension && same; i++ )
223 { same = ( m_Index[i] == vec.
m_Index[i] ); }
228 #if defined( __GNUC__ ) 229 #if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 9 ) 230 #pragma GCC diagnostic push 231 #pragma GCC diagnostic ignored "-Warray-bounds" 240 #if defined( __GNUC__ ) 241 #if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 9 ) 242 #pragma GCC diagnostic pop 250 {
return m_Index[dim]; }
254 const IndexValueType *
GetIndex()
const {
return m_Index; }
260 void SetIndex(
const IndexValueType val[VIndexDimension])
274 { m_Index[element] = val; }
283 {
return m_Index[element]; }
288 static Self GetBasisIndex(
unsigned int dim);
292 void Fill(IndexValueType value)
293 {
for (
unsigned int i = 0; i < VIndexDimension; ++i ) { m_Index[i] = value; } }
300 IndexValueType m_Index[VIndexDimension];
303 template<
typename TCoordRep >
306 itkForLoopRoundingAndAssignmentMacro(IndexType,
323 template<
typename TCoordRep >
326 for (
unsigned int i = 0; i < VIndexDimension; ++i )
328 m_Index[i] =
static_cast< IndexValueType
>( point[i] );
335 #if defined( ITK_WRAPPING_PARSER ) 336 Index() ITK_DELETE_FUNCTION;
337 Index(
const Self &) ITK_DELETE_FUNCTION;
338 void operator=(
const Self &) ITK_DELETE_FUNCTION;
353 template<
unsigned int VIndexDimension >
354 class IndexLexicographicCompare
360 for (
unsigned int i = 0; i < VIndexDimension; ++i )
376 template<
unsigned int VIndexDimension >
388 template<
unsigned int VIndexDimension >
389 std::ostream & operator<<(std::ostream & os, const Index< VIndexDimension > & ind)
392 for (
unsigned int i = 0; i + 1 < VIndexDimension; ++i )
394 os << ind[i] <<
", ";
396 if ( VIndexDimension >= 1 )
398 os << ind[VIndexDimension - 1];
bool operator()(Index< VIndexDimension > const &l, Index< VIndexDimension > const &r) const
const IndexValueType * GetIndex() const
OffsetValueType m_Offset[VOffsetDimension]
const Self & operator-=(const OffsetType &offset)
const Self operator-(const OffsetType &off) const
IndexValueType & operator[](unsigned int dim)
Represent the offset between two n-dimensional indexes in a n-dimensional image.
bool operator!=(const Self &vec) const
IndexValueType m_Index[VIndexDimension]
Represent the size (bounds) of a n-dimensional image.
Size< VIndexDimension > SizeType
signed long OffsetValueType
signed long IndexValueType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
const OffsetType operator-(const Self &vec) const
Order Index instances lexicographically.
Index< VIndexDimension > IndexType
Offset< VIndexDimension > OffsetType
void CopyWithRound(const FixedArray< TCoordRep, VIndexDimension > &point)
Simulate a standard C array with copy semnatics.
static Self GetBasisIndex(unsigned int dim)
::itk::IndexValueType IndexValueType
const Self & operator+=(const OffsetType &offset)
bool operator==(const Self &vec) const
static unsigned int GetIndexDimension()
void Fill(IndexValueType value)
const Self operator*(const SizeType &vec) const
SizeValueType m_Size[VDimension]
const Self operator+(const SizeType &size) const
const Self operator+(const OffsetType &offset) const
void CopyWithCast(const FixedArray< TCoordRep, VIndexDimension > &point)
const Self operator-(const SizeType &size) const
const Self & operator-=(const SizeType &size)
Functor::IndexLexicographicCompare< VIndexDimension > LexicographicCompare
void SetElement(unsigned long element, IndexValueType val)
const Self & operator+=(const SizeType &size)
IndexValueType GetElement(unsigned long element) const
Represent a n-dimensional index in a n-dimensional image.
::itk::OffsetValueType OffsetValueType
void SetIndex(const IndexValueType val[VIndexDimension])
IndexValueType operator[](unsigned int dim) const