日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

DICOM学习(3)——python实现worklist获取

發布時間:2023/12/9 python 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 DICOM学习(3)——python实现worklist获取 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

? ? ?這里使用的仍然是pydicom和pynetdicom模塊,在使用前需安裝。

思路:首先初始化AE作為SCP,并創建數據集dataset,dataset中可以設定具體tag的值,此處可根據需要自行設定。然后和服務端SCU連接,用send_c_find來查詢worklist,query_model為“W”表示"1.2.840.10008.5.1.4.31",即?“Modality Worklist Information - FIND”。Worklist 其實就是一個 C-Find 請求,不過這個 C-Find 請求指定了 SOP Class UID 為 【1.2.840.10008.5.1.4.31】。

?

#coding=utf-8
from pydicom.dataset import Dataset
from pydicom.uid import (
ImplicitVRLittleEndian,
ExplicitVRLittleEndian,
ExplicitVRBigEndian)
from pynetdicom import AE
from pynetdicom.sop_class import PatientRootQueryRetrieveInformationModelFind
from pynetdicom.sop_class import BasicWorklistManagementServiceClass
from pynetdicom import AE, BasicWorklistManagementPresentationContexts
# Initialise the Application Entity
ae = AE(ae_title=b'WHTM-116')
#VerificationSOPClas'1.2.840.10008.3.1.1.1'#
ae.add_requested_context('1.2.840.10008.5.1.4.31',
?[ImplicitVRLittleEndian,
? ExplicitVRLittleEndian,
ExplicitVRBigEndian])

# Create our Identifier (query) dataset
ds = Dataset()
ds.PatientName = ''
#ds.PatientID ='2019052700000014'
ds.ScheduledProcedureStepStartDate = "20190526"

print(ds)
# Associate with peer AE at IP 127.0.0.1 and port 11112
assoc = ae.associate('10.3.2.85',3321,ae_title=b'WORKLISTSERVER')

if assoc.is_established:
? ? # Use the C-FIND service to send the identifier
? ? responses = assoc.send_c_find(ds , msg_id=1, priority=2,query_model='W')
? ? for (status, identifier) in responses:
? ? ? ? if status:
? ? ? ? ? ? print('C-FIND query status: 0x{0:04x}'.format(status.Status))

? ? ? ? ? ? # If the status is 'Pending' then identifier is the C-FIND response
? ? ? ? ? ? if status.Status in (0xFF00, 0xFF01):
? ? ? ? ? ? ? ? print(identifier)
? ? ? ? else:
? ? ? ? ? ? print('Connection timed out, was aborted or received invalid response')

? ? ?# Release the association
? ? assoc.release()
else:
? ? print('Association rejected, aborted or never connected')

總結

以上是生活随笔為你收集整理的DICOM学习(3)——python实现worklist获取的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。