Exemple #1
0
        public DicomEditorComponent()
        {
            var setTagValueDelegate = new TableColumn <DicomEditorTag, string> .SetColumnValueDelegate <DicomEditorTag, string>((d, value) =>
            {
                if (d.IsEditable())
                {
                    d.Value = value;
                    _dirtyFlags[_position] = true;
                    EventsHelper.Fire(_tagEditedEvent, this, EventArgs.Empty);
                }
            });

            if (!LicenseInformation.IsFeatureAuthorized(FeatureTokens.DicomEditing))
            {
                setTagValueDelegate = null;
            }

            _dicomTagData = new Table <DicomEditorTag>();
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingGroupElement, delegate(DicomEditorTag d) { return(d.DisplayKey); }, null, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.GroupElement)); }));
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingTagName, delegate(DicomEditorTag d) { return(d.TagName); }, null, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.TagName)); }));
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingVR, delegate(DicomEditorTag d) { return(d.Vr); }, null, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.Vr)); }));
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingLength, delegate(DicomEditorTag d) { return(d.Length); }, null, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.Length)); }));
            _dicomTagData.Columns.Add(new TableColumn <DicomEditorTag, string>(SR.ColumnHeadingValue, delegate(DicomEditorTag d) { return(d.Value); }, setTagValueDelegate, 1.0f, delegate(DicomEditorTag one, DicomEditorTag two) { return(DicomEditorTag.TagCompare(one, two, SortType.Value)); }));
            _title       = "";
            _loadedFiles = new List <DicomFile>();
            _position    = 0;
            _dirtyFlags  = new List <bool>();

            _anonymizer = new DicomAnonymizer();
            _anonymizer.ValidationOptions = ValidationOptions.RelaxAllChecks | ValidationOptions.AllowUnchangedValues;
        }
Exemple #2
0
        private static bool CheckFeatureAuthorized()
        {
            var b = LicenseInformation.IsFeatureAuthorized(FeatureTokens.RIS.Core);

            LoginFacilityProviderSettings.Default.IsRisCoreFeatureLicensed = b;
            LoginFacilityProviderSettings.Default.Save();
            return(b);
        }
        public void Apply()
        {
            if (!LicenseInformation.IsFeatureAuthorized(FeatureTokens.DicomEditing))
            {
                return;
            }

            Activate();
        }
Exemple #4
0
        public void Dump()
        {
            if (!LicenseInformation.IsFeatureAuthorized(FeatureTokens.DicomEditing))
            {
                return;
            }

            BaseTool.Dump();
        }
Exemple #5
0
 public void Startup(IDesktopWindow mainDesktopWindow)
 {
     if (LicenseInformation.IsFeatureAuthorized(FeatureTokens.RIS.Core))
     {
         new RisViewerStartupActionProvider(this).Startup(mainDesktopWindow);
     }
     else
     {
         ShowExplorer(mainDesktopWindow, false);
     }
 }
 protected void OnMainMenuDataBound(object sender, EventArgs e)
 {
     // Yes this looks hacky
     if (!LicenseInformation.IsFeatureAuthorized("ImageServer.QualityControl"))
     {
         var menuPath = string.Format("{0}/{1}", Titles.Admin, Titles.QCSummaryPageTitle);
         var menu     = MainMenu.FindItem(menuPath);
         if (menu != null && menu.Parent != null)
         {
             menu.Parent.ChildItems.Remove(menu);
         }
     }
 }
Exemple #7
0
        public override bool PrepareExit()
        {
            // sanity check - if dirty flag was flipped for some reason, but user cannot save, don't let that stop user from closing application
            if (_dirtyFlags.Any(f => f) && LicenseInformation.IsFeatureAuthorized(FeatureTokens.DicomEditing))
            {
                //BUG: #11343, #11344 - returning false from this doesn't work when the entire Workstation is being closed
                //  so we'll just do Yes/No for now, and change back to Y/N/Cancel when it's fixed
                switch (Host.ShowMessageBox(SR.MessageConfirmSaveChangesBeforeClosing, MessageBoxActions.YesNo))
                {
                case DialogBoxAction.Yes:
                    return(SaveAll(false));

                case DialogBoxAction.No:
                    return(true);

                case DialogBoxAction.Cancel:
                default:
                    return(false);
                }
            }
            return(true);
        }
 public TestResult Test(object obj)
 {
     return(new TestResult(LicenseInformation.IsFeatureAuthorized(_featureToken)));
 }
        private void DumpCore()
        {
            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,
                    LicenseInformation.IsFeatureAuthorized(FeatureTokens.DicomEditing) ? SR.TitleDicomEditor : SR.TitleDicomDump,
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }

            _component.UpdateComponent();
        }