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

using lungmask to get the mask #824

Open doctorfaraday opened 1 year ago

doctorfaraday commented 1 year ago

Hi! Describe the bug When using PyRadiomics to extract radiomic features from data obtained through lungmask, an error message keeps appearing that requires adjusting the geometryTolerance parameter to 10000 (I am unsure of the consequences of doing so). Even with resampling enabled('correctMask': True,), it is not possible to achieve a voxel size of 1e-5 for geometryTolerance. I would like to know how to use lungmask to segment images and achieve my goal with PyRadiomics.

PyRadiomics configuration Add any customization you applied here (i.e. the content of the parameter file used)

PyRadiomics log file

INFO:radiomics.featureextractor: No valid config parameter, using defaults: {'minimumROIDimensions': 2, 'minimumROISize': None, 'normalize': False, 'normalizeScale': 1, 'removeOutliers': None, 'resampledPixelSpacing': None, 'interpolator': 'sitkBSpline', 'preCrop': False, 'padDistance': 5, 'distances': [1], 'force2D': False, 'force2Ddimension': 0, 'resegmentRange': None, 'label': 1, 'additionalInfo': True} INFO:radiomics.featureextractor: Enabled image types: {'Original': {}} INFO:radiomics.featureextractor: Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []} INFO:radiomics.featureextractor: Applying custom setting overrides: {'binWidth': 25, 'interpolator': 23, 'resampledPixelSpacing': None, 'force2D': False, 'force2Ddimension': 0, 'correctMask': True, 'geometryTolerance': 1e-05} DEBUG:radiomics.featureextractor: Settings: {'minimumROIDimensions': 2, 'minimumROISize': None, 'normalize': False, 'normalizeScale': 1, 'removeOutliers': None, 'resampledPixelSpacing': None, 'interpolator': 23, 'preCrop': False, 'padDistance': 5, 'distances': [1], 'force2D': False, 'force2Ddimension': 0, 'resegmentRange': None, 'label': 1, 'additionalInfo': True, 'binWidth': 25, 'correctMask': True, 'geometryTolerance': 1e-05} DEBUG:radiomics.featureextractor: Setting SimpleITK tolerance to 1e-05 DEBUG:radiomics.featureextractor: Enabling all image types DEBUG:radiomics.featureextractor: Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LBP3D': {}, 'LoG': {}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}} INFO:radiomics.featureextractor: Calculating features with label: 1 DEBUG:radiomics.featureextractor: Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LBP3D': {}, 'LoG': {}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}} DEBUG:radiomics.featureextractor: Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []} DEBUG:radiomics.featureextractor: Current settings: {'minimumROIDimensions': 2, 'minimumROISize': None, 'normalize': False, 'normalizeScale': 1, 'removeOutliers': None, 'resampledPixelSpacing': None, 'interpolator': 23, 'preCrop': False, 'padDistance': 5, 'distances': [1], 'force2D': False, 'force2Ddimension': 0, 'resegmentRange': None, 'label': 1, 'additionalInfo': True, 'binWidth': 25, 'correctMask': True, 'geometryTolerance': 1e-05} INFO:radiomics.featureextractor: Loading image and mask DEBUG:radiomics.imageoperations: Force casting mask to UInt32 to ensure correct datatype. DEBUG:radiomics.imageoperations: Checking mask with label 1 DEBUG:radiomics.imageoperations: Calculating bounding box WARNING:radiomics.imageoperations: Image/Mask geometry mismatch, attempting to correct Mask DEBUG:radiomics.imageoperations: Resampling mask to image geometry DEBUG:radiomics.imageoperations: Checking ROI validity DEBUG:radiomics.imageoperations: Checking if label 1 is persent in the mask DEBUG:radiomics.imageoperations: Comparing physical space of bounding box to physical space of image DEBUG:radiomics.imageoperations: ROI bounds (image coordinate space): ((348.16, 407.04, 285.2), (569.6, 668.16, 421.20000000000005)) eatureextractor: No valid config parameter, using defaults: {'minimumROIDimensions': 2, 'minimumROISize': None, 'normalize': False, 'normalizeScale': 1, 'removeOutliers': None, 'resampledPixelSpacing': None, 'interpolator': 'sitkBSpline', 'preCrop': False, 'padDistance': 5, 'distances': [1], 'force2D': False, 'force2Ddimension': 0, 'resegmentRange': None, 'label': 1, 'additionalInfo': True} INFO:radiomics.featureextractor: Enabled image types: {'Original': {}} INFO:radiomics.featureextractor: Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []} INFO:radiomics.featureextractor: Applying custom setting overrides: {'binWidth': 25, 'interpolator': 23, 'resampledPixelSpacing': None, 'force2D': False, 'force2Ddimension': 0, 'correctMask': True, 'geometryTolerance': 1e-05} DEBUG:radiomics.featureextractor: Settings: {'minimumROIDimensions': 2, 'minimumROISize': None, 'normalize': False, 'normalizeScale': 1, 'removeOutliers': None, 'resampledPixelSpacing': None, 'interpolator': 23, 'preCrop': False, 'padDistance': 5, 'distances': [1], 'force2D': False, 'force2Ddimension': 0, 'resegmentRange': None, 'label': 1, 'additionalInfo': True, 'binWidth': 25, 'correctMask': True, 'geometryTolerance': 1e-05} DEBUG:radiomics.featureextractor: Setting SimpleITK tolerance to 1e-05 DEBUG:radiomics.featureextractor: Enabling all image types DEBUG:radiomics.featureextractor: Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LBP3D': {}, 'LoG': {}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}} INFO:radiomics.featureextractor: Calculating features with label: 1 DEBUG:radiomics.featureextractor: Enabled images types: {'Original': {}, 'Exponential': {}, 'Gradient': {}, 'LBP2D': {}, 'LBP3D': {}, 'LoG': {}, 'Logarithm': {}, 'Square': {}, 'SquareRoot': {}, 'Wavelet': {}} DEBUG:radiomics.featureextractor: Enabled features: {'firstorder': [], 'glcm': [], 'gldm': [], 'glrlm': [], 'glszm': [], 'ngtdm': [], 'shape': []} DEBUG:radiomics.featureextractor: Current settings: {'minimumROIDimensions': 2, 'minimumROISize': None, 'normalize': False, 'normalizeScale': 1, 'removeOutliers': None, 'resampledPixelSpacing': None, 'interpolator': 23, 'preCrop': False, 'padDistance': 5, 'distances': [1], 'force2D': False, 'force2Ddimension': 0, 'resegmentRange': None, 'label': 1, 'additionalInfo': True, 'binWidth': 25, 'correctMask': True, 'geometryTolerance': 1e-05} INFO:radiomics.featureextractor: Loading image and mask DEBUG:radiomics.imageoperations: Force casting mask to UInt32 to ensure correct datatype. DEBUG:radiomics.imageoperations: Checking mask with label 1 DEBUG:radiomics.imageoperations: Calculating bounding box WARNING:radiomics.imageoperations: Image/Mask geometry mismatch, attempting to correct Mask DEBUG:radiomics.imageoperations: Resampling mask to image geometry DEBUG:radiomics.imageoperations: Checking ROI validity DEBUG:radiomics.imageoperations: Checking if label 1 is persent in the mask DEBUG:radiomics.imageoperations: Comparing physical space of bounding box to physical space of image DEBUG:radiomics.imageoperations: ROI bounds (image coordinate space): ((348.16, 407.04, 285.2), (569.6, 668.16, 421.20000000000005))

To Reproduce

    sample_dir = os.path.join(dataset_dir, sample)
    series_file_names = get_dicom_series(sample_dir)
    series_reader = sitk.ImageSeriesReader()
    series_reader.SetFileNames(series_file_names)
    series_reader.MetaDataDictionaryArrayUpdateOn()
    series_reader.LoadPrivateTagsOn()
    image3D = series_reader.Execute()
    segmentation = mask.apply(image3D)
    segmentation = sitk.GetImageFromArray(segmentation)
    extractor = featureextractor.RadiomicsFeatureExtractor(**settings)

Version (please complete the following information):

Thanks!