Beispiel #1
0
            private void ExportSingleImage(IPresentationImage image, ExportImageParams exportParams)
            {
                image = GetImageForExport(image);

                string fileName = _fileNamingStrategy.GetSingleImageFileName(image, FileExtension);

                SelectedImageExporter.Export(image, fileName, exportParams);

                ReportProgress(fileName, ++_progress);
            }
Beispiel #2
0
            private void ExportDisplaySet(IDisplaySet displaySet, ExportImageParams exportParams)
            {
                foreach (ImageFileNamePair pair in _fileNamingStrategy.GetImagesAndFileNames(displaySet, FileExtension))
                {
                    if (IsAsynchronous && _taskContext.CancelRequested)
                    {
                        break;
                    }

                    IPresentationImage image = GetImageForExport(pair.Image);
                    SelectedImageExporter.Export(image, pair.FileName, exportParams);

                    ReportProgress(pair.FileName, ++_progress);
                }
            }
Beispiel #3
0
        private void Export()
        {
            if (SelectedImageExporter == null)
            {
                throw new InvalidOperationException("No exporter was chosen; unable to export any images.");
            }

            if (NumberOfImagesToExport == 1)
            {
                EventResult      result            = EventResult.Success;
                AuditedInstances exportedInstances = GetInstancesForAudit(ItemsToExport, this.ExportFilePath);

                try
                {
                    if (!Directory.Exists(Path.GetDirectoryName(ExportFilePath ?? "")))
                    {
                        throw new FileNotFoundException("The specified export file path does not exist: " + ExportFilePath ?? "");
                    }

                    ClipboardItem clipboardItem = (ClipboardItem)_itemsToExport[0];

                    ExportImageParams exportParams = GetExportParams(clipboardItem);
                    SelectedImageExporter.Export((IPresentationImage)clipboardItem.Item, ExportFilePath, exportParams);
                }
                catch (Exception ex)
                {
                    result = EventResult.SeriousFailure;
                    Platform.Log(LogLevel.Error, ex);
                }
                finally
                {
                    AuditHelper.LogExportStudies(exportedInstances, EventSource.CurrentUser, result);
                }
            }
            else
            {
                if (!Directory.Exists(ExportFilePath ?? ""))
                {
                    throw new FileNotFoundException("The specified export directory does not exist." + ExportFilePath ?? "");
                }

                _multipleImageExporter = new MultipleImageExporter(this);
                _multipleImageExporter.Run();
            }
        }