How to set DIcomCMoveResponse fields for Completed, Remaining & Failures

346 views
Skip to first unread message

Midge Stanger

unread,
Jul 26, 2017, 10:47:09 PM7/26/17
to Fellow Oak DICOM
Hi,

I'm wanting to return the number of completed images sent, number of remaining images to be sent and the number of failures in my DicomCMoveResponse.
Setting the status of the response is easy - DicomStatus.Pending etc..

Basically my code has a loop similar to the following:

                    while (rdr.Read())
                    {
                        yield return new DicomCMoveResponse(request, DicomStatus.Pending);
                        DicomClient client = new DicomClient();
                        client.Send(calling_ip, 104, false, Association.CalledAE, request.DestinationAE);

                    }

I want to be able to send back with the DicomStatus the number of remaining jobs, completed jobs and failed jobs.

Can anyone please help??

Many thanks

Anders Gustafsson Cureos AB

unread,
Aug 7, 2017, 2:49:31 AM8/7/17
to Fellow Oak DICOM
Hi Midge,

do you have some more code to share? For a simple example of query/retrieve you could have a look in the Q/R sample in the fo-dicom-samples repository, here.

In general, I would avoid to create a new DicomClient for evey new .Send, this might in worst case lead to concurrency issues. Initialize the client outside the while loop instead.

Regards,
Anders @ Cureos

Midge Stanger

unread,
Aug 9, 2017, 10:42:02 PM8/9/17
to Fellow Oak DICOM
Hi Andres,

Thanks for getting back to me although I have slightly moved forward.
Firstly as opposed to calling a PACS and requesting images, I have created the small PACS which other Application Entities are requesting images from - although your QR example does assist.

I have a Dicom Browser that I can query my PACS with and my PACS sends back a list of related studies etc...
When the Dicom Browser requests that my PACS send it the requested images, my PACS responds with CMOVE response and then sends a CSTORE request and sends the images.

The problem I have is that although the images get to the Browser and are displayed, the browser still thinks it is waiting for images and had a continuous message saying "receiving" when in my program has already sent the images and completed its termination of network connections etc..
I appear either not to be sending the images correctly or not finishing off the process correctly.
When use the browser on other PACS systems and it received images - it's able to tell how far through the process of receiving images it is (a percentage count down) which it also does not do with the PACS i have created.

Here is my code that I use to send the CMOVE response and the CSTORE requests etc.


            public IEnumerable<DicomCMoveResponse> OnCMoveRequest(DicomCMoveRequest request)
            {

                Console.WriteLine("CMove Responce: " + request.DestinationAE + " " + request.Dataset.Get<string>(DicomTag.SeriesInstanceUID));

                var seriesUid = request.Dataset.Get<string>(DicomTag.SeriesInstanceUID);
                var studyUid = request.Dataset.Get<string>(DicomTag.StudyInstanceUID);
                var MID = request.MessageID;

                if (request.Level == DicomQueryRetrieveLevel.Series)

                {

 
// Database stuff in here to  get records etc..


                    int counter = 0;
                    int to_send = image_count - counter;

                    DicomCMoveResponse dCmove = new DicomCMoveResponse(request, DicomStatus.Pending);
                    dCmove.Completed = counter;
                    dCmove.Remaining = image_count;
                    dCmove.Failures = 0;
                    yield return dCmove;
.                    DicomClient client = new DicomClient();


                    while (rdr.Read())
                    {

                        string location = rdr.GetString(20);
                        string series_id = rdr.GetString(3);
                        string study_id = rdr.GetString(2);

                        counter++;
                        to_send--;

                        DicomCStoreRequest request2 = new DicomCStoreRequest(location);
                        client.AddRequest(request2);
                        client.Send(calling_ip, 104, false, Association.CalledAE, request.DestinationAE);

                        dCmove = new DicomCMoveResponse(request, DicomStatus.Pending);
                        dCmove.Completed = counter;
                        dCmove.Remaining = image_count;
                        dCmove.Failures = 0;
                        yield return dCmove;

                    }

                    rdr.Close();
                    conn.Close();
                    dCmove = new DicomCMoveResponse(request, DicomStatus.Success);
                    dCmove.Completed = counter;
                    dCmove.Remaining = 0;
                    dCmove.Failures = 0;
                    yield return dCmove;

                }


            }


Any help or advice you can offer would be great - I've already moved the new DicomClient out of the sending loop.

Thanks,

Midge

Midge Stanger

unread,
Aug 10, 2017, 11:45:17 PM8/10/17
to Fellow Oak DICOM
Hi Andres,

Sorry - just trying to make my question a bit clearer.
Is it possible to send back and image as part of either the CMOVE request or the CMOVE response?
I've just realised, the Dicom Browser could come from any IP address and the port might not be known / open due to firewalls etc.
So this means using a client.send(calling_ip, 104, false, Association.CalledAE, request.DestinationAE); will probably not help me.

So can images be passed back to the querying entity during a CMOVE or CSTORE command without having to know the port on which to send to??

An example of this would be when the browser queries the PACS for patient details - the details are "returned" to the entity without knowing the port or IP address required.

Would really appreciate any help.

Many thanks,

Midge
Reply all
Reply to author
Forward
0 new messages