fix(segmentation): segmentation stats calculations were not being done on a subsequent navigation to a mode (#5046)

This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2025-05-16 13:33:57 -04:00
1 parent fb1c2673a8
commit c6b28654b5
3 files changed
+72 -65

No files matched your search

+12 -8
View File
@@ -56,6 +56,7 @@ import { StudySummaryFromMetadata } from './components/StudySummaryFromMetadata'
import CornerstoneViewportDownloadForm from './utils/CornerstoneViewportDownloadForm';
import utils from './utils';
import { useMeasurementTracking } from './hooks/useMeasurementTracking';
import { setUpSegmentationEventHandlers } from './utils/setUpSegmentationEventHandlers';
export * from './components';
const { imageRetrieveMetadataProvider } = cornerstone.utilities;
@@ -91,9 +92,16 @@ const cornerstoneExtension: Types.Extensions.Extension = {
*/
id,
onModeEnter: ({ servicesManager }: withAppTypes): void => {
onModeEnter: ({ servicesManager, commandsManager }: withAppTypes): void => {
const { cornerstoneViewportService, toolbarService, segmentationService } =
servicesManager.services;
const { unsubscriptions: segmentationUnsubscriptions } = setUpSegmentationEventHandlers({
servicesManager,
commandsManager,
});
unsubscriptions.push(...segmentationUnsubscriptions);
toolbarService.registerEventForToolbarUpdate(cornerstoneViewportService, [
cornerstoneViewportService.EVENTS.VIEWPORT_DATA_CHANGED,
]);
@@ -144,6 +152,8 @@ const cornerstoneExtension: Types.Extensions.Extension = {
segmentationService.removeAllSegmentations();
unsubscriptions.forEach(unsubscribe => unsubscribe());
// Clear the unsubscriptions
unsubscriptions.length = 0;
},
/**
@@ -163,13 +173,7 @@ const cornerstoneExtension: Types.Extensions.Extension = {
const { syncGroupService } = servicesManager.services;
syncGroupService.registerCustomSynchronizer('frameview', createFrameViewSynchronizer);
const initResult = await init.call(this, props);
unsubscriptions.push(...initResult.unsubscriptions);
return {
...initResult,
};
await init.call(this, props);
},
getToolbarModule,
getHangingProtocolModule,