// 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(); }
/// <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; } }