与 fo-dicom 的存储承诺

Storage Commitment with fo-dicom

我正在尝试使用 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;
}

Disclaimer: I never used FO-DICOM. The code below is just a pseudo code and is NOT FO-DICOM syntax. I hope looking at pseudo code, you will able to figure out exact members (properties, methods, and events) in toolkit.

在您的代码中,您已经在构建请求数据集。然后,您调用 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
}

正如我在 回答中所说,您的 SCU 应该能够处理 NEventReport。您已经通过编写行 client.AddRequest(nAction); 将 NAction 添加到您的客户端。检查工具包文档,看看您是否还需要为 NEventReport 添加类似的。我强烈认为不需要这样做;你只需要订阅一个活动。