From 28888e6af3e2b76b1b88242d641eeb86b800bb08 Mon Sep 17 00:00:00 2001 From: salim kanoun Date: Sun, 28 Jun 2026 22:58:34 +0200 Subject: [PATCH] fix middle slice circle 3d --- .../CircleROIStartEndThresholdTool.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/tools/src/tools/segmentation/CircleROIStartEndThresholdTool.ts b/packages/tools/src/tools/segmentation/CircleROIStartEndThresholdTool.ts index 5af7c47197..7474d39bcf 100644 --- a/packages/tools/src/tools/segmentation/CircleROIStartEndThresholdTool.ts +++ b/packages/tools/src/tools/segmentation/CircleROIStartEndThresholdTool.ts @@ -426,9 +426,14 @@ class CircleROIStartEndThresholdTool extends CircleROITool { // if it is inside the start/end slice, but not exactly the first or // last slice, we render the line in dash, but not the handles - let isMiddleSlice = false; - if (roundedCameraCoordinate === middleCoordinate) { - isMiddleSlice = true; + let isNearMiddleSlice = false; + const targetId = this.getTargetId(viewport); + const imageVolume = cache.getVolume(targetId.split(/volumeId:|\?/)[1]); + if ( + Math.abs(roundedCameraCoordinate - middleCoordinate) < + csUtils.getSpacingInNormalDirection(imageVolume, viewplaneNormal) + ) { + isNearMiddleSlice = true; } data.handles.points[0][ @@ -467,7 +472,7 @@ class CircleROIStartEndThresholdTool extends CircleROITool { !isAnnotationLocked(annotationUID) && !this.editData && activeHandleIndex !== null && - isMiddleSlice + isNearMiddleSlice ) { if (this.configuration.simplified) { activeHandleCanvasCoords = [canvasCoordinates[activeHandleIndex]]; @@ -493,7 +498,7 @@ class CircleROIStartEndThresholdTool extends CircleROITool { let lineWidthToUse = lineWidth; let lineDashToUse = lineDash; - if (isMiddleSlice) { + if (isNearMiddleSlice) { lineWidthToUse = lineWidth; lineDashToUse = []; // Use solid line for real line } else {