adjust wait, add only_tag
This commit is contained in:
parent
f6f87ba351
commit
d070c38106
2 changed files with 62 additions and 77 deletions
55
src/pacs.py
55
src/pacs.py
|
@ -16,8 +16,9 @@ def mouse_click(ws):
|
|||
r = ws.rectangle()
|
||||
coords = (r.left + r.right)//2, (r.top + r.bottom)//2
|
||||
mouse.move(coords=coords)
|
||||
time.sleep(1)
|
||||
time.sleep(0.1)
|
||||
mouse.click(coords=coords)
|
||||
time.sleep(0.2)
|
||||
# mouse.press(coords=coords)
|
||||
# mouse.release(coords=coords)
|
||||
|
||||
|
@ -105,9 +106,12 @@ def save_tag(window, outdir):
|
|||
dlg_save['存檔(S)Button'].wrapper_object().click()
|
||||
|
||||
TDicomTagListForm.close()
|
||||
TDicomTagListForm.wait_not('exists', 9)
|
||||
|
||||
return pahtname
|
||||
|
||||
|
||||
def save_study(chartno, outdir):
|
||||
def save_study(chartno, outdir, only_tag):
|
||||
# TViewerForm
|
||||
|
||||
# while True:
|
||||
|
@ -149,42 +153,23 @@ def save_study(chartno, outdir):
|
|||
|
||||
logging.warning(str(c.element_info))
|
||||
c.set_focus()
|
||||
|
||||
mouse_click(c)
|
||||
|
||||
keyboard.send_keys('^{HOME}')
|
||||
save_tag(window, outdir)
|
||||
time.sleep(1)
|
||||
p = save_tag(window, outdir)
|
||||
|
||||
mouse_click(c)
|
||||
keyboard.send_keys('^{END}')
|
||||
save_tag(window, outdir)
|
||||
# exit()
|
||||
time.sleep(1)
|
||||
p = save_tag(window, outdir)
|
||||
|
||||
# mouse_click(window['註釋/標籤'])
|
||||
# TToolBar = window.child_window(class_name='TToolBar', found_index=2)
|
||||
|
||||
# Button5 = TToolBar.Button5
|
||||
# Button5.wait('ready', 9)
|
||||
# time.sleep(2)
|
||||
# mouse_click(Button5)
|
||||
|
||||
# export_to_file = window['輸出至檔案']
|
||||
# export_to_file.wait('ready', 99)
|
||||
# export = export_to_file.wrapper_object()
|
||||
# export.click()
|
||||
|
||||
# TDicomTagListForm = window['DICOM 標籤清單Dialog']
|
||||
|
||||
# dlg_save = Desktop(backend="uia").window(title='另存新檔')
|
||||
# NEdit = dlg_save['檔案名稱(N):Edit']
|
||||
# NEdit.wait('ready', 99)
|
||||
# edit = NEdit.wrapper_object()
|
||||
# pahtname = os.path.join(outdir, edit.get_value())
|
||||
# for p in glob.glob(pahtname + '*'):
|
||||
# os.remove(p)
|
||||
# edit.set_text(pahtname)
|
||||
# dlg_save['存檔(S)Button'].wrapper_object().click()
|
||||
|
||||
# TDicomTagListForm.close()
|
||||
# break
|
||||
# mouse_click(c)
|
||||
# keyboard.send_keys('^{HOME}')
|
||||
# time.sleep(1)
|
||||
# p = save_tag(window, outdir)
|
||||
|
||||
if not only_tag:
|
||||
|
||||
keyboard.send_keys('^s')
|
||||
keyboard.send_keys('{DOWN}')
|
||||
|
@ -229,7 +214,7 @@ def save_study(chartno, outdir):
|
|||
# time.sleep(9)
|
||||
|
||||
|
||||
def save_patient(chartno, outdir, query = "CT,MR"):
|
||||
def save_patient(chartno, outdir, query = "CT,MR", only_tag=False):
|
||||
|
||||
app = Application(backend="uia").connect(title_re='.* - Microsoft Edge$')
|
||||
logging.warning(str(app))
|
||||
|
@ -297,7 +282,7 @@ def save_patient(chartno, outdir, query = "CT,MR"):
|
|||
logging.warning(str(item.get_properties()))
|
||||
mouse_click(item)
|
||||
|
||||
save_study(chartno, outdir)
|
||||
save_study(chartno, outdir, only_tag)
|
||||
logging.warning(chartno+" completed "+query)
|
||||
return 0
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import pandas as pd
|
|||
|
||||
import pacs
|
||||
|
||||
def get_pacs(series, outdir, max_patients=10):
|
||||
def get_pacs(series, outdir, max_patients=100):
|
||||
app, window = pacs.login()
|
||||
num_patients = 0
|
||||
for index, row in series.items():
|
||||
|
@ -22,7 +22,7 @@ def get_pacs(series, outdir, max_patients=10):
|
|||
continue
|
||||
|
||||
logging.warning('saving '+chartno)
|
||||
pacs.save_patient(chartno, f'{outdir}\\{chartno}', query="CT,MR")
|
||||
pacs.save_patient(chartno, f'{outdir}\\{chartno}', query="CT,MR", only_tag=True)
|
||||
|
||||
complete_file.touch()
|
||||
num_patients += 1
|
||||
|
|
Loading…
Reference in a new issue