diff --git a/extensions/cornerstone/src/services/SyncGroupService/createHydrateSegmentationSynchronizer.ts b/extensions/cornerstone/src/services/SyncGroupService/createHydrateSegmentationSynchronizer.ts index 9b437ae6f1f..d255c8ef9af 100644 --- a/extensions/cornerstone/src/services/SyncGroupService/createHydrateSegmentationSynchronizer.ts +++ b/extensions/cornerstone/src/services/SyncGroupService/createHydrateSegmentationSynchronizer.ts @@ -88,12 +88,17 @@ const segmentationRepresentationModifiedCallback = async ( return; } - // Ensure the segmentation representation aligns with the target viewport type. - const type: Enums.SegmentationRepresentations = - isVolume3DViewportType(viewport) - ? Enums.SegmentationRepresentations.Surface - : ((segmentationRepresentationType as Enums.SegmentationRepresentations) ?? - Enums.SegmentationRepresentations.Labelmap); + // Ensure the segmentation representation aligns with the target viewport type + const is3D = isVolume3DViewportType(viewport); + const requestedRepresentation = + segmentationRepresentationType as Enums.SegmentationRepresentations; + const { Surface, Labelmap } = Enums.SegmentationRepresentations; + + const type: Enums.SegmentationRepresentations = is3D + ? Surface + : requestedRepresentation && requestedRepresentation !== Surface + ? requestedRepresentation + : Labelmap; await segmentationService.addSegmentationRepresentation(targetViewportId, { segmentationId, diff --git a/tests/SEGHydrationFrom3DFourUp.spec.ts b/tests/SEGHydrationFrom3DFourUp.spec.ts index ce232397a55..d5904bf9027 100644 --- a/tests/SEGHydrationFrom3DFourUp.spec.ts +++ b/tests/SEGHydrationFrom3DFourUp.spec.ts @@ -60,6 +60,9 @@ test.describe('3D four up SEG hydration', async () => { // Wait until all viewports have finished rendering await viewportRenderCycle; + // Hydration propagates labelmap volumes to MPR viewports asynchronously after the + // first render cycle resolves. + await waitForViewportsRendered(page, { timeout: 240000 }); await checkForScreenshot({ page, diff --git a/tests/screenshots/chromium/SEGHydrationFrom3DFourUp.spec.ts/threeDFourUpAfterSegHydrated.png b/tests/screenshots/chromium/SEGHydrationFrom3DFourUp.spec.ts/threeDFourUpAfterSegHydrated.png index 84195676641..8fcf19cb6ea 100644 Binary files a/tests/screenshots/chromium/SEGHydrationFrom3DFourUp.spec.ts/threeDFourUpAfterSegHydrated.png and b/tests/screenshots/chromium/SEGHydrationFrom3DFourUp.spec.ts/threeDFourUpAfterSegHydrated.png differ