示例#1
0
        public static void Start(ApplicationEntity host, Dictionary <string, ApplicationEntity> stations)
        {
            if (server != null)
            {
                throw new Exception("CMoveTest.Server in use.");
            }

            server = new Server(host.Title, host.Port);

            server.Hosts = stations;

            VerificationServiceSCP echo = new VerificationServiceSCP();

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

            CMoveServiceSCP pm = new CMoveServiceSCP(SOPClass.PatientRootQueryRetrieveInformationModelMOVE);

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

            CMoveServiceSCP pf = new CMoveServiceSCP(SOPClass.PatientRootQueryRetrieveInformationModelFIND);

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

            CMoveServiceSCP sm = new CMoveServiceSCP(SOPClass.StudyRootQueryRetrieveInformationModelMOVE);

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

            CMoveServiceSCP sf = new CMoveServiceSCP(SOPClass.StudyRootQueryRetrieveInformationModelFIND);

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

            server.AddService(echo);
            server.AddService(pm);
            server.AddService(pf);
            server.AddService(sm);
            server.AddService(sf);

            server.Start();
        }
示例#2
0
        static string query(string level, string id)
        {
            CMoveServiceSCP service = new CMoveServiceSCP(SOPClass.PatientRootQueryRetrieveInformationModelGET);

            DataSet dicom = new DataSet();

            dicom.Set(t.QueryRetrieveLevel, level);
            if (level == "PATIENT")
            {
                dicom.Set(t.PatientID, id);
            }
            else if (level == "STUDY")
            {
                dicom.Set(t.StudyInstanceUID, id);
            }
            else if (level == "SERIES")
            {
                dicom.Set(t.SeriesInstanceUID, id);
            }
            else if (level == "IMAGE")
            {
                dicom.Set(t.SOPInstanceUID, id);
            }

            string text = string.Empty;

            foreach (string image in service.Query(dicom))
            {
                if (text.Length > 1)
                {
                    text += ",";
                }
                text += image;
            }
            return(text);
        }
示例#3
0
        public bool StartService()
        {
            if (IsPortOpened())
            {
                MessageBox.Show("SCP is already running in another instance.");
                return(false);
            }

            server = new Server(AeTitle, Port);

            var echo = new VerificationServiceSCP();

            echo.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var dx1 = new StorageServiceSCP(SOPClass.DigitalXRayImageStorageForPresentation);

            dx1.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var dx2 = new StorageServiceSCP(SOPClass.DigitalXRayImageStorageForProcessing);

            dx2.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var cr = new StorageServiceSCP(SOPClass.ComputedRadiographyImageStorage);

            cr.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var mg1 = new StorageServiceSCP(SOPClass.DigitalMammographyImageStorageForPresentation);

            mg1.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var mg2 = new StorageServiceSCP(SOPClass.DigitalMammographyImageStorageForProcessing);

            mg2.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var gsps = new StorageServiceSCP(SOPClass.GrayscaleSoftcopyPresentationStateStorageSOPClass);

            gsps.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var sc = new StorageServiceSCP(SOPClass.SecondaryCaptureImageStorage);

            sc.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var ct = new StorageServiceSCP(SOPClass.CTImageStorage);

            ct.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var ctEnhanced = new StorageServiceSCP(SOPClass.EnhancedCTImageStorage);

            ctEnhanced.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var dose = new StorageServiceSCP(SOPClass.XRayRadiationDoseSRStorage);

            dose.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var find = new CFindServiceSCP(SOPClass.StudyRootQueryRetrieveInformationModelFIND);

            find.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var move = new CMoveServiceSCP(SOPClass.StudyRootQueryRetrieveInformationModelMOVE);

            move.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var mpps = new MppsServiceSCP();

            mpps.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var commit = new StorageCommitServiceSCP();

            commit.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var grayscale = new PrintServiceSCP(SOPClass.BasicGrayscalePrintManagementMetaSOPClass);

            grayscale.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var plut = new PresentationLUTServiceSCP();

            plut.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            var annotation = new AnnotationServiceSCP();

            annotation.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            server.AddService(echo);
            server.AddService(dx1);
            server.AddService(dx2);
            server.AddService(cr);
            server.AddService(mg1);
            server.AddService(mg2);
            server.AddService(gsps);
            server.AddService(sc);
            server.AddService(ct);
            server.AddService(ctEnhanced);
            server.AddService(dose);
            server.AddService(find);
            server.AddService(move);
            server.AddService(mpps);
            server.AddService(commit);
            server.AddService(grayscale);
            server.AddService(plut);
            server.AddService(annotation);

            foreach (ServiceClass service in server.Services)
            {
                if (service != null)
                {
                    if (service is StorageServiceSCP)
                    {
                        ((StorageServiceSCP)service).ImageStored += OnImageStored;
                    }
                    else if (service is PrintServiceSCP)
                    {
                        ((PrintServiceSCP)service).JobPrinted += OnImagePrinted;
                    }
                    else if (service is MppsServiceSCP)
                    {
                        ((MppsServiceSCP)service).MppsCreate += OnMpps;
                        ((MppsServiceSCP)service).MppsSet    += OnMpps;
                    }
                    else if (service is StorageCommitServiceSCP)
                    {
                        ((StorageCommitServiceSCP)service).StorageCommitRequest += OnStorageCommitRequested;
                    }
                    else if (service is CFindServiceSCP)
                    {
                        ((CFindServiceSCP)service).Query += OnQuery;
                    }
                }
            }

            server.Start();

            return(true);
        }
示例#4
0
        private void StartServer()
        {
            if (TestServer())
            {
                SetStatus("SCP is already running in another instance.");
                return;
            }

            server = new Server(aetitle, port);

            VerificationServiceSCP echo = new VerificationServiceSCP();

            echo.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP dx1 = new StorageServiceSCP(SOPClass.DigitalXRayImageStorageForPresentation);

            dx1.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP dx2 = new StorageServiceSCP(SOPClass.DigitalXRayImageStorageForProcessing);

            dx2.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP cr = new StorageServiceSCP(SOPClass.ComputedRadiographyImageStorage);

            cr.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP mg1 = new StorageServiceSCP(SOPClass.DigitalMammographyImageStorageForPresentation);

            mg1.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP mg2 = new StorageServiceSCP(SOPClass.DigitalMammographyImageStorageForProcessing);

            mg2.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP gsps = new StorageServiceSCP(SOPClass.GrayscaleSoftcopyPresentationStateStorageSOPClass);

            gsps.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP sc = new StorageServiceSCP(SOPClass.SecondaryCaptureImageStorage);

            sc.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP ct = new StorageServiceSCP(SOPClass.CTImageStorage);

            ct.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP ctEnhanced = new StorageServiceSCP(SOPClass.EnhancedCTImageStorage);

            ctEnhanced.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageServiceSCP dose = new StorageServiceSCP(SOPClass.XRayRadiationDoseSRStorage);

            dose.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            CFindServiceSCP find = new CFindServiceSCP(SOPClass.StudyRootQueryRetrieveInformationModelFIND);

            find.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            CMoveServiceSCP move = new CMoveServiceSCP(SOPClass.StudyRootQueryRetrieveInformationModelMOVE);

            move.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            MppsServiceSCP mpps = new MppsServiceSCP();

            mpps.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            StorageCommitServiceSCP commit = new StorageCommitServiceSCP();

            commit.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            PrintServiceSCP grayscale = new PrintServiceSCP(SOPClass.BasicGrayscalePrintManagementMetaSOPClass);

            grayscale.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            PresentationLUTServiceSCP plut = new PresentationLUTServiceSCP();

            plut.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            AnnotationServiceSCP annotation = new AnnotationServiceSCP();

            annotation.Syntaxes.Add(Syntax.ImplicitVrLittleEndian);

            server.AddService(echo);
            server.AddService(dx1);
            server.AddService(dx2);
            server.AddService(cr);
            server.AddService(mg1);
            server.AddService(mg2);
            server.AddService(gsps);
            server.AddService(sc);
            server.AddService(ct);
            server.AddService(ctEnhanced);
            server.AddService(dose);
            server.AddService(find);
            server.AddService(move);
            server.AddService(mpps);
            server.AddService(commit);
            server.AddService(grayscale);
            server.AddService(plut);
            server.AddService(annotation);

            ImageStoredEventHandler   imageHandler  = new ImageStoredEventHandler(OnImageStored);
            MppsEventHandler          mppsHandler   = new MppsEventHandler(OnMpps);
            StorageCommitEventHandler commitHandler = new StorageCommitEventHandler(OnStorageCommitRequest);

            foreach (ServiceClass service in server.Services)
            {
                if (service != null)
                {
                    if (service is StorageServiceSCP)
                    {
                        ((StorageServiceSCP)service).ImageStored += imageHandler;
                    }
                    else if (service is PrintServiceSCP)
                    {
                        ((PrintServiceSCP)service).JobPrinted += new PrintJobEventHandler(OnJobPrinted);
                    }
                    else if (service is MppsServiceSCP)
                    {
                        ((MppsServiceSCP)service).MppsCreate += mppsHandler;
                        ((MppsServiceSCP)service).MppsSet    += mppsHandler;
                    }
                    else if (service is StorageCommitServiceSCP)
                    {
                        ((StorageCommitServiceSCP)service).StorageCommitRequest += new StorageCommitEventHandler(OnStorageCommitRequest);
                    }
                    else if (service is CFindServiceSCP)
                    {
                        ((CFindServiceSCP)service).Query += new QueryEventHandler(OnQuery);
                    }
                }
            }

            server.Start();
        }