18#ifndef itkImageHelper_h
19#define itkImageHelper_h
49template <
unsigned int VImageDimension>
52template <
unsigned int VImageDimension,
unsigned int VLoop>
69 static_assert(VLoop <= VImageDimension);
71 if constexpr (VLoop > 1)
73 constexpr unsigned int loopIndex{ VLoop - 1 };
75 index[loopIndex] =
static_cast<IndexValueType>(offset / offsetTable[loopIndex]);
76 offset -= (index[loopIndex] * offsetTable[loopIndex]);
77 index[loopIndex] += bufferedRegionIndex[loopIndex];
82 static_assert(VLoop == 1);
85 index[0] = bufferedRegionIndex[0] +
static_cast<IndexValueType>(offset);
97 static_assert(VLoop <= VImageDimension);
99 if constexpr (VLoop > 1)
101 constexpr unsigned int loopIndex{ VLoop - 1 };
103 offset += (index[loopIndex] - bufferedRegionIndex[loopIndex]) * offsetTable[loopIndex];
108 static_assert(VLoop == 1);
111 offset += index[0] - bufferedRegionIndex[0];
Base class for templated image classes.
Index< VImageDimension > IndexType
Offset< VImageDimension > OffsetType
typename OffsetType::OffsetValueType OffsetValueType
typename IndexType::IndexValueType IndexValueType
Fast Index/Offset computation.
typename ImageType::IndexType IndexType
typename ImageType::OffsetValueType OffsetValueType
static void ComputeIndex(const IndexType &bufferedRegionIndex, OffsetValueType offset, const OffsetValueType offsetTable[], IndexType &index)
typename ImageType::IndexValueType IndexValueType
typename ImageType::OffsetType OffsetType
static void ComputeOffset(const IndexType &bufferedRegionIndex, const IndexType &index, const OffsetValueType offsetTable[], OffsetValueType &offset)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....