如何在我创建的服务器上设置 AE 标题?

How do I set the AE Title on a server I'm creating?

我正在制作一个非常 简单的 STORE 服务器,除了回显和接收数据外,它不打算做任何事情 DICOM-like。我从 DicomCEchoProvider 继承并让 parent class 为我完成大部分工作:到目前为止,唯一计划使用的方法是 DicomCStoreResponse()OnCStoreRequestException(),来自IDicomCStoreProvider界面。

我的 test-machine 似乎根本不关心 AET,但我不能假设其他机器都会如此适应。如何将 AE 标题设置为我选择的内容?

服务器 (SCP) 没有发送 AETitle。相反,SCU 通过关联请求(在握手时)发送主叫 AET 和被叫 AET。检查此数据然后接受或拒绝关联是 SCP 的工作。 如果您没有明确编码,则默认情况下 SCP 会接受所有关联。

查看示例项目 (https://github.com/fo-dicom/fo-dicom-samples/blob/master/Desktop/C-Store%20SCP/Program.cs)。 您必须创建自己的 class 继承自 DicomService,并且在方法 OnReceiveAssociationRequestAsync 中您必须编写类似这样的代码:

        public Task OnReceiveAssociationRequestAsync(DicomAssociation association)
        {
            // here you can check for the AETitle. You can also handle various AETitles and implement different behaviour depending on the AETitle (thats common in real PACS systems), like storing the files on different drives depending on the called AETitle...
            if (association.CalledAE != "STORESCP")
            {
                return SendAssociationRejectAsync(
                    DicomRejectResult.Permanent,
                    DicomRejectSource.ServiceUser,
                    DicomRejectReason.CalledAENotRecognized);
            }

            foreach (var pc in association.PresentationContexts)
            {
                if (pc.AbstractSyntax == DicomUID.Verification) pc.AcceptTransferSyntaxes(AcceptedTransferSyntaxes);
                else if (pc.AbstractSyntax.StorageCategory != DicomStorageCategory.None) pc.AcceptTransferSyntaxes(AcceptedImageTransferSyntaxes);
            }

            return SendAssociationAcceptAsync(association);
        }