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: Calculates the correlation over the glcm matrix
  
  :param matrix:
  :return:
docstr_tok: ["Calculates","the","correlation","over","the","glcm","matrix",":","param","matrix",":",":","return",":"]
code: def correlation(self, matrix):
      """
      Calculates the correlation over the glcm matrix
  
      :param matrix:
      :return:
      """
      range_values = np.arange(0, matrix.shape[0])
      matrix_range = np.tile(range_values, [matrix.shape[0], 1])
      mean_matrix = np.sum(matrix_range * matrix, axis=0)
      sd_matrix = np.sqrt(
          np.sum(
              (
                  matrix_range
                  - np.tile(mean_matrix, [matrix.shape[0], 1])
              )
              ** 2
              * matrix,
              axis=0,
          )
      )
      correlation = 0
      for i in range(0, matrix.shape[0]):
          for j in range(0, matrix.shape[0]):
              if sd_matrix[i] > 0 and sd_matrix[j] > 0:
                  correlation += (
                      i * j * matrix[i, j]
                      - mean_matrix[i] * mean_matrix[j]
                  ) / (sd_matrix[i] * sd_matrix[j])
      return correlation
  
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 27 for calling the RegionProperties obj's underlying member method code with example usage: obj.correlation(matrix) and returns: correlation