You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make spatial transform inverse compatible for multiple passes #6314
Using SpacingD as a pre-processing transform in a MONAILabel app, and the Deepedit click transforms often require multiple iterations. The default inverse transform runs into 2 errors when trying to inverse the SpacingD transform for the second time:
'TypeError: Cannot interpret 'torch.float64' as a data type' from 'get_numpy_dtype_from_string' in 'monai/utils/type_conversion.py' . I am able to fix this locally by changing the function to remove any numpy/torch prefix: 'dtype=str(dtype).split('.')[-1]'
' KeyError: 'src_affine' ' from 'monai/transforms/spatial/array.py", line 226, in inverse: kw_args["dst_affine"] = kw_args.pop("src_affine")' . I am able to fix this locally by adding this line before the inverse fn return: 'kw_args["src_affine"] = kw_args["dst_affine"]' in order to restore the src_affine.
Activity
wyli commentedon Apr 6, 2023
thanks for reporting these, if you plan to contribute,
for 1, please add tests to
MONAI/tests/test_get_equivalent_dtype.py
Lines 45 to 50 in 06defb7
for 2, please change it to
kw_args["src_affine"] = kw_wargs.get("dst_affine")to allow for emptysrc_affinebefore calling the inverse fnFix MONAILabel-related bugs in dtype conversion and inverse of Spacing (
auto updates (#6324)