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.11k stars 485 forks source link

[BUG] #853

Closed MicheleMureddu closed 7 months ago

MicheleMureddu commented 7 months ago
Screenshot 2023-11-29 alle 14 40 38

Describe the bug I am trying to extract radiomic features from a 3D PET image (defined in a NIFTI file) within a 3D tumor mask (defined in a NIFTI file). Feature extraction using the 3D method works. The error shown in the figure occurs when trying to obtain the feature map. To test this, I tried to obtain the feature map of the Joint Entropy extracted from the GLCM. The error occurs whenever the "voxel-based" extraction is specified. I'm encountering this issue on my computer (Mac Book Air M1 Sonoma 14.0) and a server with operating system centos 7. On the server i'm using python 3.11.5 in a conda virtual environment. I obtain this error also with the example data.

PyRadiomics configuration I only changed the bin width and set it to 64.

To Reproduce from future import print_function import six import os import csv import SimpleITK as sitk import radiomics from radiomics import featureextractor

params = os.path.join('..','/home/michele/Pet_data/radiomics_script', "Params.yaml") extractor = featureextractor.RadiomicsFeatureExtractor(params)

imagePath = '/home/michele/Pet_data/data/sub-8/ses-01/pet/sub-8_ses-01_pet.nii.gz' maskPath1 = '/home/michele/Pet_data/output_data_i/sub-8/sub-8_tumor8_rsl.nii.gz'

result = extractor.execute(imagePath, maskPath1) for key, val in six.iteritems(result): print("\t%s: %s" %(key, val))

result = extractor.execute(imagePath, maskPath1, voxelBased=True) for key, val in six.iteritems(result): if isinstance(val, sitk.Image): # Feature map sitk.WriteImage(val, key + '.nrrd', True) print("Stored feature %s in %s" % (key, key + ".nrrd")) else: # Diagnostic information print("\t%s: %s" %(key, val))

Expected behavior I would expect to visualize the feature map of (e.g.) Joint Entropy when the voxelBased = True

Version (please complete the following information):

MicheleMureddu commented 7 months ago

Applying the interpolation step solves this issue.