|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
class Repository(object): |
|
4
|
|
|
|
|
5
|
|
|
def byLocation(self, locationString): # pragma: no cover |
|
6
|
|
|
"""Get the provenance for a file at the given location. |
|
7
|
|
|
|
|
8
|
|
|
In the case of a dicom series, this returns the provenance for the |
|
9
|
|
|
series. |
|
10
|
|
|
|
|
11
|
|
|
Args: |
|
12
|
|
|
locationString (str): Location of the image file. |
|
13
|
|
|
|
|
14
|
|
|
Returns: |
|
15
|
|
|
dict: Provenance for one image file. |
|
16
|
|
|
""" |
|
17
|
|
|
|
|
18
|
|
|
def knowsByLocation(self, locationString): # pragma: no cover |
|
19
|
|
|
"""Whether the file at this location has provenance associated with it. |
|
20
|
|
|
|
|
21
|
|
|
Returns: |
|
22
|
|
|
bool: True if provenance is available for that path. |
|
23
|
|
|
""" |
|
24
|
|
|
|
|
25
|
|
|
def knows(self, image): # pragma: no cover |
|
26
|
|
|
"""Whether this file has provenance associated with it. |
|
27
|
|
|
|
|
28
|
|
|
Returns: |
|
29
|
|
|
bool: True if provenance is available for this image. |
|
30
|
|
|
""" |
|
31
|
|
|
|
|
32
|
|
|
def getSeries(self, image): # pragma: no cover |
|
33
|
|
|
"""Get the object that carries provenance for the series that the image |
|
34
|
|
|
passed is in. |
|
35
|
|
|
|
|
36
|
|
|
Args: |
|
37
|
|
|
image (:class:`.DicomFile`): File that is part of a series. |
|
38
|
|
|
|
|
39
|
|
|
Returns: |
|
40
|
|
|
:class:`.DicomFile`: Image object that caries provenance for the series. |
|
41
|
|
|
""" |
|
42
|
|
|
|
|
43
|
|
|
def knowsSeries(self, image): # pragma: no cover |
|
44
|
|
|
"""Whether this file is part of a series for which provenance |
|
45
|
|
|
is available. |
|
46
|
|
|
|
|
47
|
|
|
Args: |
|
48
|
|
|
image (:class:`.BaseFile`): File for which the series is sought. |
|
49
|
|
|
|
|
50
|
|
|
Returns: |
|
51
|
|
|
bool: True if provenance is available for this series. |
|
52
|
|
|
""" |
|
53
|
|
|
|
|
54
|
|
|
def add(self, image): # pragma: no cover |
|
55
|
|
|
"""Add the provenance for one file to storage. |
|
56
|
|
|
|
|
57
|
|
|
Args: |
|
58
|
|
|
image (:class:`.BaseFile`): Image file to store. |
|
59
|
|
|
""" |
|
60
|
|
|
|
|
61
|
|
|
def update(self, image): # pragma: no cover |
|
62
|
|
|
"""Save changed provenance for this file.. |
|
63
|
|
|
|
|
64
|
|
|
Args: |
|
65
|
|
|
image (:class:`.BaseFile`): Image file that has changed. |
|
66
|
|
|
""" |
|
67
|
|
|
|
|
68
|
|
|
def all(self): # pragma: no cover |
|
69
|
|
|
"""Retrieve all known provenance from storage. |
|
70
|
|
|
|
|
71
|
|
|
Returns: |
|
72
|
|
|
list: List of provenance for known files. |
|
73
|
|
|
""" |
|
74
|
|
|
|
|
75
|
|
|
def bySubject(self, subject): # pragma: no cover |
|
76
|
|
|
"""Get the provenance for all files of a given participant. |
|
77
|
|
|
|
|
78
|
|
|
Args: |
|
79
|
|
|
subject (str): The name or other ID string. |
|
80
|
|
|
|
|
81
|
|
|
Returns: |
|
82
|
|
|
list: List of provenance for known files imaging this subject. |
|
83
|
|
|
""" |
|
84
|
|
|
|
|
85
|
|
|
def byApproval(self, approvalStatus): # pragma: no cover |
|
86
|
|
|
"""""" |
|
87
|
|
|
|
|
88
|
|
|
def updateApproval(self, locationString, approvalStatus): # pragma: no cover |
|
89
|
|
|
"""""" |
|
90
|
|
|
|
|
91
|
|
|
def latest(self, n=20): # pragma: no cover |
|
92
|
|
|
"""Get the images that have been registered last. |
|
93
|
|
|
|
|
94
|
|
|
Args: |
|
95
|
|
|
n (int): The number of files to retrieve. Defaults to 20. |
|
96
|
|
|
|
|
97
|
|
|
Returns: |
|
98
|
|
|
list: List of BaseFile objects. |
|
99
|
|
|
""" |
|
100
|
|
|
|
|
101
|
|
|
def byId(self, uid): # pragma: no cover |
|
102
|
|
|
"""Get the provenance for a file with the given id. |
|
103
|
|
|
|
|
104
|
|
|
Args: |
|
105
|
|
|
uid (str): Unique id for the file. |
|
106
|
|
|
|
|
107
|
|
|
Returns: |
|
108
|
|
|
BaseFile: File with the given id. |
|
109
|
|
|
""" |
|
110
|
|
|
|
|
111
|
|
|
def byLocations(self, listOfLocations): # pragma: no cover |
|
112
|
|
|
"""Get any files that match one of these locations |
|
113
|
|
|
|
|
114
|
|
|
In the case of a dicom series, this returns the provenance for the |
|
115
|
|
|
series. |
|
116
|
|
|
|
|
117
|
|
|
Args: |
|
118
|
|
|
listOfLocations (list): List of image locations. |
|
119
|
|
|
|
|
120
|
|
|
Returns: |
|
121
|
|
|
list: List with BaseFile objects |
|
122
|
|
|
""" |
|
123
|
|
|
|