docstr: Similarity Metric abstract class
  
  A similarity metric is in charge of keeping track of the numerical
  value of the similarity (or distance) between the two given images. It
  also computes the update field for the forward and inverse displacement
  fields to be used in a gradient-based optimization algorithm. Note that
  this metric does not depend on any transformation (affine or
  non-linear) so it assumes the static and moving images are already
  warped
  
  Parameters
  ----------
  dim : int (either 2 or 3)
      the dimension of the image domain
docstr_tok: ["Similarity","Metric","abstract","class","A","similarity","metric","is","in","charge","of","keeping","track","of","the","numerical","value","of","the","similarity","(","or","distance",")","between","the","two","given","images",".","It","also","computes","the","update","field","for","the","forward","and","inverse","displacement","fields","to","be","used","in","a","gradient-based","optimization","algorithm",".","Note","that","this","metric","does","not","depend","on","any","transformation","(","affine","or","non-linear",")","so","it","assumes","the","static","and","moving","images","are","already","warped","Parameters","--","--","--","--","--","dim",":","int","(","either","2","or","3",")","the","dimension","of","the","image","domain"]
code: def __init__(self, dim):
      r"""Similarity Metric abstract class
  
      A similarity metric is in charge of keeping track of the numerical
      value of the similarity (or distance) between the two given images. It
      also computes the update field for the forward and inverse displacement
      fields to be used in a gradient-based optimization algorithm. Note that
      this metric does not depend on any transformation (affine or
      non-linear) so it assumes the static and moving images are already
      warped
  
      Parameters
      ----------
      dim : int (either 2 or 3)
          the dimension of the image domain
      """
      self.dim = dim
      self.levels_above = None
      self.levels_below = None
  
      self.static_image = None
      self.static_affine = None
      self.static_spacing = None
      self.static_direction = None
  
      self.moving_image = None
      self.moving_affine = None
      self.moving_spacing = None
      self.moving_direction = None
      self.mask0 = False
  
imports: import abc
  import numpy
  from numpy import gradient
  from scipy import ndimage
  from dipy.align import vector_fields
  from dipy.align import sumsqdiff
  from dipy.align import crosscorr
  from dipy.align import expectmax
  from dipy.align import floating
label_desc: Use image node_id 1 to create a new SimilarityMetric object  with example: obj = SimilarityMetric(dim)