pydicom数据集:发送并返回成功,但是status.pixel_数组在i中有错误文本

2024-09-25 06:25:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用dcm4chee作为PACS服务器,并尝试根据患者姓名检索研究。在

相关代码为:

ae = AE()
ae.add_requested_context(PatientRootQueryRetrieveInformationModelFind)
ae.add_requested_context(VerificationSOPClass)
assoc = ae.associate(config['pacs_remotehost']['ip'], config['pacs_remotehost']['ports']['DICOM'],ae_title='DCM4CHEE')

if assoc.is_established:
    ds = Dataset()
    ds.PatientName = '*************' #name erased 
    ds.QueryRetrieveLevel = 'PATIENT'
    ds.StudyInstanceUID = ''
    responses = assoc.send_c_find(ds, query_model='P')
    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')

我得到了一个成功的信号:

C-FIND查询状态:0x0000

但当我想访问像素数据时,我就输入status.pixel_数组 但它不是Numpy数组,而是包含以下错误:

^{pr2}$

有人知道为什么我得到这个错误而不是图像吗?在


Tags: theaddconfigifisstatuscontextds
2条回答

我不太明白你想做什么(也不知道有问题的技术),但我认为你的理解是不正确的。在

你在做病人级别的C-FIND。您得到的是响应(匹配的条目),最后是成功响应。很好。在

那么,您是在尝试访问这些响应中的像素数据元素吗?-没有道理。在

C-FIND,不提供实际的实例/图像。它只会为您提供SCP上存在的符合您的搜索条件的条目,最后得到一个成功的响应。如果没有找到匹配的条目,则只返回最终成功响应。在

所以,你需要针对这些条目的像素数据,它不在那里。您还必须根据在C-FIND响应中收到的标识符执行C-MOVE(或C-GET)。我已经详细解释过了here。在

This paragraph will be bit complicated and may have some variations in workflow with different implementations. To do CMove, there must exist a CStoreSCP. You (CMoveSCU) will send CMove command to PACS (CMoveSCP) with AE Title of CStoreSCP where you want to receive instances. That means either you should also develop your own CStoreSCP or you should involve some other. CMoveSCP will read the AE Title you sent and will match it with its configurations. That means your CStoreSCP must be configured on PACS in advance. From configurations, it will take IP address and Port where it will establish NEW association. This is called Role Switching. CMoveSCP now also works as CStoreSCU. Acting as a CStoreSCU, PACS will then push instances to your CStoreSCP. This way, you actually get the images/instances.

这样,您将实际获得实例。当您拥有这些实例时,您可以访问这些实例中的像素数据。在

请参考this一篇优秀的文章来了解Q/R是如何工作的。在


简单的现实生活示例:

您有一个数据库表,其中包含个人id和指向其个人资料照片的URL。你想在你的网页上加载个人资料照片。在

因此,首先启动一个SQL查询(DICOM中的C-FIND)并获取记录。然后,从记录中读取URL。通过这个URL,您可以开始从服务器下载照片的新操作(DICOM中的C-MOVE)。一旦你下载了照片,你就可以把它载入你的网页。在

啊啊。。这个例子不好,不完全匹配。但是,我希望你明白这其中涉及到两种不同的行为。在

我完全同意Amit Joshi所说的,但我想补充一点,即使使用C-FIND中找到的标识符执行C-MOVE,也无法从状态获取像素数据。状态只传递C-FIND/C-MOVE操作的状态,而不是正在传输的数据。在

对于C-MOVE(它比C-GET更受支持),MOVE SCP将打开到移动目标AE的C-STORE连接,并通过该连接传输图像。也就是说,C-MOVE只传输有关图像传输的状态信息,而不是图像本身。在

相关问题 更多 >