3
votes

I am trying to implement a storage commitment with FO-DICOM framework, but with no result. I am able to create the N-ACTION request. I am able to receive the N-ACTION response. But I don't know how to receive the EVENTREPORT. Anyone can help me and address me to the right way?

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;
}
1
Ok just included my code: the method SendRequestForCommitment send the NACTION request to the storage, scImageUid argument is the identifier of the secondary capture image i want to be notified when safely stored, NActionResponse receive the response of NACTION call.... but how to hook up the EVENTREPORT message from the storage?Ghini Antonio
Fo-Dicom is a good c# framework but for client purpose...missing many server features.... I'm sorry but I had to face the same problems time ago and at the end I had to develop this features by myselfuser7548054
General purpose advice: see if the dicom library on client has any logging for network communication, also see if the server-side dicom library has network logging as well. If neither of those give any help, then you might like to know that Wireshark has a dicom filter for network captures, very useful.Chris O

1 Answers

2
votes

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.

In your code, you are already building request dataset. Then, you are calling client.AddRequest(nAction); and then client.Send(.......);. I assume this will internally establish a connection, association and will send NAction request.

Then you have subscribed for private void NActionResponse(....) event. I assume this event is being fired and you are getting NAction Response.

Similarly, you should subscribe NEventReport event something (look for exact syntax in toolkit) like following:

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();
}

Subscribe another event to handle release response.

private void ReleaseResponseReceived(......)
{
    //Close connection
}

As I said in other answer, your SCU should have ability to process NEventReport. You have added NAction to your client by writing line client.AddRequest(nAction);. Check the toolkit documentation to see if you also need to add similar for NEventReport. I strongly think this should not be needed; you just need to subscribe an event.