Connectivity issue on GLSZM
Closed this issue · 1 comments
Thanks very much for your functions. When I call the glszm() to caculate the gray level dependent matrix of a testing array, found that the result is not the same as it in pyradiomic's doc. So I went to check the source code, figured out the paradox occurs because of the connectivety option:
for i in range(Ng-1):
temp[f!=levels[i]] = 0
temp[f==levels[i]] = 1
connected_components = measure.label(temp, connectivity=1)
connected_components = connected_components * mask
nZone = len(np.unique(connected_components))
for j in range(nZone):
col = np.count_nonzero(connected_components==j)
GLSZM[i,col] += 1
It seems like in your code, the connected voxels only include the pixesl in direction of 0°, 90°, 180°, 270°, rather than the full range. I don't know wheather this is reasonable or just a carelss mistake. Maybe it' s better for the "connectivity" to be a optional parameters?
Indeed, the connectivity was arbitrarily set by me for the purpose of the project I was working at that time. I will change it to a parameter immediately. Thank you.