Beispiel #1
0
        public static void End(string uid, ApplicationEntity host)
        {
            MppsServiceSCU mpps = new MppsServiceSCU();

            mpps.Syntaxes.Add(Syntax.ExplicitVrLittleEndian);

            Association association = new Association();

            association.AddService(mpps);

            if (association.Open(host))
            {
                DataSet dicom = DataSetTest.GetDataSet(Path.Combine(Tools.RootFolder, @"EK\Capture\Dicom\DicomToolKit\Test\Data\Mpps\end.dcm"));

                mpps.End(uid, dicom);
                //System.Console.WriteLine("end done!");
            }
            else
            {
                //System.Console.WriteLine("\ncan't Open.");
            }
            //System.Console.WriteLine("before Close!");
            association.Close();
            //System.Console.WriteLine("after Close!");
        }
Beispiel #2
0
        public static void store(string path, ApplicationEntity host, bool request_commit)
        {
            StorageServiceSCU cr = new StorageServiceSCU(SOPClass.ComputedRadiographyImageStorage);

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

            StorageServiceSCU dx = new StorageServiceSCU(SOPClass.DigitalXRayImageStorageForPresentation);

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

            StorageServiceSCU dx2 = new StorageServiceSCU(SOPClass.DigitalXRayImageStorageForProcessing);

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

            StorageServiceSCU sc = new StorageServiceSCU(SOPClass.SecondaryCaptureImageStorage);

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

            StorageCommitServiceSCU commit = new StorageCommitServiceSCU();

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

            Association association = new Association();

            association.AddService(cr);
            association.AddService(dx);
            association.AddService(dx2);
            association.AddService(sc);
            association.AddService(commit);

            if (association.Open(host))
            {
                if (cr.Active)
                {
                    DataSet dicom = DataSetTest.GetDataSet(Path.Combine(Tools.RootFolder, path));

                    // insure that the SOPClassUID matches what negotiated and are using
                    dicom.Set(t.SOPClassUID, cr.SOPClassUId);
                    string instance = (string)dicom[t.SOPInstanceUID].Value;

                    try
                    {
                        cr.Store(dicom);
                        Debug.WriteLine("store done!");
                        if (request_commit && commit.Active)
                        {
                            commit.Request(dicom);
                            Debug.WriteLine("storage commit requested!");
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                    }
                }
            }
            else
            {
                Debug.WriteLine("\ncan't Open.");
            }

            association.Close();
        }