code: def coord_transform(x, y, z, affine):
      """Convert the x, y, z coordinates from one image space to another space.
  
      Parameters
      ----------
      x : number or ndarray (any shape)
          The x coordinates in the input space.
  
      y : number or ndarray (same shape as x)
          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 (same shape as input)
          The x coordinates in the output space.
  
      y : number or ndarray (same shape as input)
          The y coordinates in the output space.
  
      z : number or ndarray (same shape as input)
          The z coordinates in the output space.
  
      Warning: The x, y and z have their output space (e.g. MNI) coordinate
      ordering, not 3D numpy image ordering.
  
      Examples
      --------
      Transform data from coordinates to brain space. The "affine" matrix
      can be found as the ".affine" attribute of a nifti image, or using
      the "get_affine()" method for older nibabel installations::
  
          >>> from nilearn import datasets, image
          >>> niimg = datasets.load_mni152_template()
          >>> # Find the MNI coordinates of the voxel (50, 50, 50)
          >>> image.coord_transform(50, 50, 50, niimg.affine)
          (-48.0, -84.0, -22.0)
  
      """
      squeeze = not hasattr(x, "__iter__")
      return_number = isinstance(x, numbers.Number)
      x = np.asanyarray(x)
      shape = x.shape
      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)
      if return_number:
          return x.item(), y.item(), z.item()
      if squeeze:
          return x.squeeze(), y.squeeze(), z.squeeze()
      return (
          np.reshape(x, shape),
          np.reshape(y, shape),
          np.reshape(z, shape),
      )
  
file_path: nilearn/nilearn/image/resampling.py
imports: import numbers
  import warnings
  import numpy
  from scipy import linalg
  from scipy.ndimage import affine_transform, find_objects
  from ..None import _utils
  from .._utils import stringify_path
  from .._utils.niimg import _get_data
  from .image import copy_img, crop_img
label_desc: Use image node_id 3 for calling a global function with example usage: coord_transform(x, y, z, affine) and returns: np,  np,  np, x,  y,  z, x,  y,  z