Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
wyli committed Feb 9, 2022
1 parent bd250f7 commit c96724e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions monai/transforms/spatial/array.py
Original file line number Diff line number Diff line change
@@ -173,14 +173,14 @@ def __call__(
if src_affine is None:
src_affine = np.eye(4, dtype=np.float64)
spatial_rank = min(len(img.shape) - 1, src_affine.shape[0] - 1, 3)
if spatial_size is not -1 and spatial_size is not None:
if (isinstance(spatial_size, int) and spatial_size != -1) and spatial_size is not None:
spatial_rank = min(len(ensure_tuple(spatial_size)), 3) # infer spatial rank based on spatial_size
src_affine = to_affine_nd(spatial_rank, src_affine)
dst_affine = to_affine_nd(spatial_rank, dst_affine) if dst_affine is not None else src_affine
dst_affine, *_ = convert_to_dst_type(dst_affine, dst_affine, dtype=torch.float32)

in_spatial_size = np.asarray(img.shape[1 : spatial_rank + 1])
if spatial_size is -1: # using the input spatial size
if isinstance(spatial_size, int) and (spatial_size == -1): # using the input spatial size
spatial_size = in_spatial_size
elif spatial_size is None: # auto spatial size
spatial_size, _ = compute_shape_offset(in_spatial_size, src_affine, dst_affine) # type: ignore

0 comments on commit c96724e

Please sign in to comment.