code: def check_same_fov(*args, **kwargs):
      """Return True if provided images have the same field of view (shape and \
      affine) and return False or raise an error elsewhere, depending on the \
      `raise_error` argument.
  
      This function can take an unlimited number of
      images as arguments or keyword arguments and raise a user-friendly
      ValueError if asked.
  
      Parameters
      ----------
      args : images
          Images to be checked. Images passed without keywords will be labelled
          as img_#1 in the error message (replace 1 with the appropriate index).
  
      kwargs : images
          Images to be checked. In case of error, images will be reference by
          their keyword name in the error message.
  
      raise_error : boolean, optional
          If True, an error will be raised in case of error.
  
      """
      raise_error = kwargs.pop("raise_error", False)
      for i, arg in enumerate(args):
          kwargs[f"img_#{i}"] = arg
      errors = []
      for (a_name, a_img), (b_name, b_img) in itertools.combinations(
          kwargs.items(), 2
      ):
          if not a_img.shape[:3] == b_img.shape[:3]:
              errors.append((a_name, b_name, "shape"))
          if not np.allclose(a_img.affine, b_img.affine):
              errors.append((a_name, b_name, "affine"))
      if len(errors) > 0 and raise_error:
          raise ValueError(
              "Following field of view errors were detected:\n"
              + "\n".join(
                  [
                      f"- {e[0]} and {e[1]} do not have the same {e[2]}"
                      for e in errors
                  ]
              )
          )
      return len(errors) == 0
  
file_path: nilearn/nilearn/_utils/niimg_conversions.py
imports: import glob
  import itertools
  import os.path
  import warnings
  import numpy
  from joblib import Memory
  import nilearn
  from .cache_mixin import cache
  from .exceptions import DimensionError
  from .helpers import stringify_path
  from .niimg import _get_data, load_niimg, safe_get_data
  from .path_finding import resolve_globbing
label_desc: Use image node_id 2 for calling a global function with example usage: check_same_fov() and returns: unknown