code: def _resample_from_to(img, affine, to_vox_map):
      # Wrap to dipy for speed, equivalent to:
      # from nibabel.processing import resample_from_to
      # from nibabel.spatialimages import SpatialImage
      # return _get_img_fdata(
      #     resample_from_to(SpatialImage(img, affine), to_vox_map, order=1))
      import dipy.align.imaffine
  
      return dipy.align.imaffine.AffineMap(
          None, to_vox_map[0], to_vox_map[1], img.shape, affine
      ).transform(img, resample_only=True)
  
imports: import copy
  import os.path
  import warnings
  import numpy
  from scipy import sparse
  from .fixes import _get_img_fdata
  from .morph_map import read_morph_map
  from .parallel import parallel_func
  from .source_estimate import _BaseSourceEstimate, _BaseSurfaceSourceEstimate, _BaseVolSourceEstimate, _get_ico_tris
  from .source_space._source_space import SourceSpaces, _ensure_src, _grid_interp
  from .surface import _compute_nearest, mesh_edges, read_surface
  from .utils import BunchConst, ProgressBar, _check_fname, _check_option, _custom_lru_cache, _ensure_int, _import_h5io_funcs, _import_nibabel, _validate_type, check_version, fill_doc, get_subjects_dir, logger, use_log_level, verbose, warn
  from .utils import warn
label_desc: Use image node_id 5 for calling a global function with example usage: _resample_from_to(img, affine, to_vox_map) and returns: dipy