void send_images(List <IPresentationImage> queue) { AEInformation destination = get_server(); SendSopInstancesRequest image_request = new SendSopInstancesRequest(); DicomSendServiceClient sender = new DicomSendServiceClient(); if (destination != null) { image_request.DestinationAEInformation = destination; List <string> studyUids = new List <string>(); List <string> seriesUids = new List <string>(); List <string> imageSopUids = new List <string>(); foreach (IPresentationImage image in queue) { if (image is IImageSopProvider) { ImageSop imageSop = ((IImageSopProvider)image).ImageSop; studyUids.Add(imageSop.StudyInstanceUid); seriesUids.Add(imageSop.SeriesInstanceUid); imageSopUids.Add(imageSop.SopInstanceUid); } } image_request.StudyInstanceUid = studyUids[0]; image_request.SeriesInstanceUid = seriesUids[0]; image_request.SopInstanceUids = imageSopUids; sender.SendSopInstances(image_request); sender.Close(); LocalDataStoreActivityMonitorComponentManager.ShowSendReceiveActivityComponent(this.Context.DesktopWindow); } }
void send_series(string studyUid, string seriesUid) { AEInformation destination = get_server(); if (destination != null) { BackgroundTask task = new BackgroundTask( delegate(IBackgroundTaskContext context) { DicomSendServiceClient sender = new DicomSendServiceClient(); sender.Open(); SendSeriesRequest series_request = new SendSeriesRequest(); series_request.DestinationAEInformation = destination; series_request.StudyInstanceUid = studyUid; List <string> seriesUids = new List <string>(); seriesUids.Add(seriesUid); series_request.SeriesInstanceUids = seriesUids; sender.SendSeries(series_request); sender.Close(); }, true); task.Run(); LocalDataStoreActivityMonitorComponentManager.ShowSendReceiveActivityComponent(this.Context.DesktopWindow); } }
private AEInformation get_server() { ServerTreeComponent serverTreeComponent = new ServerTreeComponent(); serverTreeComponent.IsReadOnly = false; serverTreeComponent.ShowCheckBoxes = false; serverTreeComponent.ShowLocalDataStoreNode = true; serverTreeComponent.ShowTitlebar = true; serverTreeComponent.ShowTools = true; SimpleComponentContainer dialogContainer = new SimpleComponentContainer(serverTreeComponent); ApplicationComponentExitCode code = ApplicationComponent.LaunchAsDialog( this.Context.DesktopWindow, dialogContainer, "Choose Server"); if (code == ApplicationComponentExitCode.Accepted) { if (serverTreeComponent.SelectedServers.IsLocalDatastore == true) { this.Context.DesktopWindow.ShowMessageBox("Cannot send to 'My Studies'", MessageBoxActions.Ok); return(null); } if (serverTreeComponent.SelectedServers == null || serverTreeComponent.SelectedServers.Servers == null || serverTreeComponent.SelectedServers.Servers.Count == 0) { this.Context.DesktopWindow.ShowMessageBox("Invalid selection", MessageBoxActions.Ok); return(null); } if (serverTreeComponent.SelectedServers.Servers.Count > 1) { this.Context.DesktopWindow.ShowMessageBox("Cannot select multiple servers", MessageBoxActions.Ok); return(null); } Server selected_server = (Server)serverTreeComponent.SelectedServers.Servers[0]; AEInformation destination = new AEInformation(); destination.AETitle = selected_server.AETitle; destination.HostName = selected_server.Host; destination.Port = selected_server.Port; return(destination); } else { return(null); } }
// Note: you may change the name of the 'Apply' method as desired, but be sure to change the // corresponding parameter in the MenuAction and ButtonAction attributes /// <summary> /// Called by the framework when the user clicks the "apply" menu item or toolbar button. /// </summary> public void Apply() { if (!Enabled || this.Context.SelectedSingleSeries == null) { return; } List <string> seriesUIDs = new List <string>(); List <string> studyUIDs = new List <string>(); foreach (SeriesItem item in this.Context.SelectedMultipleSeries) { string foo = item.SeriesInstanceUID; Platform.Log(LogLevel.Info, foo); seriesUIDs.Add(item.SeriesInstanceUID); studyUIDs.Add(item.StudyInstanceUID); } AEInformation destination = get_server(); if (destination != null) { BackgroundTask task = new BackgroundTask( delegate(IBackgroundTaskContext context) { DicomSendServiceClient sender = new DicomSendServiceClient(); sender.Open(); SendSeriesRequest series_request = new SendSeriesRequest(); series_request.DestinationAEInformation = destination; series_request.StudyInstanceUid = studyUIDs[0]; series_request.SeriesInstanceUids = seriesUIDs; sender.SendSeries(series_request); sender.Close(); // OnMoveCompleted(); }, true); task.Run(); LocalDataStoreActivityMonitorComponentManager.ShowSendReceiveActivityComponent(this.Context.DesktopWindow); } }
private AEInformation get_server() { ServerTreeComponent serverTreeComponent = new ServerTreeComponent(); serverTreeComponent.IsReadOnly = false; serverTreeComponent.ShowCheckBoxes = false; serverTreeComponent.ShowLocalDataStoreNode = true; serverTreeComponent.ShowTitlebar = true; serverTreeComponent.ShowTools = true; SimpleComponentContainer dialogContainer = new SimpleComponentContainer(serverTreeComponent); ApplicationComponentExitCode code = ApplicationComponent.LaunchAsDialog( this.Context.DesktopWindow, dialogContainer, "Choose Server"); if (serverTreeComponent.SelectedServers == null || serverTreeComponent.SelectedServers.Servers == null || serverTreeComponent.SelectedServers.Servers.Count == 0) { this.Context.DesktopWindow.ShowMessageBox("Invalid Selection", MessageBoxActions.Ok); return null; } if (serverTreeComponent.SelectedServers.Servers.Count > 1) { this.Context.DesktopWindow.ShowMessageBox("Cannot select multiple servers?", MessageBoxActions.Ok); return null; } Server selected_server = (Server)serverTreeComponent.SelectedServers.Servers[0]; AEInformation destination = new AEInformation(); destination.AETitle = selected_server.AETitle; destination.HostName = selected_server.Host; destination.Port = selected_server.Port; return destination; }