docstr: This is called by the optimizer just after setting the moving image.
  
  EMMetric takes advantage of the image dynamics by computing the
  current moving image mask from the original_moving_image mask (warped
  by nearest neighbor interpolation)
  
  Parameters
  ----------
  original_moving_image : array, shape (R, C) or (S, R, C)
      the original moving image from which the current moving image was
      generated, the current moving image is the one that was provided
      via 'set_moving_image(...)', which may not be the same as the
      original moving image but a warped version of it.
  transformation : DiffeomorphicMap object
      the transformation that was applied to the original_moving_image
      to generate the current moving image
docstr_tok: ["This","is","called","by","the","optimizer","just","after","setting","the","moving","image",".","EMMetric","takes","advantage","of","the","image","dynamics","by","computing","the","current","moving","image","mask","from","the","original_moving_image","mask","(","warped","by","nearest","neighbor","interpolation",")","Parameters","--","--","--","--","--","original_moving_image",":","array",",","shape","(","R",",","C",")","or","(","S",",","R",",","C",")","the","original","moving","image","from","which","the","current","moving","image","was","generated",",","the","current","moving","image","is","the","one","that","was","provided","via","'set_moving_image","(","...",")","'",",","which","may","not","be","the","same","as","the","original","moving","image","but","a","warped","version","of","it",".","transformation",":","DiffeomorphicMap","object","the","transformation","that","was","applied","to","the","original_moving_image","to","generate","the","current","moving","image"]
code: def use_moving_image_dynamics(
      self, original_moving_image, transformation
  ):
      r"""This is called by the optimizer just after setting the moving image.
  
      EMMetric takes advantage of the image dynamics by computing the
      current moving image mask from the original_moving_image mask (warped
      by nearest neighbor interpolation)
  
      Parameters
      ----------
      original_moving_image : array, shape (R, C) or (S, R, C)
          the original moving image from which the current moving image was
          generated, the current moving image is the one that was provided
          via 'set_moving_image(...)', which may not be the same as the
          original moving image but a warped version of it.
      transformation : DiffeomorphicMap object
          the transformation that was applied to the original_moving_image
          to generate the current moving image
      """
      self.moving_image_mask = (original_moving_image > 0).astype(
          np.int32
      )
      if transformation is None:
          return
      shape = np.array(self.moving_image.shape, dtype=np.int32)
      affine = self.moving_affine
      self.moving_image_mask = transformation.transform(
          self.moving_image_mask, "nearest", None, shape, affine
      )
  
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 11 for calling the EMMetric obj's underlying member method code with example usage: obj.use_moving_image_dynamics(original_moving_image, transformation) without return types