code: def test_convert_imgtype(tmp_path, ext, img_class):
      infile = get_test_data(fname="anatomical.nii")
      outfile = tmp_path / f"output.{ext}"
  
      orig = nib.load(infile)
      assert not outfile.exists()
  
      convert.main(
          [
              str(infile),
              str(outfile),
              "--image-type",
              img_class.__name__,
          ]
      )
      assert outfile.is_file()
  
      converted = nib.load(outfile)
      assert np.allclose(converted.affine, orig.affine)
      assert converted.shape == orig.shape
      assert converted.__class__ == img_class
  
file_path: nibabel/nibabel/cmdline/tests/test_convert.py
imports: import numpy
  import pytest
  import nibabel
  from nibabel.cmdline import convert
  from nibabel.testing import get_test_data
label_desc: Use image node_id 4 for calling a global function with example usage: test_convert_imgtype(tmp_path, ext, img_class) without return types