code: def test_nibabel_readwritedata():
      with InTemporaryDirectory():
          for name in datafiles:
              img = nib.load(name)
              nib.save(img, "test.nii")
              img2 = nib.load("test.nii")
              assert len(img.header.matrix) == len(img2.header.matrix)
              # Order should be preserved in load/save
              for mim1, mim2 in zip(
                  img.header.matrix, img2.header.matrix
              ):
                  named_maps1 = [
                      m_
                      for m_ in mim1
                      if isinstance(m_, ci.Cifti2NamedMap)
                  ]
                  named_maps2 = [
                      m_
                      for m_ in mim2
                      if isinstance(m_, ci.Cifti2NamedMap)
                  ]
                  assert len(named_maps1) == len(named_maps2)
                  for map1, map2 in zip(named_maps1, named_maps2):
                      assert map1.map_name == map2.map_name
                      if map1.label_table is None:
                          assert map2.label_table is None
                      else:
                          assert len(map1.label_table) == len(
                              map2.label_table
                          )
              assert_array_almost_equal(img.dataobj, img2.dataobj)
  
imports: import io
  from os.path import dirname
  from os.path import join
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from packaging.version import Version
  import nibabel
  from nibabel import cifti2
  from nibabel.cifti2.parse_cifti2 import _Cifti2AsNiftiHeader
  from nibabel.tests import test_nifti2
  from nibabel.tests.nibabel_data import get_nibabel_data, needs_nibabel_data
  from nibabel.tmpdirs import InTemporaryDirectory
label_desc: Use image node_id 7 for calling a global function with example usage: test_nibabel_readwritedata() without return types