Skip to content

Commit

Permalink
STYLE: Remove & from LinearInterpolateImageFunction distance variables
Browse files Browse the repository at this point in the history
There appear no need to avoid copying expressions like

    index[i] - static_cast<InternalComputationType>(basei[i])

So it appears unnecessary to bind such expression to a reference. It's simpler
to just copy such an expression.
  • Loading branch information
N-Dekker authored and hjmjohnson committed Mar 6, 2024
1 parent b914646 commit 876da25
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class ITK_TEMPLATE_EXPORT LinearInterpolateImageFunction : public InterpolateIma
IndexType basei;
basei[0] = std::max(Math::Floor<IndexValueType>(index[0]), this->m_StartIndex[0]);

const InternalComputationType & distance = index[0] - static_cast<InternalComputationType>(basei[0]);
const InternalComputationType distance = index[0] - static_cast<InternalComputationType>(basei[0]);

const TInputImage * const inputImagePtr = this->GetInputImage();
const RealType & val0 = inputImagePtr->GetPixel(basei);
Expand All @@ -160,10 +160,10 @@ class ITK_TEMPLATE_EXPORT LinearInterpolateImageFunction : public InterpolateIma
IndexType basei;

basei[0] = std::max(Math::Floor<IndexValueType>(index[0]), this->m_StartIndex[0]);
const InternalComputationType & distance0 = index[0] - static_cast<InternalComputationType>(basei[0]);
const InternalComputationType distance0 = index[0] - static_cast<InternalComputationType>(basei[0]);

basei[1] = std::max(Math::Floor<IndexValueType>(index[1]), this->m_StartIndex[1]);
const InternalComputationType & distance1 = index[1] - static_cast<InternalComputationType>(basei[1]);
const InternalComputationType distance1 = index[1] - static_cast<InternalComputationType>(basei[1]);

const TInputImage * const inputImagePtr = this->GetInputImage();
const RealType & val00 = inputImagePtr->GetPixel(basei);
Expand Down Expand Up @@ -228,13 +228,13 @@ class ITK_TEMPLATE_EXPORT LinearInterpolateImageFunction : public InterpolateIma
{
IndexType basei;
basei[0] = std::max(Math::Floor<IndexValueType>(index[0]), this->m_StartIndex[0]);
const InternalComputationType & distance0 = index[0] - static_cast<InternalComputationType>(basei[0]);
const InternalComputationType distance0 = index[0] - static_cast<InternalComputationType>(basei[0]);

basei[1] = std::max(Math::Floor<IndexValueType>(index[1]), this->m_StartIndex[1]);
const InternalComputationType & distance1 = index[1] - static_cast<InternalComputationType>(basei[1]);
const InternalComputationType distance1 = index[1] - static_cast<InternalComputationType>(basei[1]);

basei[2] = std::max(Math::Floor<IndexValueType>(index[2]), this->m_StartIndex[2]);
const InternalComputationType & distance2 = index[2] - static_cast<InternalComputationType>(basei[2]);
const InternalComputationType distance2 = index[2] - static_cast<InternalComputationType>(basei[2]);

const TInputImage * const inputImagePtr = this->GetInputImage();
const RealType & val000 = inputImagePtr->GetPixel(basei);
Expand Down

0 comments on commit 876da25

Please sign in to comment.