Skip to content

Commit

Permalink
BUG: Reduce tolerance for same slice checks
Browse files Browse the repository at this point in the history
The AlmostEquals function fails for slices that are only 1e-15 different
for 1.5mm slices.

The DefaultImageCoordinateTolerance has been determined to be 1e-6.

Using the global default tolerance provides more meaningful default
behaviors.
  • Loading branch information
hjmjohnson committed Nov 17, 2024
1 parent 34e53a8 commit 916a40c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Modules/IO/ImageBase/include/itkImageSeriesReader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "itkMetaDataObject.h"
#include <cstddef> // For ptrdiff_t.
#include <iomanip>
#include "itkImageBase.h"

namespace itk
{
Expand Down Expand Up @@ -432,9 +433,8 @@ ImageSeriesReader<TOutputImage>::GenerateData()
SpacingScalarType dirNnorm = dirN.GetNorm();

if (this->m_SpacingDefined &&
!Math::AlmostEquals(
dirNnorm,
outputSpacing[this->m_NumberOfDimensionsInImage])) // either non-uniform sampling or missing slice
std::abs(dirNnorm - outputSpacing[this->m_NumberOfDimensionsInImage]) >
itk::DefaultImageCoordinateTolerance) // either non-uniform sampling or missing slice
{
nonUniformSampling = true;
spacingDeviation = itk::Math::abs(outputSpacing[this->m_NumberOfDimensionsInImage] - dirNnorm);
Expand Down

0 comments on commit 916a40c

Please sign in to comment.