Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Image Resampling] Different mask and image spacing, are both resampled? #548

Closed
GiulioBen opened this issue Jan 7, 2020 · 3 comments
Closed
Labels

Comments

@GiulioBen
Copy link

GiulioBen commented Jan 7, 2020

I have an image and a mask (NRRD) with the following spacings.

Image

sizes: 384 384 195
space directions: (0.88541668653499994,0,0) (0,0.88541668653499994,0) (0,0,0.90000152587888649)
space origin: (-169.55729547141999,-140.2094694674,-100.48773193358997)

Mask

sizes: 258 243 287
space directions: (-0.066025928798141606,0,0) (0,-0.066025928798141606,0) (0,0,0.066025928798141606)
space origin: (80.501059337315141,-20.490285052856315,0.76234966516494795)

The mask spacing is much finer than the image one, since it originates from an automatic segmentation. However, considering the origin and size, the mask cover the lesion (ROI)

Starting the extraction with "resampledPixelSpacing": [0.9, 0.9, 0.9] i obtain the following INFO:

[2020-01-07 15:20:29] I: radiomics.imageoperations: Applying resampling from spacing [0.06602593 0.06602593 0.06602593] and size [257 221 273] to spacing [0.9 0.9 0.9] and size [19, 17, 21]

Is it normal? Is it only related to the mask? Also the image should be resampled, but I find no info about that.

I think a separate output should be shown for mask and image. Furthermore I'm not sure whether this coarse graining a priori will affect the result.

Any help will be appreciated. Best regards.

@JoostJM
Copy link
Collaborator

JoostJM commented Jan 7, 2020

@GiulioBen, for feature extraction to work, Image and Mask are obligated to be in the same image space. Even if you don't enable resampling, you'll still need to translate the mask to the image space.

This is due to the fact that further on in PyRadiomics, image and mask are converted to numpy arrays, which loses the geometric information (not needed anymore at that point).

So this output tells the result for both image and mask resampling, and is normal behavior. The small size reflects the fact that PyRadiomics only resamples a small area (equal to ROI bounding box + additional padding), which is computationally much more efficient.

@JoostJM
Copy link
Collaborator

JoostJM commented Jan 7, 2020

As to the results of extracted features: Yes, resampling WILL change the values of the extracted features. However, resampling to a coarser spacing does not necessarily mean the performance of models based on those features is affected too. In fact, performance may even increase, as more coarse structures are analyzed, which are less susceptible to noise.

I.e. there is a tradeoff: Coarser spacing is less susceptible to noise, but at some point important information is also lost. So it depends a bit on your dataset what settings will get the best results. I generally advise to not interpolate too much, and find a compromise between in-plane spacing and slice thickness.

@GiulioBen
Copy link
Author

So, is the mask resampled to the space of the image and resampled again in cubic voxels due to the resampledPixelSpacing": [0.9, 0.9, 0.9] setting?

Are the shape features calculated before resampling?

I'm forced to resample the images since they don't have the same spacing, that's why I resampled.

Thank you for your help! :)

@JoostJM JoostJM closed this as completed Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants