code: def dist2loss(q, qI=None, qJ=None):
      """
      Convert a joint distribution model q(i,j) into a pointwise loss:
  
      L(i,j) = - log q(i,j)/(q(i)q(j))
  
      where q(i) = sum_j q(i,j) and q(j) = sum_i q(i,j)
  
      See: Roche, medical image registration through statistical
      inference, 2001.
      """
      qT = q.T
      if qI is None:
          qI = q.sum(0)
      if qJ is None:
          qJ = q.sum(1)
      q /= nonzero(qI)
      qT /= nonzero(qJ)
      return -np.log(nonzero(q))
  
imports: import numpy
  from scipy.ndimage import gaussian_filter
  from ._registration import _L1_moments
label_desc: Use image node_id 2 for calling a global function with example usage: dist2loss(q, qI, qJ) and returns: unknown