code: def yslice(y, x_spec, z_spec, world):
      """Return a slice through a 3d box with y fixed.
  
      Parameters
      ----------
      y : float
         The value at which y 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.
      z_spec : sequence
         As for `x_spec` but for z
      world : str or CoordinateSystem CoordSysMaker or XYZSpace
          World 3D space to which resulting coordmap refers
  
      Returns
      -------
      affine_transform : AffineTransform
         An affine transform that describes an plane in
         LPS coordinates with y fixed.
  
      Examples
      --------
      >>> x_spec = ([-92,92], 93) # voxels of size 2 in x, starting at -92, ending at 92
      >>> z_spec = ([-70,100], 86) # voxels of size 2 in z, starting at -70, ending at 100
      >>> y70 = yslice(70, x_spec, z_spec, 'mni')
      >>> y70
      AffineTransform(
         function_domain=CoordinateSystem(coord_names=('i_x', 'i_z'), name='slice', coord_dtype=float64),
         function_range=CoordinateSystem(coord_names=('mni-x=L->R', 'mni-y=P->A', 'mni-z=I->S'), name='mni', coord_dtype=float64),
         affine=array([[  2.,   0., -92.],
                       [  0.,   0.,  70.],
                       [  0.,   2., -70.],
                       [  0.,   0.,   1.]])
      )
      >>> y70([0,0])
      array([-92.,  70., -70.])
      >>> y70([92,85])
      array([  92.,   70.,  100.])
      >>> bounding_box(y70, (x_spec[1], z_spec[1]))
      ((-92.0, 92.0), (70.0, 70.0), (-70.0, 100.0))
      """
      affine_range = get_world_cs(world)
      (xmin, xmax), xno = x_spec
      x_tick = (xmax - xmin) / (xno - 1.0)
      (zmin, zmax), zno = z_spec
      z_tick = (zmax - zmin) / (zno - 1.0)
      origin = [xmin, y, zmin]
      colvectors = np.asarray([[x_tick, 0], [0, 0], [0, z_tick]])
      T = from_matvec(colvectors, origin)
      affine_domain = CoordinateSystem(["i_x", "i_z"], "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 2 for calling a global function with example usage: yslice(y, x_spec, z_spec, world) and returns: AffineTransform