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

GLCM Calculate Error: Error getting angle count. #631

Closed mozdag closed 4 years ago

mozdag commented 4 years ago

I have an H&E stained medical image that contains 480 cells. For each cell I am calculating the Radiomics features. However, I get this error: P_glcm, angles = cMatrices.calculate_glcm(*matrix_args) RuntimeError: Error getting angle count.

Is this because some cells are too small, e.g. only have 1 pixel? How would be your solution to this? Can we set those GLCM feature values causing the issue to a default value which makes sense? e.g., 0? Can you show me how to do it in the code, please?

JoostJM commented 4 years ago

@mozdag, It is indeed caused by segmentations consisting of a single voxel. For those segmentations, GLCM features can not be calculated. You can run a batch file just fine, though it will keep indicating this error. For other cases, features are still calculated normally. After extraction, you can exclude the failed cases by checking for which cases not all features were calculated.

Theoretically, you can indeed set them to some value, e.g. the value you would get for a 'flat region' (all pixels identical value), though it depends on what you aim to do with the feature values if it is a good way to go.