-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclear_dicom_overlay.py
More file actions
34 lines (27 loc) · 989 Bytes
/
clear_dicom_overlay.py
File metadata and controls
34 lines (27 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Author: Aarash Heydari with help from https://groups.google.com/forum/#!topic/horos-project/pwz9aSWhYJ8
import osirix
import dicom
import numpy as np
import shutil
import os
vc = osirix.frontmostViewer()
pixs = vc.pixList()
wait = vc.startWaitProgressWindow('Deleting all DICOM Overlays…', len(pixs))
for pix in pixs:
ds = dicom.read_file(pix.sourceFile)
for j in range(16):
try:
del ds[0x60000010 + j*0x20000]
del ds[0x60000011 + j*0x20000]
del ds[0x60000022 + j*0x20000]
del ds[0x60000040 + j*0x20000]
del ds[0x60000050 + j*0x20000]
del ds[0x60000100 + j*0x20000]
del ds[0x60000102 + j*0x20000]
del ds[0x60003000 + j*0x20000]
print("Deleted ROI at index ", j, " for dicom at slice ", ds.ImagePositionPatient[2])
except Exception:
pass
ds.save_as(pix.sourceFile)
wait.incrementBy(1.0)
vc.endWaitWindow(wait)