niprov.adding module

niprov.adding.add(filepath, transient=False, provenance=None, dependencies=<niprov.dependencies.Dependencies object>)

Simply register the file.

Inspects the file and makes it known to the provenance data, such that image files can be logged that have been created using this file. Useful also for temporary files.

Example

(provenance, status) = niprov.add(‘/path/to/my.nii’)

Parameters:
  • filepath (str) – Path to the newly created file.
  • transient (bool, optional) – Set this to True to indicate that the file is only temporary and future checks should not expect it to be physically present. Defaults to False, assuming that the file remains.
  • provenance (dict, optional) – Add the key-value pairs in this dictionary to the provenance record for the new file.
Returns:

Tuple of new provenance and status. Status is a string with one of the following values: ‘new’: File was not known yet and has been added. ‘series’: The file was deemed part of a series and has been added. ‘failed’: There was an error inspecting the file. ‘known’: The file was already known to niprov, nothing happened. ‘dryrun’: Function called with config.dryrun, database not touched.

Return type:

tuple