code: def test_bdg_get_direction():
      """This tests the direction found by the bootstrap direction getter."""
  
      _, fbvals, fbvecs = get_fnames("small_64D")
  
      bvals, bvecs = read_bvals_bvecs(fbvals, fbvecs)
      gtab = gradient_table(bvals, bvecs, b0_threshold=0)
      mevals = np.array(
          ([0.0015, 0.0003, 0.0003], [0.0015, 0.0003, 0.0003])
      )
  
      angles = [(0, 0)]
  
      voxel, _ = multi_tensor(
          gtab, mevals, 1, angles=angles, fractions=[100], snr=100
      )
      data = np.tile(voxel, (3, 3, 3, 1))
      sphere = get_sphere("symmetric362")
      response = (np.array([0.0015, 0.0003, 0.0003]), 1)
  
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=shm.descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          csd_model = ConstrainedSphericalDeconvModel(
              gtab, response, sh_order=6
          )
  
      point = np.array([0.0, 0.0, 0.0])
      prev_direction = sphere.vertices[5]
  
      # test case in which no valid direction is found with default max attempts
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=shm.descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          boot_dg = BootDirectionGetter(
              data, model=csd_model, max_angle=10.0, sphere=sphere
          )
          npt.assert_equal(
              boot_dg.get_direction(point, prev_direction), 1
          )
  
      # test case in which no valid direction is found with new max attempts
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=shm.descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          boot_dg = BootDirectionGetter(
              data,
              model=csd_model,
              max_angle=10,
              sphere=sphere,
              max_attempts=3,
          )
          npt.assert_equal(
              boot_dg.get_direction(point, prev_direction), 1
          )
  
      # test case in which a valid direction is found
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=shm.descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          boot_dg = BootDirectionGetter(
              data,
              model=csd_model,
              max_angle=60.0,
              sphere=sphere,
              max_attempts=5,
          )
          npt.assert_equal(
              boot_dg.get_direction(point, prev_direction), 0
          )
  
      # test invalid max_attempts parameters
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=shm.descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          npt.assert_raises(
              ValueError,
              lambda: BootDirectionGetter(
                  data, csd_model, 60, sphere=sphere, max_attempts=0
              ),
          )
  
file_path: dipy/dipy/direction/tests/test_bootstrap_direction_getter.py
imports: import warnings
  import numpy
  import numpy.testing
  from dipy.core.geometry import cart2sphere
  from dipy.core.gradients import gradient_table
  from dipy.core.sphere import HemiSphere, unit_icosahedron
  from dipy.data import get_sphere, get_fnames
  from dipy.direction.bootstrap_direction_getter import BootDirectionGetter
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.reconst import dti, shm
  from dipy.reconst.csdeconv import ConstrainedSphericalDeconvModel, TensorModel
  from dipy.sims.voxel import multi_tensor, single_tensor
  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_bdg_get_direction() without return types