code: def resample_img2img(
      img_to, img_from, order=1, out_class=nib.Nifti1Image
  ):
      if not have_scipy:
          raise Exception(
              "Scipy must be installed to run resample_img2img."
          )
  
      from scipy import ndimage as spnd
  
      vox2vox = npl.inv(img_from.affine).dot(img_to.affine)
      rzs, trans = to_matvec(vox2vox)
      data = spnd.affine_transform(
          img_from.get_fdata(), rzs, trans, img_to.shape, order=order
      )
      return out_class(data, img_to.affine)
  
file_path: nibabel/nibabel/tests/data/check_parrec_reslice.py
imports: import glob
  import numpy
  import numpy.linalg
  import nibabel
  from nibabel import parrec
  from nibabel.affines import to_matvec
  from nibabel.optpkg import optional_package
label_desc: Use image node_id 1 for calling a global function with example usage: resample_img2img(img_to, img_from, order, out_class) and returns: out_class