code: def test_horizon(rng):
      s1 = 10 * np.array(
          [[0, 0, 0], [1, 0, 0], [2, 0, 0], [3, 0, 0], [4, 0, 0]],
          dtype="f8",
      )
  
      s2 = 10 * np.array(
          [[0, 0, 0], [0, 1, 0], [0, 2, 0], [0, 3, 0], [0, 4, 0]],
          dtype="f8",
      )
  
      s3 = 10 * np.array(
          [
              [0, 0, 0],
              [1, 0.2, 0],
              [2, 0.2, 0],
              [3, 0.2, 0],
              [4, 0.2, 0],
          ],
          dtype="f8",
      )
  
      streamlines = Streamlines()
      streamlines.append(s1)
      streamlines.append(s2)
      streamlines.append(s3)
  
      affine = np.array(
          [
              [1.0, 0.0, 0.0, -98.0],
              [0.0, 1.0, 0.0, -134.0],
              [0.0, 0.0, 1.0, -72.0],
              [0.0, 0.0, 0.0, 1.0],
          ]
      )
  
      data = 255 * rng.random((197, 233, 189))
      vox_size = (1.0, 1.0, 1.0)
  
      streamlines._data += np.array([-98.0, -134.0, -72.0])
  
      header = create_nifti_header(affine, data.shape, vox_size)
      sft = StatefulTractogram(streamlines, header, Space.RASMM)
  
      # only tractograms
      tractograms = [sft]
      images = None
      horizon(
          tractograms,
          images=images,
          cluster=True,
          cluster_thr=5,
          random_colors=False,
          length_lt=np.inf,
          length_gt=0,
          clusters_lt=np.inf,
          clusters_gt=0,
          world_coords=True,
          interactive=False,
      )
  
      images = [(data, affine)]
  
      # tractograms in native coords (not supported for now)
      with npt.assert_raises(ValueError) as ve:
          horizon(
              tractograms,
              images=images,
              cluster=True,
              cluster_thr=5,
              random_colors=False,
              length_lt=np.inf,
              length_gt=0,
              clusters_lt=np.inf,
              clusters_gt=0,
              world_coords=False,
              interactive=False,
          )
  
      msg = "Currently native coordinates are not supported for streamlines."
      npt.assert_(msg in str(ve.exception))
  
      # only images
      tractograms = None
      horizon(
          tractograms,
          images=images,
          cluster=True,
          cluster_thr=5,
          random_colors=False,
          length_lt=np.inf,
          length_gt=0,
          clusters_lt=np.inf,
          clusters_gt=0,
          world_coords=True,
          interactive=False,
      )
  
      # no clustering tractograms and images
      horizon(
          tractograms,
          images=images,
          cluster=False,
          cluster_thr=5,
          random_colors=False,
          length_lt=np.inf,
          length_gt=0,
          clusters_lt=np.inf,
          clusters_gt=0,
          world_coords=True,
          interactive=False,
      )
  
file_path: dipy/dipy/viz/tests/test_apps.py
imports: import os
  import warnings
  import numpy
  import numpy.testing
  import pytest
  from dipy.data import DATA_DIR
  from dipy.io.stateful_tractogram import Space, StatefulTractogram
  from dipy.io.utils import create_nifti_header
  from dipy.testing import check_for_warnings
  from dipy.testing.decorators import use_xvfb
  from dipy.tracking.streamline import Streamlines
  from dipy.utils.optpkg import optional_package
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 2 for calling a global function with example usage: test_horizon(rng) without return types