Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MattesMutualInformation corner case spacing error #1491

Open
michaelzenkay opened this issue Dec 12, 2019 · 1 comment
Open

MattesMutualInformation corner case spacing error #1491

michaelzenkay opened this issue Dec 12, 2019 · 1 comment
Labels
status:Backlog Postponed without a fixed deadline type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Comments

@michaelzenkay
Copy link

Description

corner case error in ITK's MattesMutualInformation metric when both images are all zeros, then the internal data structure (Image) has the reported invalid size

Steps to Reproduce

import SimpleITK as sitk
import numpy as np

I = np.zeros((100,100,100))
I = sitk.GetImageFromArray(I)
I.SetSpacing((1.0,1.0,1.0))
I = sitk.Cast(I, sitk.sitkFloat32)

J = np.zeros((100,100,100))
J = sitk.GetImageFromArray(J)
J.SetSpacing((1.0,1.0,1.0))
J = sitk.Cast(J, sitk.sitkFloat32)

R = sitk.ImageRegistrationMethod()
R.SetMetricAsMattesMutualInformation()
MMI = R.MetricEvaluate(I, J)

Expected behavior

Evaluation of Mutual Information Metric

Actual behavior

ERROR: Image(0x32256f0): A spacing of 0 is not allowed: Spacing is [0, 0]

Reproducibility

100%

Versions

Environment

Ubuntu 18.04, python 3.7, SimpleITK 1.1.0, numpy 1.17.2

Additional Information

Changing metric e.g. SetMetricAsCorrelation() does not throw error -> therefore must be the MattesMutualInformation metric
Initializing image with np.random.rand(100,100,100) does not throw error -> therefore must be the corner case where inputs are zero

@michaelzenkay michaelzenkay added the type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances label Dec 12, 2019
@stale
Copy link

stale bot commented Apr 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the status:Backlog Postponed without a fixed deadline label Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:Backlog Postponed without a fixed deadline type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Projects
None yet
Development

No branches or pull requests

1 participant