The following looks suspicious:
for (unsigned int i = 0; i < nzji.size(); ++i)
{
while (imjacit != imageJacobian.end())
{
*imjacit *= *jacprecit;
++imjacit;
++jacprecit;
}
}
When the while loop is completely processed for the first time, imjacit will be at imageJacobian.end(), so the next for-loop iterations (for i > 0) won't do much anymore.
This very same code is encountered twice in itkParzenWindowMutualInformationImageToImageMetric.hxx, probably copy-and-pasted:
|
for (unsigned int i = 0; i < nzji.size(); ++i) |
|
{ |
|
while (imjacit != imageJacobian.end()) |
|
{ |
|
*imjacit *= *jacprecit; |
|
++imjacit; |
|
++jacprecit; |
|
} |
|
} |
|
for (unsigned int i = 0; i < nzji.size(); ++i) |
|
{ |
|
while (imjacit != imageJacobian.end()) |
|
{ |
|
*imjacit *= *jacprecit; |
|
++imjacit; |
|
++jacprecit; |
|
} |
|
} |
The for-while loop appears introduced by commit 1767cd3, May 22, 2009, at
|
for ( unsigned int i = 0; i < this->m_NonZeroJacobianIndices.size(); ++i ) |
|
while ( imjacit != imageJacobian.end() ) |
|
{ |
|
(*imjacit) *= (*jacprecit); |
|
++imjacit; |
|
++jacprecit; |
|
} |
The following looks suspicious:
When the
whileloop is completely processed for the first time,imjacitwill be atimageJacobian.end(), so the nextfor-loop iterations (for i > 0) won't do much anymore.This very same code is encountered twice in itkParzenWindowMutualInformationImageToImageMetric.hxx, probably copy-and-pasted:
elastix/Components/Metrics/AdvancedMattesMutualInformation/itkParzenWindowMutualInformationImageToImageMetric.hxx
Lines 345 to 353 in 8ae83b8
elastix/Components/Metrics/AdvancedMattesMutualInformation/itkParzenWindowMutualInformationImageToImageMetric.hxx
Lines 490 to 498 in 8ae83b8
The for-while loop appears introduced by commit 1767cd3, May 22, 2009, at
elastix/src/Components/Metrics/AdvancedMattesMutualInformation/itkParzenWindowMutualInformationImageToImageMetric.hxx
Lines 342 to 348 in 1767cd3