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.17k stars 497 forks source link

[BUG] Segmentation fault (core dumped) in voxel-wise feature extraction #737

Open mligerhe opened 2 years ago

mligerhe commented 2 years ago

Describe the bug When I try to run a voxel-wise feature extraction, I get the following error: 'Segmentation fault (core dumped)'. It works with the same parameters and images when VoxelBased=False

PyRadiomics configuration Bin size = 64 Resampling voxel size 4x4x4 Interpolation method B-spline Radiomics features: GLDM and GLCM

PyRadiomics log file log_file_errorpyradiomics.txt

To Reproduce Execute the code

params = {}
params['binWidth'] = 64
params['resampledPixelSpacing'] = [4,4,4]
params['interpolator'] = 3
extractor = featureextractor.RadiomicsFeatureExtractor(**params)
extractor.disableAllFeatures()
extractor.enableFeatureClassByName('glcm')
voxel_result = extractor.execute(image1, mask, label = labels[0], voxelBased=True)

Expected behavior Voxel-wise images of the different features from GLCM and GLDM matrices.

Version (please complete the following information):

JoostJM commented 2 years ago

Can you share a sample of the image/mask for debugging?

mligerhe commented 2 years ago

pyradiomics_testimages.zip

Can you share a sample of the image/mask for debugging? pyradiomics_testimages.zip

md863 commented 2 years ago

Hi, I'm encountering this same issue. Is there any update? Thanks!

llu025 commented 2 years ago

Same here with any first order feature extraction. It works like a charm with any other features (glcm, glrlm, etc.).

PyRadiomics configuration

imageType:
  Original: {}

featureClass:
  firstorder:
    - 'Minimum'

setting:
  normalize: true
  normalizeScale: 100
  binWidth: 25
  interpolator: 'sitkBSpline'
  resampledPixelSpacing: [1, 1, 1]
  correctMask: true
  voxelArrayShift: 300
  force2D: true
  force2Ddimension: 0

voxelSetting:
  kernelRadius: 1
  maskedKernel: true
  voxelBatch: 10000

To reproduce

extractor = featureextractor.RadiomicsFeatureExtractor(PRM_PATH)
features = extractor.execute(IMG, SEG, voxelBased=True)

Output

[1]    61328 segmentation fault  python3 main.py

Expected behavior

Working just fine

Version

llu025 commented 1 year ago

⬆️ ⬆️ ⬆️

ginagigo123 commented 1 year ago

Hey Guys, When I tried to extract the 3D image shaped (512, 512, 512), some of the images will trigger the segmentation fault error. I thought the error will be triggered only when the voxels of segmentation exceed specific numbers due to memory limit.

So in my case, I added resampling to the image in yaml file and solved the problem.