code: def test_basic_nipy2nifti():
      # Go from nipy image to header and data for nifti
      fimg = copy_of(funcfile)
      hdr = fimg.metadata["header"]
      data = fimg.get_fdata()
      # Header is preserved
      # Put in some information to check header is preserved
      hdr["slice_duration"] = 0.25
      ni_img = nipy2nifti(fimg)
      new_hdr = get_header(ni_img)
      # header copied on the way through
      assert not hdr is new_hdr
      # Check information preserved
      assert hdr["slice_duration"] == new_hdr["slice_duration"]
      assert_array_equal(data, ni_img.get_fdata())
      # Shape obviously should be same
      assert ni_img.shape == fimg.shape
  
imports: import warnings
  from copy import copy
  import nibabel
  import numpy
  import pytest
  from nibabel.affines import from_matvec
  from nibabel.spatialimages import HeaderDataError
  from numpy.testing import assert_array_equal
  from ...core.api import AffineTransform
  from ...core.api import CoordinateSystem
  from ...core.api import Image
  from ...core.reference.spaces import aligned_csm, mni_csm, scanner_csm, talairach_csm, unknown_csm, unknown_space, vox2mni
  from ...testing import anatfile, funcfile
  from ..files import load
  from ..nibcompat import get_affine, get_header
  from ..nifti_ref import NiftiError, nifti2nipy, nipy2nifti
label_desc: Use image node_id 2 for calling a global function with example usage: test_basic_nipy2nifti() without return types