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"]
code: def __init__(
      self,
      seg,
      img,
      measures,
      num_neighbors=6,
      threshold=0,
      pixdim=(1, 1, 1),
  ):
      self.seg = seg
      self.bin = 100
      self.mul = 100
      self.trans = 0
      self.img = img
      self.img_channels = self.img.shape[4] if img.ndim >= 4 else 1
      img_id = range(0, self.img_channels)
      self.neigh = num_neighbors
      self.harilick_m = np.atleast_2d(self.harilick_matrix())
      self.m_dict = {
          "centre of mass": (
              self.centre_of_mass,
              ["CoMx", "CoMy", "CoMz"],
          ),
          "volume": (
              self.volume,
              ["NVoxels", "NVoxelsBinary", "Vol", "VolBinary"],
          ),
          "surface": (
              self.surface,
              [
                  "NSurface",
                  "NSurfaceBinary",
                  "SurfaceVol",
                  "SurfaceVolBinary",
              ],
          ),
          "surface volume ratio": (
              self.sav,
              ["SAVNumb", "SAVNumBinary", "SAV", "SAVBinary"],
          ),
          "compactness": (
              self.compactness,
              [
                  "CompactNumb",
                  "CompactNumbBinary",
                  "Compactness",
                  "CompactnessBinary",
              ],
          ),
          "mean": (self.mean_, ["Mean_%d" % i for i in img_id]),
          "weighted_mean": (
              self.weighted_mean_,
              ["Weighted_mean_%d" % i for i in img_id],
          ),
          "median": (self.median_, ["Median_%d" % i for i in img_id]),
          "skewness": (
              self.skewness_,
              ["Skewness_%d" % i for i in img_id],
          ),
          "kurtosis": (
              self.kurtosis_,
              ["Kurtosis_%d" % i for i in img_id],
          ),
          "min": (self.min_, ["Min_%d" % i for i in img_id]),
          "max": (self.max_, ["Max_%d" % i for i in img_id]),
          "quantile_25": (
              self.quantile_25,
              ["P25_%d" % i for i in img_id],
          ),
          "quantile_50": (self.median_, ["P50_%d" % i for i in img_id]),
          "quantile_75": (
              self.quantile_75,
              ["P75_%d" % i for i in img_id],
          ),
          "std": (self.std_, ["STD_%d" % i for i in img_id]),
          "asm": (self.call_asm, ["asm%d" % i for i in img_id]),
          "contrast": (
              self.call_contrast,
              ["contrast%d" % i for i in img_id],
          ),
          "correlation": (
              self.call_correlation,
              ["correlation%d" % i for i in img_id],
          ),
          "sumsquare": (
              self.call_sum_square,
              ["sumsquare%d" % i for i in img_id],
          ),
          "sum_average": (
              self.call_sum_average,
              ["sum_average%d" % i for i in img_id],
          ),
          "idifferentmomment": (
              self.call_idifferent_moment,
              ["idifferentmomment%d" % i for i in img_id],
          ),
          "sumentropy": (
              self.call_sum_entropy,
              ["sumentropy%d" % i for i in img_id],
          ),
          "entropy": (
              self.call_entropy,
              ["entropy%d" % i for i in img_id],
          ),
          "differencevariance": (
              self.call_difference_variance,
              ["differencevariance%d" % i for i in img_id],
          ),
          "differenceentropy": (
              self.call_difference_entropy,
              ["differenceentropy%d" % i for i in img_id],
          ),
          "sumvariance": (
              self.call_sum_variance,
              ["sumvariance%d" % i for i in img_id],
          ),
          "imc1": (self.call_imc1, ["imc1%d" % i for i in img_id]),
          "imc2": (self.call_imc2, ["imc2%d" % i for i in img_id]),
      }
      self.measures = measures
  
      self.pixdim = pixdim
      self.threshold = threshold
      if self.seg is not None:
          self.masked_img, self.masked_seg = self.__compute_mask()
      self.vol_vox = np.prod(pixdim)
  
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 1 to create a new RegionProperties object from inherited base classes: object with example: obj = RegionProperties(seg, img, measures, num_neighbors, threshold, pixdim)