mippy 2.20.4__tar.gz → 2.22.0__tar.gz
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.
- mippy-2.22.0/PKG-INFO +38 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/application.py +6 -6
- {mippy-2.20.4 → mippy-2.22.0}/mippy/fileio.py +18 -0
- mippy-2.22.0/mippy/luts/red_grey_green.csv +257 -0
- mippy-2.22.0/mippy/luts/red_grey_green_clipped.csv +257 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/io.py +1 -1
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/mrenhanced.py +1 -1
- mippy-2.22.0/mippy/mdicom/sorting.py +66 -0
- mippy-2.22.0/mippy/misc.py +78 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/splash.py +4 -4
- {mippy-2.20.4 → mippy-2.22.0}/mippy/threading.py +5 -1
- {mippy-2.20.4 → mippy-2.22.0}/mippy/viewing.py +3 -3
- mippy-2.22.0/mippy.egg-info/PKG-INFO +38 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy.egg-info/SOURCES.txt +3 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy.egg-info/requires.txt +3 -2
- {mippy-2.20.4 → mippy-2.22.0}/setup.py +27 -27
- mippy-2.20.4/PKG-INFO +0 -10
- mippy-2.20.4/mippy/misc.py +0 -74
- mippy-2.20.4/mippy.egg-info/PKG-INFO +0 -10
- {mippy-2.20.4 → mippy-2.22.0}/LICENSE +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/README.md +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/__init__.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/html.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/improcess.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/launcher.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/16_colors.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/blue.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/colours_roman.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/cyan.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/fire.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/green.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/green_fire_blue.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/hi_lo.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/ice.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/magenta.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/phase.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/physics.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/rainbow.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/red.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/red_green.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/spectrum.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/luts/yellow.csv +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/math.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/__init__.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/anon.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/miners/SIEMENS.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/miners/__init__.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/miners/ge_fallback.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/miners/implementations.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/miners/philips_fallback.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/miners/siemens_fallback.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/miners/syngo_mr_xa20a.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/miners/syngo_mr_xa31a.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/mrspectroscopy.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/pixel.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/reading.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/siemens.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mdicom/xml.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mlogging.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mviewer/__init__.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mviewer/config +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/mviewer/module_main.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/add.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/brain_bw.xbm +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/brain_orange.ico +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/common.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/dcmdjpeg_linux +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/dcmdjpeg_mac +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/dcmdjpeg_win.exe +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/ellipse_roi.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/freehand_roi.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/line_roi.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/mrs.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/roi_circle.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/roi_ellipse.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/roi_freehand.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/roi_line.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/roi_rectangular.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/roi_rectangular_ab.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/splash11.jpg +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/splash20.bmp +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/splash20.jpg +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/splash3.jpg +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/square_roi.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy/resources/subtract.png +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy.egg-info/dependency_links.txt +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/mippy.egg-info/top_level.txt +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/scripts/_mippy.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/scripts/install_mippy.bat +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/scripts/install_mippy.py +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/scripts/mippy.bat +0 -0
- {mippy-2.20.4 → mippy-2.22.0}/setup.cfg +0 -0
mippy-2.22.0/PKG-INFO
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mippy
|
|
3
|
+
Version: 2.22.0
|
|
4
|
+
Summary: Modular Image Processing in Python
|
|
5
|
+
Home-page: https://tree.taiga.io/project/robflintham-mippy/
|
|
6
|
+
Author: Robert Flintham
|
|
7
|
+
Author-email: rbf906@gmail.com
|
|
8
|
+
License: BSD-3-Clause
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: scipy
|
|
13
|
+
Requires-Dist: pydicom
|
|
14
|
+
Requires-Dist: pillow
|
|
15
|
+
Requires-Dist: nibabel
|
|
16
|
+
Requires-Dist: easygui
|
|
17
|
+
Requires-Dist: dill
|
|
18
|
+
Requires-Dist: tinydb<4
|
|
19
|
+
Requires-Dist: requests
|
|
20
|
+
Requires-Dist: tkinterhtml
|
|
21
|
+
Requires-Dist: markdown2
|
|
22
|
+
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: scikit-image
|
|
24
|
+
Requires-Dist: pyperclip
|
|
25
|
+
Requires-Dist: colorama
|
|
26
|
+
Requires-Dist: termcolor
|
|
27
|
+
Requires-Dist: psutil
|
|
28
|
+
Requires-Dist: pyscreenshot
|
|
29
|
+
Requires-Dist: threadpoolctl
|
|
30
|
+
Requires-Dist: setuptools
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: license
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
Dynamic: requires-dist
|
|
38
|
+
Dynamic: summary
|
|
@@ -50,7 +50,7 @@ from .mdicom.mrenhanced import get_frame_ds
|
|
|
50
50
|
from .mdicom.io import save_temp_ds
|
|
51
51
|
from . import fileio
|
|
52
52
|
from .threading import multithread
|
|
53
|
-
import
|
|
53
|
+
import importlib
|
|
54
54
|
#~ print "Done!"
|
|
55
55
|
from zipfile import ZipFile
|
|
56
56
|
from .misc import cprint
|
|
@@ -115,13 +115,13 @@ class MIPPYMain(Frame):
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
"""
|
|
119
119
|
This section is to determine the host OS, and set up the appropriate temp
|
|
120
120
|
directory for images.
|
|
121
|
-
Windows = C
|
|
121
|
+
Windows = C:\\Temp
|
|
122
122
|
Mac = /tmp
|
|
123
123
|
Linux = /tmp
|
|
124
|
-
|
|
124
|
+
"""
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
|
|
@@ -1088,12 +1088,12 @@ class MIPPYMain(Frame):
|
|
|
1088
1088
|
# print(path)
|
|
1089
1089
|
# print("Loader:\n{}".format(importlib.find_loader(module_name)))
|
|
1090
1090
|
active_module = importlib.import_module(module_name)
|
|
1091
|
-
|
|
1091
|
+
importlib.reload(active_module)
|
|
1092
1092
|
# if not module_name in sys.modules:
|
|
1093
1093
|
# active_module = importlib.import_module(module_name)
|
|
1094
1094
|
# else:
|
|
1095
1095
|
# active_module = importlib.import_module(module_name)
|
|
1096
|
-
#
|
|
1096
|
+
# importlib.reload(active_module)
|
|
1097
1097
|
preload_dicom = active_module.preload_dicom()
|
|
1098
1098
|
try:
|
|
1099
1099
|
flatten_list = active_module.flatten_series()
|
|
@@ -7,6 +7,11 @@ import fnmatch
|
|
|
7
7
|
import stat
|
|
8
8
|
import itertools
|
|
9
9
|
|
|
10
|
+
import pydicom
|
|
11
|
+
from pydicom.dataset import FileDataset, Dataset
|
|
12
|
+
import pydicom.uid
|
|
13
|
+
from pydicom.uid import generate_uid, PYDICOM_IMPLEMENTATION_UID, ImplicitVRLittleEndian, UID
|
|
14
|
+
|
|
10
15
|
def list_all_files(dirpath,recursive=False):
|
|
11
16
|
pathlist = []
|
|
12
17
|
if recursive:
|
|
@@ -58,6 +63,19 @@ def export_dicom_file(ds,outdir):
|
|
|
58
63
|
dir2 = ds.StudyDate+"_"+ds.StudyTime
|
|
59
64
|
dir3 = str(ds.SeriesNumber).zfill(4)+"_"+remove_invalid_characters(str(ds.SeriesDescription))
|
|
60
65
|
|
|
66
|
+
if 'ENHANCED' in ds.file_meta.MediaStorageSOPClassUID.name.upper():
|
|
67
|
+
ds.file_meta.MediaStorageSOPClassUID = UID('1.2.840.10008.5.1.4.1.1.4') # Set to MR Image Storage if saving datasets split from enhanced DICOM
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# ds.file_meta.MediaStorageSOPClassUID = ref[i].file_meta.MediaStorageSOPClassUID
|
|
71
|
+
ds.file_meta.ImplementationClassUID = PYDICOM_IMPLEMENTATION_UID
|
|
72
|
+
ds.file_meta.MediaStorageSOPInstanceUID = generate_uid()
|
|
73
|
+
# ds.file_meta.TransferSyntaxUID = ImplicitVRLittleEndian
|
|
74
|
+
|
|
75
|
+
ds.SeriesInstanceUID = ds.SeriesInstanceUID+'.1'
|
|
76
|
+
ds.SOPInstanceUID = generate_uid()
|
|
77
|
+
# ds.StudyInstanceUID = ref[i].StudyInstanceUID
|
|
78
|
+
|
|
61
79
|
#~ fname1 = str(ds.ImageType).replace('/','-').strip()+"_"
|
|
62
80
|
fname1 = ''.join(str(i)+"_" for i in ds.ImageType)
|
|
63
81
|
fname2 = str(ds.SeriesNumber).zfill(4)+"_"
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Index,Red,Green,Blue
|
|
2
|
+
0,255,0,0
|
|
3
|
+
1,254,1,1
|
|
4
|
+
2,253,2,2
|
|
5
|
+
3,252,3,3
|
|
6
|
+
4,251,4,4
|
|
7
|
+
5,250,5,5
|
|
8
|
+
6,249,6,6
|
|
9
|
+
7,248,7,7
|
|
10
|
+
8,247,8,8
|
|
11
|
+
9,246,9,9
|
|
12
|
+
10,245,10,10
|
|
13
|
+
11,244,11,11
|
|
14
|
+
12,243,12,12
|
|
15
|
+
13,242,13,13
|
|
16
|
+
14,241,14,14
|
|
17
|
+
15,240,15,15
|
|
18
|
+
16,239,16,16
|
|
19
|
+
17,238,17,17
|
|
20
|
+
18,237,18,18
|
|
21
|
+
19,236,19,19
|
|
22
|
+
20,235,20,20
|
|
23
|
+
21,234,21,21
|
|
24
|
+
22,233,22,22
|
|
25
|
+
23,232,23,23
|
|
26
|
+
24,231,24,24
|
|
27
|
+
25,230,25,25
|
|
28
|
+
26,229,26,26
|
|
29
|
+
27,228,27,27
|
|
30
|
+
28,227,28,28
|
|
31
|
+
29,226,29,29
|
|
32
|
+
30,225,30,30
|
|
33
|
+
31,224,31,31
|
|
34
|
+
32,223,32,32
|
|
35
|
+
33,222,33,33
|
|
36
|
+
34,221,34,34
|
|
37
|
+
35,220,35,35
|
|
38
|
+
36,219,36,36
|
|
39
|
+
37,218,37,37
|
|
40
|
+
38,217,38,38
|
|
41
|
+
39,216,39,39
|
|
42
|
+
40,215,40,40
|
|
43
|
+
41,214,41,41
|
|
44
|
+
42,213,42,42
|
|
45
|
+
43,212,43,43
|
|
46
|
+
44,211,44,44
|
|
47
|
+
45,210,45,45
|
|
48
|
+
46,209,46,46
|
|
49
|
+
47,208,47,47
|
|
50
|
+
48,207,48,48
|
|
51
|
+
49,206,49,49
|
|
52
|
+
50,205,50,50
|
|
53
|
+
51,204,51,51
|
|
54
|
+
52,203,52,52
|
|
55
|
+
53,202,53,53
|
|
56
|
+
54,201,54,54
|
|
57
|
+
55,200,55,55
|
|
58
|
+
56,199,56,56
|
|
59
|
+
57,198,57,57
|
|
60
|
+
58,197,58,58
|
|
61
|
+
59,196,59,59
|
|
62
|
+
60,195,60,60
|
|
63
|
+
61,194,61,61
|
|
64
|
+
62,193,62,62
|
|
65
|
+
63,192,63,63
|
|
66
|
+
64,191,64,64
|
|
67
|
+
65,190,65,65
|
|
68
|
+
66,189,66,66
|
|
69
|
+
67,188,67,67
|
|
70
|
+
68,187,68,68
|
|
71
|
+
69,186,69,69
|
|
72
|
+
70,185,70,70
|
|
73
|
+
71,184,71,71
|
|
74
|
+
72,183,72,72
|
|
75
|
+
73,182,73,73
|
|
76
|
+
74,181,74,74
|
|
77
|
+
75,180,75,75
|
|
78
|
+
76,179,76,76
|
|
79
|
+
77,178,77,77
|
|
80
|
+
78,177,78,78
|
|
81
|
+
79,176,79,79
|
|
82
|
+
80,175,80,80
|
|
83
|
+
81,174,81,81
|
|
84
|
+
82,173,82,82
|
|
85
|
+
83,172,83,83
|
|
86
|
+
84,171,84,84
|
|
87
|
+
85,170,85,85
|
|
88
|
+
86,169,86,86
|
|
89
|
+
87,168,87,87
|
|
90
|
+
88,167,88,88
|
|
91
|
+
89,166,89,89
|
|
92
|
+
90,165,90,90
|
|
93
|
+
91,164,91,91
|
|
94
|
+
92,163,92,92
|
|
95
|
+
93,162,93,93
|
|
96
|
+
94,161,94,94
|
|
97
|
+
95,160,95,95
|
|
98
|
+
96,159,96,96
|
|
99
|
+
97,158,97,97
|
|
100
|
+
98,157,98,98
|
|
101
|
+
99,156,99,99
|
|
102
|
+
100,155,100,100
|
|
103
|
+
101,154,101,101
|
|
104
|
+
102,153,102,102
|
|
105
|
+
103,152,103,103
|
|
106
|
+
104,151,104,104
|
|
107
|
+
105,150,105,105
|
|
108
|
+
106,149,106,106
|
|
109
|
+
107,148,107,107
|
|
110
|
+
108,147,108,108
|
|
111
|
+
109,146,109,109
|
|
112
|
+
110,145,110,110
|
|
113
|
+
111,144,111,111
|
|
114
|
+
112,143,112,112
|
|
115
|
+
113,142,113,113
|
|
116
|
+
114,141,114,114
|
|
117
|
+
115,140,115,115
|
|
118
|
+
116,139,116,116
|
|
119
|
+
117,138,117,117
|
|
120
|
+
118,137,118,118
|
|
121
|
+
119,136,119,119
|
|
122
|
+
120,135,120,120
|
|
123
|
+
121,134,121,121
|
|
124
|
+
122,133,122,122
|
|
125
|
+
123,132,123,123
|
|
126
|
+
124,131,124,124
|
|
127
|
+
125,130,125,125
|
|
128
|
+
126,129,126,126
|
|
129
|
+
127,128,127,127
|
|
130
|
+
128,127,128,128
|
|
131
|
+
129,126,129,126
|
|
132
|
+
130,125,130,125
|
|
133
|
+
131,124,131,124
|
|
134
|
+
132,123,132,123
|
|
135
|
+
133,122,133,122
|
|
136
|
+
134,121,134,121
|
|
137
|
+
135,120,135,120
|
|
138
|
+
136,119,136,119
|
|
139
|
+
137,118,137,118
|
|
140
|
+
138,117,138,117
|
|
141
|
+
139,116,139,116
|
|
142
|
+
140,115,140,115
|
|
143
|
+
141,114,141,114
|
|
144
|
+
142,113,142,113
|
|
145
|
+
143,112,143,112
|
|
146
|
+
144,111,144,111
|
|
147
|
+
145,110,145,110
|
|
148
|
+
146,109,146,109
|
|
149
|
+
147,108,147,108
|
|
150
|
+
148,107,148,107
|
|
151
|
+
149,106,149,106
|
|
152
|
+
150,105,150,105
|
|
153
|
+
151,104,151,104
|
|
154
|
+
152,103,152,103
|
|
155
|
+
153,102,153,102
|
|
156
|
+
154,101,154,101
|
|
157
|
+
155,100,155,100
|
|
158
|
+
156,99,156,99
|
|
159
|
+
157,98,157,98
|
|
160
|
+
158,97,158,97
|
|
161
|
+
159,96,159,96
|
|
162
|
+
160,95,160,95
|
|
163
|
+
161,94,161,94
|
|
164
|
+
162,93,162,93
|
|
165
|
+
163,92,163,92
|
|
166
|
+
164,91,164,91
|
|
167
|
+
165,90,165,90
|
|
168
|
+
166,89,166,89
|
|
169
|
+
167,88,167,88
|
|
170
|
+
168,87,168,87
|
|
171
|
+
169,86,169,86
|
|
172
|
+
170,85,170,85
|
|
173
|
+
171,84,171,84
|
|
174
|
+
172,83,172,83
|
|
175
|
+
173,82,173,82
|
|
176
|
+
174,81,174,81
|
|
177
|
+
175,80,175,80
|
|
178
|
+
176,79,176,79
|
|
179
|
+
177,78,177,78
|
|
180
|
+
178,77,178,77
|
|
181
|
+
179,76,179,76
|
|
182
|
+
180,75,180,75
|
|
183
|
+
181,74,181,74
|
|
184
|
+
182,73,182,73
|
|
185
|
+
183,72,183,72
|
|
186
|
+
184,71,184,71
|
|
187
|
+
185,70,185,70
|
|
188
|
+
186,69,186,69
|
|
189
|
+
187,68,187,68
|
|
190
|
+
188,67,188,67
|
|
191
|
+
189,66,189,66
|
|
192
|
+
190,65,190,65
|
|
193
|
+
191,64,191,64
|
|
194
|
+
192,63,192,63
|
|
195
|
+
193,62,193,62
|
|
196
|
+
194,61,194,61
|
|
197
|
+
195,60,195,60
|
|
198
|
+
196,59,196,59
|
|
199
|
+
197,58,197,58
|
|
200
|
+
198,57,198,57
|
|
201
|
+
199,56,199,56
|
|
202
|
+
200,55,200,55
|
|
203
|
+
201,54,201,54
|
|
204
|
+
202,53,202,53
|
|
205
|
+
203,52,203,52
|
|
206
|
+
204,51,204,51
|
|
207
|
+
205,50,205,50
|
|
208
|
+
206,49,206,49
|
|
209
|
+
207,48,207,48
|
|
210
|
+
208,47,208,47
|
|
211
|
+
209,46,209,46
|
|
212
|
+
210,45,210,45
|
|
213
|
+
211,44,211,44
|
|
214
|
+
212,43,212,43
|
|
215
|
+
213,42,213,42
|
|
216
|
+
214,41,214,41
|
|
217
|
+
215,40,215,40
|
|
218
|
+
216,39,216,39
|
|
219
|
+
217,38,217,38
|
|
220
|
+
218,37,218,37
|
|
221
|
+
219,36,219,36
|
|
222
|
+
220,35,220,35
|
|
223
|
+
221,34,221,34
|
|
224
|
+
222,33,222,33
|
|
225
|
+
223,32,223,32
|
|
226
|
+
224,31,224,31
|
|
227
|
+
225,30,225,30
|
|
228
|
+
226,29,226,29
|
|
229
|
+
227,28,227,28
|
|
230
|
+
228,27,228,27
|
|
231
|
+
229,26,229,26
|
|
232
|
+
230,25,230,25
|
|
233
|
+
231,24,231,24
|
|
234
|
+
232,23,232,23
|
|
235
|
+
233,22,233,22
|
|
236
|
+
234,21,234,21
|
|
237
|
+
235,20,235,20
|
|
238
|
+
236,19,236,19
|
|
239
|
+
237,18,237,18
|
|
240
|
+
238,17,238,17
|
|
241
|
+
239,16,239,16
|
|
242
|
+
240,15,240,15
|
|
243
|
+
241,14,241,14
|
|
244
|
+
242,13,242,13
|
|
245
|
+
243,12,243,12
|
|
246
|
+
244,11,244,11
|
|
247
|
+
245,10,245,10
|
|
248
|
+
246,9,246,9
|
|
249
|
+
247,8,247,8
|
|
250
|
+
248,7,248,7
|
|
251
|
+
249,6,249,6
|
|
252
|
+
250,5,250,5
|
|
253
|
+
251,4,251,4
|
|
254
|
+
252,3,252,3
|
|
255
|
+
253,2,253,2
|
|
256
|
+
254,1,254,1
|
|
257
|
+
255,0,255,0
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Index,Red,Green,Blue
|
|
2
|
+
0,0,0,0
|
|
3
|
+
1,254,1,1
|
|
4
|
+
2,253,2,2
|
|
5
|
+
3,252,3,3
|
|
6
|
+
4,251,4,4
|
|
7
|
+
5,250,5,5
|
|
8
|
+
6,249,6,6
|
|
9
|
+
7,248,7,7
|
|
10
|
+
8,247,8,8
|
|
11
|
+
9,246,9,9
|
|
12
|
+
10,245,10,10
|
|
13
|
+
11,244,11,11
|
|
14
|
+
12,243,12,12
|
|
15
|
+
13,242,13,13
|
|
16
|
+
14,241,14,14
|
|
17
|
+
15,240,15,15
|
|
18
|
+
16,239,16,16
|
|
19
|
+
17,238,17,17
|
|
20
|
+
18,237,18,18
|
|
21
|
+
19,236,19,19
|
|
22
|
+
20,235,20,20
|
|
23
|
+
21,234,21,21
|
|
24
|
+
22,233,22,22
|
|
25
|
+
23,232,23,23
|
|
26
|
+
24,231,24,24
|
|
27
|
+
25,230,25,25
|
|
28
|
+
26,229,26,26
|
|
29
|
+
27,228,27,27
|
|
30
|
+
28,227,28,28
|
|
31
|
+
29,226,29,29
|
|
32
|
+
30,225,30,30
|
|
33
|
+
31,224,31,31
|
|
34
|
+
32,223,32,32
|
|
35
|
+
33,222,33,33
|
|
36
|
+
34,221,34,34
|
|
37
|
+
35,220,35,35
|
|
38
|
+
36,219,36,36
|
|
39
|
+
37,218,37,37
|
|
40
|
+
38,217,38,38
|
|
41
|
+
39,216,39,39
|
|
42
|
+
40,215,40,40
|
|
43
|
+
41,214,41,41
|
|
44
|
+
42,213,42,42
|
|
45
|
+
43,212,43,43
|
|
46
|
+
44,211,44,44
|
|
47
|
+
45,210,45,45
|
|
48
|
+
46,209,46,46
|
|
49
|
+
47,208,47,47
|
|
50
|
+
48,207,48,48
|
|
51
|
+
49,206,49,49
|
|
52
|
+
50,205,50,50
|
|
53
|
+
51,204,51,51
|
|
54
|
+
52,203,52,52
|
|
55
|
+
53,202,53,53
|
|
56
|
+
54,201,54,54
|
|
57
|
+
55,200,55,55
|
|
58
|
+
56,199,56,56
|
|
59
|
+
57,198,57,57
|
|
60
|
+
58,197,58,58
|
|
61
|
+
59,196,59,59
|
|
62
|
+
60,195,60,60
|
|
63
|
+
61,194,61,61
|
|
64
|
+
62,193,62,62
|
|
65
|
+
63,192,63,63
|
|
66
|
+
64,191,64,64
|
|
67
|
+
65,190,65,65
|
|
68
|
+
66,189,66,66
|
|
69
|
+
67,188,67,67
|
|
70
|
+
68,187,68,68
|
|
71
|
+
69,186,69,69
|
|
72
|
+
70,185,70,70
|
|
73
|
+
71,184,71,71
|
|
74
|
+
72,183,72,72
|
|
75
|
+
73,182,73,73
|
|
76
|
+
74,181,74,74
|
|
77
|
+
75,180,75,75
|
|
78
|
+
76,179,76,76
|
|
79
|
+
77,178,77,77
|
|
80
|
+
78,177,78,78
|
|
81
|
+
79,176,79,79
|
|
82
|
+
80,175,80,80
|
|
83
|
+
81,174,81,81
|
|
84
|
+
82,173,82,82
|
|
85
|
+
83,172,83,83
|
|
86
|
+
84,171,84,84
|
|
87
|
+
85,170,85,85
|
|
88
|
+
86,169,86,86
|
|
89
|
+
87,168,87,87
|
|
90
|
+
88,167,88,88
|
|
91
|
+
89,166,89,89
|
|
92
|
+
90,165,90,90
|
|
93
|
+
91,164,91,91
|
|
94
|
+
92,163,92,92
|
|
95
|
+
93,162,93,93
|
|
96
|
+
94,161,94,94
|
|
97
|
+
95,160,95,95
|
|
98
|
+
96,159,96,96
|
|
99
|
+
97,158,97,97
|
|
100
|
+
98,157,98,98
|
|
101
|
+
99,156,99,99
|
|
102
|
+
100,155,100,100
|
|
103
|
+
101,154,101,101
|
|
104
|
+
102,153,102,102
|
|
105
|
+
103,152,103,103
|
|
106
|
+
104,151,104,104
|
|
107
|
+
105,150,105,105
|
|
108
|
+
106,149,106,106
|
|
109
|
+
107,148,107,107
|
|
110
|
+
108,147,108,108
|
|
111
|
+
109,146,109,109
|
|
112
|
+
110,145,110,110
|
|
113
|
+
111,144,111,111
|
|
114
|
+
112,143,112,112
|
|
115
|
+
113,142,113,113
|
|
116
|
+
114,141,114,114
|
|
117
|
+
115,140,115,115
|
|
118
|
+
116,139,116,116
|
|
119
|
+
117,138,117,117
|
|
120
|
+
118,137,118,118
|
|
121
|
+
119,136,119,119
|
|
122
|
+
120,135,120,120
|
|
123
|
+
121,134,121,121
|
|
124
|
+
122,133,122,122
|
|
125
|
+
123,132,123,123
|
|
126
|
+
124,131,124,124
|
|
127
|
+
125,130,125,125
|
|
128
|
+
126,129,126,126
|
|
129
|
+
127,128,127,127
|
|
130
|
+
128,127,128,128
|
|
131
|
+
129,126,129,126
|
|
132
|
+
130,125,130,125
|
|
133
|
+
131,124,131,124
|
|
134
|
+
132,123,132,123
|
|
135
|
+
133,122,133,122
|
|
136
|
+
134,121,134,121
|
|
137
|
+
135,120,135,120
|
|
138
|
+
136,119,136,119
|
|
139
|
+
137,118,137,118
|
|
140
|
+
138,117,138,117
|
|
141
|
+
139,116,139,116
|
|
142
|
+
140,115,140,115
|
|
143
|
+
141,114,141,114
|
|
144
|
+
142,113,142,113
|
|
145
|
+
143,112,143,112
|
|
146
|
+
144,111,144,111
|
|
147
|
+
145,110,145,110
|
|
148
|
+
146,109,146,109
|
|
149
|
+
147,108,147,108
|
|
150
|
+
148,107,148,107
|
|
151
|
+
149,106,149,106
|
|
152
|
+
150,105,150,105
|
|
153
|
+
151,104,151,104
|
|
154
|
+
152,103,152,103
|
|
155
|
+
153,102,153,102
|
|
156
|
+
154,101,154,101
|
|
157
|
+
155,100,155,100
|
|
158
|
+
156,99,156,99
|
|
159
|
+
157,98,157,98
|
|
160
|
+
158,97,158,97
|
|
161
|
+
159,96,159,96
|
|
162
|
+
160,95,160,95
|
|
163
|
+
161,94,161,94
|
|
164
|
+
162,93,162,93
|
|
165
|
+
163,92,163,92
|
|
166
|
+
164,91,164,91
|
|
167
|
+
165,90,165,90
|
|
168
|
+
166,89,166,89
|
|
169
|
+
167,88,167,88
|
|
170
|
+
168,87,168,87
|
|
171
|
+
169,86,169,86
|
|
172
|
+
170,85,170,85
|
|
173
|
+
171,84,171,84
|
|
174
|
+
172,83,172,83
|
|
175
|
+
173,82,173,82
|
|
176
|
+
174,81,174,81
|
|
177
|
+
175,80,175,80
|
|
178
|
+
176,79,176,79
|
|
179
|
+
177,78,177,78
|
|
180
|
+
178,77,178,77
|
|
181
|
+
179,76,179,76
|
|
182
|
+
180,75,180,75
|
|
183
|
+
181,74,181,74
|
|
184
|
+
182,73,182,73
|
|
185
|
+
183,72,183,72
|
|
186
|
+
184,71,184,71
|
|
187
|
+
185,70,185,70
|
|
188
|
+
186,69,186,69
|
|
189
|
+
187,68,187,68
|
|
190
|
+
188,67,188,67
|
|
191
|
+
189,66,189,66
|
|
192
|
+
190,65,190,65
|
|
193
|
+
191,64,191,64
|
|
194
|
+
192,63,192,63
|
|
195
|
+
193,62,193,62
|
|
196
|
+
194,61,194,61
|
|
197
|
+
195,60,195,60
|
|
198
|
+
196,59,196,59
|
|
199
|
+
197,58,197,58
|
|
200
|
+
198,57,198,57
|
|
201
|
+
199,56,199,56
|
|
202
|
+
200,55,200,55
|
|
203
|
+
201,54,201,54
|
|
204
|
+
202,53,202,53
|
|
205
|
+
203,52,203,52
|
|
206
|
+
204,51,204,51
|
|
207
|
+
205,50,205,50
|
|
208
|
+
206,49,206,49
|
|
209
|
+
207,48,207,48
|
|
210
|
+
208,47,208,47
|
|
211
|
+
209,46,209,46
|
|
212
|
+
210,45,210,45
|
|
213
|
+
211,44,211,44
|
|
214
|
+
212,43,212,43
|
|
215
|
+
213,42,213,42
|
|
216
|
+
214,41,214,41
|
|
217
|
+
215,40,215,40
|
|
218
|
+
216,39,216,39
|
|
219
|
+
217,38,217,38
|
|
220
|
+
218,37,218,37
|
|
221
|
+
219,36,219,36
|
|
222
|
+
220,35,220,35
|
|
223
|
+
221,34,221,34
|
|
224
|
+
222,33,222,33
|
|
225
|
+
223,32,223,32
|
|
226
|
+
224,31,224,31
|
|
227
|
+
225,30,225,30
|
|
228
|
+
226,29,226,29
|
|
229
|
+
227,28,227,28
|
|
230
|
+
228,27,228,27
|
|
231
|
+
229,26,229,26
|
|
232
|
+
230,25,230,25
|
|
233
|
+
231,24,231,24
|
|
234
|
+
232,23,232,23
|
|
235
|
+
233,22,233,22
|
|
236
|
+
234,21,234,21
|
|
237
|
+
235,20,235,20
|
|
238
|
+
236,19,236,19
|
|
239
|
+
237,18,237,18
|
|
240
|
+
238,17,238,17
|
|
241
|
+
239,16,239,16
|
|
242
|
+
240,15,240,15
|
|
243
|
+
241,14,241,14
|
|
244
|
+
242,13,242,13
|
|
245
|
+
243,12,243,12
|
|
246
|
+
244,11,244,11
|
|
247
|
+
245,10,245,10
|
|
248
|
+
246,9,246,9
|
|
249
|
+
247,8,247,8
|
|
250
|
+
248,7,248,7
|
|
251
|
+
249,6,249,6
|
|
252
|
+
250,5,250,5
|
|
253
|
+
251,4,251,4
|
|
254
|
+
252,3,252,3
|
|
255
|
+
253,2,253,2
|
|
256
|
+
254,1,254,1
|
|
257
|
+
255,0,0,0
|
|
@@ -87,7 +87,7 @@ def save_dicom(images,directory,
|
|
|
87
87
|
ds.is_little_endian = True
|
|
88
88
|
ds.is_implicit_VR = True
|
|
89
89
|
add_all(ds,ref[i])
|
|
90
|
-
ds.SeriesInstanceUID =
|
|
90
|
+
ds.SeriesInstanceUID = generate_uid()
|
|
91
91
|
ds.SOPInstanceUID = generate_uid()
|
|
92
92
|
ds.StudyInstanceUID = ref[i].StudyInstanceUID
|
|
93
93
|
|
|
@@ -88,7 +88,7 @@ def get_frame_ds(frame,ds):
|
|
|
88
88
|
ds_new.InstanceNumber = frame
|
|
89
89
|
ds_new.NumberOfFrames = 1
|
|
90
90
|
# Change SOP Class UID to MR Image Storage
|
|
91
|
-
ds_new.SOPClassUID = '1.2.840.10008.5.1.4.1.1.4'
|
|
91
|
+
ds_new.SOPClassUID = '1.2.840.10008.5.1.4.1.1.4' # Change this to use UID object
|
|
92
92
|
# Return new dataset
|
|
93
93
|
ds_str = str(ds_new)
|
|
94
94
|
return ds_new
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from copy import copy
|
|
2
|
+
from pydicom.tag import Tag
|
|
3
|
+
import pydicom
|
|
4
|
+
import itertools
|
|
5
|
+
|
|
6
|
+
def split_dynamics_to_series(input_list):
|
|
7
|
+
"""
|
|
8
|
+
Splits a series containing multiple images per slice position (assumed to be multiple dynamics)
|
|
9
|
+
into multiple series. DOES NOT MODIFY UIDs!
|
|
10
|
+
|
|
11
|
+
This is not an intelligent function, and it assumes the images are already in some sort of
|
|
12
|
+
sensible order... if this fails, it will need coding to also account for the acquisition timestamp.
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
# Check for repeated slice positions
|
|
17
|
+
repeated_slice_positions,positions = check_repeated_positions(input_list,include_positions=True)
|
|
18
|
+
if not repeated_slice_positions:
|
|
19
|
+
print("No repeated positions detected")
|
|
20
|
+
return None
|
|
21
|
+
|
|
22
|
+
split_series = []
|
|
23
|
+
positions_sorted = []
|
|
24
|
+
|
|
25
|
+
for i in range(len(input_list)):
|
|
26
|
+
if positions[i] in positions_sorted:
|
|
27
|
+
# We've seen this position before
|
|
28
|
+
j = positions_sorted.index(positions[i])
|
|
29
|
+
split_series[j].append(input_list[i])
|
|
30
|
+
else:
|
|
31
|
+
# This is a new position
|
|
32
|
+
positions_sorted.append(positions[i])
|
|
33
|
+
split_series.append([])
|
|
34
|
+
split_series[-1].append(input_list[i])
|
|
35
|
+
|
|
36
|
+
# Currently have a list per slice position, we need to reshape this so that the top
|
|
37
|
+
# level of the list is dynamic, not position
|
|
38
|
+
|
|
39
|
+
split_series_reshaped = [list(a) for a in zip(*split_series)]
|
|
40
|
+
|
|
41
|
+
# Split series is currently
|
|
42
|
+
|
|
43
|
+
print("SPLIT INTO {} SERIES".format(len(split_series_reshaped)))
|
|
44
|
+
return split_series_reshaped
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def check_repeated_positions(input_list,include_positions=False):
|
|
49
|
+
"""
|
|
50
|
+
Takes an input list of pydicom Dataset objects and returns True if any slice positions are repeated.
|
|
51
|
+
"""
|
|
52
|
+
positions = [(a.ImagePositionPatient,a.ImageOrientationPatient) for a in input_list]
|
|
53
|
+
print(positions)
|
|
54
|
+
checked_positions = []
|
|
55
|
+
return_value = None
|
|
56
|
+
for pos in positions:
|
|
57
|
+
if not pos in checked_positions:
|
|
58
|
+
checked_positions.append(pos)
|
|
59
|
+
else:
|
|
60
|
+
return_value = True
|
|
61
|
+
if return_value is None:
|
|
62
|
+
return_value = False
|
|
63
|
+
if include_positions:
|
|
64
|
+
return return_value,positions
|
|
65
|
+
else:
|
|
66
|
+
return return_value
|