static void mppsservice(bool wait) { Server server = new Server("MPPS", 2010); VerificationServiceSCP echo = new VerificationServiceSCP(); echo.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); MppsServiceSCP mpps = new MppsServiceSCP(); mpps.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); MppsEventHandler handler = new MppsEventHandler(OnMpps); mpps.MppsCreate += handler; mpps.MppsSet += handler; server.AddService(echo); server.AddService(mpps); server.Start(); if (wait) { System.Console.WriteLine("\nPress <enter> to stop server ..."); System.Console.ReadLine(); } else { string uid = Element.NewUid(); ApplicationEntity host = new ApplicationEntity("MPPS", IPAddress.Parse("10.95.53.106"), 2010); Begin(uid, host); End(uid, host); } mpps.MppsCreate -= handler; mpps.MppsSet -= handler; server.Stop(); }
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); }
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(); }
private static Server StartServer(ApplicationEntity host) { Server server = new Server(host.Title, host.Port); VerificationServiceSCP echo = new VerificationServiceSCP(); echo.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); echo.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); PrintServiceSCP grayscale = new PrintServiceSCP(SOPClass.BasicGrayscalePrintManagementMetaSOPClass); grayscale.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); grayscale.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); PresentationLUTServiceSCP plut = new PresentationLUTServiceSCP(); plut.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); plut.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); AnnotationServiceSCP annotation = new AnnotationServiceSCP(); annotation.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); annotation.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); server.AddService(echo); server.AddService(grayscale); server.AddService(plut); server.AddService(annotation); PrintJobEventHandler print_handler = new PrintJobEventHandler(OnPagePrinted); grayscale.JobPrinted += print_handler; StorageServiceSCP cr = new StorageServiceSCP(SOPClass.ComputedRadiographyImageStorage); cr.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); cr.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); StorageServiceSCP dx1 = new StorageServiceSCP(SOPClass.DigitalXRayImageStorageForPresentation); dx1.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); dx1.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); StorageServiceSCP dx2 = new StorageServiceSCP(SOPClass.DigitalXRayImageStorageForProcessing); dx2.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); dx2.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); StorageServiceSCP mg1 = new StorageServiceSCP(SOPClass.DigitalMammographyImageStorageForPresentation); mg1.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); mg1.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); StorageServiceSCP mg2 = new StorageServiceSCP(SOPClass.DigitalMammographyImageStorageForProcessing); mg2.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); mg2.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); StorageServiceSCP gsps = new StorageServiceSCP(SOPClass.GrayscaleSoftcopyPresentationStateStorageSOPClass); gsps.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); gsps.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); StorageServiceSCP sc = new StorageServiceSCP(SOPClass.SecondaryCaptureImageStorage); sc.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); sc.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); StorageServiceSCP dose = new StorageServiceSCP(SOPClass.XRayRadiationDoseSRStorage); dose.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); dose.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); ImageStoredEventHandler store_handler = new ImageStoredEventHandler(OnImageStored); cr.ImageStored += store_handler; dx1.ImageStored += store_handler; dx2.ImageStored += store_handler; mg1.ImageStored += store_handler; mg2.ImageStored += store_handler; gsps.ImageStored += store_handler; sc.ImageStored += store_handler; dose.ImageStored += store_handler; server.AddService(cr); server.AddService(dx1); server.AddService(dx2); server.AddService(mg1); server.AddService(mg2); server.AddService(gsps); server.AddService(sc); server.AddService(dose); MppsServiceSCP mpps = new MppsServiceSCP(); mpps.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); MppsEventHandler mpps_handler = new MppsEventHandler(OnMpps); mpps.MppsCreate += mpps_handler; mpps.MppsSet += mpps_handler; server.AddService(mpps); server.Start(); return(server); }