class_docstr: This class enables the extraction of image features (Harilick
  features) and basic statistics over a segmentation
class_docstr_tok: ["This","class","enables","the","extraction","of","image","features","(","Harilick","features",")","and","basic","statistics","over","a","segmentation"]
docstr: Creation of the grey level co-occurrence matrix. The neighbourhood
  distance is set to 1 in this instance. All neighborhood shifts are
  calculated for each modality
  
  :return: multi_mod_glcm list of m (number of modalities) matrices of
      size bin x bin x neigh
docstr_tok: ["Creation","of","the","grey","level","co-occurrence","matrix",".","The","neighbourhood","distance","is","set","to","1","in","this","instance",".","All","neighborhood","shifts","are","calculated","for","each","modality",":","return",":","multi_mod_glcm","list","of","m","(","number","of","modalities",")","matrices","of","size","bin","x","bin","x","neigh"]
code: def glcm(self):
      """
      Creation of the grey level co-occurrence matrix. The neighbourhood
      distance is set to 1 in this instance. All neighborhood shifts are
      calculated for each modality
  
      :return: multi_mod_glcm list of m (number of modalities) matrices of
          size bin x bin x neigh
      """
      shifts = [
          [0, 0, 0],
          [1, 0, 0],
          [-1, 0, 0],
          [0, 1, 0],
          [0, -1, 0],
          [0, 0, 1],
          [0, 0, -1],
          [1, 1, 0],
          [-1, -1, 0],
          [-1, 1, 0],
          [1, -1, 0],
          [1, 1, 0],
          [0, -1, -1],
          [0, -1, 1],
          [0, 1, -1],
          [1, 0, 1],
          [-1, 0, -1],
          [-1, 0, 1],
          [1, 0, -1],
          [1, 1, 1],
          [-1, 1, -1],
          [-1, 1, 1],
          [1, 1, -1],
          [1, -1, 1],
          [-1, -1, -1],
          [-1, -1, 1],
          [1, -1, -1],
      ]
      bins = np.arange(0, self.bin)
      multi_mod_glcm = []
      if self.seg is None:
          return None
      for m in range(0, self.img.shape[4]):
          shifted_image = []
          for n in range(0, self.neigh + 1):
              new_img = self.seg * self.img[:, :, :, 0, m]
              print(np.max(self.img), "is max img")
              new_img = ndimage.shift(new_img, shifts[n], order=0)
              print(np.max(self.seg), "is max shift")
              if np.count_nonzero(new_img) > 0:
                  flattened_new = new_img.flatten()
                  flattened_seg = self.seg.flatten()
                  affine = np.round(
                      flattened_new * self.mul + self.trans
                  )
                  # select = [round(flattened_new[i] * self.mul+self.trans) for i in
                  #                 range(0, new_img.size) if
                  #           flattened_seg[i]>0]
  
                  select_new = np.digitize(
                      affine[flattened_seg == 1], bins
                  )
                  select_new[select_new >= self.bin] = self.bin - 1
                  print(
                      np.max(select_new), " is max bin", np.max(affine)
                  )
                  shifted_image.append(select_new)
          glcm = np.zeros([self.bin, self.bin, self.neigh])
          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
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import numpy.ma
  import math
  import scipy.stats.mstats
  import scipy.ndimage
  from niftynet.utilities.util_common import MorphologyOps, CacheFunctionOutput
label_desc: Use image node_id 6 for calling the RegionProperties obj's underlying member method code with example usage: obj.glcm() and returns: multi_mod_glcm, None