Use Case
| • | You want to add a tool to the study browser. |
Relevant Architecture
Relevant Types
| • | StudyBrowserTool |
| • | StudyBrowserToolExtensionPoint |
| • | IStudyBrowserToolContext |
Sample Code
using System;
using ClearCanvas.Common;
using ClearCanvas.Desktop;
using ClearCanvas.Desktop.Actions;
using ClearCanvas.ImageViewer.Explorer.Dicom;
using ClearCanvas.ImageViewer.StudyManagement;
// ... (other using namespace statements)
namespace MyPlugin.Miscellaneous
{
[ButtonAction("activate", "dicomstudybrowser-toolbar/ToolbarMyStudyBrowserTool", "Activate")]
[MenuAction("activate", "dicomstudybrowser-contextmenu/MenuMyStudyBrowserTool", "Activate")]
[EnabledStateObserver("activate", "Enabled", "EnabledChanged")]
[Tooltip("activate", "TooltipMyStudyBrowserTool")]
[IconSet("activate", IconScheme.Colour, "Icons.MyToolSmall.png", "Icons.MyToolMedium.png", "Icons.MyToolLarge.png")]
// ... (other action attributes)
[ExtensionOf(typeof (StudyBrowserToolExtensionPoint))]
public class MyStudyBrowserTool : StudyBrowserTool
{
public MyStudyBrowserTool() {}
public void Activate()
{
StudyItem item = this.Context.SelectedStudy;
// Do something with the selected study
base.Context.DesktopWindow.ShowMessageBox(item.StudyInstanceUid, MessageBoxActions.Ok);
}
protected override void OnSelectedServerChanged(object sender, EventArgs e)
{
// Executed if the selected server changed
}
}
}
Remarks
Adding a tool to the study browser toolbar and context menu is useful if you want to perform some kind of custom action on the currently selected study. Note the site portions of the toolbar and menu paths in the example above (i.e., "dicomstudybrowser-toolbar" and "dicomstudybrowser-contextmenu"). As usual, if you want to change the ordering of the tools on the study browser toolbar or context menu, do so as you would with the main tool or menu bar.
Examples in Code Base
| • | ClearCanvas.ImageViewer.Explorer.Dicom.OpenStudyTool |
| • | ClearCanvas.ImageViewer.Services.Tools.DeleteStudyTool |