fix(interpolation): Auto accept interpolation when the interpolation process is completed. (#5555)

* Update Cornerstone3D packages to 4.9.1.
This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2025-11-11 08:19:45 -05:00
1 parent 79fab8d70d
commit 834ae3c762
18 files changed
+251 -228

No files matched your search

@@ -2292,7 +2292,6 @@ function commandsModule({
const interpolationConfig = {
interpolation: {
enabled: interpolateContours,
showInterpolationPolyline: true,
},
};
toolGroup.setToolConfiguration(activeTool, interpolationConfig);
@@ -2358,7 +2357,6 @@ function commandsModule({
break;
default:
throw new Error('Unsupported logical operation');
break;
}
},
copyContourSegment: ({
+5 -1
View File
@@ -58,6 +58,7 @@ import CornerstoneViewportDownloadForm from './utils/CornerstoneViewportDownload
import utils from './utils';
import { useMeasurementTracking } from './hooks/useMeasurementTracking';
import { setUpSegmentationEventHandlers } from './utils/setUpSegmentationEventHandlers';
import { setUpAnnotationEventHandlers } from './utils/setUpAnnotationEventHandlers';
export * from './components';
const { imageRetrieveMetadataProvider } = cornerstone.utilities;
@@ -103,6 +104,9 @@ const cornerstoneExtension: Types.Extensions.Extension = {
});
unsubscriptions.push(...segmentationUnsubscriptions);
const annotationUnsubscriptions = setUpAnnotationEventHandlers();
unsubscriptions.push(...annotationUnsubscriptions);
toolbarService.registerEventForToolbarUpdate(cornerstoneViewportService, [
cornerstoneViewportService.EVENTS.VIEWPORT_DATA_CHANGED,
]);
@@ -110,7 +114,7 @@ const cornerstoneExtension: Types.Extensions.Extension = {
toolbarService.registerEventForToolbarUpdate(segmentationService, [
segmentationService.EVENTS.SEGMENTATION_REMOVED,
segmentationService.EVENTS.SEGMENTATION_MODIFIED,
segmentationService.EVENTS.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED,
segmentationService.EVENTS.SEGMENTATION_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED,
]);
toolbarService.registerEventForToolbarUpdate(cornerstone.eventTarget, [
+1 -1
View File
@@ -109,7 +109,7 @@ export default async function init({
toolbarService.registerEventForToolbarUpdate(segmentationService, [
segmentationService.EVENTS.SEGMENTATION_MODIFIED,
segmentationService.EVENTS.SEGMENTATION_REPRESENTATION_MODIFIED,
segmentationService.EVENTS.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED,
segmentationService.EVENTS.SEGMENTATION_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED,
]);
window.services = servicesManager.services;
@@ -82,7 +82,8 @@ const EVENTS = {
// loading completed for all segments
SEGMENTATION_LOADING_COMPLETE: 'event::segmentation_loading_complete',
// fired when a contour annotation cut merge process is completed
ANNOTATION_CUT_MERGE_PROCESS_COMPLETED: 'event::annotation_cut_merge_process_completed',
SEGMENTATION_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED:
'event::annotation_cut_merge_process_completed',
};
const VALUE_TYPES = {};
@@ -1696,13 +1697,6 @@ class SegmentationService extends PubSubService {
if (hideOthers) {
throw new Error('hideOthers is not working right now');
for (let i = 0; i < segments.length; i++) {
if (i !== segmentIndex) {
newSegmentSpecificConfig[i] = {
fillAlpha: 0,
};
}
}
}
const { fillAlpha } = this.getStyle({
@@ -1928,7 +1922,7 @@ class SegmentationService extends PubSubService {
private _onAnnotationCutMergeProcessCompletedFromSource = evt => {
const { segmentationId } = evt.detail;
this._broadcastEvent(this.EVENTS.ANNOTATION_CUT_MERGE_PROCESS_COMPLETED, {
this._broadcastEvent(this.EVENTS.SEGMENTATION_ANNOTATION_CUT_MERGE_PROCESS_COMPLETED, {
segmentationId,
});
};
@@ -0,0 +1,26 @@
import * as csTools from '@cornerstonejs/tools';
import { eventTarget } from '@cornerstonejs/core';
const { Enums: csToolsEnums } = csTools;
const _autoAcceptAnnotationInterpolationHandler = evt => {
const { element } = evt.detail;
csTools.utilities.contours.acceptAutogeneratedInterpolations(element, {});
};
export const setUpAnnotationEventHandlers = (): [() => void] => {
eventTarget.addEventListener(
csToolsEnums.Events.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED,
_autoAcceptAnnotationInterpolationHandler
);
const annotationInterpolationProcessCompletedUnsubscribe = () => {
eventTarget.removeEventListener(
csToolsEnums.Events.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED,
_autoAcceptAnnotationInterpolationHandler
);
};
return [annotationInterpolationProcessCompletedUnsubscribe];
};