code: def _resample_one_img(
      data,
      A,
      b,
      target_shape,
      interpolation_order,
      out,
      copy=True,
      fill_value=0,
  ):
      """Do not use: internal function for resample_img."""
      if data.dtype.kind in ("i", "u"):
          # Integers are always finite
          has_not_finite = False
      else:
          not_finite = np.logical_not(np.isfinite(data))
          has_not_finite = np.any(not_finite)
      if has_not_finite:
          warnings.warn(
              "NaNs or infinite values are present in the data "
              "passed to resample. This is a bad thing as they "
              "make resampling ill-defined and much slower.",
              RuntimeWarning,
              stacklevel=2,
          )
          if copy:
              # We need to do a copy to avoid modifying the input
              # array
              data = data.copy()
          # data[not_finite] = 0
          from ..masking import extrapolate_out_mask
  
          data = extrapolate_out_mask(
              data, np.logical_not(not_finite), iterations=2
          )[0]
  
      # If data is binary and interpolation is continuous or linear,
      # warn the user as this might be unintentional
      if (
          sorted(list(np.unique(data))) == [0, 1]
          and interpolation_order != 0
      ):
          warnings.warn(
              "Resampling binary images with continuous or "
              "linear interpolation. This might lead to "
              "unexpected results. You might consider using "
              "nearest interpolation instead."
          )
  
      # Suppresses warnings in https://github.com/nilearn/nilearn/issues/1363
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore", message=".*has changed in SciPy 0.18.*"
          )
          # The resampling itself
          affine_transform(
              data,
              A,
              offset=b,
              output_shape=target_shape,
              output=out,
              cval=fill_value,
              order=interpolation_order,
          )
  
      if has_not_finite:
          # Suppresses warnings in https://github.com/nilearn/nilearn/issues/1363
          with warnings.catch_warnings():
              warnings.filterwarnings(
                  "ignore", message=".*has changed in SciPy 0.18.*"
              )
              # We need to resample the mask of not_finite values
              not_finite = affine_transform(
                  not_finite,
                  A,
                  offset=b,
                  output_shape=target_shape,
                  order=0,
              )
          out[not_finite] = np.nan
      return out
  
file_path: nilearn/nilearn/image/resampling.py
imports: import numbers
  import warnings
  import numpy
  from scipy import linalg
  from scipy.ndimage import affine_transform, find_objects
  from ..None import _utils
  from .._utils import stringify_path
  from .._utils.niimg import _get_data
  from .image import copy_img, crop_img
label_desc: Use image node_id 6 for calling a global function with example usage: _resample_one_img(data, A, b, target_shape, interpolation_order, out, copy, fill_value) and returns: out