带附加实用程序的ortanc rest api python包装器
pyorthanc的Python项目详细描述
Pyorthanc
包装orthanc rest api并促进数据操作的python库。
链接到orthanc网站:https://www.orthanc-server.com/
注释:
请注意,这是包装器的早期版本(version<;1.0)。
因此,某些方法描述(可能还有名称)可能会更改,因为
它们没有充分描述相应的orthanc rest api路由的行为。
还要注意这个图书馆还在开发中。
如果Orthanc
方法的描述与计划的
行为,请做一个问题。
但是,“pyorthanc”包含的对象和函数可能是 对于编写python脚本以与orthanc交互的任何人都很有用。
还要注意,测试(python setup.py test
)可能只起作用
在Linux机器上。
安装
$ pip install pyorthanc
或者从存储库:
pip install git+https://gitlab.physmed.chudequebec.ca/gacou54/pyorthanc.git
或者,如果您没有安装git,请克隆存储库:
pip install -e pyorthanc.zip
特定版本
如果要查找特定版本,请使用所需的 标记arhttps://gitlab.physmed.chudequebec.ca/gacou54/pyorthanc/tags。
用法示例
一定要确保奥桑奇在跑。默认url(如果在本地运行)是http://localhost:8042
。
使用orthanc服务器:
frompyorthancimportOrthancorthanc=Orthanc('http://localhost:8042')orthanc.setup_credentials('username','password')# If needed# To get patients identifier and main informationpatients_identifiers=orthanc.get_patients()forpatient_identifierinpatients_identifiers:patient_information=orthanc.get_patient_information(patient_identifier)# To get patient's studies identifier and main informationa_patient_identifier=patients_identifiers[0]studies_identifiers=orthanc.get_studies(a_patient_identifier)forstudy_identifierinstudies_identifiers:study_information=orthanc.get_study_information(study_identifier)
获取远程模式列表:
frompyorthancimportOrthancorthanc=Orthanc('http://localhost:8042')orthanc.setup_credentials('username','password')# If neededorthanc.get_modalities()
从远程成像设备查询(C-find)和检索(C-move):
frompyorthancimportRemoteModality,Orthancremote_modality=RemoteModality(Orthanc('http://localhost:8042'),'modality')remote_modality.setup_credentials('username','password')# If needed# Query (C-Find) on modalitydata={'Level':'Study','Query':{'PatientID':'*'}}query_response=remote_modality.query(data=data)# Retrieve (C-Move) results of query on a target modality (AET)remote_modality.move(query_response['QUERY_ID'],'target_modality')
为orhanc实例中的所有患者构建患者树结构:
每个病人都是一棵树。每棵树的层是Patient
->;Study
->;Series
->;Instance
。
frompyorthancimportOrthanc,datastructurepatient_forest=datastructure.build_patient_forest(Orthanc('http://localhost:8042/'))forpatientinpatient_forest:patient_info=patient.get_main_information()forstudyinpatient.get_studies():...