code: def dist_to_corner(affine):
      """Calculate the maximal distance from the center to a corner of a voxel,
      given an affine
  
      Parameters
      ----------
      affine : 4 by 4 array.
          The spatial transformation from the measurement to the scanner space.
  
      Returns
      -------
      dist: float
          The maximal distance to the corner of a voxel, given voxel size encoded
          in the affine.
  
      """
      R = affine[0:3, 0:3]
      vox_dim = np.diag(np.linalg.cholesky(R.T.dot(R)))
      return np.sqrt(np.sum((vox_dim / 2) ** 2))
  
imports: import itertools
  import math
  import numpy
  import numpy.linalg
label_desc: Use image node_id 20 for calling a global function with example usage: dist_to_corner(affine) and returns: np