Commit cbfdb1d8 authored by Baumgartner, Michael's avatar Baumgartner, Michael
Browse files

allclose for float comp

parent fcc1cd64
...@@ -283,15 +283,15 @@ def _check_itk_params( ...@@ -283,15 +283,15 @@ def _check_itk_params(
ValueError: raised if spacing does not match ValueError: raised if spacing does not match
""" """
for idx, img in enumerate(img_seq[1:], start=1): for idx, img in enumerate(img_seq[1:], start=1):
if not (np.asarray(img_seq[0].GetDimension()) == \ if not (np.allclose(np.asarray(img_seq[0].GetDimension()) == \
np.asarray(img.GetDimension())).all(): np.asarray(img.GetDimension()))):
raise ValueError(f"Expected {paths[idx]} and {paths[0]} to have same dimensions!") raise ValueError(f"Expected {paths[idx]} and {paths[0]} to have same dimensions!")
if not (np.asarray(img_seq[0].GetOrigin()) == \ if not (np.allclose(np.asarray(img_seq[0].GetOrigin()) == \
np.asarray(img.GetOrigin())).all(): np.asarray(img.GetOrigin()))):
raise ValueError(f"Expected {paths[idx]} and {paths[0]} to have same origin!") raise ValueError(f"Expected {paths[idx]} and {paths[0]} to have same origin!")
if not (np.asarray(img_seq[0].GetDirection()) == \ if not (np.allclose(np.asarray(img_seq[0].GetDirection()) == \
np.asarray(img.GetDirection())).all(): np.asarray(img.GetDirection()))):
raise ValueError(f"Expected {paths[idx]} and {paths[0]} to have same direction!") raise ValueError(f"Expected {paths[idx]} and {paths[0]} to have same direction!")
if not (np.asarray(img_seq[0].GetSpacing()) == \ if not (np.allclose(np.asarray(img_seq[0].GetSpacing()) == \
np.asarray(img.GetSpacing())).all(): np.asarray(img.GetSpacing()))):
raise ValueError(f"Expected {paths[idx]} and {paths[0]} to have same spacing!") raise ValueError(f"Expected {paths[idx]} and {paths[0]} to have same spacing!")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment