code: def array_affine_coord(mask, affine):
      """Compute coordinates from a boolean array and an affine transform
  
      Parameters
      ----------
      mask: nd array,
             input array, interpreted as a mask
      affine: (n+1, n+1) matrix,
              affine transform that maps the mask points to some embedding space
  
      Returns
      -------
      coords: array of shape(sum(mask>0), n),
              the computed coordinates
  
      """
      idx = np.array(np.where(mask)).T
      return idx_affine_coord(idx, affine)
  
imports: import numpy
  import scipy.sparse
  from nibabel import Nifti1Image, load, save
  from nipy.algorithms.graph import WeightedGraph, wgraph_from_3d_grid, wgraph_from_coo_matrix
  from nipy.io.nibcompat import get_affine, get_header
label_desc: Use image node_id 5 for calling a global function with example usage: array_affine_coord(mask, affine) and returns: idx_affine_coord