From 9a334657d091079f9633873f399188dc5480faa4 Mon Sep 17 00:00:00 2001 From: Igor Octaviano Date: Wed, 27 May 2026 16:56:34 -0300 Subject: [PATCH] Fix auto load seg lock --- extensions/cornerstone/src/commandsModule.ts | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/extensions/cornerstone/src/commandsModule.ts b/extensions/cornerstone/src/commandsModule.ts index fe47568067f..b29c0bc7ab3 100644 --- a/extensions/cornerstone/src/commandsModule.ts +++ b/extensions/cornerstone/src/commandsModule.ts @@ -288,7 +288,7 @@ function commandsModule({ ? Enums.SegmentationRepresentations.Labelmap : Enums.SegmentationRepresentations.Contour; - segmentationService.addSegmentationRepresentation(activeViewportId, { + await segmentationService.addSegmentationRepresentation(activeViewportId, { segmentationId: displaySet.displaySetInstanceUID, type: representationType, }); @@ -300,6 +300,27 @@ function commandsModule({ return; } + const disableEditing = customizationService.getCustomization( + 'panelSegmentation.disableEditing' + ); + if (disableEditing) { + const activeViewportId = viewportGridService.getActiveViewportId(); + const segmentationRepresentations = segmentationService.getSegmentationRepresentations( + activeViewportId + ); + + segmentationRepresentations.forEach(representation => { + const segmentIndices = Object.keys(representation.segments); + segmentIndices.forEach(segmentIndex => { + segmentationService.setSegmentLocked( + representation.segmentationId, + parseInt(segmentIndex), + true + ); + }); + }); + } + console.info('Segmentations loaded for active viewport.'); }, jumpToMeasurementViewport: ({ annotationUID, measurement }) => {