Skip to content

Commit

Permalink
BUG: Fix uninitialized variable use in ANTS neighborhood correlatio…
Browse files Browse the repository at this point in the history
…n metric

Fix uninitialized variable use in `ANTS` neighborhood correlation metric:
ensure that `fixedImageGradient` and `movingImageGradient` have valid
values before assigning them to the `scanMem` struct that scans over
images.

Fixes:
```
Run-Time Check Failure #3 - The variable 'fixedImageGradient' is being
used without being initialized.
```

The bug was affecting a number of tests in the
`ITKRegistrationMethodsv4Test` module.

Signaled at
https://open.cdash.org/viewTest.php?onlyfailed&buildid=7067466
and
https://open.cdash.org/viewTest.php?onlyfailed&buildid=7069241
  • Loading branch information
jhlegarreta committed Feb 28, 2021
1 parent d8f088f commit 72ea1f2
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,14 @@ ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<
scanMem.sFixedFixed = sFixedFixed;
scanMem.sMovingMoving = sMovingMoving;

scanMem.fixedImageGradient = fixedImageGradient;
scanMem.movingImageGradient = movingImageGradient;
if (this->m_ANTSAssociate->GetComputeDerivative() && this->m_ANTSAssociate->GetGradientSourceIncludesFixed())
{
scanMem.fixedImageGradient = fixedImageGradient;
}
if (this->m_ANTSAssociate->GetComputeDerivative() && this->m_ANTSAssociate->GetGradientSourceIncludesMoving())
{
scanMem.movingImageGradient = movingImageGradient;
}

scanMem.mappedFixedPoint = mappedFixedPoint;
scanMem.mappedMovingPoint = mappedMovingPoint;
Expand Down

0 comments on commit 72ea1f2

Please sign in to comment.