Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voxel extraction GLSZM fails [FEAT EXTRACTION] #617

Closed
kingaber opened this issue Jul 30, 2020 · 6 comments
Closed

Voxel extraction GLSZM fails [FEAT EXTRACTION] #617

kingaber opened this issue Jul 30, 2020 · 6 comments
Labels

Comments

@kingaber
Copy link

Describe the bug
(1) I can compute all voxel features, but GLSZM fails in my data set. Why is GLSZM different? Do I need to change some settings?
(2) Why extraction of features (e.g. GLSZM statistics, which are extracted from computed arrays) takes 1 second, while computing voxel feature arrays takes a long time? How to define the optimum voxelBatch for the system setting?

PyRadiomics configuration
imageType:
Original: {}
featureClass:

glcm:

glrlm:

glszm:

gldm:

ngtdm:

setting:
binWidth: 12
label: 1
voxelSetting:
kernelRadius: 2
maskedKernel: false
initValue: nan
voxelBatch: 5000

PyRadiomics log file
INFO:radiomics.featureextractor: Loading parameter file C:\Users\me\mypath\R2B12.yaml
DEBUG:radiomics.featureextractor: Parameters parsed, input is valid.
DEBUG:radiomics.featureextractor: Applying settings
DEBUG:radiomics.featureextractor: Enabled image types: {'Original': {}}
DEBUG:radiomics.featureextractor: Enabled features: {'glszm': None}
DEBUG:radiomics.featureextractor: Settings: {'binWidth': 12, 'label': 1}
INFO:radiomics.featureextractor: Starting voxel based extraction
INFO:radiomics.featureextractor: Calculating features with label: 1
DEBUG:radiomics.featureextractor: Enabled images types: {'Original': {}}
DEBUG:radiomics.featureextractor: Enabled features: {'glszm': None}
DEBUG:radiomics.featureextractor: Current settings: {'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, 'binWidth': 12, 'kernelRadius': 2, 'maskedKernel': False, 'initValue': 'nan', 'voxelBatch': 5000, 'voxelBased': True}
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
DEBUG:radiomics.imageoperations: Checking minimum number of dimensions requirements (2)
DEBUG:radiomics.featureextractor: Image and Mask loaded and valid, starting extraction
DEBUG:radiomics.featureextractor: Creating image type iterator
INFO:radiomics.featureextractor: Adding image type "Original" with custom settings: {}
DEBUG:radiomics.featureextractor: Extracting features
DEBUG:radiomics.imageoperations: Yielding original image
INFO:radiomics.featureextractor: Calculating features for original image
DEBUG:radiomics.imageoperations: Cropping to size [15 49 40]
INFO:radiomics.featureextractor: Computing glszm
DEBUG:radiomics.glszm: Initializing feature class
DEBUG:radiomics.imageoperations: Discretizing gray levels inside ROI
DEBUG:radiomics.imageoperations: Calculated 21 bins for bin width 12 with edges: [-156. -144. -132. -120. -108. -96. -84. -72. -60. -48. -36. -24.
-12. 0. 12. 24. 36. 48. 60. 72. 84. 96.])
DEBUG:radiomics.glszm: Calculating voxel batch no. 1/4
DEBUG:radiomics.glszm: Calculating GLSZM matrix in C

Version (please complete the following information):

  • OS: Windows 10
  • Python version: 3.7
  • PyRadiomics version 3.0
@JoostJM
Copy link
Collaborator

JoostJM commented Jul 31, 2020

It appears to be failing in the C extension. There were some bugs in the code that are not yet part of the official release, but I don't think they apply here. Can you share an example image and mask to debug this issue?

As to the additional time required, this is to be expected, as features and matrices are calculated for each voxel separately, and not just once for the entire ROI.

@kingaber
Copy link
Author

Here is the image and mask to test.
test.zip

@kingaber
Copy link
Author

kingaber commented Sep 4, 2020

I was wondering if there are any updates on the issue? thanks

@JoostJM
Copy link
Collaborator

JoostJM commented Sep 5, 2020

@kingaber, I believe I have found the bug, it was due to a faulty check in GLSZM's C calculation. I have made a PR of the fix (#635), which I will merge after checks pass.

I will also be making a new release of PyRadiomics soon, which will contain this fix.

@kingaber
Copy link
Author

kingaber commented Sep 7, 2020

Great news. Looking forward to test it soon.

@JoostJM
Copy link
Collaborator

JoostJM commented Sep 18, 2020

@kingaber, the fix is now merged in the master branch. However, I'm currently unable to make a new release due to a (different) issue in the Mac testing CI (using TravisCI).

You can try to compile PyRadiomics from source by checking out the current master of this repository and running setup.py install (from repository root). This involves compiling the C Extensions, if you have any issues, let me know. In the worst case, I can build you a wheel (for either windows or linux), if you need this, please let me know your OS type and specific Python version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants