code: def test_bootstap_peak_tracker():
      """This tests that the Bootstrap Peak Direction Getter plays nice
      LocalTracking and produces reasonable streamlines in a simple example.
      """
      sphere = get_sphere("repulsion100")
  
      # A simple image with three possible configurations, a vertical tract,
      # a horizontal tract and a crossing
      simple_image = np.array(
          [
              [0, 1, 0, 0, 0, 0],
              [0, 1, 0, 0, 0, 0],
              [2, 3, 2, 2, 2, 0],
              [0, 1, 0, 0, 0, 0],
              [0, 1, 0, 0, 0, 0],
          ]
      )
      simple_image = simple_image[..., None]
  
      bvecs = sphere.vertices
      bvals = np.ones(len(bvecs)) * 1000
      bvecs = np.insert(bvecs, 0, np.array([0, 0, 0]), axis=0)
      bvals = np.insert(bvals, 0, 0)
      gtab = gradient_table(bvals, bvecs)
      angles = [(90, 90), (90, 0)]
      fracs = [50, 50]
      mevals = np.array([[1.5, 0.4, 0.4], [1.5, 0.4, 0.4]]) * 1e-3
      mevecs = [
          np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]),
          np.array([[0, 1, 0], [1, 0, 0], [0, 0, 1]]),
      ]
      voxel1 = single_tensor(gtab, 1, mevals[0], mevecs[0], snr=None)
      voxel2 = single_tensor(gtab, 1, mevals[0], mevecs[1], snr=None)
      voxel3, _ = multi_tensor(
          gtab, mevals, fractions=fracs, angles=angles, snr=None
      )
      data = np.tile(voxel3, [5, 6, 1, 1])
      data[simple_image == 1] = voxel1
      data[simple_image == 2] = voxel2
  
      response = (np.array(mevals[1]), 1)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          csd_model = ConstrainedSphericalDeconvModel(
              gtab, response, sh_order=6
          )
  
      seeds = [np.array([0.0, 1.0, 0.0]), np.array([2.0, 4.0, 0.0])]
  
      sc = BinaryStoppingCriterion((simple_image > 0).astype(float))
      sphere = HemiSphere.from_sphere(get_sphere("symmetric724"))
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          boot_dg = BootDirectionGetter.from_data(
              data, csd_model, 60, sphere=sphere
          )
  
      streamlines_generator = LocalTracking(
          boot_dg, sc, seeds, np.eye(4), 1.0
      )
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          streamlines = Streamlines(streamlines_generator)
      expected = [
          np.array(
              [
                  [0.0, 1.0, 0.0],
                  [1.0, 1.0, 0.0],
                  [2.0, 1.0, 0.0],
                  [3.0, 1.0, 0.0],
                  [4.0, 1.0, 0.0],
              ]
          ),
          np.array(
              [
                  [2.0, 4.0, 0.0],
                  [2.0, 3.0, 0.0],
                  [2.0, 2.0, 0.0],
                  [2.0, 1.0, 0.0],
                  [2.0, 0.0, 0.0],
              ]
          ),
      ]
  
      if not allclose(streamlines[0], expected[0], atol=0.5):
          raise AssertionError()
      if not allclose(streamlines[1], expected[1], atol=0.5):
          raise AssertionError()
  
imports: from logging import warn
  import warnings
  import nibabel
  import numpy
  import numpy.testing
  from dipy.core.gradients import gradient_table
  from dipy.core.sphere import HemiSphere, unit_octahedron
  from dipy.data import get_fnames, get_sphere
  from dipy.direction import BootDirectionGetter, ClosestPeakDirectionGetter, DeterministicMaximumDirectionGetter, PeaksAndMetrics, ProbabilisticDirectionGetter, PTTDirectionGetter
  from dipy.reconst.csdeconv import ConstrainedSphericalDeconvModel
  from dipy.reconst.shm import descoteaux07_legacy_msg
  from dipy.tracking.local_tracking import LocalTracking, ParticleFilteringTracking
  from dipy.tracking.streamline import Streamlines
  from dipy.tracking.stopping_criterion import ActStoppingCriterion, BinaryStoppingCriterion, ThresholdStoppingCriterion, StreamlineStatus
  from dipy.tracking.utils import random_seeds_from_mask, seeds_from_mask
  from dipy.sims.voxel import single_tensor, multi_tensor
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 8 for calling a global function with example usage: test_bootstap_peak_tracker() without return types