Skip to content

Commit a31e8bf

Browse files
jhlegarretadzenanz
authored andcommitted
BUG: Fix uninitialized value ImageRegistrationMethodv4::m_NumberOfLevels
Fix uninitialized value warning for `itk::ImageRegistrationMethodv4::m_NumberOfLevels`. Fixes: ``` UMC ==16463== Conditional jump or move depends on uninitialised value(s) ==16463== at 0x9BD983: itk::ImageRegistrationMethodv4, itk::Image, itk::DisplacementFieldTransform, itk::Image, itk::PointSet > >::SetNumberOfLevels(unsigned long) (itkImageRegistrationMethodv4.hxx:881) ==16463== by 0x9C44B6: itk::ImageRegistrationMethodv4, itk::Image, itk::DisplacementFieldTransform, itk::Image, itk::PointSet > >::ImageRegistrationMethodv4() (itkImageRegistrationMethodv4.hxx:103) ==16463== by 0x9BBFA0: itk::SyNImageRegistrationMethod, itk::Image, itk::DisplacementFieldTransform, itk::Image, itk::PointSet > >::SyNImageRegistrationMethod() (itkSyNImageRegistrationMethod.hxx:41) ==16463== by 0x9B5974: itk::SyNImageRegistrationMethod, itk::Image, itk::DisplacementFieldTransform, itk::Image, itk::PointSet > >::New() (itkSyNImageRegistrationMethod.h:84) ==16463== by 0xA15CD4: itkSyNPointSetRegistrationTest(int, char**) (itkSyNPointSetRegistrationTest.cxx:132) ==16463== by 0x317927: main (ITKRegistrationMethodsv4TestDriver.cxx:222) ``` and similar warnings triggered by registration testing code. Visible in: https://open.cdash.org/viewDynamicAnalysis.php?buildid=8374098 Introduced in d1c46d6. Recover the comment highlighting the initialization to a 3-level registration, and reword to make the need for the call (with a value different from the current value) even more explicit.
1 parent e528a89 commit a31e8bf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ class ITK_TEMPLATE_EXPORT ImageRegistrationMethodv4 : public ProcessObject
532532
SetMetricSamplePoints();
533533

534534
SizeValueType m_CurrentLevel;
535-
SizeValueType m_NumberOfLevels;
535+
SizeValueType m_NumberOfLevels{ 0 };
536536
SizeValueType m_CurrentIteration;
537537
RealType m_CurrentMetricValue;
538538
RealType m_CurrentConvergenceValue;

Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ ImageRegistrationMethodv4<TFixedImage, TMovingImage, TTransform, TVirtualImage,
9999
this->ProcessObject::SetNthOutput(0, transformDecorator);
100100
this->m_OutputTransform = transformDecorator->GetModifiable();
101101

102-
// By default we set up a 3-level image registration.
102+
// Default to a 3-level image registration: force the initialization of the ivars that depend on the number of levels.
103103
this->SetNumberOfLevels(3);
104104

105105
this->m_ShrinkFactorsPerLevel.resize(this->m_NumberOfLevels);

0 commit comments

Comments
 (0)