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

[FEAT EXTRACTION] ERROR: Filter does not support casting from casting 32-bit float to 32-bit unsigned integer #832

Closed Ianyliu closed 1 year ago

Ianyliu commented 1 year ago

When conducting feature extraction using Pyradiomics, I encountered this error:

Exception thrown in SimpleITK Cast: /tmp/SimpleITK/Code/BasicFilters/src/sitkCastImageFilter.cxx:94:
sitk::ERROR: Filter does not support casting from casting 32-bit float to 32-bit unsigned integer

I then tried doing feature extraction without a configuration parameter file but encountered the same error.

To Reproduce Steps to reproduce the behavior:

# Import libraries 
import SimpleITK as sitk
from radiomics import featureextractor

image = sitk.ReadImage(image_filepath)
label = sitk.ReadImage(label_filepath)
extractor = featureextractor.RadiomicsFeatureExtractor()
extractor.execute(image, label, voxelBased = False)

Version (please complete the following information):

Additional context The image file was a PET image and the mask was a c1 segmentation file generated from SPM. The dimensions of the image and the mask match perfectly, and the mask contains

Ianyliu commented 1 year ago

Sorry it was just a bug in my code. Instead of inputting the filename as a string, I used the list of filenames as input, resulting in the above error.

I will close this issue now.