Exemplo n.º 1
0
        public static void Show(IDesktopWindow desktopWindow, ShelfDisplayHint displayHint)
        {
            // TODO (CR Phoenix5 - Med): Clinical as well
            if (!PermissionsHelper.IsInRole(AuthorityTokens.KeyImages))
            {
                throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied);
            }

            desktopWindow = desktopWindow ?? Application.ActiveDesktopWindow;

            IShelf shelf = GetClipboardShelf(desktopWindow);

            if (shelf != null)
            {
                shelf.Activate();
            }
            else
            {
                Workspace           activeWorkspace = desktopWindow.ActiveWorkspace;
                KeyImageInformation info            = GetKeyImageInformation(activeWorkspace) ?? new KeyImageInformation();
                ClipboardComponent  component       = new KeyImageClipboardComponent(info);
                shelf         = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleKeyImages, displayHint);
                shelf.Closed += OnClipboardShelfClosed;

                ClipboardShelves[desktopWindow] = shelf;
            }
        }
Exemplo n.º 2
0
        public void Launch()
        {
            try
            {
                if (_shelf == null)
                {
                    var component = new CannedTextSummaryComponent();

                    _shelf = ApplicationComponent.LaunchAsShelf(
                        this.Context.DesktopWindow,
                        component,
                        SR.TitleCannedText,
                        SR.TitleCannedText,
                        ShelfDisplayHint.DockFloat);

                    _shelf.Closed += delegate { _shelf = null; };
                }
                else
                {
                    _shelf.Activate();
                }
            }
            catch (Exception e)
            {
                // could not launch component
                ExceptionHandler.Report(e, this.Context.DesktopWindow);
            }
        }
Exemplo n.º 3
0
        public static void Show(IDesktopWindow desktopWindow, ShelfDisplayHint displayHint)
        {
            if (!KeyImageClipboardComponent.HasViewPlugin)
            {
                return;
            }

            if (!PermissionsHelper.IsInRole(AuthorityTokens.Study.KeyImages))
            {
                throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied);
            }

            desktopWindow = desktopWindow ?? Application.ActiveDesktopWindow;

            IShelf shelf = GetClipboardShelf(desktopWindow);

            if (shelf != null)
            {
                shelf.Activate();
            }
            else
            {
                Workspace          activeWorkspace = desktopWindow.ActiveWorkspace;
                var                info            = GetKeyImageClipboard(activeWorkspace);
                ClipboardComponent component       = new KeyImageClipboardComponent(info);
                shelf         = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleKeyImages, displayHint);
                shelf.Closed += OnClipboardShelfClosed;

                ClipboardShelves[desktopWindow] = shelf;
            }
        }
Exemplo n.º 4
0
 public void Show()
 {
     if (_shelf == null)
     {
         _shelf         = ApplicationComponent.LaunchAsShelf(_desktopWindow, _progressDialog, "Dicom打印", ShelfDisplayHint.DockAutoHide | ShelfDisplayHint.DockBottom);
         _shelf.Closed += ShelfClose;
         _shelf.Activate();
     }
     else
     {
         _shelf.Activate();
     }
 }
Exemplo n.º 5
0
 public void Show()
 {
     if (_shelf != null)
     {
         _shelf.Activate();
     }
     else
     {
         MemoryAnalysisComponent component = new MemoryAnalysisComponent(this.Context.DesktopWindow);
         _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, component, "Memory Analysis",
                                                     ShelfDisplayHint.DockFloat);
         _shelf.Closed += delegate { _shelf = null; };
     }
 }
Exemplo n.º 6
0
        public void Apply()
        {
            if (_shelf != null)
            {
                _shelf.Activate();
                return;
            }

            PerformanceAnalysisComponent component = new PerformanceAnalysisComponent();

            _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, component, "Performance Analysis",
                                                        ShelfDisplayHint.DockFloat);

            _shelf.Closing += delegate { _shelf = null; };
        }
Exemplo n.º 7
0
        public void OpenAnalysisTool()
        {
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                StreamingAnalysisComponent component = new StreamingAnalysisComponent(base.Context);
                _shelf = ApplicationComponent.LaunchAsShelf(base.Context.DesktopWindow, component,
                                                            "Streaming Analysis", ShelfDisplayHint.DockFloat | ShelfDisplayHint.ShowNearMouse);

                _shelf.Closed += delegate { _shelf = null; };
            }
        }
Exemplo n.º 8
0
        // 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()
        {
            _component = new DicomEditorComponent();

            // Loop through all selected studies
            foreach (StudyItem selectedstudy in this.Context.SelectedStudies)
            {
                string studyUID     = selectedstudy.StudyInstanceUid;
                int    numberOfSops = LocalStudyLoader.Start(new StudyLoaderArgs(studyUID, null));

                // Loop through all images in study
                for (int i = 0; i < numberOfSops; ++i)
                {
                    Sop imageSop = LocalStudyLoader.LoadNextSop();
                    ILocalSopDataSource localsource = (ILocalSopDataSource)imageSop.DataSource;
                    // Load images into dicom editor
                    _component.Load(localsource.SourceMessage);
                    // Keep track of file paths for later re-importation
                    _filePaths.Add(localsource.Filename);
                }
                // This code deletes the study from the database, so that when it is re-imported the changed fields
                // will appear
                using (IDataStoreStudyRemover studyRemover = DataAccessLayer.GetIDataStoreStudyRemover())
                {
                    studyRemover.RemoveStudy(selectedstudy.StudyInstanceUid);
                }
            }
            // Launch Dicom Editor Shelf
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    _component,
                    "Dicom Editor",
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }

            _component.UpdateComponent();
        }
Exemplo n.º 9
0
        public void Show()
        {
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                ExtensionBrowserComponent browser = new ExtensionBrowserComponent();

                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    browser,
                    SR.TitleExtensionBrowser,
                    "Extension Browser",
                    ShelfDisplayHint.DockLeft | ShelfDisplayHint.DockAutoHide);

                _shelf.Closed += OnShelfClosed;
            }
        }
        public void CopySubset()
        {
            try
            {
                CopySubsetToClipboardComponent component;

                if (_copySubsetShelf != null)
                {
                    component = (CopySubsetToClipboardComponent)_copySubsetShelf.Component;
                    if (component.DesktopWindow != this.Context.DesktopWindow)
                    {
                        component.Close();
                    }
                    else
                    {
                        _copySubsetShelf.Activate();
                        return;
                    }
                }

                IDesktopWindow desktopWindow = this.Context.DesktopWindow;

                component = new CopySubsetToClipboardComponent(desktopWindow);

                _copySubsetShelf = ApplicationComponent.LaunchAsShelf(
                    desktopWindow,
                    component,
                    SR.TitleCopySubsetToClipboard,
                    ShelfDisplayHint.ShowNearMouse);

                _copySubsetShelf.Closed += delegate { _copySubsetShelf = null; };
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, SR.MessageClipboardCopyFailed, Context.DesktopWindow);
            }
        }
        private void Dump()
        {
            if (this.ContextBase is IImageViewerToolContext)
            {
                IImageViewerToolContext context = this.ContextBase as IImageViewerToolContext;
                _desktopWindow = context.DesktopWindow;
                IImageSopProvider image = context.Viewer.SelectedPresentationImage as IImageSopProvider;
                if (image == null)
                {
                    _desktopWindow.ShowMessageBox(SR.MessagePleaseSelectAnImage, MessageBoxActions.Ok);
                    return;
                }

                IDicomMessageSopDataSource dataSource = image.ImageSop.DataSource as IDicomMessageSopDataSource;
                if (dataSource == null || dataSource.SourceMessage == null)
                {
                    _desktopWindow.ShowMessageBox(SR.MessageUnknownDataSource, MessageBoxActions.Ok);
                    return;
                }

                //Fix for Ticket #623 - HH - It turns out that for memory usage optimization the pixel data tag is stripped from the in memory dataset.
                //So while there are probably many better ways to address the missing pixel data tag a small hack was introduced because this entire utility will
                //be completely refactored in the very near future to make use of the methods the pacs uses to parse the tags.
                //Addendum to Comment above - HH 07/27/07 - Turns out that our implementation continues to remove the pixel data for optimization at this time so
                //the workaround is still needed.
                //Addendum to Comment above - JY 09/16/08 - Somewhere along the line, things were changed that made this line redundant - the only reference to
                //it after this point is at +11 lines or so, and all it does is get file.Filename. Therefore, I am commenting this line out.
                //file = new DicomFile(file.Filename);

                if (_component == null)
                {
                    _component = new DicomEditorComponent();
                }
                else
                {
                    _component.Clear();
                }

                _component.Load(dataSource.SourceMessage);
            }
            else if (this.ContextBase is ILocalImageExplorerToolContext)
            {
                ILocalImageExplorerToolContext context = this.ContextBase as ILocalImageExplorerToolContext;
                _desktopWindow = context.DesktopWindow;
                List <string> files = new List <string>();

                if (context.SelectedPaths.Count == 0)
                {
                    return;
                }

                foreach (string rawPath in context.SelectedPaths)
                {
                    if (string.IsNullOrEmpty(rawPath))
                    {
                        continue;
                    }

                    FileProcessor.Process(rawPath, "*.*", files.Add, true);
                }

                if (files.Count == 0)
                {
                    context.DesktopWindow.ShowMessageBox(SR.MessageNoFilesSelected, MessageBoxActions.Ok);
                    return;
                }

                if (_component == null)
                {
                    _component = new DicomEditorComponent();
                }
                else
                {
                    _component.Clear();
                }

                bool userCancelled = false;

                BackgroundTask task = new BackgroundTask(delegate(IBackgroundTaskContext backgroundcontext)
                {
                    int i = 0;

                    foreach (string file in files)
                    {
                        if (backgroundcontext.CancelRequested)
                        {
                            backgroundcontext.Cancel();
                            userCancelled = true;
                            return;
                        }
                        try
                        {
                            _component.Load(file);
                        }
                        catch (DicomException e)
                        {
                            backgroundcontext.Error(e);
                            return;
                        }
                        backgroundcontext.ReportProgress(new BackgroundTaskProgress((int)(((double)(i + 1) / (double)files.Count) * 100.0), SR.MessageDumpProgressBar));
                        i++;
                    }

                    backgroundcontext.Complete(null);
                }, true);

                try
                {
                    ProgressDialog.Show(task, _desktopWindow, true);
                }
                catch (Exception e)
                {
                    ExceptionHandler.Report(e, SR.MessageFailedDump, _desktopWindow);
                    return;
                }

                if (userCancelled == true)
                {
                    return;
                }
            }

            //common to both contexts
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                _shelf = ApplicationComponent.LaunchAsShelf(
                    _desktopWindow,
                    _component,
                    SR.TitleDicomEditor,
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }

            _component.UpdateComponent();
        }
        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void Edit()
        {
            _component = new DicomEditorComponent();
            List <string> filePaths = new List <string>();

            // Loop through all items in clipboard (code from CC forum)
            foreach (IClipboardItem item in this.Context.SelectedClipboardItems)
            {
                List <IPresentationImage> queue = new List <IPresentationImage>();
                if (item.Item is IPresentationImage)
                {
                    Enqueue(queue, (IPresentationImage)item.Item);
                }
                else if (item.Item is IDisplaySet)
                {
                    Enqueue(queue, (IDisplaySet)item.Item);
                }
                else if (item.Item is IImageSet)
                {
                    Enqueue(queue, (IImageSet)item.Item);
                }

                foreach (IPresentationImage image in queue)
                {
                    if (image is IImageSopProvider)
                    {
                        ImageSop imageSop = ((IImageSopProvider)image).ImageSop;

                        ILocalSopDataSource localsource = (ILocalSopDataSource)imageSop.DataSource;
                        // Load each image path into dicom editor, and record path in array for later, re-import
                        _component.Load(localsource.SourceMessage);
                        filePaths.Add(localsource.Filename);
                    }
                }
            }
            //common to both contexts
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    _component,
                    "Dicom Editor",
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }

            _component.UpdateComponent();

            //trigger an import of the Renamed files.
            LocalDataStoreServiceClient client = new LocalDataStoreServiceClient();

            client.Open();
            try
            {
                FileImportRequest request = new FileImportRequest();
                request.BadFileBehaviour    = BadFileBehaviour.Move;
                request.FileImportBehaviour = FileImportBehaviour.Move;
                request.FilePaths           = filePaths;
                request.Recursive           = false;
                client.Import(request);
                client.Close();
            }
            catch
            {
                client.Abort();
                throw;
            }
        }