C-Move and C-Store

1,766 views
Skip to first unread message

Christos Yiallouras

unread,
Oct 11, 2014, 5:27:15 AM10/11/14
to fo-d...@googlegroups.com
Hi all,

I have already implement the C-Find command. I would like to ask if i am going to execute the C-Move command (using studyinstanceUID, i extract it using C_Find query), the images will be transferred from the MRI scanner to my computer?

Thank you very much for your help.

Christos

Jan-Walter Benjamins

unread,
Oct 17, 2014, 3:04:49 AM10/17/14
to fo-d...@googlegroups.com
Hi Christos,

as far as I know, you need to take care of the following:
  • -Instantiate a dicomserver with a storescp implementation (example can be found at fo-dicom github site) with a certain port number (e.g. 12345), which accepts association requests with a given called AE title (your AE title, eg "MyAe"): 
    • Create the server instance: new DicomServer<CStoreScp>(12345);
    • Accept (or block) an association:
                  if (association.CalledAE != "MyAe")
                  {
                      this.SendAssociationReject(DicomRejectResult.Permanent, DicomRejectSource.ServiceUser, DicomRejectReason.CalledAENotRecognized);
                      return;
                  }
  • -Configure your MRI scanner with a c-store destination that points to the IP address or computer name of your listening server, its AE title ("MyAe" in this case) as mentioned before and its StoreSCP instance's port number (12345);
  • Call the MRI scanner with a CMove client at the MRI's AE title and give it your own AE title in the command:  new DicomCMoveRequest("MyAe", studyInstanceUID);

This works fine for me. The studyInstanceUID obviously is a result of an earlier CFind action.

Kind regards,

Jan-Walter

Christos Yiallouras

unread,
Oct 18, 2014, 6:06:26 AM10/18/14
to fo-d...@googlegroups.com
Hi Jan-Walter,

Thank you very much for your reply.

During the test of my code and execute C-Find commands i get the following error Object reference not set to an instance of an object.

my code is the following:

var cfind = DicomCFindRequest.CreateStudyQuery(patientId: "*");
                cfind.OnResponseReceived = (DicomCFindRequest rq, DicomCFindResponse rp) =>
                {
                    Console.WriteLine("Study UID: {0}", rp.Dataset.Get<string>(DicomTag.StudyInstanceUID));
                };
                var client = new DicomClient();
                client.AddRequest(cfind);
                client.Send("213.165.94.158", 104, false, "SCU", "MR01");

                // Keep the console window open in debug mode.
                System.Console.WriteLine("Press any key to exit.");
                System.Console.ReadKey();

The error is in the line Console.WriteLine("Study UID: {0}", rp.Dataset.Get<string>(DicomTag.StudyInstanceUID));

I tested before and it was correct, but it starts to show that error.

Thank you very much.

Christos
Message has been deleted

Christos Yiallouras

unread,
Oct 19, 2014, 8:06:33 AM10/19/14
to fo-d...@googlegroups.com
Dear Jan - Walter,

I found the error about the null reference, i used try catch block.

But i have a problem while i tried to instantiate the Dicom Server with CStoreSCP type.
The type or namespace name 'CStoreSCP' could not be found (are you missing a using directive or an assembly reference?)

Can you help me, because i can find the missing reference.

Thank you a lot
Christos.

Jan-Walter Benjamins

unread,
Oct 20, 2014, 3:10:30 AM10/20/14
to fo-d...@googlegroups.com
Hello Christos,

A null reference can always occur inside the response received. I think it's better to check if the dataset is set than to let a a null reference exception kick in.

About the CStoreSCP: you can find an example implementation at https://github.com/rcd/fo-dicom/blob/master/Examples/C-Store%20SCP/Program.cs 

As far as I know, no standard implementation is provided in the assembly, but you should create your own.

Jan-Walter
Message has been deleted

Christos Yiallouras

unread,
Oct 20, 2014, 5:07:32 AM10/20/14
to fo-d...@googlegroups.com
Hello again,

I fixed the null reference exception and the C-Find command works fine.

I implement CStoreSCP class based on the example on the github website.below is the code i execute in order to get the dicom files.

var server = new DicomServer<CStoreSCP>(104);

            //C-Store

            var client = new DicomClient();
            client.AddRequest(new DicomCStoreRequest(@"C:\DICOM\test.dcm"));
            client.Send("213.165.94.158", 104, false, "SCU", "DEST-AE");

            //C-Move Command
            var cmove = new DicomCMoveRequest("DEST-AE", StudyInstanceUID);
            client = new DicomClient();
            client.AddRequest(cmove);
            client.Send("213.165.94.158", 104, false, "SCU", "DEST-AE");

            server.Dispose();

I did not find anything on my local folder.

I don't know if i miss something.

Thank you a lot
Christos


Jan-Walter Benjamins

unread,
Oct 20, 2014, 10:02:21 AM10/20/14
to fo-d...@googlegroups.com
Hello Chrisotos,

I'm not sure about your intentions with the cstore command, but when I look at your cmove, it looks like you switched the called AE and the calling AE in the client.Send call. Does the server, you call for the cmove run on port 104? 

To get all things straight, could you summarize portnumbers, IP addresses and AE-titles of your MRI system and your local system?

Jan-Walter


Christos Yiallouras

unread,
Oct 21, 2014, 2:51:15 PM10/21/14
to fo-d...@googlegroups.com

Hi, Jan-Walter,

Dicom Server IP: 213.165.94.158
Server Port: 104
CalledAET: MR01
CallingAET: SCU

My Code


var server = new DicomServer<CStoreSCP>(104);

 //C-Move Command
 var cmove = new DicomCMoveRequest("SCU", txtqueryseries.Text);

 var client = new DicomClient();
 client.AddRequest(cmove);
 client.Send("213.165.94.158", 104, false, "SCU", aetitle);

storage path in CStoreSCP : @"C:\DICOM"


Thank you a lot.
Christos

Christos Yiallouras

unread,
Oct 22, 2014, 5:02:59 AM10/22/14
to fo-d...@googlegroups.com
Hi Jan-Walter,

While executed the C-Move command, I get the following response

Christos Yiallouras

unread,
Oct 22, 2014, 5:05:32 AM10/22/14
to fo-d...@googlegroups.com
Hi again

I have attached here an image with the error message.

Christos
error.png

Vinay Rathore

unread,
Jan 27, 2015, 7:03:32 AM1/27/15
to fo-d...@googlegroups.com
HI
Jan-Walter Benjamins,

i am getting Data set null using below code .
Please tell me what is the issue due to it, i not getting Data set .

public void GetPatient(string remotehost, Int16 port, string callingAET, string calledAET, string PatientID, string InstanaceUID, string SeriesInsUid)
        {
            //MessageBox.Show(remotehost + " " + port.ToString() + " " + callingAET + " " + calledAET + " " + PatientID + " " + InstanaceUID + " " +  SeriesInsUid);
           
            DicomCFindRequest fr = DicomCFindRequest.
CreatePatientQuery(PatientID);
            MessageBox.Show(callingAET + " " + InstanaceUID);
            DicomCMoveRequest mr = new DicomCMoveRequest(callingAET, InstanaceUID); //, SeriesInsUid);
            mr.OnResponseReceived = MoveFinished;


            var client = new DicomClient();
            client.NegotiateAsyncOps(2, 0);
            client.AddRequest(fr);
            client.AddRequest(mr);
            //client.BeginSend(remotehost, port, false, callingAET, calledAET, Done, client);
            client.Send(remotehost, port, false, callingAET, calledAET);
        }

        public void MoveFinished(DicomCMoveRequest request, DicomCMoveResponse response)
        {
           
            MessageBox.Show("MoveFinished " + response.Status.Description);
            //.... No code yet but inside response only a command dataset with 9 items, unsigned ints.. no images anywhere
        }

        public void Done(IAsyncResult result)
        {
            //MessageBox.Show("Done " + result.ToString());
            //...Blank, just made this to get BeginSend to work? Something goes here???
        }

Reply all
Reply to author
Forward
0 new messages