我看过官方的pynetdicom文档,但在接收图像时,我没有得到正确的事件处理程序(用于SCU)。
首先,我创建了所需的.dcm文件数据集,并使用了C-GET命令,这应该会给我.dcm文件,但是我没有指定我的图像要存储在SCU上的位置。我需要使用C-MOVE命令来获取图像吗?或者我的代码不完整(在未为SCU onReceiveStore指定事件处理程序的意义上)?
ConQuest服务器正在发送文件,但SCU无法接收!
首先,我创建了所需的.dcm文件数据集,并使用了C-GET命令,这应该会给我.dcm文件,但是我没有指定我的图像要存储在SCU上的位置。我需要使用C-MOVE命令来获取图像吗?或者我的代码不完整(在未为SCU onReceiveStore指定事件处理程序的意义上)?
from pydicom.dataset import Dataset
import pydicom
from pynetdicom import (
AE, evt, build_role,
PYNETDICOM_IMPLEMENTATION_UID,
PYNETDICOM_IMPLEMENTATION_VERSION
)
from pynetdicom.sop_class import (
PatientRootQueryRetrieveInformationModelGet,
CTImageStorage
)
ae = AE()
ae.add_requested_context(PatientRootQueryRetrieveInformationModelGet)
ae.add_requested_context(CTImageStorage)
role = build_role(CTImageStorage, scp_role=True)
ds = Dataset()
ds.QueryRetrieveLevel = 'SERIES'
ds.PatientID = '0009703828'
ds.StudyInstanceUID = '1.3.46.670589.5.2.10.2156913941.892665384.993397'
ds.SeriesInstanceUID = '1.3.46.670589.5.2.10.2156913941.892665339.860724'
assoc = ae.associate('127.0.0.1', 5678)
if assoc.is_established:
responses = assoc.send_c_get(ds, PatientRootQueryRetrieveInformationModelGet)
for (status,dataset) in responses:
if status:
print('C-GET query status: 0x{0:04x}'.format(status.Status))
# If the status is 'Pending' then `identifier` is the C-GET response
if status.Status in (0x0000, 0x1022):
print(dataset)
else:
print('Connection timed out, was aborted or received invalid response')
assoc.release()
else:
print('Association rejected, aborted or never connected')
我期望从DICOM服务器(如我的ConQuest服务器)收到.dcm文件,但我只收到了DICOM标签,确认这个数据集(作为一个查询发送到ConQuest服务器)是存在的!我想确切地知道如何使用这个应用实体(AE)在我的SCU上接收图像。
这是来自ConQuest服务器的响应。
[CONQUESTSRV1] UPACS THREAD 11: STARTED AT: Fri Oct 25 06:56:23 2019
[CONQUESTSRV1] Calling Application Title : "PYNETDICOM "
[CONQUESTSRV1] Called Application Title : "ANY-SCP "
[CONQUESTSRV1] Application Context : "1.2.840.10008.3.1.1.1", PDU length: 16382
[CONQUESTSRV1] Presentation Context 0 "1.2.840.10008.5.1.4.1.2.1.3" 1
[CONQUESTSRV1] Presentation Context 1 "1.2.840.10008.5.1.4.1.1.2" 1
[CONQUESTSRV1] Number of images to send: 2
[CONQUESTSRV1] Sending file : c:\users\sagar\onedrive\desktop\dicomserver1419d1\data\0009703828\1.3.46.670589.5.2.10.2156913941.892665339.860724_0001_002000_14579035620000.dcm
[CONQUESTSRV1] [recompress]: recompressed with mode = un (strip=1)
[CONQUESTSRV1] C-Get (PatientRoot)
[CONQUESTSRV1] UPACS THREAD 11: ENDED AT: Fri Oct 25 06:56:23 2019
[CONQUESTSRV1] UPACS THREAD 11: TOTAL RUNNING TIME: 0 SECONDS
ConQuest服务器正在发送文件,但SCU无法接收!
scp = ae.start_server((scp_peer["ipv4"],scp_peer["port"]), block=False, evt_handlers=handlers, ae_title=ownae)
使用默认值会让(Conquest)服务器声称请求实例“未接受连接”。 - knobi