ITK icon indicating copy to clipboard operation
ITK copied to clipboard

MattesMutualInformationv4 throws exception when fixed image has a single value.

Open zivy opened this issue 2 years ago • 2 comments

PR #3679 provides a test illustrating the issue.

Issue originally reported here.

zivy avatar Oct 07 '22 00:10 zivy

Hi, I have encountered this same issue with MI metric when running antsSliceRegularizedRegistration (2D slices), but as far as I can tell, no slices have a single value? Some may have a lot of zeroes. Setting CC as metric works, also replacing zeroes with random noise works with MI too.

I got this warning first: Warning: bad time point - too little intensity variation0 0

Then the next exception: terminate called after throwing an instance of 'itk::ExceptionObject' what(): /home/runner/work/_temp/build/staging/include/ITK-5.3/itkImageBase.hxx:77: ITK ERROR: Image(0x55a2a1f15e30): Zero-valued spacing is not supported and may result in undefined behavior. Refusing to change spacing from [1, 1] to [0, 0]

On other cases, I got a different error message (Joint PDF summed to zero), but also fixed by the workaround above. Many of these: /home/runner/work/_temp/build/ITKv5/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.hxx: suspicious return value (2) from SVDC /home/runner/work/_temp/build/ITKv5/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_svd.hxx: M is 2x2 M = [ ... -nan -nan -nan -nan ]

And then: Exception caught: itk::ExceptionObject (0x555cb90599a0) Location: "unknown" File: /home/runner/work/_temp/build/staging/include/ITK-5.3/itkMattesMutualInformationImageToImageMetricv4.hxx Line: 315 Description: ITK ERROR: MattesMutualInformationImageToImageMetricv4(0x555cbc91ee60): Joint PDF summed to zero

Just reporting I think it happens with very little intensity variation, and in case someone else is getting these exceptions, so they can try the workaround to know if that is the issue.

agarcia-ruiz avatar Mar 17 '23 09:03 agarcia-ruiz

any update on this one? Thanks

orena1 avatar Apr 19 '24 17:04 orena1