diff --git a/monai/auto3dseg/utils.py b/monai/auto3dseg/utils.py index 61ca58b6fe..8e6e6a9573 100644 --- a/monai/auto3dseg/utils.py +++ b/monai/auto3dseg/utils.py @@ -62,7 +62,7 @@ def get_foreground_image(image: MetaTensor) -> np.ndarray: the size of the output is smaller than the input. """ - copper = CropForeground(select_fn=lambda x: x > 0) + copper = CropForeground(select_fn=lambda x: x > 0, allow_smaller=False) image_foreground = copper(image) return cast(np.ndarray, image_foreground) diff --git a/monai/transforms/utils_create_transform_ims.py b/monai/transforms/utils_create_transform_ims.py index a98cdfe936..4b5990abd3 100644 --- a/monai/transforms/utils_create_transform_ims.py +++ b/monai/transforms/utils_create_transform_ims.py @@ -538,8 +538,8 @@ def create_transform_im( ) create_transform_im(DivisiblePad, dict(k=64), data) create_transform_im(DivisiblePadd, dict(keys=keys, k=64), data) - create_transform_im(CropForeground, dict(), data) - create_transform_im(CropForegroundd, dict(keys=keys, source_key=CommonKeys.IMAGE), data) + create_transform_im(CropForeground, dict(allow_smaller=False), data) + create_transform_im(CropForegroundd, dict(keys=keys, source_key=CommonKeys.IMAGE, allow_smaller=False), data) create_transform_im(RandGaussianNoise, dict(prob=1, mean=0, std=0.1), data) create_transform_im(RandGaussianNoised, dict(keys=CommonKeys.IMAGE, prob=1, mean=0, std=0.1), data) create_transform_im(KSpaceSpikeNoise, dict(loc=(100, 100, 100), k_intensity=13), data)