diff --git a/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.h b/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.h index d77d1a5324b..91c9be76411 100644 --- a/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.h +++ b/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.h @@ -115,17 +115,6 @@ class ITK_TEMPLATE_EXPORT BSplineInterpolationWeightFunction protected: BSplineInterpolationWeightFunction() = default; ~BSplineInterpolationWeightFunction() override = default; - -private: - /** Lookup table type. */ - using TableType = FixedArray; - - /** Table mapping linear offset to indices. */ - const TableType m_OffsetToIndexTable{ [] { - TableType table; - std::copy_n(ZeroBasedIndexRange(SupportSize).cbegin(), NumberOfWeights, table.begin()); - return table; - }() }; }; } // end namespace itk diff --git a/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.hxx b/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.hxx index 59fc3c8f480..08cbb55af7e 100644 --- a/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.hxx +++ b/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.hxx @@ -47,6 +47,18 @@ BSplineInterpolationWeightFunction::Ev WeightsType & weights, IndexType & startIndex) const { + static constexpr auto offsetToIndexTable = [] { + FixedArray table{}; + auto indexIterator = ZeroBasedIndexRange(SupportSize).cbegin(); + + for (size_t i{}; i < NumberOfWeights; ++i) + { + table[i] = *indexIterator; + ++indexIterator; + } + return table; + }(); + unsigned int j, k; // Find the starting index of the support region @@ -77,7 +89,7 @@ BSplineInterpolationWeightFunction::Ev for (j = 0; j < SpaceDimension; ++j) { - weights[k] *= weights1D[j][m_OffsetToIndexTable[k][j]]; + weights[k] *= weights1D[j][offsetToIndexTable[k][j]]; } } }