feat(measurements): Provide for the Load (SR) measurements button to optionally clear existing measurements prior to loading the SR. (#4586)
This commit is contained in:
1 parent
7eec015ff1
commit
4d3d5e794c
15 files changed
+185
-128
No files matched your search
+8
@@ -272,6 +272,14 @@ function TrackedMeasurementsContextProvider(
|
||||
viewports,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
// The command needs to be bound to the context's sendTrackedMeasurementsEvent
|
||||
// so the command has to be registered in a React component.
|
||||
commandsManager.registerCommand('DEFAULT', 'loadTrackedSRMeasurements', {
|
||||
commandFn: props => sendTrackedMeasurementsEvent('HYDRATE_SR', props),
|
||||
});
|
||||
}, [commandsManager, sendTrackedMeasurementsEvent]);
|
||||
|
||||
return (
|
||||
<TrackedMeasurementsContext.Provider
|
||||
value={[trackedMeasurements, sendTrackedMeasurementsEvent]}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import React from 'react';
|
||||
|
||||
import getContextModule from './getContextModule';
|
||||
import getPanelModule from './getPanelModule';
|
||||
import getViewportModule from './getViewportModule';
|
||||
import { id } from './id.js';
|
||||
import { ViewportActionButton } from '@ohif/ui';
|
||||
import i18n from '@ohif/i18n';
|
||||
|
||||
const measurementTrackingExtension = {
|
||||
/**
|
||||
@@ -12,6 +16,28 @@ const measurementTrackingExtension = {
|
||||
getContextModule,
|
||||
getPanelModule,
|
||||
getViewportModule,
|
||||
|
||||
onModeEnter({ servicesManager }) {
|
||||
const { toolbarService } = servicesManager.services;
|
||||
|
||||
toolbarService.addButtons(
|
||||
[
|
||||
{
|
||||
// A button for loading tracked, SR measurements.
|
||||
// Note that the command run is registered in TrackedMeasurementsContext
|
||||
// because it must be bound to a React context's data.
|
||||
id: 'loadSRMeasurements',
|
||||
component: props => (
|
||||
<ViewportActionButton {...props}>{i18n.t('Common:LOAD')}</ViewportActionButton>
|
||||
),
|
||||
props: {
|
||||
commands: ['loadTrackedSRMeasurements'],
|
||||
},
|
||||
},
|
||||
],
|
||||
true // replace the button if it is already defined
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export default measurementTrackingExtension;
|
||||
Reference in new issue
Block a user