for m in range(0, self.img.shape[4]):
shifted_image = []
for n in range(0, self.neigh+1):
new_img = np.multiply(self.seg, self.img[..., m:m+1, 0:1])
new_img = ndimage.shift(new_img, shifts[n], order=0)
if np.count_nonzero(new_img) > 0:
flattened_new = np.flatten(new_img)
flattened_seg = np.flatten(self.seg)
After Change
for n in range(0, self.neigh):
for i in range(0, shifted_image[0].size):
glcm[shifted_image[0][i], shifted_image[n+1][i], n] += 1
glcm[:,:,n] = glcm[:,:,n] / np.sum(glcm[:,:,n])
multi_mod_glcm.append(glcm)
return multi_mod_glcm