now save 3 dicom tag files in each series
This commit is contained in:
parent
283748aa78
commit
ad2d52ff9d
4 changed files with 29 additions and 7 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -165,4 +165,5 @@ cython_debug/
|
|||
# xfr
|
||||
*.xlsx
|
||||
*.local.txt
|
||||
*.nii.gz
|
||||
*.nii.gz
|
||||
*.tar
|
|
@ -10,10 +10,11 @@ import pacs
|
|||
|
||||
EXCLUDE = {
|
||||
'5228932',
|
||||
'2911015',
|
||||
}
|
||||
|
||||
|
||||
def get_pacs(series, outdir, max_patients=20):
|
||||
def get_pacs(series, outdir, max_patients=30):
|
||||
app, window = pacs.login()
|
||||
num_patients = 0
|
||||
for index, row in series.iterrows():
|
||||
|
|
13
src/pacs.py
13
src/pacs.py
|
@ -23,6 +23,7 @@ def mouse_click(ws):
|
|||
time.sleep(0.1)
|
||||
# mouse.press(coords=coords)
|
||||
# mouse.release(coords=coords)
|
||||
return coords
|
||||
|
||||
def login(id=USER_ID, pw=PASSWORD):
|
||||
# Timings.fast()
|
||||
|
@ -180,11 +181,21 @@ def save_study(chartno, outdir, only_tag):
|
|||
time.sleep(.1)
|
||||
p = save_tag(window, outdir)
|
||||
|
||||
mouse_click(c)
|
||||
keyboard.send_keys('^{RIGHT}')
|
||||
time.sleep(.1)
|
||||
p = save_tag(window, outdir)
|
||||
|
||||
mouse_click(c)
|
||||
keyboard.send_keys('^{END}')
|
||||
time.sleep(.1)
|
||||
p = save_tag(window, outdir)
|
||||
|
||||
# mouse_click(c)
|
||||
# keyboard.send_keys('^{LEFT}')
|
||||
# time.sleep(.1)
|
||||
# p = save_tag(window, outdir)
|
||||
|
||||
# mouse_click(c)
|
||||
# keyboard.send_keys('^{HOME}')
|
||||
# time.sleep(1)
|
||||
|
@ -373,7 +384,7 @@ def main():
|
|||
# save_patient('2380784', r'T:\3\2380784', query=False)
|
||||
# save_study('2380784', outdir=r'T:\0\2380784')
|
||||
# save_patient('6631848', r'T:\0\6631848', query='MR')
|
||||
save_patient('6166521', r'T:\0\6166521', query='CT,MR')
|
||||
save_patient('5530663', r'T:\0\5530663', query='CT,MR')
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -110,11 +110,15 @@ class Series:
|
|||
norm1, size1 = value
|
||||
|
||||
# print(size1)
|
||||
|
||||
# print(self.jpgs.keys())
|
||||
|
||||
# k, v = sorted(self.jpgs.items(), key=lambda item: -len(item[1]))[0]
|
||||
# print(k)
|
||||
|
||||
# if size1 not in self.jpgs:
|
||||
# print(size1, "not in", self.jpgs)
|
||||
# return
|
||||
|
||||
v = self.jpgs[size1]
|
||||
fileNames = []
|
||||
for ins in sorted(v.keys()):
|
||||
|
@ -321,6 +325,11 @@ class Series:
|
|||
size1 = int(self.headers[a]["Columns"]),int(self.headers[a]["Rows"])
|
||||
size2 = int(self.headers[b]["Columns"]),int(self.headers[b]["Rows"])
|
||||
if size1 != size2:
|
||||
print(size1, "!=", size2)
|
||||
continue
|
||||
|
||||
if size1 not in self.jpgs:
|
||||
print(size1, "not in", self.jpgs.keys())
|
||||
continue
|
||||
|
||||
o1 = np.array([float(o) for o in self.headers[a]["Image Orientation (Patient)"].split('\\')])
|
||||
|
@ -463,14 +472,14 @@ def main():
|
|||
# s = Study(r'T:\0\6166521\20250513_MR_2316')
|
||||
# s = Study(r'T:\0\6166521\20220330_MR_1690')
|
||||
# s = Study(r'T:\0\6166521\20210625_MR_693')
|
||||
# s = Study(r'T:\0\6166521\20231117_MR_1983')
|
||||
# s = Study(r'T:\0\2508411\20200226_CT_894')
|
||||
# s.write('0/')
|
||||
# exit()
|
||||
|
||||
for e in os.scandir(r'T:\0\6166521'):
|
||||
for e in os.scandir(r'T:\0\6041550'):
|
||||
if e.is_dir():
|
||||
indir = e.path
|
||||
outdir = os.path.join('0/', e.name)
|
||||
outdir = os.path.join(r'T:\1\6041550', e.name)
|
||||
print(indir)
|
||||
# continue
|
||||
s = Study(indir)
|
||||
|
|
Loading…
Reference in a new issue