code: def test_loading():
      # Test loading of parrec files
      for par in glob(pjoin(BALLS, "PARREC", "*.PAR")):
          par_root, ext = splitext(basename(par))
          # NA.PAR appears to be a localizer, with three slices in each of the
          # three orientations: sagittal; coronal, transverse
          if par_root == "NA":
              continue
          # Check we can load the image
          pimg = load(par)
          assert pimg.shape[:3] == (80, 80, 10)
          # Compare against NIFTI if present
          nifti_fname = pjoin(BALLS, "NIFTI", par_root + ".nii.gz")
          if exists(nifti_fname):
              nimg = top_load(nifti_fname)
              assert_almost_equal(
                  nimg.affine[:3, :3], pimg.affine[:3, :3], 3
              )
              # The translation part is always off by the same ammout
              aff_off = pimg.affine[:3, 3] - nimg.affine[:3, 3]
              assert_almost_equal(aff_off, AFF_OFF, 4)
              # The difference is max in the order of 0.5 voxel
              vox_sizes = voxel_sizes(nimg.affine)
              assert np.all(np.abs(aff_off / vox_sizes) <= 0.501)
              # The data is very close, unless it's the fieldmap
              if par_root != "fieldmap":
                  assert np.allclose(pimg.dataobj, nimg.dataobj)
  
file_path: nibabel/nibabel/tests/test_parrec_data.py
imports: import unittest
  from glob import glob
  from os.path import basename, exists
  from os.path import join
  from os.path import splitext
  import numpy
  import pytest
  from numpy.testing import assert_almost_equal
  from ..None import load
  from ..affines import voxel_sizes
  from ..parrec import load
  from .nibabel_data import get_nibabel_data, needs_nibabel_data
label_desc: Use image node_id 1 for calling a global function with example usage: test_loading() without return types