code: def _mapping_to_voxel(affine):
      """Inverts affine and returns a mapping so voxel coordinates. This
      function is an implementation detail and only meant to be used with
      ``_to_voxel_coordinates``.
  
      Parameters
      ----------
      affine : array_like (4, 4)
          The mapping from voxel indices, [i, j, k], to real world coordinates.
          The inverse of this mapping is used unless `affine` is None.
  
      Returns
      -------
      lin_T : array (3, 3)
          Transpose of the linear part of the mapping to voxel space, (ie
          ``inv(affine)[:3, :3].T``)
      offset : array or scalar
          Offset part of the mapping (ie, ``inv(affine)[:3, 3]``) + ``.5``. The
          half voxel shift is so that truncating the result of this mapping
          will give the correct integer voxel coordinate.
  
      Raises
      ------
      ValueError
          If both affine and voxel_size are None.
  
      """
      if affine is None:
          raise ValueError("no affine specified")
  
      affine = np.array(affine, dtype=float)
      inv_affine = np.linalg.inv(affine)
      lin_T = inv_affine[:3, :3].T.copy()
      offset = inv_affine[:3, 3] + 0.5
  
      return lin_T, offset
  
label_desc: Use image node_id 1 for calling a global function with example usage: _mapping_to_voxel(affine) and returns: lin_T,  offset