Parsing

heudiconv.parser.find_files(regex, topdir='.', exclude=None, exclude_vcs=True, dirs=False)

Generator to find files matching regex

Parameters:
  • regex (basestring) –
  • exclude (basestring, optional) – Matches to exclude
  • exclude_vcs – If True, excludes commonly known VCS subdirectories. If string, used as regex to exclude those files (regex: /.(?:git|gitattributes|svn|bzr|hg)(?:/|$))
  • topdir (basestring or list, optional) – Directory where to search
  • dirs (bool, optional) – Either to match directories as well as files
heudiconv.parser.get_extracted_dicoms(fl)

Given a list of files, possibly extract some from tarballs.

For ‘classical’ heudiconv, if multiple tarballs are provided, they correspond to different sessions, so here we would group into sessions and return pairs sessionid, files with sessionid being None if no “sessions” detected for that file or there was just a single tarball in the list

heudiconv.parser.get_study_sessions(dicom_dir_template, files_opt, heuristic, outdir, session, sids, grouping='studyUID')

Sort files or dicom seqinfos into study_sessions.

study_sessions put together files for a single session of a subject in a study. Two major possible workflows:

  • if dicom_dir_template provided – doesn’t pre-load DICOMs and just loads files pointed by each subject and possibly sessions as corresponding to different tarballs.
  • if files_opt is provided, sorts all DICOMs it can find under those paths