def scans_for_fname(fname):
 if isinstance(fname, list):
  scans = np.zeros((len(fname),), dtype=object)
  for (sno, f) in enumerate(fname):
   scans[sno] = (u'%s,1' % f)
  return scans
 img = load(fname)
 if (len(img.shape) == 3):
  return np.array(((u'%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] = (u'%s,%d' % (fname, (sno + 1)))
  return scans

def scans_for_fname ( fname ) : if isinstance ( fname , list ) : scans = np . zeros ( ( len ( fname ) , ) , dtype = object ) for ( sno , f ) in enumerate ( fname ) : scans [ sno ] = ( u'%s,1' % f ) return scans img = load ( fname ) if ( len ( img . shape ) == 3 ) : return np . array ( ( ( u'%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 ] = ( u'%s,%d' % ( fname , ( sno + 1 ) ) ) return scans
reads a nifti file and converts it to a numpy array storing individual nifti volumes .