我正在制作一个非常简单的 STORE 服务器,它不打算做任何类似 DICOM 的事情,而不是回显和接收数据。我从父类继承DicomCEchoProvider
并让父类为我完成大部分工作:到目前为止,唯一有计划使用的方法是DicomCStoreResponse()
和OnCStoreRequestException()
,来自IDicomCStoreProvider
接口。
我的测试机器似乎根本不关心 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)。您必须创建自己的继承自的类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);
}