code: def zslice(z, x_spec, y_spec, world):
      """Return a slice through a 3d box with z fixed.
  
      Parameters
      ----------
      z : float
         The value at which z is fixed.
      x_spec : sequence
         A sequence with 2 values of form ((float, float), int). The
         (float, float) components are the min and max x values; the int
         is the number of points.
      y_spec : sequence
         As for `x_spec` but for y
      world : str or CoordinateSystem CoordSysMaker or XYZSpace
          World 3D space to which resulting coordmap refers
  
      Returns
      -------
      affine_transform : AffineTransform
         An affine transform that describes a plane in LPS coordinates with z
         fixed.
  
      Examples
      --------
      >>> x_spec = ([-92,92], 93) # voxels of size 2 in x, starting at -92, ending at 92
      >>> y_spec = ([-114,114], 115) # voxels of size 2 in y, starting at -114, ending at 114
      >>> z40 = zslice(40, x_spec, y_spec, 'unknown')
      >>> z40
      AffineTransform(
         function_domain=CoordinateSystem(coord_names=('i_x', 'i_y'), name='slice', coord_dtype=float64),
         function_range=CoordinateSystem(coord_names=('unknown-x=L->R', 'unknown-y=P->A', 'unknown-z=I->S'), name='unknown', coord_dtype=float64),
         affine=array([[   2.,    0.,  -92.],
                       [   0.,    2., -114.],
                       [   0.,    0.,   40.],
                       [   0.,    0.,    1.]])
      )
      >>> z40([0,0])
      array([ -92., -114.,   40.])
      >>> z40([92,114])
      array([  92.,  114.,   40.])
      >>> bounding_box(z40, (x_spec[1], y_spec[1]))
      ((-92.0, 92.0), (-114.0, 114.0), (40.0, 40.0))
      """
      affine_range = get_world_cs(world)
      (xmin, xmax), xno = x_spec
      x_tick = (xmax - xmin) / (xno - 1.0)
      (ymin, ymax), yno = y_spec
      y_tick = (ymax - ymin) / (yno - 1.0)
      origin = [xmin, ymin, z]
      colvectors = np.asarray([[x_tick, 0], [0, y_tick], [0, 0]])
      T = from_matvec(colvectors, origin)
      affine_domain = CoordinateSystem(["i_x", "i_y"], "slice")
      return AffineTransform(affine_domain, affine_range, T)
  
file_path: nipy/nipy/core/reference/slices.py
imports: import numpy
  from nibabel.affines import from_matvec
  from .array_coords import ArrayCoordMap
  from .coordinate_map import AffineTransform
  from .coordinate_system import CoordinateSystem
  from .spaces import get_world_cs
label_desc: Use image node_id 3 for calling a global function with example usage: zslice(z, x_spec, y_spec, world) and returns: AffineTransform