orhanc dicom服务器的rest客户端

orthanc-rest-client的Python项目详细描述


orthanc rest客户端

Build Status

提供针对Orthancrest api端点的rest客户端。

基于优秀的apiron库。

安装

pip install orthanc-rest-client

如何使用

导入预定义的客户端并传递服务器详细信息

from orthanc_rest_client import Orthanc
orthanc = Orthanc('http://localhost:8042')

# Patient endpoints
orthanc.get_patients()
orthanc.get_patient(id)
...and so on

# Study endpoints
orthanc.get_studies()
orthanc.get_study(id)
...and so on

# Series endpoints
orthanc.get_series()
orthanc.get_one_series(id)
...and so on

# Instance endpoints
orthanc.get_instances()
orthanc.get_instance(id)
...and so on

# Get changes
orthanc.get_changes()

# Find objects by query
query = {'Level': 'Patient',
            'Query': {'PatientName': 'Jon*'},
        }
orthanc.find(query)

# Get previous queries
orthanc.get_queries()

还有许多其他预配置的端点。

认证

传递有效的身份验证对象:

from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth('orthanc', 'orthanc')
orthanc = Orthanc('https://test.server.com', auth=auth)

然后正常调用函数(自动传递auth对象)。

高级示例

将实例文件保存到本地目录:

def save_dcm_file(instance_id):
    fileName = '.'.join([instance_id, "dcm"])
    with open(fileName, 'wb') as dcm:
        for chunk in orthanc.get_instance_file(instance_id):
            dcm.write(chunk)

http端点

rest客户端将在使用http端点时发出警告。考虑到数据敏感性,强烈考虑使用https。

进一步帮助

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
导入如何引用同一目录中的Java类?   java AngularJS+Spring Security如何在POST请求中设置CSRF令牌?   numberformatexception在java中将文件名存储在整数变量中   switch语句中需要java常量表达式   java ConcurrentModificationException在生成时发生。removeAll()方法   java我无法从充满Order对象的ArrayList打印   java流和筛选列表中包含的子列表中的数据   java如何从hibernate创建/调用mysql事件?   java如何在oracle clob数据类型列中一次存储长度大于4000个字符的字符串?   java smartGWT:从服务器检索数据以填充listGrid   带有Spring Security的Spring MVC不支持java HTTP状态405请求方法“POST”   java为什么编写简单。xlsx的书在我的情况下很慢?   java从十六进制字符串创建EC私钥   java如何将磁贴留空   java嵌套类:`OuterClass。这什么属性`?   无法理解以下Java程序的输出