niprov.repository module

class niprov.repository.Repository

Bases: object

add(image)

Add the provenance for one file to storage.

Parameters:image (BaseFile) – Image file to store.
all()

Retrieve all known provenance from storage.

Returns:List of provenance for known files.
Return type:list
byApproval(approvalStatus)
byId(uid)

Get the provenance for a file with the given id.

Parameters:uid (str) – Unique id for the file.
Returns:File with the given id.
Return type:BaseFile
byLocation(locationString)

Get the provenance for a file at the given location.

In the case of a dicom series, this returns the provenance for the series.

Parameters:locationString (str) – Location of the image file.
Returns:Provenance for one image file.
Return type:dict
byLocations(listOfLocations)

Get any files that match one of these locations

In the case of a dicom series, this returns the provenance for the series.

Parameters:listOfLocations (list) – List of image locations.
Returns:List with BaseFile objects
Return type:list
bySubject(subject)

Get the provenance for all files of a given participant.

Parameters:subject (str) – The name or other ID string.
Returns:List of provenance for known files imaging this subject.
Return type:list
getSeries(image)

Get the object that carries provenance for the series that the image passed is in.

Parameters:image (DicomFile) – File that is part of a series.
Returns:Image object that caries provenance for the series.
Return type:DicomFile
knows(image)

Whether this file has provenance associated with it.

Returns:True if provenance is available for this image.
Return type:bool
knowsByLocation(locationString)

Whether the file at this location has provenance associated with it.

Returns:True if provenance is available for that path.
Return type:bool
knowsSeries(image)

Whether this file is part of a series for which provenance is available.

Parameters:image (BaseFile) – File for which the series is sought.
Returns:True if provenance is available for this series.
Return type:bool
latest(n=20)

Get the images that have been registered last.

Parameters:n (int) – The number of files to retrieve. Defaults to 20.
Returns:List of BaseFile objects.
Return type:list
update(image)

Save changed provenance for this file..

Parameters:image (BaseFile) – Image file that has changed.
updateApproval(locationString, approvalStatus)