Skip to content

Commit

Permalink
Merge pull request #1575 from ANTsX/BugKnotSpacing
Browse files Browse the repository at this point in the history
BUG:  Avoid divide by 0.
  • Loading branch information
ntustison authored Jul 26, 2023
2 parents 7627c44 + 97a6b89 commit 3cecf99
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Examples/itkantsRegistrationHelper.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -3712,9 +3712,16 @@ RegistrationHelper<TComputeType, VImageDimension>::CalculateMeshSizeForSpecified

for (unsigned int d = 0; d < ImageDimension; d++)
{
if (itk::Math::FloatAlmostEqual(knotSpacing, itk::NumericTraits<PixelType>::ZeroValue()))
{
meshSize.push_back(itk::NumericTraits<unsigned int>::ZeroValue());
}
else
{
RealType domain = static_cast<RealType>(inputImage->GetLargestPossibleRegion().GetSize()[d] - 1) *
static_cast<RealType>(inputImage->GetSpacing()[d]);
meshSize.push_back(static_cast<unsigned int>(std::ceil(domain / knotSpacing)));
}
// unsigned long extraPadding = static_cast<unsigned long>(
// ( numberOfSpans * splineDistance - domain ) / inputImage->GetSpacing()[d] + 0.5 );
// lowerBound[d] = static_cast<unsigned long>( 0.5 * extraPadding );
Expand Down

0 comments on commit 3cecf99

Please sign in to comment.