dbdicom 0.2.5__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dbdicom might be problematic. Click here for more details.
- dbdicom/__init__.py +1 -28
- dbdicom/api.py +267 -0
- dbdicom/const.py +144 -0
- dbdicom/dataset.py +752 -0
- dbdicom/dbd.py +719 -0
- dbdicom/external/__pycache__/__init__.cpython-311.pyc +0 -0
- dbdicom/external/dcm4che/__pycache__/__init__.cpython-311.pyc +0 -0
- dbdicom/external/dcm4che/bin/__pycache__/__init__.cpython-311.pyc +0 -0
- dbdicom/register.py +527 -0
- dbdicom/{ds/types → sop_classes}/ct_image.py +2 -16
- dbdicom/{ds/types → sop_classes}/enhanced_mr_image.py +153 -26
- dbdicom/{ds/types → sop_classes}/mr_image.py +185 -140
- dbdicom/sop_classes/parametric_map.py +307 -0
- dbdicom/sop_classes/secondary_capture.py +140 -0
- dbdicom/sop_classes/segmentation.py +311 -0
- dbdicom/{ds/types → sop_classes}/ultrasound_multiframe_image.py +1 -15
- dbdicom/{ds/types → sop_classes}/xray_angiographic_image.py +2 -17
- dbdicom/utils/arrays.py +36 -0
- dbdicom/utils/files.py +0 -20
- dbdicom/utils/image.py +10 -629
- dbdicom-0.3.0.dist-info/METADATA +28 -0
- dbdicom-0.3.0.dist-info/RECORD +53 -0
- {dbdicom-0.2.5.dist-info → dbdicom-0.3.0.dist-info}/WHEEL +1 -1
- dbdicom/create.py +0 -457
- dbdicom/dro.py +0 -174
- dbdicom/ds/__init__.py +0 -10
- dbdicom/ds/create.py +0 -63
- dbdicom/ds/dataset.py +0 -869
- dbdicom/ds/dictionaries.py +0 -620
- dbdicom/ds/types/parametric_map.py +0 -226
- dbdicom/extensions/__init__.py +0 -9
- dbdicom/extensions/dipy.py +0 -448
- dbdicom/extensions/elastix.py +0 -503
- dbdicom/extensions/matplotlib.py +0 -107
- dbdicom/extensions/numpy.py +0 -271
- dbdicom/extensions/scipy.py +0 -1512
- dbdicom/extensions/skimage.py +0 -1030
- dbdicom/extensions/sklearn.py +0 -243
- dbdicom/extensions/vreg.py +0 -1390
- dbdicom/manager.py +0 -2132
- dbdicom/message.py +0 -119
- dbdicom/pipelines.py +0 -66
- dbdicom/record.py +0 -1893
- dbdicom/types/database.py +0 -107
- dbdicom/types/instance.py +0 -231
- dbdicom/types/patient.py +0 -40
- dbdicom/types/series.py +0 -2874
- dbdicom/types/study.py +0 -58
- dbdicom-0.2.5.dist-info/METADATA +0 -71
- dbdicom-0.2.5.dist-info/RECORD +0 -66
- {dbdicom-0.2.5.dist-info → dbdicom-0.3.0.dist-info/licenses}/LICENSE +0 -0
- {dbdicom-0.2.5.dist-info → dbdicom-0.3.0.dist-info}/top_level.txt +0 -0
dbdicom/message.py
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
class StatusBar():
|
|
4
|
-
"""
|
|
5
|
-
Class with the same interface as StatusBar for use outside weasel.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
def __init__(self):
|
|
9
|
-
self._message = ''
|
|
10
|
-
self.muted = False # Needs adding in wezel status as well.
|
|
11
|
-
|
|
12
|
-
def mute(self):
|
|
13
|
-
self.muted = True
|
|
14
|
-
def unmute(self):
|
|
15
|
-
self.muted = False
|
|
16
|
-
|
|
17
|
-
def hide(self):
|
|
18
|
-
pass
|
|
19
|
-
|
|
20
|
-
def message(self, message):
|
|
21
|
-
self._message = message
|
|
22
|
-
if not self.muted:
|
|
23
|
-
print(message)
|
|
24
|
-
|
|
25
|
-
def progress(self, value, maximum, message=None):
|
|
26
|
-
if message is not None:
|
|
27
|
-
self._message = message
|
|
28
|
-
if not self.muted:
|
|
29
|
-
perc = str(round(100*value/maximum))
|
|
30
|
-
print(self._message + ' [' + perc + ' %]')
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class Dialog():
|
|
34
|
-
"""Class with the same interface as widgets.Dialog for commandline operation"""
|
|
35
|
-
|
|
36
|
-
def information(self, message="Message in the box", title=""):
|
|
37
|
-
"""
|
|
38
|
-
Information message.
|
|
39
|
-
"""
|
|
40
|
-
print("INFORMATION")
|
|
41
|
-
if title != "": print(title)
|
|
42
|
-
print(message)
|
|
43
|
-
|
|
44
|
-
def warning(self, message="Message in the box", title=""):
|
|
45
|
-
"""
|
|
46
|
-
Warning message.
|
|
47
|
-
"""
|
|
48
|
-
print("WARNING!")
|
|
49
|
-
if title != "": print(title)
|
|
50
|
-
print(message)
|
|
51
|
-
|
|
52
|
-
def error(self, message="Message in the box", title=""):
|
|
53
|
-
"""
|
|
54
|
-
Error message.
|
|
55
|
-
"""
|
|
56
|
-
print("ERROR!")
|
|
57
|
-
if title != "": print(title)
|
|
58
|
-
print(message)
|
|
59
|
-
|
|
60
|
-
def directory(self, message='Please provide a folder', datafolder=None):
|
|
61
|
-
"""
|
|
62
|
-
Select a directory.
|
|
63
|
-
"""
|
|
64
|
-
print(message)
|
|
65
|
-
path = input()
|
|
66
|
-
while not os.path.exists(path):
|
|
67
|
-
reply = self.question(
|
|
68
|
-
title = 'Error!',
|
|
69
|
-
message = path + ' does not exist. Select another?')
|
|
70
|
-
if reply == "Yes":
|
|
71
|
-
print(message)
|
|
72
|
-
path = input()
|
|
73
|
-
elif reply == 'No':
|
|
74
|
-
return None
|
|
75
|
-
return path
|
|
76
|
-
|
|
77
|
-
def question(self, message="Do you wish to proceed?", title="Question", cancel=False):
|
|
78
|
-
"""
|
|
79
|
-
Displays a question window in the User Interface.
|
|
80
|
-
|
|
81
|
-
The user has to click either "OK" or "Cancel" in order to continue using the interface.
|
|
82
|
-
Returns False if reply is "Cancel" and True if reply is "OK".
|
|
83
|
-
"""
|
|
84
|
-
if cancel:
|
|
85
|
-
instructions = "y = yes, n = no, c = cancel"
|
|
86
|
-
options = ['y', 'n', 'c']
|
|
87
|
-
else:
|
|
88
|
-
instructions = "y = yes, n = no, c = cancel"
|
|
89
|
-
options = ['y', 'n']
|
|
90
|
-
print(title)
|
|
91
|
-
print(message)
|
|
92
|
-
print(instructions)
|
|
93
|
-
answer = input()
|
|
94
|
-
while answer not in options:
|
|
95
|
-
print("Sorry, I can't interpret that answer")
|
|
96
|
-
print(message)
|
|
97
|
-
print(instructions)
|
|
98
|
-
answer = input()
|
|
99
|
-
if answer == 'y': return "Yes"
|
|
100
|
-
if answer == 'n': return "No"
|
|
101
|
-
if answer == 'c': return "Cancel"
|
|
102
|
-
|
|
103
|
-
def file_to_open(self, title='Open file..', initial_folder=None, extension="All files (*.*)", datafolder=None):
|
|
104
|
-
"""
|
|
105
|
-
Select a file to read.
|
|
106
|
-
"""
|
|
107
|
-
pass
|
|
108
|
-
|
|
109
|
-
def file_to_save(self, title='Save as ...', directory=None, filter="All files (*.*)", datafolder=None):
|
|
110
|
-
"""
|
|
111
|
-
Select a filename to save.
|
|
112
|
-
"""
|
|
113
|
-
pass
|
|
114
|
-
|
|
115
|
-
def input(self, *fields, title="User input window"):
|
|
116
|
-
"""
|
|
117
|
-
Collect user input of various types.
|
|
118
|
-
"""
|
|
119
|
-
pass
|
dbdicom/pipelines.py
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Some utilities for writing automated pipelines.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def input_series(database, series_desc, study_desc=None, handle_duplicate=False):
|
|
8
|
-
"""Select a list of series for processing, and a study for saving the results"""
|
|
9
|
-
|
|
10
|
-
# Make sure the input is a list for convenience
|
|
11
|
-
lst = True
|
|
12
|
-
if not isinstance(series_desc, list):
|
|
13
|
-
lst = False
|
|
14
|
-
series_desc = [series_desc]
|
|
15
|
-
|
|
16
|
-
# Find series and check if valid
|
|
17
|
-
input_series = []
|
|
18
|
-
for desc in series_desc:
|
|
19
|
-
database.message('Finding input series ' + desc)
|
|
20
|
-
series = database.series(SeriesDescription=desc)
|
|
21
|
-
if series == []:
|
|
22
|
-
return None, None
|
|
23
|
-
elif len(series) > 1:
|
|
24
|
-
msg = 'Multiple series found with the description: ' + desc + '\n'
|
|
25
|
-
#msg += 'Please rename the others so there is only one.'
|
|
26
|
-
msg += 'Last one was selected'
|
|
27
|
-
database.dialog.information(msg)
|
|
28
|
-
if handle_duplicate:
|
|
29
|
-
series = series[-1]
|
|
30
|
-
else:
|
|
31
|
-
return None,None
|
|
32
|
-
else:
|
|
33
|
-
series = series[0]
|
|
34
|
-
input_series.append(series)
|
|
35
|
-
|
|
36
|
-
if study_desc is None:
|
|
37
|
-
# If the input was a list, return a list - else return a scalar.
|
|
38
|
-
if lst:
|
|
39
|
-
return input_series
|
|
40
|
-
else:
|
|
41
|
-
return input_series[0]
|
|
42
|
-
|
|
43
|
-
# Find study and check if valid.
|
|
44
|
-
database.message('Finding export study ' + study_desc)
|
|
45
|
-
studies = database.studies(StudyDescription=study_desc)
|
|
46
|
-
if studies == []:
|
|
47
|
-
study = input_series[0].new_pibling(StudyDescription=study_desc)
|
|
48
|
-
elif len(studies) > 1:
|
|
49
|
-
msg = 'Multiple studies found with the same description: ' + study_desc + '\n'
|
|
50
|
-
#msg += 'Please rename the others so there is only one, or choose another study for the output.'
|
|
51
|
-
msg += 'Last one was selected'
|
|
52
|
-
database.dialog.information(msg)
|
|
53
|
-
#return None, None
|
|
54
|
-
if handle_duplicate:
|
|
55
|
-
study = studies[-1]
|
|
56
|
-
else:
|
|
57
|
-
return None,None
|
|
58
|
-
|
|
59
|
-
else:
|
|
60
|
-
study = studies[0]
|
|
61
|
-
|
|
62
|
-
# If the input was a list, return a list - else return a scalar.
|
|
63
|
-
if lst:
|
|
64
|
-
return input_series, study
|
|
65
|
-
else:
|
|
66
|
-
return input_series[0], study
|