fix(viewport-webworker-segmentation): Resolve issues with viewport detection, webworker termination, and segmentation panel layout change (#4059)

This commit is contained in:
Alireza authored and GitHub committed 2024-04-22 14:43:26 -04:00
1 parent 3ec7e51216
commit 52a0c59294
15 files changed
+71 -51

No files matched your search

@@ -46,8 +46,8 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.70.10",
"@cornerstonejs/core": "^1.70.10",
"@cornerstonejs/adapters": "^1.70.12",
"@cornerstonejs/core": "^1.70.12",
"@kitware/vtk.js": "30.3.3",
"react-color": "^2.19.3"
}
@@ -107,7 +107,9 @@ export default function PanelSegmentation({
};
const onSegmentationAdd = async () => {
commandsManager.runCommand('createEmptySegmentationForViewport');
commandsManager.runCommand('createEmptySegmentationForViewport', {
viewportId: viewportGridService.getActiveViewportId(),
});
};
const onSegmentationClick = (segmentationId: string) => {
@@ -25,7 +25,6 @@ function OHIFCornerstoneSEGViewport(props) {
displaySetService,
toolGroupService,
segmentationService,
uiNotificationService,
customizationService,
viewportActionCornersService,
} = servicesManager.services;
+3 -3
View File
@@ -46,9 +46,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.70.10",
"@cornerstonejs/core": "^1.70.10",
"@cornerstonejs/tools": "^1.70.10",
"@cornerstonejs/adapters": "^1.70.12",
"@cornerstonejs/core": "^1.70.12",
"@cornerstonejs/tools": "^1.70.12",
"classnames": "^2.3.2"
}
}
@@ -42,9 +42,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/core": "^1.70.10",
"@cornerstonejs/streaming-image-volume-loader": "^1.70.10",
"@cornerstonejs/tools": "^1.70.10",
"@cornerstonejs/core": "^1.70.12",
"@cornerstonejs/streaming-image-volume-loader": "^1.70.12",
"@cornerstonejs/tools": "^1.70.12",
"classnames": "^2.3.2"
}
}
+5 -5
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.10",
"@cornerstonejs/dicom-image-loader": "^1.70.12",
"@icr/polyseg-wasm": "^0.4.0",
"@ohif/core": "3.8.0-beta.88",
"@ohif/ui": "3.8.0-beta.88",
@@ -55,10 +55,10 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.70.10",
"@cornerstonejs/core": "^1.70.10",
"@cornerstonejs/streaming-image-volume-loader": "^1.70.10",
"@cornerstonejs/tools": "^1.70.10",
"@cornerstonejs/adapters": "^1.70.12",
"@cornerstonejs/core": "^1.70.12",
"@cornerstonejs/streaming-image-volume-loader": "^1.70.12",
"@cornerstonejs/tools": "^1.70.12",
"@icr/polyseg-wasm": "^0.4.0",
"@kitware/vtk.js": "30.3.3",
"html2canvas": "^1.4.1",
@@ -132,7 +132,7 @@ const OHIFCornerstoneViewport = React.memo(props => {
// Since we only have support for dynamic data in volume viewports, we should
// handle this case here and set the viewportType to volume if any of the
// displaySets are dynamic volumes
viewportOptions.viewportType = displaySets.some(ds => ds.isDynamicVolume)
viewportOptions.viewportType = displaySets.some(ds => ds.isDynamicVolume && ds.isReconstructable)
? 'volume'
: viewportOptions.viewportType;
+2 -2
View File
@@ -32,8 +32,8 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@cornerstonejs/core": "^1.70.10",
"@cornerstonejs/tools": "^1.70.10",
"@cornerstonejs/core": "^1.70.12",
"@cornerstonejs/tools": "^1.70.12",
"@ohif/core": "3.8.0-beta.88",
"@ohif/extension-cornerstone-dicom-sr": "3.8.0-beta.88",
"@ohif/ui": "3.8.0-beta.88",
@@ -76,7 +76,7 @@ export default function PanelRoiThresholdSegmentation({ servicesManager, command
}
};
eventTarget.addEventListenerDebounced(Enums.Events.SEGMENTATION_DATA_MODIFIED, callback, 300);
eventTarget.addEventListenerDebounced(Enums.Events.SEGMENTATION_DATA_MODIFIED, callback, 250);
return () => {
eventTarget.removeEventListenerDebounced(Enums.Events.SEGMENTATION_DATA_MODIFIED, callback);
+19 -1
View File
@@ -316,10 +316,28 @@ const commandsModule = ({ servicesManager, commandsManager, extensionManager })
metadata: referencedVolume.metadata,
};
// metadata in annotations has enabledElement which is not serializable
// we need to remove it
// Todo: we should probably have a sanitization function for this
const annotationsToSend = annotations.map(annotation => {
return {
...annotation,
metadata: {
...annotation.metadata,
enabledElement: {
...annotation.metadata.enabledElement,
viewport: null,
renderingEngine: null,
element: null,
},
},
};
});
const suvPeak = await workerManager.executeTask('suv-peak-worker', 'calculateSuvPeak', {
labelmapProps,
referenceVolumeProps,
annotations,
annotations: annotationsToSend,
segmentIndex,
});