code: def coord_transform(x, y, z, affine):
      """Convert x, y, z coordinates from one image space to another space.
  
      Warning: x, y and z have Talairach ordering, not 3D numpy image ordering.
  
      Parameters
      ----------
      x : number or ndarray
          The x coordinates in the input space
      y : number or ndarray
          The y coordinates in the input space
      z : number or ndarray
          The z coordinates in the input space
      affine : 2D 4x4 ndarray
          affine that maps from input to output space.
  
      Returns
      -------
      x : number or ndarray
          The x coordinates in the output space
      y : number or ndarray
          The y coordinates in the output space
      z : number or ndarray
          The z coordinates in the output space
      """
      coords = np.c_[
          np.atleast_1d(x).flat,
          np.atleast_1d(y).flat,
          np.atleast_1d(z).flat,
          np.ones_like(np.atleast_1d(z).flat),
      ].T
      x, y, z, _ = np.dot(affine, coords)
      return x.squeeze(), y.squeeze(), z.squeeze()
  
file_path: nipy/nipy/labs/viz_tools/coord_tools.py
imports: import warnings
  import numpy
  from scipy import ndimage, stats
  from ..datasets.transforms.affine_utils import get_bounds
  from ..mask import largest_cc
label_desc: Use image node_id 1 for calling a global function with example usage: coord_transform(x, y, z, affine) and returns: x,  y,  z