public DicomEditorControl(DicomEditorComponent component) { Platform.CheckForNullReference(component, "component"); InitializeComponent(); _dicomEditorComponent = component; _dicomTagTable.Table = _dicomEditorComponent.DicomTagData; _dicomTagTable.ToolbarModel = _dicomEditorComponent.ToolbarModel; _dicomTagTable.MenuModel = _dicomEditorComponent.ContextMenuModel; _dicomTagTable.SelectionChanged += new EventHandler(OnDicomTagTableSelectionChanged); _dicomTagTable.MultiLine = true; _dicomEditorTitleBar.DataBindings.Add("Text", _dicomEditorComponent, "DicomFileTitle", true, DataSourceUpdateMode.OnPropertyChanged); }
public DicomEditorControl(DicomEditorComponent component) { Platform.CheckForNullReference(component, "component"); InitializeComponent(); _dicomEditorComponent = component; _dicomEditorComponent.CommitChangesRequested += OnDicomEditorComponentCommitChangesRequested; _dicomTagTable.Table = _dicomEditorComponent.DicomTagData; _dicomTagTable.ToolbarModel = _dicomEditorComponent.ToolbarModel; _dicomTagTable.MenuModel = _dicomEditorComponent.ContextMenuModel; _dicomTagTable.SelectionChanged += OnDicomTagTableSelectionChanged; _dicomTagTable.MultiLine = true; _dicomEditorTitleBar.DataBindings.Add("Text", _dicomEditorComponent, "DicomFileTitle", true, DataSourceUpdateMode.OnPropertyChanged); }
// 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(); }
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(); }
// 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(); }
public void SetComponent(IApplicationComponent component) { _component = (DicomEditorComponent)component; }
public void SetComponent(IApplicationComponent component) { _component = (DicomEditorComponent)component; }
/// <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; } }
/// <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; } }