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 }) => {