clean code
This commit is contained in:
parent
abaac1ecfc
commit
7581a7cb16
2 changed files with 11 additions and 12 deletions
|
@ -8,19 +8,18 @@ import pandas as pd
|
||||||
|
|
||||||
import pacs
|
import pacs
|
||||||
|
|
||||||
def get_pacs(series, outdir, max_patients=10):
|
EXCLUDE = {
|
||||||
|
'5228932',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def get_pacs(series, outdir, max_patients=20):
|
||||||
app, window = pacs.login()
|
app, window = pacs.login()
|
||||||
num_patients = 0
|
num_patients = 0
|
||||||
for index, row in series.iterrows():
|
for index, row in series.iterrows():
|
||||||
chartno = str(row.CHARTNO).zfill(7)
|
chartno = str(row.CHARTNO).zfill(7)
|
||||||
# chartno = str(int(row.CHARTNO)).zfill(7)
|
if chartno in EXCLUDE:
|
||||||
# print(chartno)
|
continue
|
||||||
# continue
|
|
||||||
# exit()
|
|
||||||
|
|
||||||
# if isinstance(row, float):
|
|
||||||
# row = int(row)
|
|
||||||
# chartno = str(int(row)).zfill(7)
|
|
||||||
|
|
||||||
complete_file = Path(f'{outdir}\\{chartno}.complete')
|
complete_file = Path(f'{outdir}\\{chartno}.complete')
|
||||||
if complete_file.is_file():
|
if complete_file.is_file():
|
||||||
|
|
|
@ -89,7 +89,7 @@ def save_tag(window, outdir):
|
||||||
TDicomTagListForm = window['DICOM 標籤清單Dialog']
|
TDicomTagListForm = window['DICOM 標籤清單Dialog']
|
||||||
if TDicomTagListForm.exists():
|
if TDicomTagListForm.exists():
|
||||||
TDicomTagListForm.close()
|
TDicomTagListForm.close()
|
||||||
TDicomTagListForm.wait_not('exists', 20)
|
TDicomTagListForm.wait_not('exists', 30)
|
||||||
|
|
||||||
TToolBar = window.child_window(class_name='TToolBar', found_index=2)
|
TToolBar = window.child_window(class_name='TToolBar', found_index=2)
|
||||||
Button5 = TToolBar.Button5
|
Button5 = TToolBar.Button5
|
||||||
|
@ -135,7 +135,7 @@ def save_study(chartno, outdir, only_tag):
|
||||||
# time.sleep(1)
|
# time.sleep(1)
|
||||||
|
|
||||||
logging.warning('connecting '+chartno)
|
logging.warning('connecting '+chartno)
|
||||||
app = Application(backend="uia").connect(title_re='.*%s.*'%chartno, timeout=200)
|
app = Application(backend="uia").connect(title_re='.*%s.*'%chartno, timeout=300)
|
||||||
|
|
||||||
shutil.rmtree(outdir, ignore_errors=True)
|
shutil.rmtree(outdir, ignore_errors=True)
|
||||||
os.makedirs(outdir, exist_ok=True)
|
os.makedirs(outdir, exist_ok=True)
|
||||||
|
@ -311,7 +311,7 @@ def save_patient(chartno, outdir, query = "CT,MR", only_tag=False):
|
||||||
|
|
||||||
subdir = Path(f'{outdir}\\{series_name}')
|
subdir = Path(f'{outdir}\\{series_name}')
|
||||||
|
|
||||||
time.sleep(.1)
|
time.sleep(.3)
|
||||||
logging.warning(str(item.get_properties()))
|
logging.warning(str(item.get_properties()))
|
||||||
mouse_click(item)
|
mouse_click(item)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue