Browsing this Thread:   1 Anonymous Users


 Bottom   Previous Topic   Next Topic  Register To Post



C-GET DICOM file with SCU from SCP using DVTk
Just popping in
Joined:
2011/1/21 20:15
Group:
Registered Users
Posts: 2
Level : 1; EXP : 2
HP : 0 / 0
MP : 0 / 4
Offline
Hello, I'm working on a project where I need to communicate with medical equipment x-ray and extract DICOM files, so I'm using the simulation tools of DVTk, Storage SCP simulator to simulate medical equipment and using the library for DICOM DVTk trying to establish communication with the equipment and get the DICOM images, looked around for samples on the Web and looking for help in the documentation, I did some tests based on some examples I found but am having trouble doing that so if anyone has a simple example would help me a lot.

Thanks.

Posted on: 2011/1/21 20:27
Transfer the post to other applications Transfer


Re: C-GET DICOM file with SCU from SCP using DVTk
Quite a regular
Joined:
2010/3/23 15:01
Group:
Registered Users
Posts: 24
Level : 3; EXP : 62
HP : 0 / 65
MP : 8 / 607
Offline

I'm not very familiar how exactly C-GET implementation works out.I never had experience with it.

But so far what i know is; SCU sends c-get request.. Scp first responds with a storage-request in the same association... After each storage message, scp also sends c-get responses. If this implementation is true; your dvtk library codes should look like the following :

 

                public class myCgetSCU : DicomThread

                {

                    ThreadManager threadManager;

                    MainThread mainThread;

                    public myCgetSCU()

                    {

                      

                       

                    }

 

                  

 

                    protected override void Execute()

                    {

                        // first load operations for dicom thread

                        // making these operations sometimes returns error if they are in the constructer.

                        // making them in execute method is safer...

 

                        threadManager = new ThreadManager();

                        mainThread = new MainThread();

 

                        mainThread.Initialize(threadManager);

                        this.Initialize(mainThread);

                        this.Options.LoadDefinitionFile("........ dvtk def file 1 for query retrieve ");

                        this.Options.LoadDefinitionFile("........ dvtk def file 2 for query retrieve ");

                        // .....

                        // .....

                        this.Options.LoadDefinitionFile("........ dvtk def file 1 for storage ");

                        this.Options.LoadDefinitionFile("........ dvtk def file 2 for storage ");

                        // .....

                        // .....

 

                        this.Options.AutoValidate = false;

                        this.Options.StorageMode = Dvtk.Sessions.StorageMode.AsMedia;

 

                        this.Options.RemoteAeTitle = "RemoteSCPAe";

                        this.Options.RemoteHostName = "RemoteIpAdress";

                        this.Options.RemotePort = 104;

 

                        this.MessageReceivedEvent += new MessageReceivedEventHandler(mySCU_MessageReceivedEvent);

 

                        // ------------------------------

 

                        // preapare your presentation contexts for association request...

 

                        string abstractSyntax = ".... sop class uid for query retrieve ";

                        string[] transferSyntaxes = new string[] { " tr.syntaxUid 1 your scu support", " tr.syntaxUid 2 your scu support", " .... " };

                        PresentationContext queryRetrieveContext = new PresentationContext( abstractSyntax, transferSyntaxes  );

 

                        // because you are using c-get instead of a C-move, you should

                        // create more presentaion contexes due to your supported storage sop classes

                        string abstractSyntaxStor1 = ".... sop class uid for query retrieve ";

                        string[] transferSyntaxesStor1 = new string[] { " tr.syntaxUid 1 your scu support", " tr.syntaxUid 2 your scu support", " .... " };

                        PresentationContext queryRetrieveContextStor1 = new PresentationContext(abstractSyntaxStor1, transferSyntaxesStor1);

                        // other storage presentation contexes..

                        // ..

                        // ..

                        // ..

 

 

                        // send your association request to scp

                        SendAssociateRq(new PresentationContext[] { queryRetrieveContext , queryRetrieveContextStor1 });

 

                        // wait for association response

                        ReceiveMessage();

                    }

 

                    void mySCU_MessageReceivedEvent(DvtkHighLevelInterface.Dicom.Messages.DicomProtocolMessage dicomProtocolMessage)

                    {

                        if (dicomProtocolMessage.IsAssociateAc)

                        {

                            // Thread will come here right after your association is accepted by remote scp

 

                            DicomMessage cGetRqMsg = new DvtkHighLevelInterface.Dicom.Messages.DicomMessage(DvtkData.Dimse.DimseCommand.CGETRQ);

                            cGetRqMsg.CommandSet.Set(DvtkData.Dimse.Tag.AFFECTED_SOP_CLASS_UID, DvtkData.Dimse.VR.UI, ".. query retrieve sop class uid");

                            cGetRqMsg.CommandSet.Set(DvtkData.Dimse.Tag.MESSAGE_ID, DvtkData.Dimse.VR.US, "1");

                            // ..... set other commandSet values due to dicom implementation

                            // .....

                            cGetRqMsg.DataSet.Set(DvtkData.Dimse.Tag.STUDY_INSTANCE_UID, DvtkData.Dimse.VR.UI, " .. study instance uid you request .. ");

                            // ..... set other dataSet values due to dicom implementation

                            // .....

                            Send(cGetRqMsg);

 

                            cGetRqMsg.DataSet.Clear();

                            cGetRqMsg = null;

 

                            ReceiveMessage();

                        }

                        else if (dicomProtocolMessage.IsDicomMessage)

                        {

                            if (dicomProtocolMessage.DicomMessage.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.CGETRSP)

                            {

                                // Thread will come here after your previous c-get request is being responded by remote scp and after you recieved a store request

                                DicomMessage recievedMsg = dicomProtocolMessage.DicomMessage;

 

                                // you can get attribute values from recieved message like this...

 

                                string status = "" + recievedMsg.CommandSet["0x00000900"].Values[0];

                                if (status != "65280")

                                {

                                    // status = pending

                                    // storage operations will continue by the remote scp

                                    string numberOfRemaining = "" + recievedMsg.DataSet["0x00100010"].Values[0];

                                    // ... you can get other status informations like this one

                                    // ..

                                    // ..

 

                                    // you should wait for the next storage message

                                    ReceiveMessage();

                                }

                                else

                                {

                                    // all c-get responses are finished or error occured

                                   

                                    // send a release request

                                    SendReleaseRq();

                                   

                                    // wait for release response

                                    ReceiveMessage();

                                }

                            }

                            else if (dicomProtocolMessage.DicomMessage.CommandSet.DimseCommand == DvtkData.Dimse.DimseCommand.CSTORERQ)

                            {

                                // Thread will come here when remote scp sends a store request

                                // The whole dataset contains the dicom file dataset..

                                // you can create a dicom file here using a DicomFile class and set its dataset to a clone of recieved message.

                               

                                DvtkHighLevelInterface.Dicom.Files.DicomFile file = new DvtkHighLevelInterface.Dicom.Files.DicomFile();

                                file.DataSet.CloneFrom(dicomProtocolMessage.DicomMessage.DataSet);

                                file.FileMetaInformation.MediaStorageSOPClassUID = "...."; // read it from dataset

                                file.FileMetaInformation.MediaStorageSOPInstanceUID = "...."; // read it from dataset

                                file.Write("where you want to save the file");

                                file.DataSet.Clear();

                                file = null;

 

                                // then you should wait for a c-get response

                                ReceiveMessage();

                            }

                        }

                    }

                }

 

 

/// 

 

in your application :

myCgetSCU scu = new myCgetSC();

myCgetSCU.Start();


Posted on: 2011/1/24 14:55
Transfer the post to other applications Transfer


Re: C-GET DICOM file with SCU from SCP using DVTk
Quite a regular
Joined:
2010/3/23 15:01
Group:
Registered Users
Posts: 24
Level : 3; EXP : 62
HP : 0 / 65
MP : 8 / 607
Offline
EDIT:
the line :
string numberOfRemaining = "" + recievedMsg.DataSet["0x00100010"].Values[0];

must be:
string numberOfRemaining = "" + recievedMsg.CommandSet["0x00001020"].Values[0];

Posted on: 2011/1/24 15:10
Transfer the post to other applications Transfer


Re: C-GET DICOM file with SCU from SCP using DVTk
Not too shy to talk
Joined:
2011/2/18 3:19
Group:
Registered Users
Posts: 5
Level : 1; EXP : 34
HP : 0 / 8
MP : 1 / 56
Offline
Sorry I can't know.

Posted on: 2011/2/18 3:41
_________________
silk duvetsSilk Beddingwww.revesilkdirect.com/silk-duvets-c-1.html
www.ugg-style.com
www.monosilk.com
Transfer the post to other applications Transfer



 Top   Previous Topic   Next Topic

 Register To Post


You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]