Skip to content

Commit

Permalink
STYLE: Prefer itk::Math::abs for consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjmjohnson committed Dec 17, 2021
1 parent 501ffd9 commit 7ad5492
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/itkTileMergeImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ TileMergeImageFilter<TImageType, TPixelAccumulateType, TInterpolator>::ResampleS
for (unsigned d = 0; d < ImageDimension; d++)
{
ContinuousValueType translation = (oOrigin[d] - iOrigin[d]) / spacing[d] + continuousIndexDifferences[t][d];
ContinuousValueType absDiff = std::abs(translation - std::round(translation));
ContinuousValueType absDiff = itk::Math::abs(translation - std::round(translation));
if (absDiff > eps)
{
interpolate = true;
Expand Down
2 changes: 1 addition & 1 deletion include/itkTileMontage.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ TileMontage<TImageType, TCoordinate>::OptimizeTiles()
for (unsigned d = 0; d < ImageDimension; d++)
{
TCoordinate trOverDev = translations(i, d) / stdDev0(d);
outlierScore[i] += std::abs(trOverDev);
outlierScore[i] += itk::Math::abs(trOverDev);
}
if (outlierScore[i] > m_RelativeThreshold) // more than this many standard deviations
{
Expand Down
2 changes: 1 addition & 1 deletion test/itkMontagePCMTestSynthetic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ PhaseCorrelationRegistration(int argc, char * argv[])
// All other parameters must be 0
for (unsigned int i = numberOfParameters; i < VDimension; i++)
{
if ((std::abs(finalParameters[i]) > tolerance) || (std::abs(transformParameters[i]) > tolerance))
if ((itk::Math::abs(finalParameters[i]) > tolerance) || (itk::Math::abs(transformParameters[i]) > tolerance))
{
std::cout << "Tolerance exceeded at component " << i << std::endl;
pass = false;
Expand Down
4 changes: 2 additions & 2 deletions test/itkMontageTestHelper.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ montageTest(const itk::TileConfiguration<Dimension> & stageTiles,
{
registrationErrors << '\t' << (tr[d] - ta[d]);
std::cout << " " << std::setw(8) << std::setprecision(3) << (tr[d] - ta[d]);
singleError += std::abs(tr[d] - ta[d]);
alternativeError += std::abs(avgPos[t][d] - ta[d]);
singleError += itk::Math::abs(tr[d] - ta[d]);
alternativeError += itk::Math::abs(avgPos[t][d] - ta[d]);
}

if (alternativeError >= 5.0 && alternativeError < singleError)
Expand Down
2 changes: 1 addition & 1 deletion test/itkPairwiseTestHelper.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ calculateError(const itk::TileConfiguration<Dimension> &
{
out << '\t' << (tr[d] - ta[d]);
std::cout << " " << std::setw(8) << std::setprecision(8) << (tr[d] - ta[d]);
translationError += std::abs(tr[d] - ta[d]);
translationError += itk::Math::abs(tr[d] - ta[d]);
}
std::cout << std::endl;
out << std::endl;
Expand Down

0 comments on commit 7ad5492

Please sign in to comment.