def scans_for_fnames(fnames, keep4d=False, separate_sessions=False):
 flist = None
 if (not isinstance(fnames[0], list)):
  if func_is_3d(fnames[0]):
   fnames = [fnames]
 if (separate_sessions or keep4d):
  flist = np.zeros((len(fnames),), dtype=object)
 for (i, f) in enumerate(fnames):
  if separate_sessions:
   if keep4d:
    if isinstance(f, list):
     flist[i] = np.array(f, dtype=object)
    else:
     flist[i] = np.array([f], dtype=object)
   else:
    flist[i] = scans_for_fname(f)
  elif keep4d:
   flist[i] = f
  else:
   scans = scans_for_fname(f)
   if (flist is None):
    flist = scans
   else:
    flist = np.concatenate((flist, scans))
 return flist

def scans_for_fnames ( fnames , keep4d = False , separate_sessions = False ) : flist = None if ( not isinstance ( fnames [ 0 ] , list ) ) : if func_is_3d ( fnames [ 0 ] ) : fnames = [ fnames ] if ( separate_sessions or keep4d ) : flist = np . zeros ( ( len ( fnames ) , ) , dtype = object ) for ( i , f ) in enumerate ( fnames ) : if separate_sessions : if keep4d : if isinstance ( f , list ) : flist [ i ] = np . array ( f , dtype = object ) else : flist [ i ] = np . array ( [ f ] , dtype = object ) else : flist [ i ] = scans_for_fname ( f ) elif keep4d : flist [ i ] = f else : scans = scans_for_fname ( f ) if ( flist is None ) : flist = scans else : flist = np . concatenate ( ( flist , scans ) ) return flist
converts a list of files to a concatenated numpy array for each volume .