BlackSpecter
BlackSpecter

Reputation: 61

Bounding box of ROI is larger than image space with pyradiomics mask correction

I've been trying to implement feature extraction with pyradiomics for the following image and the segmented output . When i run the command

pyradiomics Brats18_CBICA_AAM_1_t1ce_corrected.nii.gz Brats18_CBICA_AAM_1.nii.gz --setting "correctMask:True" .

I get the following error.

Image/Mask geometry mismatch, attempting to correct Mask Bounding box of ROI is larger than image space: ROI bounds (image coordinate space) ((-86.5, 85.5, 80.5), (-114.5, 46.5, 121.5)) Image Size (240, 240, 155) Image/Mask correction failed, ROI invalid (not found or outside of physical image bounds) Case-1_Image: /home/sid/Documents/pyradiomics-master/bin/Brats18_CBICA_AAM_1/Brats18_CBICA_AAM_1_t1ce_corrected.nii.gz Case-1_Mask: /home/sid/Documents/pyradiomics-master/bin/Brats18_CBICA_AAM_1/Brats18_CBICA_AAM_1.nii.gz

I've tried correct mask with other options as well as setting the tolerance high, but nothing seems to work. I have visualized them properlly without any issues with the CaPTK tool. Is there something wrong with the mask correction or mask resampling?

Upvotes: 0

Views: 1112

Answers (2)

JoostJM
JoostJM

Reputation: 367

This is indeed the cause of the error. I don't know if CapTK takes direction, spacing and origin into account, but PyRadiomics does. This allows you to use masks made with different source images (e.g. use a mask made on a DWI image to extract features from a T2W image). To prevent unintentional errors, this required the correctMask.

Still, whenever a correction has to be made, PyRadiomics checks if the bounding box of the mask is contained within the physical space defined by the image. In your case, direction and y are flipped, which causes your mask to be entirely outside the image space in the x domain (y is probably fine due to the fact that the origin is 239). Resampling would just yield an empty mask.

Upvotes: 0

Bartłomiej
Bartłomiej

Reputation: 1078

The two images are not in the same physical space. If you compare them as two three-dimensional arrays, the segmentation results is indeed correct. But in medical images, they have to always be transformed info global space before further processing (for example, if you have 100x100pix PET image and 256x256 CT image from the same plane, you should take into consideration the resolutions). I recommend short explanation of this problem in 3D Slicer documentation.

Anyway, your images' headers are the following:

flair:

Image Origin (0, 239, 0)

Spacing (1, 1, 1)

Axis orientation

(1, 0, 0, 0, 1, 0, 0, 0, 1)

segmentation results:

Image Origin (0, 0, 0)

Spacing (1, 1, 1)

Axis orientation

(-1, 0, 0, 0, -1, 0, 0, 0, 1)

(it means that both x and y are mirrored)

So, you should flip the segmented image along X and Y and translate it by a vector (0, 239, 0). Unfortunately I am not familiar with pyradiomics, but every image processing tool should deal with it.

Upvotes: 2

Related Questions