Skip to content

Commit

Permalink
BUG: Replace Math::Round with std::round for double-to-double rounding
Browse files Browse the repository at this point in the history
According to https://github.com/InsightSoftwareConsortium/ITK/blob/66ab5b14c476d057ed46a4daba05b710681160e6/Modules/Core/Common/include/itkMath.h#L127 the `TReturn` template argument of `Math::Round` must be an integer type. For double-to-double rounding, a call to `std::round` is preferred.
  • Loading branch information
N-Dekker committed Jan 19, 2024
1 parent 5962579 commit 217a07c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Core/ComponentBaseClasses/elxOptimizerBase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "itkSingleValuedNonLinearOptimizer.h"
#include "itk_zlib.h"
#include <cmath> // For round.

namespace elastix
{
Expand Down Expand Up @@ -83,7 +84,7 @@ OptimizerBase<TElastix>::AfterRegistrationBase()
ParametersType roundedTP(N);
for (unsigned int i = 0; i < N; ++i)
{
roundedTP[i] = itk::Math::Round<ParametersValueType>(finalTP[i] * 1.0e6);
roundedTP[i] = std::round(finalTP[i] * 1.0e6);
}

/** Compute the crc checksum using zlib crc32 function. */
Expand Down

0 comments on commit 217a07c

Please sign in to comment.