简体   繁体   English

SCU 如何使用 C-GET 从 Dicom Server 接收 dcm 图像?

[英]How does the SCU receive dcm images from Dicom Server with C-GET?

I've seen the official pynetdicom documentation but I've not got the proper event handlers (for the SCU) on receiving images.我已经看过官方的 pynetdicom 文档,但是在接收图像时我没有正确的事件处理程序(用于 SCU)。

First I've created the required.dcm files Dataset and used the C-GET command, which should actually give me the.dcm files but also I've not specified where my images are to be stored on the SCU.首先,我创建了所需的 .dcm 文件数据集并使用了 C-GET 命令,它实际上应该给我 .dcm 文件,但我还没有指定我的图像在 SCU 上的存储位置。 Do I need to use the C-MOVE command to actually get images or my code is incomplete (in a sense that no event handlers are specified for SCU onReceiveStore)?我是否需要使用 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')

I expected the.dcm be sent from the DICOM server (ie ConQuest server in my case),but I'm only receving the DICOM tag confirming that this Dataset (given as a query to the ConQuest Server) is present!我希望 .dcm 是从 DICOM 服务器(即我的情况下的 ConQuest 服务器)发送的,但我只收到 DICOM 标签,确认该数据集(作为对 ConQuest 服务器的查询)存在! I want to know exactly how do I receive the images on my SCU using this Application Entity (ae)我想确切地知道如何使用此应用程序实体 (ae) 在我的 SCU 上接收图像

This is the response from the ConQuest Server这是来自 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

The ConQuest Server is sending the file but the SCU is unable to receive it! ConQuest 服务器正在发送文件,但 SCU 无法接收!

Do I need to use the C-MOVE command to actually get images我是否需要使用 C-MOVE 命令来实际获取图像

Yes;是的; either of C-MOVE or C-GET will work without issue; C-MOVE 或 C-GET 中的任何一个都可以正常工作; which one to use depends on your requirements.使用哪一种取决于您的要求。 C-MOVE will establish new connection (roles will be reversed) and instances will be sent on newly established connection. C-MOVE 将建立新的连接(角色将被颠倒),实例将在新建立的连接上发送。 C-GET will work on same connection. C-GET 将在同一连接上工作。

or my code is incomplete (in a sense that no event handlers are specified for SCU onReceiveStore)?还是我的代码不完整(从某种意义上说,没有为 SCU onReceiveStore 指定事件处理程序)?

I do not know the programming language and the toolkit.我不知道编程语言和工具包。 So I may not comment on this.所以我可能不会对此发表评论。

I expected the.dcm be sent from the DICOM server (ie ConQuest server in my case),but I'm only receving the DICOM tag confirming that this Dataset (given as a query to the ConQuest Server) is present!我希望 .dcm 是从 DICOM 服务器(即我的情况下的 ConQuest 服务器)发送的,但我只收到 DICOM 标签,确认该数据集(作为对 ConQuest 服务器的查询)存在!

Most probably, you are getting C-FIND response here.最有可能的是,您在这里得到 C-FIND 响应。 This does not contain image instance.这不包含图像实例。 Please refer to this answer for more details.有关详细信息,请参阅答案。

I want to know exactly how do I receive the images on my SCU using this Application Entity (ae)我想确切地知道如何使用此应用程序实体 (ae) 在我的 SCU 上接收图像

On receiving C-FIND response, using the identifiers from it, you should further issue C-MOVE/C-GET command/request.在收到 C-FIND 响应时,使用其中的标识符,您应该进一步发出 C-MOVE/C-GET 命令/请求。 In response to this request, you will get actual image instance.响应此请求,您将获得实际的图像实例。 Your C-FIND SCU becomes C-STORE SCP here;您的 C-FIND SCU 在这里变成 C-STORE SCP; generally called Role Reversal .一般称为角色反转 Please refer to this answer for more details.有关详细信息,请参阅答案。

I also recommend you to read below articles from Roni:我还建议您阅读以下来自 Roni 的文章:

Both C-GET and C-MOVE will cause the SCP to send back to your device a C-STORE command containing the dataset. C-GET 和 C-MOVE 都会导致 SCP 向您的设备发送回包含数据集的 C-STORE 命令。

The difference between C-GET and C-MOVE is that C-MOVE will try to open a connection back to your device (which has to act also as an SCP to receive the C-STORE) while C-GET will send the C-STORE on the same connection negotiated by your device. C-GET 和 C-MOVE 之间的区别在于 C-MOVE 将尝试打开与您设备的连接(它也必须充当 SCP 才能接收 C-STORE),而 C-GET 将发送 C-在您的设备协商的同一连接上存储。

The response for the C-GET and C-MOVE contains just the status of the operation. C-GET 和 C-MOVE 的响应只包含操作的状态。

You need to bind a callable handler function to evt.EVT_C_STORE as shown in this example .您需要将一个可调用的处理程序 function 绑定到evt.EVT_C_STORE ,如 本例所示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM