docstr: Demons step for SSD metric
  
  Computes the demons step proposed by Vercauteren et al.[Vercauteren09]
  for the SSD metric.
  
  Parameters
  ----------
  forward_step : boolean
      if True, computes the Demons step in the forward direction
      (warping the moving towards the static image). If False,
      computes the backward step (warping the static image to the
      moving image)
  
  Returns
  -------
  displacement : array, shape (R, C, 2) or (S, R, C, 3)
      the Demons step
  
  References
  ----------
  [Vercauteren09] Tom Vercauteren, Xavier Pennec, Aymeric Perchant,
                  Nicholas Ayache, "Diffeomorphic Demons: Efficient
                  Non-parametric Image Registration", Neuroimage 2009
docstr_tok: ["Demons","step","for","SSD","metric","Computes","the","demons","step","proposed","by","Vercauteren","et","al",".","[","Vercauteren09","]","for","the","SSD","metric",".","Parameters","--","--","--","--","--","forward_step",":","boolean","if","True",",","computes","the","Demons","step","in","the","forward","direction","(","warping","the","moving","towards","the","static","image",")",".","If","False",",","computes","the","backward","step","(","warping","the","static","image","to","the","moving","image",")","Returns","--","--","--","-","displacement",":","array",",","shape","(","R",",","C",",","2",")","or","(","S",",","R",",","C",",","3",")","the","Demons","step","References","--","--","--","--","--","[","Vercauteren09","]","Tom","Vercauteren",",","Xavier","Pennec",",","Aymeric","Perchant",",","Nicholas","Ayache",",","``","Diffeomorphic","Demons",":","Efficient","Non-parametric","Image","Registration","''",",","Neuroimage","2009"]
code: def compute_demons_step(self, forward_step=True):
      r"""Demons step for SSD metric
  
      Computes the demons step proposed by Vercauteren et al.[Vercauteren09]
      for the SSD metric.
  
      Parameters
      ----------
      forward_step : boolean
          if True, computes the Demons step in the forward direction
          (warping the moving towards the static image). If False,
          computes the backward step (warping the static image to the
          moving image)
  
      Returns
      -------
      displacement : array, shape (R, C, 2) or (S, R, C, 3)
          the Demons step
  
      References
      ----------
      [Vercauteren09] Tom Vercauteren, Xavier Pennec, Aymeric Perchant,
                      Nicholas Ayache, "Diffeomorphic Demons: Efficient
                      Non-parametric Image Registration", Neuroimage 2009
      """
      sigma_reg_2 = np.sum(self.static_spacing**2) / self.dim
  
      if forward_step:
          gradient = self.gradient_static
          delta_field = self.static_image - self.moving_image
      else:
          gradient = self.gradient_moving
          delta_field = self.moving_image - self.static_image
  
      if self.dim == 2:
          step, self.energy = ssd.compute_ssd_demons_step_2d(
              delta_field, gradient, sigma_reg_2, None
          )
      else:
          step, self.energy = ssd.compute_ssd_demons_step_3d(
              delta_field, gradient, sigma_reg_2, None
          )
      for i in range(self.dim):
          step[..., i] = ndimage.gaussian_filter(
              step[..., i], self.smooth
          )
      return step
  
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 7 for calling the SSDMetric obj's underlying member method code with example usage: obj.compute_demons_step(forward_step) and returns: step