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.14k stars 492 forks source link

[FEAT EXTRACTION] GLCM autocorrelation is always 1 #772

Open Mojzaar opened 2 years ago

Mojzaar commented 2 years ago

I have a 3d numpy array as my image, and I want to calculate the GLCM across the entire image. As the autocorrelation value, the pipeline always returns 1. I get the same results if I use a random array as the image. What am I overlooking here? I've included the image and its mask for your convenience. (int8 images with size (16,128,128))

I use the following code to calculate the correlation matrix. `import radiomics

import SimpleITK as sitk

mask = np.random.rand(128,128,16)

mask[mask>0.5] = int(1)

mask[mask<=0.5] = int(0)

maks= mask.astype(bool)

imgm = sitk.GetImageFromArray(np.random.rand(128,128,16))

segm = sitk.GetImageFromArray(mask)

imgm.SetSpacing((0.1,0.1,0.1))

segm.SetSpacing((0.1,0.1,0.1))

glcmRF = radiomics.glcm.RadiomicsGLCM(imgm,segm)

P_glcm = glcmRF._calculateMatrix()

img-0439.zip `