code: def scans_for_fname(fname):
      """Reads a nifti file and converts it to a numpy array storing
      individual nifti volumes.
  
      Opens images so will fail if they are not found.
  
      """
      if isinstance(fname, list):
          scans = np.zeros((len(fname),), dtype=object)
          for sno, f in enumerate(fname):
              scans[sno] = "%s,1" % f
          return scans
      img = load(fname)
      if len(img.shape) == 3:
          return np.array(("%s,1" % fname,), dtype=object)
      else:
          n_scans = img.shape[3]
          scans = np.zeros((n_scans,), dtype=object)
          for sno in range(n_scans):
              scans[sno] = "%s,%d" % (fname, sno + 1)
          return scans
  
imports: import os
  from copy import deepcopy
  from nibabel import load
  import numpy
  from ...None import logging
  from ...utils import spm_docs
  from ..base import BaseInterface, traits, isdefined, InputMultiPath, BaseInterfaceInputSpec, Directory, Undefined, ImageFile, PackageInfo
  from ..base.traits_extension import NoDefaultSpecified
  from ..matlab import MatlabCommand
  from ...external.due import due, Doi, BibTeX
label_desc: Use image node_id 3 for calling a global function with example usage: scans_for_fname(fname) and returns: scans, np, scans