18 #ifndef itkImageHelper_h
19 #define itkImageHelper_h
49 template <
unsigned int VImageDimension>
52 template <
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];