diff --git a/monai/transforms/spatial/array.py b/monai/transforms/spatial/array.py index 2b61b1f61a..f263e89152 100644 --- a/monai/transforms/spatial/array.py +++ b/monai/transforms/spatial/array.py @@ -230,6 +230,7 @@ def inverse(self, data: torch.Tensor) -> torch.Tensor: with self.trace_transform(False): # we can't use `self.__call__` in case a child class calls this inverse. out: torch.Tensor = SpatialResample.__call__(self, data, **kw_args) + kw_args["src_affine"] = kw_args.get("dst_affine") return out diff --git a/monai/utils/type_conversion.py b/monai/utils/type_conversion.py index c5dd3a797c..734d8a2b17 100644 --- a/monai/utils/type_conversion.py +++ b/monai/utils/type_conversion.py @@ -45,7 +45,7 @@ def get_numpy_dtype_from_string(dtype: str) -> np.dtype: """Get a numpy dtype (e.g., `np.float32`) from its string (e.g., `"float32"`).""" - return np.empty([], dtype=dtype).dtype + return np.empty([], dtype=str(dtype).split(".")[-1]).dtype def get_torch_dtype_from_string(dtype: str) -> torch.dtype: