예제 #1
0
        public static IImageViewer OpenStudies(OpenStudyArgs openStudyArgs)
        {
            OpenStudyHelper helper = new OpenStudyHelper();

            helper.WindowBehaviour = openStudyArgs.WindowBehaviour;
            foreach (string studyInstanceUid in openStudyArgs.StudyInstanceUids)
            {
                helper.AddStudy(studyInstanceUid, openStudyArgs.Server);
            }

            return(helper.OpenStudies());
        }
예제 #2
0
		public void OpenStudy()
		{
			try
			{
			    int numberOfSelectedStudies = Context.SelectedStudies.Count;
                if (Context.SelectedStudies.Count == 0)
					return;

				if (!PermissionsHelper.IsInRole(ImageViewer.AuthorityTokens.Study.Open))
				{
					Context.DesktopWindow.ShowMessageBox(SR.MessageOpenStudyPermissionDenied, MessageBoxActions.Ok);
					return;
				}

				int numberOfLoadableStudies = GetNumberOfLoadableStudies();
				if (numberOfLoadableStudies != numberOfSelectedStudies)
				{
					int numberOfNonLoadableStudies = numberOfSelectedStudies - numberOfLoadableStudies;
					string message;
					if (numberOfSelectedStudies == 1)
					{
						message = SR.MessageCannotOpenNonStreamingStudy;
					}
					else
					{
						if (numberOfNonLoadableStudies == 1)
							message = SR.MessageOneNonStreamingStudyCannotBeOpened;
						else 
							message = String.Format(SR.MessageFormatXNonStreamingStudiesCannotBeOpened, numberOfNonLoadableStudies);
					}

					Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok);
					return;
				}

				if (Context.SelectedServers.Count == 1 && Context.SelectedServers[0].IsLocal)
				{
					// #10746:  Workstation: the user must be warned when opening studies that are being processed
					// This implementation does not cover all the possible cases of when a study might be modified.
					// For example: if a study is being retrieved, WQI failed and deleted, the study is technically
					// not complete and user should be warned.  The risk of such cases are mitigated by the fact the
					// user is warned about the failed WQI.  This implementation is only meant to warn user if the
					// study is "being" or "about to" be modified before opening the study.
					try
					{
						Platform.Log(LogLevel.Debug, "Querying for a StudyUpdate work items that are in progress for the studies that are being opened.");

						var anyStudyBeingModified = Context.SelectedStudies.Any(study =>
						{
							var request = new WorkItemQueryRequest { StudyInstanceUid = study.StudyInstanceUid };
							IEnumerable<WorkItemData> workItems = null;

							Platform.GetService<IWorkItemService>(s => workItems = s.Query(request).Items);
							return workItems.Any(IsNonTerminalStudyUpdateItem);
						});

						if (anyStudyBeingModified)
						{
							var message = Context.SelectedStudies.Count == 1 ? SR.MessageStudyIsBeingModified : SR.MessageStudiesAreBeingModified;

							if (DialogBoxAction.No == Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo))
								return;
						}
					}
					catch (Exception e)
					{
						Platform.Log(LogLevel.Debug, e);
					}
				}

				var helper = new OpenStudyHelper
				                 {
				                     WindowBehaviour = ViewerLaunchSettings.WindowBehaviour,
				                     AllowEmptyViewer = ViewerLaunchSettings.AllowEmptyViewer
				                 };

				foreach (var study in Context.SelectedStudies)
					helper.AddStudy(study.StudyInstanceUid, study.Server);

				helper.Title = ImageViewerComponent.CreateTitle(GetSelectedPatients());
				helper.OpenStudies();
			}
			catch (Exception e)
			{
				ExceptionHandler.Report(e, Context.DesktopWindow);
			}
		}
예제 #3
0
		public static IImageViewer OpenStudies(OpenStudyArgs openStudyArgs)
		{
			OpenStudyHelper helper = new OpenStudyHelper();
			helper.WindowBehaviour = openStudyArgs.WindowBehaviour;
			foreach (string studyInstanceUid in openStudyArgs.StudyInstanceUids)
				helper.AddStudy(studyInstanceUid, openStudyArgs.Server);

			return helper.OpenStudies();
		}
예제 #4
0
		public void OpenStudy()
		{
			try
			{
			    int numberOfSelectedStudies = Context.SelectedStudies.Count;
                if (Context.SelectedStudies.Count == 0)
					return;

				if (!PermissionsHelper.IsInRole(ImageViewer.AuthorityTokens.Study.Open))
				{
					Context.DesktopWindow.ShowMessageBox(SR.MessageOpenStudyPermissionDenied, MessageBoxActions.Ok);
					return;
				}

				int numberOfLoadableStudies = GetNumberOfLoadableStudies();
				if (numberOfLoadableStudies != numberOfSelectedStudies)
				{
					int numberOfNonLoadableStudies = numberOfSelectedStudies - numberOfLoadableStudies;
					string message;
					if (numberOfSelectedStudies == 1)
					{
						message = SR.MessageCannotOpenNonStreamingStudy;
					}
					else
					{
						if (numberOfNonLoadableStudies == 1)
							message = SR.MessageOneNonStreamingStudyCannotBeOpened;
						else 
							message = String.Format(SR.MessageFormatXNonStreamingStudiesCannotBeOpened, numberOfNonLoadableStudies);
					}

					Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok);
					return;
				}

				var helper = new OpenStudyHelper
				                 {
				                     WindowBehaviour = ViewerLaunchSettings.WindowBehaviour,
				                     AllowEmptyViewer = ViewerLaunchSettings.AllowEmptyViewer
				                 };

				foreach (var study in Context.SelectedStudies)
					helper.AddStudy(study.StudyInstanceUid, study.Server);

				helper.Title = ImageViewerComponent.CreateTitle(GetSelectedPatients());
				helper.OpenStudies();
			}
			catch (Exception e)
			{
				ExceptionHandler.Report(e, Context.DesktopWindow);
			}
		}
예제 #5
0
		public OpenViewerOutput OpenViewer(OpenViewerInput input)
		{
			Platform.CheckForNullReference(input, "input");
			Platform.CheckMemberIsSet(input.StudyInstanceUids, "StudyInstanceUids");

			if (input.StudyInstanceUids.Length == 0)
				return new OpenViewerOutput();

			var helper = new OpenStudyHelper();
			foreach (var studyInstanceUid in input.StudyInstanceUids)
				helper.AddStudy(studyInstanceUid, null, "DICOM_LOCAL");

			var id = Interlocked.Increment(ref _viewerId);
			helper.Title = "imageviewer " + id;

			var viewer = helper.OpenStudies();

			var workspace = Application.ActiveDesktopWindow.Workspaces
				.First(w => ImageViewerComponent.GetAsImageViewer(w) == viewer);

			lock(_viewers)
			{
				_viewers.Add(id, viewer);
			}

			workspace.Closed += (sender, e) =>
									{
										lock (_viewers)
										{
											_viewers.Remove(id);
										}
									};

			return new OpenViewerOutput {ViewerId = id};
		}