code: def test_register_dwi_to_template():
      # Default is syn registration:
      warped_b0, mapping = register_dwi_to_template(
          subset_dwi_data,
          gtab,
          template=subset_t2_img,
          level_iters=[5, 5, 5],
          sigma_diff=2.0,
          radius=1,
      )
      npt.assert_(isinstance(mapping, DiffeomorphicMap))
      npt.assert_equal(warped_b0.shape, subset_t2_img.shape)
  
      # Use affine registration (+ don't provide a template and inputs as
      # strings):
      fdata, fbval, fbvec = dpd.get_fnames("small_64D")
      warped_data, affine_mat = register_dwi_to_template(
          fdata,
          (fbval, fbvec),
          reg_method="aff",
          level_iters=[5, 5, 5],
          sigmas=[3, 1, 0],
          factors=[4, 2, 1],
      )
      npt.assert_(isinstance(affine_mat, np.ndarray))
      npt.assert_(affine_mat.shape == (4, 4))
  
imports: import os.path
  import pytest
  from tempfile import TemporaryDirectory
  import numpy
  import numpy.testing
  import nibabel
  import dipy.data
  import dipy.core.gradients
  from dipy.align import syn_registration, register_series, register_dwi_series, center_of_mass, translation, rigid_isoscaling, rigid_scaling, rigid, affine, motion_correction, affine_registration, streamline_registration, write_mapping, read_mapping, register_dwi_to_template
  from dipy.align.imwarp import DiffeomorphicMap
  from dipy.tracking.utils import transform_tracking_output
  from dipy.io.streamline import save_trk
  from dipy.io.stateful_tractogram import StatefulTractogram, Space
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.io.image import load_nifti
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 3 for calling a global function with example usage: test_register_dwi_to_template() without return types