关于 ValueError: (‘Label (…) not present in mask. Choose from […]’

官方解释为:


This error indicates that the ROI identified by the value of label does not exist. I.e. there are no voxels in the mask volume that have the value specified in label. To help you fix the error, this error also lists the possible alternative label values that have been found. If no values are listed at the end of this error, it means that there are no segmented voxels in your mask.

Note

It is possible that in the original mask there were voxels segmented, but were lost during resampling (when upsampling). In that case, the ROI is too small for the requested resampledPixelSpacing and should be treated as ‘nothing is segmented’.


注意note中的话,很大可能是resample的时候导致的ROI和spacing不符合导致的。

刚开始我的理解是:
原始Spacing和新设置的spacing不匹配,新设置的过大导致原spacing下的分割图像在新的上不在是匹配的mask。

比如说之前的spacing是4 * 4,如图一,现在2 * 2的也能勾勒出来ROI,如图二,但是3*3的就无法正确的够累出ROI,如图三。

之后我把spacing设置为原始图像的spacing最接近的整数,甚至spacing直接不改变,但是都会出现这个问题。

BUT

最后我发现,我的image和label在重采样的时候分别用了线性插值和最近邻插值,插值方法不同导致了本文出现的题目,重新用相同的插值方法重采样之后,使用pyradiomic提取特征时就不会出现该问题

posted @ 2021-02-23 00:56  GJ_Albert  阅读(1101)  评论(0编辑  收藏  举报