code: def compute_orthographic_projection_image(
      filepath,
      size,
      shading_mode=None,
      colormap=None,
      subsampling_rate=None,
      projection_normal=None,
      bounds=None,
  ):
      """Generates an orthographic projection image for the given PCD file onto
      the specified plane (default xy plane).
  
      The returned image is a three-channel array encoding the intensity, height,
      and density of the point cloud.
  
      Args:
          filepath: the path to the ``.pcd`` file
          size: the desired ``(width, height)`` for the generated maps. Either
              dimension can be None or negative, in which case the appropriate
              aspect-preserving value is used
          shading_mode (None): an optional shading algorithm for the points.
              Supported values are ``("intensity", "rgb", or "height")``. The
              ``"intensity"`` and ``"rgb"`` options are only valid if the PCD's
              header contains the ``"rgb"`` flag. By default, all points are
              shaded white
          colormap (None): an optional colormap to use when shading gradients,
              formatted as either:
  
              -   a dict mapping values in ``[0, 1]`` to ``(R, G, B)`` tuples in
                  ``[0, 255]``
              -   a list of of ``(R, G, B)`` tuples in ``[0, 255]`` that cover
                  ``[0, 1]`` linearly spaced
          subsampling_rate (None): an unsigned ``int`` that, if defined,
              defines a uniform subsampling rate. The selected point indices are
              [0, k, 2k, ...], where ``k = subsampling_rate``
          projection_normal (None): the normal vector of the plane onto which to
              perform the projection. By default, ``(0, 0, 1)`` is used
          bounds (None): an optional ``((xmin, ymin, zmin), (xmax, ymax, zmax))``
              tuple defining the field of view for which to generate each map in
              the projected plane. Either element of the tuple or any/all of its
              values can be None, in which case a tight crop of the point cloud
              along the missing dimension(s) are used
  
      Returns:
          a tuple of
  
          -   the orthographic projection image
          -   an :class:`OrthographicProjectionMetadata` instance
      """
      if colormap is None:
          colormap = DEFAULT_SHADING_GRADIENT_MAP
  
      if not isinstance(colormap, dict):
          colormap = dict(
              zip(np.linspace(0, 1, len(colormap)), colormap)
          )
  
      points, colors, metadata = _parse_point_cloud(
          filepath,
          size=size,
          bounds=bounds,
          projection_normal=projection_normal,
          subsampling_rate=subsampling_rate,
      )
  
      min_bound = metadata.min_bound
      max_bound = metadata.max_bound
      width = metadata.width
      height = metadata.height
  
      # scale and normalize XY points based on width / height and bounds
      points[:, 0] *= (width - 1) / (max_bound[0] - min_bound[0])
      points[:, 1] *= (height - 1) / (max_bound[1] - min_bound[1])
  
      image = np.zeros((width, height, 3), dtype=np.uint8)
  
      if (
          len(colors) == len(points)
          and shading_mode is not None
          and shading_mode != "height"
      ):
          if shading_mode == "rgb":
              image[np.int_(points[:, 0]), np.int_(points[:, 1]), :] = (
                  colors * 255.0
              )
          else:
              # use R channel for intensity, discard G and B channels
              min_intensity = np.min(colors[:, 0])
              max_intensity = np.max(colors[:, 1])
              intensities_normalized_t = (
                  colors[:, 0] - min_intensity
              ) / (max_intensity - min_intensity)
  
              # map intensity value to RGB
              rgb_refs = _clamp_to_discrete(
                  intensities_normalized_t, list(colormap.keys())
              )
              rgbs = np.array([colormap[v] for v in rgb_refs])
              image[
                  np.int_(points[:, 0]), np.int_(points[:, 1]), :
              ] = rgbs
      elif shading_mode == "height":
          # color by height (z)
          max_z = np.max(points[:, 2])
          min_z = np.min(points[:, 2])
          z_normalized = (points[:, 2] - min_z) / (max_z - min_z)
  
          # map z value to color
          rgb_refs = _clamp_to_discrete(
              z_normalized, list(colormap.keys())
          )
          rgbs = np.array([colormap[v] for v in rgb_refs])
          image[np.int_(points[:, 0]), np.int_(points[:, 1]), :] = rgbs
      else:
          image[np.int_(points[:, 0]), np.int_(points[:, 1]), :] = 255.0
  
      # change axis orientation such that y is up
      image = np.rot90(image, k=1, axes=(0, 1))
  
      return image, metadata
  
imports: import itertools
  import logging
  import warnings
  import numpy
  import scipy.spatial
  import eta.core.numutils
  import fiftyone.core.fields
  import fiftyone.core.labels
  import fiftyone.core.media
  from fiftyone.core.sample import Sample
  import fiftyone.core.utils
  import fiftyone.core.validation
  from fiftyone.core.odm import DynamicEmbeddedDocument
  import fiftyone.utils.image
label_desc: Use image node_id 9 for calling a global function with example usage: compute_orthographic_projection_image(filepath, size, shading_mode, colormap, subsampling_rate, projection_normal, bounds) and returns: image,  metadata