code: def test_header_roundtrip(in_tmp_path):
      img = load_image(anatfile)
      hdr = img.metadata["header"]
      # Update some header values and make sure they're saved
      hdr["slice_duration"] = 0.200
      hdr["intent_p1"] = 2.0
      hdr["descrip"] = "descrip for TestImage:test_header_roundtrip"
      hdr["slice_end"] = 12
      save_image(img, "img.nii.gz")
      newimg = load_image("img.nii.gz")
      newhdr = newimg.metadata["header"]
      assert_array_almost_equal(
          newhdr["slice_duration"], hdr["slice_duration"]
      )
      assert newhdr["intent_p1"] == hdr["intent_p1"]
      assert newhdr["descrip"] == hdr["descrip"]
      assert newhdr["slice_end"] == hdr["slice_end"]
  
imports: from os.path import dirname
  from os.path import join
  import nibabel
  import numpy
  import pytest
  from nibabel import Nifti1Header
  from nibabel.filebasedimages import ImageFileError
  from nibabel.spatialimages import HeaderDataError
  from nibabel.tests.test_round_trip import big_bad_ulp
  from nipy.core.api import AffineTransform
  from nipy.core.api import Image, vox2mni
  from nipy.testing import anatfile, assert_almost_equal, assert_array_almost_equal, assert_array_equal, funcfile
  from nipy.testing.decorators import if_templates
  from nipy.utils import DataError, templates
  from ..api import as_image, load_image, save_image
label_desc: Use image node_id 9 for calling a global function with example usage: test_header_roundtrip(in_tmp_path) without return types