2023-12-11 15:43:58 +01:00
|
|
|
import i18n from 'i18next';
|
2023-04-28 02:53:52 +02:00
|
|
|
|
|
|
|
|
import { id } from './id';
|
|
|
|
|
import toolbarButtons from './toolbarButtons';
|
|
|
|
|
|
|
|
|
|
const ohif = {
|
|
|
|
|
layout: '@ohif/extension-default.layoutTemplateModule.viewerLayout',
|
|
|
|
|
sopClassHandler: '@ohif/extension-default.sopClassHandlerModule.stack',
|
|
|
|
|
hangingProtocols: '@ohif/extension-default.hangingProtocolModule.default',
|
|
|
|
|
leftPanel: '@ohif/extension-default.panelModule.seriesList',
|
2025-02-18 15:07:17 +01:00
|
|
|
rightPanel: '@ohif/extension-dicom-microscopy.panelModule.measure',
|
2023-04-28 02:53:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const cornerstone = {
|
|
|
|
|
viewport: '@ohif/extension-cornerstone.viewportModule.cornerstone',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const dicomvideo = {
|
2023-09-01 22:19:39 +02:00
|
|
|
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
|
2023-04-28 02:53:52 +02:00
|
|
|
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const dicompdf = {
|
|
|
|
|
sopClassHandler: '@ohif/extension-dicom-pdf.sopClassHandlerModule.dicom-pdf',
|
|
|
|
|
viewport: '@ohif/extension-dicom-pdf.viewportModule.dicom-pdf',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const extensionDependencies = {
|
|
|
|
|
// Can derive the versions at least process.env.from npm_package_version
|
|
|
|
|
'@ohif/extension-default': '^3.0.0',
|
|
|
|
|
'@ohif/extension-cornerstone': '^3.0.0',
|
|
|
|
|
'@ohif/extension-cornerstone-dicom-sr': '^3.0.0',
|
|
|
|
|
'@ohif/extension-dicom-pdf': '^3.0.1',
|
|
|
|
|
'@ohif/extension-dicom-video': '^3.0.1',
|
|
|
|
|
'@ohif/extension-dicom-microscopy': '^3.0.0',
|
|
|
|
|
};
|
|
|
|
|
|
2023-08-08 16:05:20 +02:00
|
|
|
function modeFactory({ modeConfiguration }) {
|
2023-04-28 02:53:52 +02:00
|
|
|
return {
|
|
|
|
|
id,
|
|
|
|
|
routeName: 'microscopy',
|
2023-12-11 15:43:58 +01:00
|
|
|
displayName: i18n.t('Modes:Microscopy'),
|
2023-04-28 02:53:52 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Lifecycle hooks
|
|
|
|
|
*/
|
2025-03-07 04:19:47 +01:00
|
|
|
onModeEnter: ({ servicesManager }: withAppTypes) => {
|
2023-04-28 02:53:52 +02:00
|
|
|
const { toolbarService } = servicesManager.services;
|
|
|
|
|
|
2025-05-15 18:08:12 +02:00
|
|
|
toolbarService.register(toolbarButtons);
|
|
|
|
|
toolbarService.updateSection('primary', ['MeasurementTools', 'dragPan', 'TagBrowser']);
|
2025-03-07 04:19:47 +01:00
|
|
|
|
2025-05-16 19:42:35 +02:00
|
|
|
toolbarService.updateSection('MeasurementTools', [
|
2025-03-07 04:19:47 +01:00
|
|
|
'line',
|
|
|
|
|
'point',
|
|
|
|
|
'polygon',
|
|
|
|
|
'circle',
|
|
|
|
|
'box',
|
|
|
|
|
'freehandpolygon',
|
|
|
|
|
'freehandline',
|
|
|
|
|
]);
|
2023-04-28 02:53:52 +02:00
|
|
|
},
|
|
|
|
|
|
2024-05-08 18:12:49 +02:00
|
|
|
onModeExit: ({ servicesManager }: withAppTypes) => {
|
2024-03-19 01:27:12 +01:00
|
|
|
const { toolbarService, uiDialogService, uiModalService } = servicesManager.services;
|
2023-04-28 02:53:52 +02:00
|
|
|
|
2025-02-28 21:17:55 +01:00
|
|
|
uiDialogService.hideAll();
|
2024-03-19 01:27:12 +01:00
|
|
|
uiModalService.hide();
|
2023-04-28 02:53:52 +02:00
|
|
|
toolbarService.reset();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
validationTags: {
|
|
|
|
|
study: [],
|
|
|
|
|
series: [],
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
isValidMode: ({ modalities }) => {
|
|
|
|
|
const modalities_list = modalities.split('\\');
|
|
|
|
|
|
2024-03-19 01:27:12 +01:00
|
|
|
return {
|
|
|
|
|
valid: modalities_list.includes('SM'),
|
|
|
|
|
description: 'Microscopy mode only supports the SM modality',
|
|
|
|
|
};
|
2023-04-28 02:53:52 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
|
{
|
|
|
|
|
path: 'microscopy',
|
|
|
|
|
layoutTemplate: ({ location, servicesManager }) => {
|
|
|
|
|
return {
|
|
|
|
|
id: ohif.layout,
|
|
|
|
|
props: {
|
|
|
|
|
leftPanels: [ohif.leftPanel],
|
2025-01-23 20:13:44 +01:00
|
|
|
leftPanelResizable: true,
|
2024-04-10 05:57:34 +02:00
|
|
|
leftPanelClosed: true, // we have problem with rendering thumbnails for microscopy images
|
2025-04-08 18:06:07 +02:00
|
|
|
// rightPanelClosed: true, // we do not have the save microscopy measurements yet
|
2025-02-18 15:07:17 +01:00
|
|
|
rightPanels: [ohif.rightPanel],
|
2025-01-23 20:13:44 +01:00
|
|
|
rightPanelResizable: true,
|
2023-04-28 02:53:52 +02:00
|
|
|
viewports: [
|
|
|
|
|
{
|
2023-09-01 22:19:39 +02:00
|
|
|
namespace: '@ohif/extension-dicom-microscopy.viewportModule.microscopy-dicom',
|
2023-04-28 02:53:52 +02:00
|
|
|
displaySetsToDisplay: [
|
2024-08-15 20:36:53 +02:00
|
|
|
// Share the sop class handler with cornerstone version of it
|
|
|
|
|
'@ohif/extension-cornerstone.sopClassHandlerModule.DicomMicroscopySopClassHandler',
|
2023-04-28 02:53:52 +02:00
|
|
|
'@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopySRSopClassHandler',
|
2025-08-20 14:13:30 +02:00
|
|
|
'@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopyANNSopClassHandler',
|
2023-04-28 02:53:52 +02:00
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
namespace: dicomvideo.viewport,
|
|
|
|
|
displaySetsToDisplay: [dicomvideo.sopClassHandler],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
namespace: dicompdf.viewport,
|
|
|
|
|
displaySetsToDisplay: [dicompdf.sopClassHandler],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
extensions: extensionDependencies,
|
2024-11-11 20:28:34 +01:00
|
|
|
hangingProtocol: 'default',
|
2023-04-28 02:53:52 +02:00
|
|
|
sopClassHandlers: [
|
2024-08-15 20:36:53 +02:00
|
|
|
'@ohif/extension-cornerstone.sopClassHandlerModule.DicomMicroscopySopClassHandler',
|
2023-04-28 02:53:52 +02:00
|
|
|
'@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopySRSopClassHandler',
|
2025-08-20 14:13:30 +02:00
|
|
|
'@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopyANNSopClassHandler',
|
2023-04-28 02:53:52 +02:00
|
|
|
dicomvideo.sopClassHandler,
|
|
|
|
|
dicompdf.sopClassHandler,
|
|
|
|
|
],
|
2023-08-08 16:05:20 +02:00
|
|
|
...modeConfiguration,
|
2023-04-28 02:53:52 +02:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mode = {
|
|
|
|
|
id,
|
|
|
|
|
modeFactory,
|
|
|
|
|
extensionDependencies,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default mode;
|