code: def test_voxel2streamline():
      streamline = [
          [[1.1, 2.4, 2.9], [4, 5, 3], [5, 6, 3], [6, 7, 3]],
          [[1, 2, 3], [4, 5, 3], [5, 6, 3]],
      ]
      affine = np.eye(4)
      v2f, v2fn = life.voxel2streamline(streamline, affine)
      npt.assert_equal(v2f, {0: [0, 1], 1: [0, 1], 2: [0, 1], 3: [0]})
      npt.assert_equal(
          v2fn,
          {
              0: {0: [0], 1: [1], 2: [2], 3: [3]},
              1: {0: [0], 1: [1], 2: [2]},
          },
      )
      affine = np.array(
          [
              [0.9, 0, 0, 10],
              [0, 0.9, 0, -100],
              [0, 0, 0.9, 2],
              [0, 0, 0, 1],
          ]
      )
  
      xform_sl = life.transform_streamlines(
          streamline, np.linalg.inv(affine)
      )
      v2f, v2fn = life.voxel2streamline(xform_sl, affine)
      npt.assert_equal(v2f, {0: [0, 1], 1: [0, 1], 2: [0, 1], 3: [0]})
      npt.assert_equal(
          v2fn,
          {
              0: {0: [0], 1: [1], 2: [2], 3: [3]},
              1: {0: [0], 1: [1], 2: [2]},
          },
      )
  
file_path: dipy/dipy/tracking/tests/test_life.py
imports: import os.path
  import dipy.core.gradients
  import dipy.core.optimize
  import dipy.data
  from dipy.io.image import load_nifti_data
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.io.stateful_tractogram import Space, StatefulTractogram
  import dipy.tracking.life
  import nibabel
  import numpy
  import numpy.testing
  import scipy.linalg
label_desc: Use image node_id 4 for calling a global function with example usage: test_voxel2streamline() without return types