Back to Projects List
The OHIF Viewer is a zero-footprint medical image viewer provided by the Open Health Imaging Foundation (OHIF). It is a configurable and extensible progressive web application with out-of-the-box support for image archives which support DICOMweb. We would like to make the OHIF Viewer easier to extend and customize in order to better support the workflow and feature needs of end users.
Some amount of extensibility is available via OHIF existing extensions. Our objective is specific to our overarching goal of integrating James A Petts existing Segmentation tools and UI, currently maintained here. For example, we would like it to be possible to add the following via plugins:
@ohif/extension-segmentation
The OHIF Viewer Platform is currently coupled to it’s various components’ dependencies and implementations. The goal is to refactor the Viewer to add it’s features and functionality via it’s own extension/module system. Then, migrate each of the existing components to do the same. Key concepts:
ExtensionManager
responsible for extension and module registration
ExtensionManager
was updated to support Panel ExtensionsExtensionManager
was updated to support a preRegistration
hook
ToolbarDefinition
schema was updated to support nested menu itemsreact-viewerbase
to assist Extension AuthorsMeasurementsTable
was converted to a PanelModule
extension
docs.ohif.org
with latest extension informationAn OHIF extension is a POJO (plain old JavasSript object) that has properties and methods that provide information to OHIF’s extension manager.
preRegistration(configuration = {}) {
},
getPanelModule() {
return {
menuOptions: [
{
icon: 'th-list',
label: 'Segments',
target: 'segment-panel'
},
{
icon: 'th',
label: 'Contours',
target: 'contour-panel'
}
],
components: [
{
id: 'segment-panel',
from: 'right',
width: '500px',
component: SegmentationMenu // React Component
},
{
id: 'contour-panel',
from: 'right',
width: '500px',
component: RoiContourMenu // React Component
}
],
defaultContext: ['VIEWER']
};
}
getToolbarModule() {
return {
definitions: [
{
id: 'freehandRoiTools',
label: 'ROI',
icon: 'level',
buttons: [
{
id: 'FreehandRoi',
label: 'Draw',
icon: 'level',
type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
commandName: 'setToolActive',
commandOptions: { toolName: TOOL_NAMES.FREEHAND_ROI_3D_TOOL }
},
{
id: 'FreehandRoiSculptor',
label: 'Sculpt',
icon: 'level',
type: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
commandName: 'setToolActive',
commandOptions: { toolName: TOOL_NAMES.FREEHAND_ROI_3D_SCULPTOR_TOOL }
}
]
},
...
],
defaultContext: 'ACTIVE_VIEWPORT::CORNERSTONE'
};
},
/**
* Registers one or more named commands scoped to a context. Commands are
* the primary means for toolbar actions and actions that can be bound to hotkeys.
*/
getCommandsModule() {
actions: {
nextSegmentForActiveViewport: ({ viewports }) => {
// Command implementation.
},
previousSegmentForActiveViewport: ({ viewports }) => {
// Command implementations.
},
increaseBrushSize: () => {
// Command implementations.
},
decreaseBrushSize: () => {
// Command implementations.
}
}
definitions: {
nextSegmentForActiveViewport: {
commandFn: actions.nextSegmentForActiveViewport,
storeContexts: ['viewports']
},
previousSegmentForActiveViewport: {
commandFn: actions.previousSegmentForActiveViewport,
storeContexts: ['viewports']
},
increaseBrushSize: {
commandFn: actions.increaseBrushSize
},
decreaseBrushSize: {
commandFn: actions.decreaseBrushSize
}
}
defaultContext: 'ACTIVE_VIEWPORT::CORNERSTONE'
};