我正在尝试使用FO-DICOM框架实施存储承诺,但没有结果。我能够创建N-ACTION请求。我能够收到N-ACTION回复。但我不知道如何接收EVENTREPORT。任何人都可以帮助我,并以正确的方式向我讲话?
private DicomStatus _responseStatus;
public void SendRequestForCommitment(string scImageUid)
{
var client = new DicomClient();
var nAction = new DicomNActionRequest(DicomUID.StorageCommitmentPushModelSOPClass,
new UIDGenerator().PrivatelyDefinedSoapInstanceUid(), 1);
var ds = new DicomDataset();
nAction.Dataset = ds;
nAction.Dataset.Add(DicomTag.TransactionUID, new UIDGenerator().uid);
var sps = new DicomDataset();
nAction.Dataset.Add(new DicomSequence(DicomTag.ReferencedSOPSequence, sps));
sps.Add(DicomTag.ReferencedSOPClassUID, DicomUID.SecondaryCaptureImageStorage);
sps.Add(DicomTag.ReferencedSOPInstanceUID, scImageUid);
DicomNActionRequest.ResponseDelegate nActionResponseDelegate = NActionResponse;
nAction.OnResponseReceived = nActionResponseDelegate;
client.AddRequest(nAction);
client.Send("127.0.0.1", 105, false, "myAE", "DVTK_STRC_SCP");
}
private void NActionResponse(DicomNActionRequest request, DicomNActionResponse response)
{
_responseStatus = response.Status;
}
最佳答案
免责声明:我从未使用过FO-DICOM。下面的代码只是一个伪代码,不是FO-DICOM语法。我希望查看伪代码,您将能够找出工具箱中的确切成员(属性,方法和事件)。
在您的代码中,您已经在构建请求数据集。然后,您先呼叫client.AddRequest(nAction);
,然后呼叫client.Send(.......);
。我假设这将在内部建立连接,关联并发送NAction请求。
然后,您已订阅private void NActionResponse(....)
事件。我认为此事件已被触发,并且您正在收到NAction响应。
同样,您应该为NEventReport事件订阅一些内容(在工具箱中查找确切的语法),如下所示:
private void NEventReportReceived(DicomNEventReport request, ......)
{
//Parse the request here.
//Check what files were archived and what were failed.
//Do your stuff accordingly.
//Send NEventReport response conveying the status.
client.SendReleaseRequest();
}
订阅另一个事件以处理发布响应。
private void ReleaseResponseReceived(......)
{
//Close connection
}
正如我在other回答中所说,您的SCU应该具有处理NEventReport的能力。您已通过编写第
client.AddRequest(nAction);
行将NAction添加到客户端。查看工具包文档,以查看是否还需要为NEventReport添加类似内容。我强烈认为这是不必要的;您只需要订阅一个活动。关于c# - fo-dicom的存储 promise ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42285941/