code: def horizon(
      tractograms=None,
      images=None,
      pams=None,
      cluster=False,
      rgb=False,
      cluster_thr=15.0,
      random_colors=None,
      bg_color=(0, 0, 0),
      order_transparent=True,
      length_gt=0,
      length_lt=1000,
      clusters_gt=0,
      clusters_lt=10000,
      world_coords=True,
      interactive=True,
      buan=False,
      buan_colors=None,
      roi_images=False,
      roi_colors=(1, 0, 0),
      out_png="tmp.png",
      recorded_events=None,
      return_showm=False,
  ):
      """Interactive medical visualization - Invert the Horizon!
  
  
      Parameters
      ----------
      tractograms : sequence of StatefulTractograms
              StatefulTractograms are used for making sure that the coordinate
              systems are correct
      images : sequence of tuples
          Each tuple contains data and affine
      pams : sequence of PeakAndMetrics
          Contains peak directions and spherical harmonic coefficients
      cluster : bool
          Enable QuickBundlesX clustering
      rgb: bool, optional
          Enable the color image.
      cluster_thr : float
          Distance threshold used for clustering. Default value 15.0 for
          small animal data you may need to use something smaller such
          as 2.0. The threshold is in mm. For this parameter to be active
          ``cluster`` should be enabled.
      random_colors : string
          Given multiple tractograms and/or ROIs then each tractogram and/or
          ROI will be shown with different color. If no value is provided both
          the tractograms and the ROIs will have a different random color
          generated from a distinguishable colormap. If the effect should only be
          applied to one of the 2 objects, then use the options 'tracts' and
          'rois' for the tractograms and the ROIs respectively.
      bg_color : ndarray or list or tuple
          Define the background color of the scene. Default is black (0, 0, 0)
      order_transparent : bool
          Default True. Use depth peeling to sort transparent objects.
          If True also enables anti-aliasing.
      length_gt : float
          Clusters with average length greater than ``length_gt`` amount
          in mm will be shown.
      length_lt : float
          Clusters with average length less than ``length_lt`` amount in mm
          will be shown.
      clusters_gt : int
          Clusters with size greater than ``clusters_gt`` will be shown.
      clusters_lt : int
          Clusters with size less than ``clusters_lt`` will be shown.
      world_coords : bool
          Show data in their world coordinates (not native voxel coordinates)
          Default True.
      interactive : bool
          Allow user interaction. If False then Horizon goes on stealth mode
          and just saves pictures.
      buan : bool, optional
          Enables BUAN framework visualization. Default is False.
      buan_colors : list, optional
          List of colors for bundles.
      roi_images : bool, optional
          Displays binary images as contours. Default is False.
      roi_colors : ndarray or list or tuple, optional
          Define the color of the roi images. Default is red (1, 0, 0)
      out_png : string
          Filename of saved picture.
      recorded_events : string
          File path to replay recorded events
      return_showm : bool
          Return ShowManager object. Used only at Python level. Can be used
          for extending Horizon's cababilities externally and for testing
          purposes.
  
      References
      ----------
      .. [Horizon_ISMRM19] Garyfallidis E., M-A. Cote, B.Q. Chandio,
          S. Fadnavis, J. Guaje, R. Aggarwal, E. St-Onge, K.S. Juneja,
          S. Koudoro, D. Reagan, DIPY Horizon: fast, modular, unified and
          adaptive visualization, Proceedings of: International Society of
          Magnetic Resonance in Medicine (ISMRM), Montreal, Canada, 2019.
      """
  
      hz = Horizon(
          tractograms,
          images,
          pams,
          cluster,
          rgb,
          cluster_thr,
          random_colors,
          length_gt,
          length_lt,
          clusters_gt,
          clusters_lt,
          world_coords,
          interactive,
          out_png,
          recorded_events,
          return_showm,
          bg_color=bg_color,
          order_transparent=order_transparent,
          buan=buan,
          buan_colors=buan_colors,
          roi_images=roi_images,
          roi_colors=roi_colors,
      )
  
      scene = hz.build_scene()
  
      if return_showm:
          return hz.build_show(scene)
      hz.build_show(scene)
  
imports: from packaging.version import Version
  import warnings
  import numpy
  from dipy import __version__
  from dipy.io.stateful_tractogram import Space, StatefulTractogram
  from dipy.io.streamline import save_tractogram
  from dipy.tracking.streamline import Streamlines
  from dipy.utils.optpkg import optional_package
  from dipy.viz.gmem import GlobalHorizon
  from dipy.viz.horizon.tab import ClustersTab, PeaksTab, ROIsTab, SlicesTab, TabManager, build_label
  from dipy.viz.horizon.visualizer import ClustersVisualizer, SlicesVisualizer
  from dipy.viz.horizon.util import check_img_dtype, check_img_shapes
label_desc: Use image node_id 1 for calling a global function with example usage: horizon(tractograms, images, pams, cluster, rgb, cluster_thr, random_colors, bg_color, order_transparent, length_gt, length_lt, clusters_gt, clusters_lt, world_coords, interactive, buan, buan_colors, roi_images, roi_colors, out_png, recorded_events, return_showm) and returns: hz