Project-MONAI / tutorials

MONAI Tutorials
https://monai.io/started.html
Apache License 2.0
1.77k stars 668 forks source link

How to set the parameters of RandCropByPosNegLabeld() for pancreas segmentation (Task07_Pancreas)? #314

Closed Shyamapada34 closed 3 years ago

Shyamapada34 commented 3 years ago

Dear Sir, I want to segment the pancreas from CT images (Task07_Pancreas), so I have taken the Jupyter notebook code 'spleen_segmentation_3d_lightning.ipynb'. But, I got the following error: raise ValueError("The size of the proposed random crop ROI is larger than the image size.") ValueError: The size of the proposed random crop ROI is larger than the image size.

The error were occurring in the function RandCropByPosNegLabeld(keys=["image", "label"], label_key="label", spatial_size=(96, 96, 96), pos=1, neg=1, num_samples=4, image_key="image", image_threshold=0)

Please suggest how to solve this issue.

With thanks and regards Shyamapada Mandal Error.pdf

Nic-Ma commented 3 years ago

Hi @Shyamapada34 ,

Thanks for your interest here. The error is because the data shape of some images in your dataset is smaller than (96, 96, 96), so it failed to crop. Please try to adjust the crop size of spleen dataset to your dataset.

Thanks.