feat(SM): remove SM measurements from measurement panel (#4022)

This commit is contained in:
Alireza 2024-04-10 13:44:25 -04:00 committed by GitHub
parent 77693ddef4
commit df49a653be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 106 additions and 85 deletions

View File

@ -1,25 +0,0 @@
# ABOUT:
# https://docs.codecov.io/docs/codecov-yaml
#
#
# COMMIT STATUS:
# https://docs.codecov.io/docs/commit-status
coverage:
status:
project:
default:
threshold: 0.5%
core:
flags: core
threshold: 0.5%
viewer:
flags: viewer
threshold: 0.5%
patch: off
flags:
core:
paths:
- platform/core
viewer:
paths:
- platform/app

View File

@ -46,8 +46,8 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.70.0",
"@cornerstonejs/core": "^1.70.0",
"@cornerstonejs/adapters": "^1.70.5",
"@cornerstonejs/core": "^1.70.5",
"@kitware/vtk.js": "30.3.1",
"react-color": "^2.19.3"
}

View File

@ -46,9 +46,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.70.0",
"@cornerstonejs/core": "^1.70.0",
"@cornerstonejs/tools": "^1.70.0",
"@cornerstonejs/adapters": "^1.70.5",
"@cornerstonejs/core": "^1.70.5",
"@cornerstonejs/tools": "^1.70.5",
"classnames": "^2.3.2"
}
}

View File

@ -42,9 +42,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/core": "^1.70.0",
"@cornerstonejs/streaming-image-volume-loader": "^1.70.0",
"@cornerstonejs/tools": "^1.70.0",
"@cornerstonejs/core": "^1.70.5",
"@cornerstonejs/streaming-image-volume-loader": "^1.70.5",
"@cornerstonejs/tools": "^1.70.5",
"classnames": "^2.3.2"
}
}

View File

@ -38,7 +38,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.2",
"@cornerstonejs/codec-openjph": "^2.4.2",
"@cornerstonejs/dicom-image-loader": "^1.70.0",
"@cornerstonejs/dicom-image-loader": "^1.70.5",
"@icr/polyseg-wasm": "^0.4.0",
"@ohif/core": "3.8.0-beta.78",
"@ohif/ui": "3.8.0-beta.78",
@ -55,10 +55,10 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.70.0",
"@cornerstonejs/core": "^1.70.0",
"@cornerstonejs/streaming-image-volume-loader": "^1.70.0",
"@cornerstonejs/tools": "^1.70.0",
"@cornerstonejs/adapters": "^1.70.5",
"@cornerstonejs/core": "^1.70.5",
"@cornerstonejs/streaming-image-volume-loader": "^1.70.5",
"@cornerstonejs/tools": "^1.70.5",
"@icr/polyseg-wasm": "^0.4.0",
"@kitware/vtk.js": "30.3.1",
"html2canvas": "^1.4.1",

View File

@ -10,7 +10,7 @@ import {
utilities as csUtils,
} from '@cornerstonejs/core';
import { MeasurementService } from '@ohif/core';
import { Notification, useViewportDialog, Types as UITypes, AllInOneMenu } from '@ohif/ui';
import { Notification, useViewportDialog, AllInOneMenu } from '@ohif/ui';
import { IStackViewport, IVolumeViewport } from '@cornerstonejs/core/dist/esm/types';
import { setEnabledElement } from '../state';
@ -114,7 +114,6 @@ const OHIFCornerstoneViewport = React.memo(props => {
// of the imageData in the OHIFCornerstoneViewport. This prop is used
// to set the initial state of the viewport's first image to render
initialImageIndex,
onReady,
} = props;
const viewportId = viewportOptions.viewportId;
@ -142,7 +141,6 @@ const OHIFCornerstoneViewport = React.memo(props => {
viewportGridService,
stateSyncService,
viewportActionCornersService,
customizationService,
} = servicesManager.services as CornerstoneServices;
const [viewportDialogState] = useViewportDialog();
@ -203,7 +201,6 @@ const OHIFCornerstoneViewport = React.memo(props => {
if (onElementEnabled) {
onElementEnabled(evt);
onReady?.(evt);
}
},
[viewportId, onElementEnabled, toolGroupService]

View File

@ -275,16 +275,16 @@ function commandsModule({
actions.setViewportWindowLevel({ ...props, viewportId });
},
setToolEnabled: ({ toolName, toggle }) => {
setToolEnabled: ({ toolName, toggle, toolGroupId }) => {
const { viewports } = viewportGridService.getState();
if (!viewports.size) {
return;
}
const toolGroup = toolGroupService.getToolGroup(null);
const toolGroup = toolGroupService.getToolGroup(toolGroupId ?? null);
if (!toolGroup) {
if (!toolGroup || !toolGroup.hasTool(toolName)) {
return;
}
@ -293,6 +293,8 @@ function commandsModule({
// Toggle the tool's state only if the toggle is true
if (toggle) {
toolIsEnabled ? toolGroup.setToolDisabled(toolName) : toolGroup.setToolEnabled(toolName);
} else {
toolGroup.setToolEnabled(toolName);
}
const renderingEngine = cornerstoneViewportService.getRenderingEngine();

View File

@ -15,7 +15,6 @@ import {
utilities as csUtilities,
Enums as csEnums,
} from '@cornerstonejs/core';
import { utilities } from '@cornerstonejs/tools';
import {
cornerstoneStreamingImageVolumeLoader,
cornerstoneStreamingDynamicImageVolumeLoader,

View File

@ -35,6 +35,7 @@ import {
PlanarFreehandROITool,
SplineROITool,
LivewireContourTool,
OrientationMarkerTool,
} from '@cornerstonejs/tools';
import CalibrationLineTool from './tools/CalibrationLineTool';
@ -80,6 +81,7 @@ export default function initCornerstoneTools(configuration = {}) {
addTool(PlanarFreehandROITool);
addTool(SplineROITool);
addTool(LivewireContourTool);
addTool(OrientationMarkerTool);
// Modify annotation tools to use dashed lines on SR
const annotationStyle = {
@ -132,6 +134,7 @@ const toolNames = {
SplineROI: SplineROITool.toolName,
LivewireContour: LivewireContourTool.toolName,
PlanarFreehandROI: PlanarFreehandROITool.toolName,
OrientationMarker: OrientationMarkerTool.toolName,
};
export { toolNames };

View File

@ -1,11 +1,10 @@
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import { ServicesManager, ExtensionManager, CommandsManager, DicomMetadataStore } from '@ohif/core';
import { MeasurementTable, Icon, ButtonGroup, Button } from '@ohif/ui';
import { MeasurementTable } from '@ohif/ui';
import { withTranslation, WithTranslation } from 'react-i18next';
import { EVENTS as MicroscopyEvents } from '../../services/MicroscopyService';
import dcmjs from 'dcmjs';
import styles from '../../utils/styles';
import callInputDialog from '../../utils/callInputDialog';
import constructSR from '../../utils/constructSR';
import { saveByteArray } from '../../utils/saveByteArray';
@ -286,6 +285,11 @@ function MicroscopyPanel(props: IMicroscopyPanelProps) {
props.commandsManager.runCommand('setLabel', { uid }, 'MICROSCOPY');
};
const onMeasurementDeleteHandler = ({ uid, isActive }: { uid: string; isActive: boolean }) => {
const roiAnnotation = microscopyService.getAnnotation(uid);
microscopyService.removeAnnotation(roiAnnotation);
};
// Convert ROI annotations managed by microscopyService into our
// own format for display
const data = roiAnnotations.map((roiAnnotation, index) => {
@ -322,8 +326,6 @@ function MicroscopyPanel(props: IMicroscopyPanelProps) {
};
});
const disabled = data.length === 0;
return (
<>
<div
@ -336,6 +338,7 @@ function MicroscopyPanel(props: IMicroscopyPanelProps) {
data={data}
onClick={onMeasurementItemClickHandler}
onEdit={onMeasurementItemEditHandler}
onDelete={onMeasurementDeleteHandler}
/>
</div>
</>

View File

@ -32,8 +32,8 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@cornerstonejs/core": "^1.70.0",
"@cornerstonejs/tools": "^1.70.0",
"@cornerstonejs/core": "^1.70.5",
"@cornerstonejs/tools": "^1.70.5",
"@ohif/core": "3.8.0-beta.78",
"@ohif/extension-cornerstone-dicom-sr": "3.8.0-beta.78",
"@ohif/ui": "3.8.0-beta.78",

View File

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { Icon, ActionButtons } from '@ohif/ui';
import { useTranslation } from 'react-i18next';
export default function PanelRoiThresholdSegmentation({ servicesManager, commandsManager }) {
const { segmentationService } = servicesManager.services;
const { segmentationService, uiNotificationService } = servicesManager.services;
const { t } = useTranslation('PanelSUVExport');
const [segmentations, setSegmentations] = useState(() => segmentationService.getSegmentations());
@ -36,6 +36,24 @@ export default function PanelRoiThresholdSegmentation({ servicesManager, command
const tmtvValue = segmentations?.[0]?.cachedStats?.tmtv?.value || null;
const config = segmentations?.[0]?.cachedStats?.tmtv?.config || {};
segmentations.forEach(segmentation => {
const { cachedStats } = segmentation;
if (!cachedStats) {
return;
}
// segment 1
const suvPeak = cachedStats?.['1']?.suvPeak?.suvPeak;
if (Number.isNaN(suvPeak)) {
uiNotificationService.show({
title: 'Unable to calculate SUV Peak',
message: 'The resulting threshold is not big enough.',
type: 'warning',
});
}
});
const actions = [
{
label: 'Export CSV',

View File

@ -53,6 +53,7 @@ function modeFactory({ modeConfiguration }) {
customizationService,
hangingProtocolService,
displaySetService,
viewportGridService,
} = servicesManager.services;
const utilityModule = extensionManager.getModuleEntry(
@ -111,6 +112,19 @@ function modeFactory({ modeConfiguration }) {
},
]);
// This is a hack and we need to find a better way to enable
// some tools that require the viewport to be ready
const { unsubscribe: unsub1 } = viewportGridService.subscribe(
viewportGridService.EVENTS.VIEWPORTS_READY,
() => {
commandsManager.run('setToolEnabled', {
toolName: 'OrientationMarker',
toolGroupId: 'mipToolGroup',
});
unsub1();
}
);
// For the hanging protocol we need to decide on the window level
// based on whether the SUV is corrected or not, hence we can't hard
// code the window level in the hanging protocol but we add a custom

View File

@ -102,7 +102,17 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, mo
bindings: [{ mouseButton: Enums.MouseBindings.Primary }],
},
],
enabled: [{ toolName: toolNames.SegmentationDisplay }],
enabled: [
{ toolName: toolNames.SegmentationDisplay },
{
toolName: toolNames.OrientationMarker,
configuration: {
orientationWidget: {
viewportCorner: 'BOTTOM_LEFT',
},
},
},
],
};
toolGroupService.createToolGroupAndAddTools(toolGroupIds.MIP, mipTools);

View File

@ -54,7 +54,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.2",
"@cornerstonejs/codec-openjph": "^2.4.5",
"@cornerstonejs/dicom-image-loader": "^1.70.0",
"@cornerstonejs/dicom-image-loader": "^1.70.5",
"@emotion/serialize": "^1.1.3",
"@ohif/core": "3.8.0-beta.78",
"@ohif/extension-cornerstone": "3.8.0-beta.78",

View File

@ -340,7 +340,7 @@ function ViewerViewportGrid(props) {
viewportOptions={viewportOptions}
displaySetOptions={displaySetOptions}
needsRerendering={displaySetsNeedsRerendering}
onReady={() => {
onElementEnabled={() => {
viewportGridService.setViewportIsReady(viewportId, true);
}}
/>

View File

@ -37,7 +37,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.2",
"@cornerstonejs/codec-openjph": "^2.4.2",
"@cornerstonejs/dicom-image-loader": "^1.70.0",
"@cornerstonejs/dicom-image-loader": "^1.70.5",
"@ohif/ui": "3.8.0-beta.78",
"cornerstone-math": "0.1.9",
"dicom-parser": "^1.8.21"

View File

@ -2,11 +2,10 @@ import React from 'react';
import { ServicesManager } from '@ohif/core';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { annotation as CsAnnotation } from '@cornerstonejs/tools';
import MeasurementItem from './MeasurementItem';
const MeasurementTable = ({ data, title, onClick, onEdit, servicesManager }) => {
const MeasurementTable = ({ data, title, onClick, onEdit, onDelete, servicesManager }) => {
servicesManager = servicesManager as ServicesManager;
const { customizationService, measurementService } = servicesManager.services;
const { t } = useTranslation('MeasurementTable');
@ -20,6 +19,7 @@ const MeasurementTable = ({ data, title, onClick, onEdit, servicesManager }) =>
const onMeasurementDeleteHandler = ({ uid }) => {
const measurement = measurementService.getMeasurement(uid);
onDelete?.({ uid });
measurementService.remove(
uid,
{

View File

@ -189,6 +189,7 @@ export {
ViewportOverlay,
WindowLevel,
WindowLevelMenuItem,
MeasurementItem,
InputDoubleRange,
LabellingFlow,
HeaderPatientInfo,
@ -197,5 +198,4 @@ export {
ToolSettings,
Toolbox,
InvestigationalUseDialog,
MeasurementItem,
};

View File

@ -125,12 +125,12 @@ export {
WindowLevelMenuItem,
ImageScrollbar,
ViewportOverlay,
MeasurementItem,
LabellingFlow,
HeaderPatientInfo,
ToolSettings,
Toolbox,
InvestigationalUseDialog,
MeasurementItem,
LayoutPreset,
} from './components';

View File

@ -1568,13 +1568,13 @@
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"
integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==
"@cornerstonejs/adapters@^1.70.0":
version "1.70.0"
resolved "https://registry.yarnpkg.com/@cornerstonejs/adapters/-/adapters-1.70.0.tgz#e824bc193e4bbcdc33036b9c6aa41a3742cfe469"
integrity sha512-Eny4vsutkPo9WMQ+i8h5XxCaSqgg9SEj6nizsygDrYZGpJUmTVjJyTkMfSsO0AuiFRwgaWP+rmnF2323YfHtYA==
"@cornerstonejs/adapters@^1.70.5":
version "1.70.5"
resolved "https://registry.yarnpkg.com/@cornerstonejs/adapters/-/adapters-1.70.5.tgz#aa1e706a18b1e5d597b1b95bac928ee85b400a33"
integrity sha512-Jmxqz8crNx37jSBmlsfAKxKHi4wj0vICPzvCQ3c5F4+rSaEswD3JefHfzrNCk1xMaAGE7hkA7szWNDVCoovDBQ==
dependencies:
"@babel/runtime-corejs2" "^7.17.8"
"@cornerstonejs/tools" "^1.70.0"
"@cornerstonejs/tools" "^1.70.5"
buffer "^6.0.3"
dcmjs "^0.29.8"
gl-matrix "^3.4.3"
@ -1621,10 +1621,10 @@
resolved "https://registry.yarnpkg.com/@cornerstonejs/codec-openjph/-/codec-openjph-2.4.5.tgz#8690b61a86fa53ef38a70eee9d665a79229517c0"
integrity sha512-MZCUy8VG0VG5Nl1l58+g+kH3LujAzLYTfJqkwpWI2gjSrGXnP6lgwyy4GmPRZWVoS40/B1LDNALK905cNWm+sg==
"@cornerstonejs/core@^1.70.0":
version "1.70.0"
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-1.70.0.tgz#e4ae043fe720caff26320de44b41b1d5d1bfd884"
integrity sha512-tmSY9SPy6VnRYgMSWikDG1Wy4bF0Vg8F/7TfsviA18sKFr9ABlL7MS+fvU9L1e6/6oC7G+wGzBMFvx+krWDt8g==
"@cornerstonejs/core@^1.70.5":
version "1.70.5"
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-1.70.5.tgz#4667c018a22f06e83548d230c55a4c8d6b6630ea"
integrity sha512-cqSRLA3V6C1MAQ+S5EQoNdxuTG0c/c8bULZ9XKiZYd9YIY26wDsboDJ9a+vzJWNxw9ZFDW0H0F+zJsIu64a3ig==
dependencies:
"@kitware/vtk.js" "30.3.1"
comlink "^4.4.1"
@ -1632,34 +1632,34 @@
gl-matrix "^3.4.3"
lodash.clonedeep "4.5.0"
"@cornerstonejs/dicom-image-loader@^1.70.0":
version "1.70.0"
resolved "https://registry.yarnpkg.com/@cornerstonejs/dicom-image-loader/-/dicom-image-loader-1.70.0.tgz#c2f51b942b526254197edc86b3c5201bd24c5752"
integrity sha512-szV0IdeQ2MdYL30xq5dpCp8tfi+vXjOP3qtKI4ZbNQicuYGTuIxIQYTsHgBdqv2tyC1H7wuIIANv4XbHYbQTyA==
"@cornerstonejs/dicom-image-loader@^1.70.5":
version "1.70.5"
resolved "https://registry.yarnpkg.com/@cornerstonejs/dicom-image-loader/-/dicom-image-loader-1.70.5.tgz#6d41e3ee1df8ba659bb5bc69f660b421cd38d0ad"
integrity sha512-j8kNnzv5bE2A8jVEXdDFY1ZXoowNGRRAFCO1FlO0aU7yA3YwRXNAeAerJCRJROxl6E//Bsj2WbjRd+mPXE4JVg==
dependencies:
"@cornerstonejs/codec-charls" "^1.2.3"
"@cornerstonejs/codec-libjpeg-turbo-8bit" "^1.2.2"
"@cornerstonejs/codec-openjpeg" "^1.2.2"
"@cornerstonejs/codec-openjph" "^2.4.5"
"@cornerstonejs/core" "^1.70.0"
"@cornerstonejs/core" "^1.70.5"
dicom-parser "^1.8.9"
pako "^2.0.4"
uuid "^9.0.0"
"@cornerstonejs/streaming-image-volume-loader@^1.70.0":
version "1.70.0"
resolved "https://registry.yarnpkg.com/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-1.70.0.tgz#a8d96abf4b9963e6b30ea86db99c10f63e237dea"
integrity sha512-ZeFkKUhDlHAvjM4QGTeIsNvkih87rHS98k2DcIX2nJOilNT7KG8bsd1Clllm6Dq99rQCGGfs0ZLSb3CVLI5JXA==
"@cornerstonejs/streaming-image-volume-loader@^1.70.5":
version "1.70.5"
resolved "https://registry.yarnpkg.com/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-1.70.5.tgz#d6044b4258e28b38c00e8463afef064af85bd3ec"
integrity sha512-p7NZBixKRmQtZ4/auUvGEsX78/Xcdb6D5gG+hjk1ScF3d9kX5uafgBMj1aBQuO9WlcU6r7AGdIRy4hfGW+s/2w==
dependencies:
"@cornerstonejs/core" "^1.70.0"
"@cornerstonejs/core" "^1.70.5"
comlink "^4.4.1"
"@cornerstonejs/tools@^1.70.0":
version "1.70.0"
resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-1.70.0.tgz#563e08fb664d92aaf74ef8c0f49322f17e8b90a6"
integrity sha512-dj4RuYTMFKEWfi3PIyf3xebAC3lfjsuYD95SunkYRH2sxESd5l6A7Vnzk4cdajGqKeXrDVd6LD/P3dxbu/25bw==
"@cornerstonejs/tools@^1.70.5":
version "1.70.5"
resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-1.70.5.tgz#ebf7700516169c8283d44d146e5e995ed42dd1a2"
integrity sha512-gIo+JfcduvmxpQSXj3BX0N7IwkQZg9yGhexTToSDPo/kpAs5ju2rbnEK++y7kT5zn+G9blDzz9q1clS+++q90w==
dependencies:
"@cornerstonejs/core" "^1.70.0"
"@cornerstonejs/core" "^1.70.5"
"@icr/polyseg-wasm" "0.4.0"
"@types/offscreencanvas" "2019.7.3"
comlink "^4.4.1"