コード例 #1
0
        static void move(string destination, ApplicationEntity host)
        {
            CMoveServiceSCU pm = new CMoveServiceSCU(SOPClass.PatientRootQueryRetrieveInformationModelMOVE);

            pm.Syntaxes.Add(Syntax.ExplicitVrLittleEndian);
            pm.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            CFindServiceSCU pf = new CFindServiceSCU(SOPClass.PatientRootQueryRetrieveInformationModelFIND);

            pf.Syntaxes.Add(Syntax.ExplicitVrLittleEndian);
            pf.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            CMoveServiceSCU sm = new CMoveServiceSCU(SOPClass.StudyRootQueryRetrieveInformationModelMOVE);

            sm.Syntaxes.Add(Syntax.ExplicitVrLittleEndian);
            sm.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            CFindServiceSCU sf = new CFindServiceSCU(SOPClass.StudyRootQueryRetrieveInformationModelFIND);

            sf.Syntaxes.Add(Syntax.ExplicitVrLittleEndian);
            sf.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            Association association = new Association();

            association.AddService(pm);
            association.AddService(pf);
            association.AddService(sm);
            association.AddService(sf);

            if (association.Open(host))
            {
                if (sm.Active)
                {
                    sm.ImageMoved += new CMoveEventHandler(OnImageMoved);
                    try
                    {
                        Element element = new Element(t.StudyInstanceUID, "1.2.840.113564.109517115.2009111711190101521");
                        DataSet results = sm.CMove(destination, element);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                        throw;
                    }
                    finally
                    {
                        sm.ImageMoved -= new CMoveEventHandler(OnImageMoved);
                    }
                }
            }
            else
            {
                Debug.WriteLine("\ncan't Open.");
            }

            association.Close();
        }
コード例 #2
0
        static void get(ApplicationEntity host)
        {
            CMoveServiceSCU get = new CMoveServiceSCU(SOPClass.PatientRootQueryRetrieveInformationModelGET);

            get.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP store = new StorageServiceSCP(SOPClass.DigitalXRayImageStorageForPresentation);

            store.Role = Role.Scp;
            store.Syntaxes.Add(Syntax.ExplicitVrLittleEndian);
            store.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            VerificationServiceSCU echo = new VerificationServiceSCU();

            echo.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            Association association = new Association();

            association.AddService(store);
            association.AddService(get);
            association.AddService(echo);

            if (association.Open(host))
            {
                if (get.Active && store.Active)
                {
                    store.ImageStored += new ImageStoredEventHandler(OnImageStored);
                    try
                    {
                        Element element = new Element(t.PatientID, "759274");
                        DataSet results = get.CGet(element);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                    }
                    finally
                    {
                        store.ImageStored -= new ImageStoredEventHandler(OnImageStored);
                    }
                }
            }
            else
            {
                Debug.WriteLine("\ncan't Open.");
            }

            association.Close();
        }
コード例 #3
0
        public void EditorTest()
        {
            Process pacs = new Process();

            pacs.StartInfo.FileName = Tools.RootFolder + @"\EK\Capture\Dicom\Tools\DicomEditor\bin\Debug\DicomEditor.exe";

            ApplicationEntity editor  = new ApplicationEntity("DICOMEDITOR", IPAddress.Parse("127.0.0.1"), 2009);
            ApplicationEntity console = new ApplicationEntity("CONSOLE", IPAddress.Parse("127.0.0.1"), 2010);

            try
            {
                pacs.Start();
                StorageTest.Start(console);
            }
            catch
            {
                pacs.StartInfo.FileName = Tools.RootFolder + @"\EK\Capture\Dicom\Tools\DicomEditor\bin\Debug\DicomEditor.exe";
                pacs.Start();
            }
            Thread.Sleep(1000);

            StorageTest.store(@"EK\Capture\Dicom\DicomToolKit\Test\Data\DicomDir\THGLUZ5J.dcm", editor, false);

            RecordCollection            records;
            Dictionary <string, string> filter;

            filter = new Dictionary <string, string>();
            filter.Add(t.PatientID, "759275");
            records = CFindTest.Query(editor, "STUDY", filter);
            if (records != null)
            {
                filter = new Dictionary <string, string>();
                filter.Add(t.StudyInstanceUID, (string)records[0][t.StudyInstanceUID].Value);
                records = CFindTest.Query(editor, "SERIES", filter);
                if (records != null)
                {
                    filter = new Dictionary <string, string>();
                    filter.Add(t.SeriesInstanceUID, (string)records[0][t.SeriesInstanceUID].Value);
                    records = CFindTest.Query(editor, "IMAGE", filter);
                    if (records != null)
                    {
                        CMoveServiceSCU move = new CMoveServiceSCU(SOPClass.StudyRootQueryRetrieveInformationModelMOVE);
                        move.Syntaxes.Add(Syntax.ExplicitVrLittleEndian);
                        move.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

                        Association association = new Association();
                        association.AddService(move);

                        if (association.Open(editor))
                        {
                            if (move.Active)
                            {
                                move.ImageMoved += new CMoveEventHandler(OnImageMoved);
                                try
                                {
                                    //Element element = new Element(t.SOPInstanceUID, records[0][t.ReferencedSOPInstanceUIDinFile].Value);
                                    Element element = new Element(t.SOPInstanceUID, records[0][t.SOPInstanceUID].Value);
                                    DataSet results = move.CMove(console.Title, element);
                                }
                                catch (Exception ex)
                                {
                                    Debug.WriteLine(ex.Message);
                                    throw;
                                }
                                finally
                                {
                                    move.ImageMoved -= new CMoveEventHandler(OnImageMoved);
                                }
                            }
                        }
                        else
                        {
                            Debug.WriteLine("\ncan't Open.");
                        }

                        association.Close();
                    }
                }
            }
            pacs.Kill();
        }