AIM-Harvard / pyradiomics

Open-source python package for the extraction of Radiomics features from 2D and 3D images and binary masks. Support: https://discourse.slicer.org/c/community/radiomics
http://pyradiomics.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.16k stars 499 forks source link

How can I get the resampled image? #604

Closed LiJiaqi96 closed 4 years ago

LiJiaqi96 commented 4 years ago

Thanks for @KathrynSch in Issue #544 about the operation of image resampling.

It seems that Pyradiomics package performs the image resampling like this: setting the resampling spacing [x,y,z] --> establishing the extractor with this setting --> resampling the image and performing feature extraction --> obtaining extracted image features on the resampled image

settings = { 'resampledPixelSpacing': [1.0, 1.0, 1.0] } original_pixel_spacing = [0.97, 0.97, 3.0] img_ex.SetSpacing(original_pixel_spacing) mask_ex.SetSpacing(original_pixel_spacing) extractor = featureextractor.RadiomicsFeatureExtractor(**settings) radiomic_features = extractor.execute(img_ex, mask_ex)

But I'm confused about whether and how can I get the intermediate resampled image (and masks)? Thanks a lot!

fedorov commented 4 years ago

I am not sure intermediate image/mask can be accessed, but it's easy to just do the resampling on your own, see https://github.com/Radiomics/pyradiomics/blob/master/radiomics/featureextractor.py#L397-L401.

rcuocolo commented 4 years ago

A simple workaround is to perform a voxel based extraction for mean, min or max GL using firstorder features and a mask encompassing the entire image (or a ROI, as needed).

LiJiaqi96 commented 4 years ago

https://github.com/Radiomics/pyradiomics/blob/master/radiomics/featureextractor.py#L397-L401

Thanks man, it really helps.