code: def test_syn_registration():
      with TemporaryDirectory() as tmpdir:
          warped_moving, mapping = syn_registration(
              subset_b0,
              subset_t2,
              moving_affine=hardi_affine,
              static_affine=MNI_T2_affine,
              step_length=0.1,
              metric="CC",
              dim=3,
              level_iters=[5, 5, 5],
              sigma_diff=2.0,
              radius=1,
              prealign=None,
          )
  
          npt.assert_equal(warped_moving.shape, subset_t2.shape)
          mapping_fname = op.join(tmpdir, "mapping.nii.gz")
          write_mapping(mapping, mapping_fname)
          file_mapping = read_mapping(
              mapping_fname, subset_b0_img, subset_t2_img
          )
  
          # Test that it has the same effect on the data:
          warped_from_file = file_mapping.transform(subset_b0)
          npt.assert_equal(warped_from_file, warped_moving)
  
          # Test that it is, attribute by attribute, identical:
          for k in mapping.__dict__:
              npt.assert_(
                  (
                      np.all(
                          mapping.__getattribute__(k)
                          == file_mapping.__getattribute__(k)
                      )
                  )
              )
  
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 2 for calling a global function with example usage: test_syn_registration() without return types