importargparseimportdicom# = pydicomimportglobimportos# useage:# python3 dumpWorklists.py --folder=/var/lib/orthanc/db/worklists/if__name__=="__main__":try:parser=argparse.ArgumentParser("Dumps info from a set of worklists contained in a folder (i.e a folder that the Orthanc modality worklist plugin is serving)")parser.add_argument('-f','--folder',help="the folder containing the worklidsts (.wl) files.url of the orthanc to monitor")args=parser.parse_args()fileFilter=os.path.join("{folder}".format(folder=args.folder),"*.wl")forwlFileinglob.glob(fileFilter):try:wl=dicom.read_file(wlFile)values=[wl.PatientID,str(wl.PatientName),wl.AccessionNumber,wl.ScheduledProcedureStepSequence[0].ScheduledProcedureStepStartDate,wl.ScheduledProcedureStepSequence[0].Modality,wlFile]print(", ".join(values))exceptExceptionasex:print(wlFile+": "+str(ex))exceptExceptionasex:print("Unhandled exception: "+str(ex))
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.