fix(SR): Bring back the onModeEnter for the cornerstone-dicom-sr extension that was accidentally removed by PR #4586 (#4616)
This commit is contained in:
parent
11050441e5
commit
2df8e1d5cd
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import getSopClassHandlerModule from './getSopClassHandlerModule';
|
import getSopClassHandlerModule from './getSopClassHandlerModule';
|
||||||
import { srProtocol } from './getHangingProtocolModule';
|
import { srProtocol } from './getHangingProtocolModule';
|
||||||
|
import onModeEnter from './onModeEnter';
|
||||||
import getCommandsModule from './commandsModule';
|
import getCommandsModule from './commandsModule';
|
||||||
import preRegistration from './init';
|
import preRegistration from './init';
|
||||||
import { id } from './id.js';
|
import { id } from './id.js';
|
||||||
@ -8,8 +9,6 @@ import toolNames from './tools/toolNames';
|
|||||||
import hydrateStructuredReport from './utils/hydrateStructuredReport';
|
import hydrateStructuredReport from './utils/hydrateStructuredReport';
|
||||||
import createReferencedImageDisplaySet from './utils/createReferencedImageDisplaySet';
|
import createReferencedImageDisplaySet from './utils/createReferencedImageDisplaySet';
|
||||||
import Enums from './enums';
|
import Enums from './enums';
|
||||||
import { ViewportActionButton } from '@ohif/ui';
|
|
||||||
import i18n from '@ohif/i18n';
|
|
||||||
|
|
||||||
const Component = React.lazy(() => {
|
const Component = React.lazy(() => {
|
||||||
return import(/* webpackPrefetch: true */ './components/OHIFCornerstoneSRViewport');
|
return import(/* webpackPrefetch: true */ './components/OHIFCornerstoneSRViewport');
|
||||||
@ -32,29 +31,7 @@ const dicomSRExtension = {
|
|||||||
*/
|
*/
|
||||||
id,
|
id,
|
||||||
|
|
||||||
onModeEnter({ servicesManager }) {
|
onModeEnter,
|
||||||
const { toolbarService } = servicesManager.services;
|
|
||||||
|
|
||||||
toolbarService.addButtons([
|
|
||||||
{
|
|
||||||
// A base/default button for loading measurements. It is added to the toolbar below.
|
|
||||||
// Customizations to this button can be made in the mode or by another extension.
|
|
||||||
// For example, the button label can be changed and/or the command to clear
|
|
||||||
// the measurements can be dropped.
|
|
||||||
id: 'loadSRMeasurements',
|
|
||||||
component: props => (
|
|
||||||
<ViewportActionButton {...props}>{i18n.t('Common:LOAD')}</ViewportActionButton>
|
|
||||||
),
|
|
||||||
props: {
|
|
||||||
commands: ['clearMeasurements', 'loadSRMeasurements'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
// The toolbar used in the viewport's status bar. Modes and extensions can further customize
|
|
||||||
// it to optionally add other buttons.
|
|
||||||
toolbarService.createButtonSection('loadSRMeasurements', ['loadSRMeasurements']);
|
|
||||||
},
|
|
||||||
|
|
||||||
preRegistration,
|
preRegistration,
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
import { SOPClassHandlerId, SOPClassHandlerId3D } from './id';
|
|
||||||
|
|
||||||
export default function onModeEnter({ servicesManager }) {
|
|
||||||
const { displaySetService } = servicesManager.services;
|
|
||||||
const displaySetCache = displaySetService.getDisplaySetCache();
|
|
||||||
|
|
||||||
const srDisplaySets = [...displaySetCache.values()].filter(
|
|
||||||
ds => ds.SOPClassHandlerId === SOPClassHandlerId || ds.SOPClassHandlerId === SOPClassHandlerId3D
|
|
||||||
);
|
|
||||||
|
|
||||||
srDisplaySets.forEach(ds => {
|
|
||||||
// New mode route, allow SRs to be hydrated again
|
|
||||||
ds.isHydrated = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
39
extensions/cornerstone-dicom-sr/src/onModeEnter.tsx
Normal file
39
extensions/cornerstone-dicom-sr/src/onModeEnter.tsx
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { SOPClassHandlerId, SOPClassHandlerId3D } from './id';
|
||||||
|
import { ViewportActionButton } from '@ohif/ui';
|
||||||
|
import i18n from '@ohif/i18n';
|
||||||
|
|
||||||
|
export default function onModeEnter({ servicesManager }) {
|
||||||
|
const { displaySetService, toolbarService } = servicesManager.services;
|
||||||
|
const displaySetCache = displaySetService.getDisplaySetCache();
|
||||||
|
|
||||||
|
const srDisplaySets = [...displaySetCache.values()].filter(
|
||||||
|
ds => ds.SOPClassHandlerId === SOPClassHandlerId || ds.SOPClassHandlerId === SOPClassHandlerId3D
|
||||||
|
);
|
||||||
|
|
||||||
|
srDisplaySets.forEach(ds => {
|
||||||
|
// New mode route, allow SRs to be hydrated again
|
||||||
|
ds.isHydrated = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
toolbarService.addButtons([
|
||||||
|
{
|
||||||
|
// A base/default button for loading measurements. It is added to the toolbar below.
|
||||||
|
// Customizations to this button can be made in the mode or by another extension.
|
||||||
|
// For example, the button label can be changed and/or the command to clear
|
||||||
|
// the measurements can be dropped.
|
||||||
|
id: 'loadSRMeasurements',
|
||||||
|
component: props => (
|
||||||
|
<ViewportActionButton {...props}>{i18n.t('Common:LOAD')}</ViewportActionButton>
|
||||||
|
),
|
||||||
|
props: {
|
||||||
|
commands: ['clearMeasurements', 'loadSRMeasurements'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
// The toolbar used in the viewport's status bar. Modes and extensions can further customize
|
||||||
|
// it to optionally add other buttons.
|
||||||
|
toolbarService.createButtonSection('loadSRMeasurements', ['loadSRMeasurements']);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user