@[TOC](提取ROI时的错误 Requested region is (at least partially) outside the largest possible region.)
当我使用SimpleITK提取图像的ROI区域时,遇到如下错误:
Traceback (most recent call last):
File “D:/Examples/prostate_Segmentation/crop_prostate_region.py”, line 56, in
prostate_img_crop = sitk.RegionOfInterest(prostate_img, roi_size, roi_index)
File “D:\AppInstall\conda\envs\torch_1\lib\site-packages\SimpleITK\SimpleITK.py”, line 19863, in RegionOfInterest
return _SimpleITK.RegionOfInterest(*args, **kwargs)
RuntimeError: Exception thrown in SimpleITK RegionOfInterest: D:\a\1\sitk-build\ITK\Modules\Core\Common\src\itkDataObject.cxx:355:
Requested region is (at least partially) outside the largest possible region.
也就是说是我选择的ROI区域超出了图像本身的大小。
将图像尺寸进行打印,结果如下:
发现是加载的图片文件名对不上,尺寸也就对不上,在计算时产生错误。