diff --git a/extensions/cornerstone-dicom-sr/src/commandsModule.ts b/extensions/cornerstone-dicom-sr/src/commandsModule.ts index c572ca00a5..e124ba67f9 100644 --- a/extensions/cornerstone-dicom-sr/src/commandsModule.ts +++ b/extensions/cornerstone-dicom-sr/src/commandsModule.ts @@ -82,13 +82,6 @@ const commandsModule = (props: withAppTypes) => { window.location.assign(objectUrl); }, - /** - * Download the CSV report for the measurements. - */ - downloadCSVMeasurementsReport: ({ measurementFilter }) => { - utils.downloadCSVReport(measurementService.getMeasurements(measurementFilter)); - }, - /** * * @param measurementData An array of measurements from the measurements service @@ -160,9 +153,6 @@ const commandsModule = (props: withAppTypes) => { storeMeasurements: { commandFn: actions.storeMeasurements, }, - downloadCSVMeasurementsReport: { - commandFn: actions.downloadCSVMeasurementsReport, - }, }; return { diff --git a/extensions/cornerstone/src/commandsModule.ts b/extensions/cornerstone/src/commandsModule.ts index 1bc0b3541e..08651e05b2 100644 --- a/extensions/cornerstone/src/commandsModule.ts +++ b/extensions/cornerstone/src/commandsModule.ts @@ -302,11 +302,22 @@ function commandsModule({ toggleVisibilityMeasurement: ({ uid }) => { measurementService.toggleVisibilityMeasurement(uid); }, + /** * Clear the measurements */ - clearMeasurements: ({ measurementFilter }) => { - measurementService.clearMeasurements(measurementFilter); + clearMeasurements: options => { + const { measurementFilter } = options; + measurementService.clearMeasurements( + measurementFilter ? measurementFilter.bind(options) : null + ); + }, + + /** + * Download the CSV report for the measurements. + */ + downloadCSVMeasurementsReport: ({ measurementFilter }) => { + utils.downloadCSVReport(measurementService.getMeasurements(measurementFilter)); }, // Retrieve value commands @@ -1313,6 +1324,9 @@ function commandsModule({ toggleVisibilityMeasurement: { commandFn: actions.toggleVisibilityMeasurement, }, + downloadCSVMeasurementsReport: { + commandFn: actions.downloadCSVMeasurementsReport, + }, setViewportWindowLevel: { commandFn: actions.setViewportWindowLevel, }, diff --git a/extensions/cornerstone/src/getPanelModule.tsx b/extensions/cornerstone/src/getPanelModule.tsx index bb3f65d9d8..f5c15e99ff 100644 --- a/extensions/cornerstone/src/getPanelModule.tsx +++ b/extensions/cornerstone/src/getPanelModule.tsx @@ -81,7 +81,7 @@ const getPanelModule = ({ commandsManager, servicesManager, extensionManager }: name: 'panelMeasurement', iconName: 'tab-linear', iconLabel: 'Measure', - label: 'Measurement', + label: 'All Measurements', component: wrappedPanelMeasurement, }, { diff --git a/extensions/cornerstone/src/panels/PanelMeasurement.tsx b/extensions/cornerstone/src/panels/PanelMeasurement.tsx index f11f9bada9..039fd83fee 100644 --- a/extensions/cornerstone/src/panels/PanelMeasurement.tsx +++ b/extensions/cornerstone/src/panels/PanelMeasurement.tsx @@ -14,14 +14,14 @@ export default function PanelMeasurementTable({ servicesManager, commandsManager, customHeader, - measurementFilters, + measurementFilters = { measurementFilter: filterAny }, }: withAppAndFilters): React.ReactNode { const measurementsPanelRef = useRef(null); const { measurementService, customizationService } = servicesManager.services; const displayMeasurements = useMeasurements(servicesManager, { - measurementFilter: filterAny, + measurementFilter: measurementFilters.measurementFilter.bind(measurementFilters), }); useEffect(() => { diff --git a/modes/basic-test-mode/src/index.ts b/modes/basic-test-mode/src/index.ts index 740ff90796..41d9d63413 100644 --- a/modes/basic-test-mode/src/index.ts +++ b/modes/basic-test-mode/src/index.ts @@ -15,7 +15,6 @@ const ohif = { wsiSopClassHandler: '@ohif/extension-cornerstone.sopClassHandlerModule.DicomMicroscopySopClassHandler', thumbnailList: '@ohif/extension-default.panelModule.seriesList', - measurements: '@ohif/extension-default.panelModule.measurements', }; const tracked = { @@ -46,6 +45,7 @@ const dicomSeg = { const cornerstone = { panel: '@ohif/extension-cornerstone.panelModule.panelSegmentation', + measurements: '@ohif/extension-cornerstone.panelModule.panelMeasurement', }; const dicomPmap = { @@ -150,7 +150,8 @@ function modeFactory() { // leftPanels: [ohif.thumbnailList], // rightPanels: [dicomSeg.panel, ohif.measurements], leftPanels: [tracked.thumbnailList], - rightPanels: [cornerstone.panel, tracked.measurements], + // Can use cornerstone.measurements for all measurements + rightPanels: [cornerstone.panel, tracked.measurements, cornerstone.measurements], // rightPanelClosed: true, // optional prop to start with collapse panels viewports: [ { diff --git a/platform/core/src/utils/measurementFilters.ts b/platform/core/src/utils/measurementFilters.ts index 9f60820469..8e1814ed45 100644 --- a/platform/core/src/utils/measurementFilters.ts +++ b/platform/core/src/utils/measurementFilters.ts @@ -22,13 +22,15 @@ export function filterNone(_measurement) { } /** - * Filters the measurements which are found in any of the filters in the provided - * object. This can be used to query for any matching of a set. - * This passes the this argument to the child function(s) + * Filters the measurements which are found in any of the specified + * filters. Strings will be looked up by name. */ -export function filterOr(measurementFilters) { +export function filterOr(...filters) { return function (item) { - for (const filter of Object.values(measurementFilters)) { + for (let filter of filters) { + if (typeof filter === 'string') { + filter = this[filter]; + } if (typeof filter !== 'function') { continue; }