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); }
public static void Start(ApplicationEntity host, Dictionary <string, ApplicationEntity> stations) { if (server != null) { throw new Exception("StorageTest.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); 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); StorageCommitServiceSCP commit = new StorageCommitServiceSCP(); commit.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); commit.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); ImageStoredEventHandler handler = new ImageStoredEventHandler(OnImageStored); cr.ImageStored += handler; dx1.ImageStored += handler; dx2.ImageStored += handler; mg1.ImageStored += handler; mg2.ImageStored += handler; gsps.ImageStored += handler; sc.ImageStored += handler; commit.StorageCommitReport += new StorageCommitEventHandler(OnStorageCommit); server.AddService(echo); server.AddService(cr); server.AddService(dx1); server.AddService(dx2); server.AddService(mg1); server.AddService(mg2); server.AddService(gsps); server.AddService(sc); server.AddService(commit); server.Start(); }
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(); }