From d0e9e2e85c8b03370260016d5f3c695b4ca4175a Mon Sep 17 00:00:00 2001 From: kom482 Date: Wed, 5 Jun 2024 19:18:35 +0200 Subject: [PATCH] fix(PlanarFreehandROITool) Issue 1297 - PlanarFreehandROITool decimate configuration parameter not working on annotation update (#1298) --- .../planarFreehandROITool/closedContourEditLoop.ts | 10 +++++++++- .../planarFreehandROITool/openContourEditLoop.ts | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/tools/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts b/packages/tools/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts index 8ae336f275..3a835d0ef1 100644 --- a/packages/tools/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +++ b/packages/tools/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts @@ -452,6 +452,8 @@ function completeClosedContourEdit(element: HTMLDivElement) { ) : fusedCanvasPoints; + const decimateConfig = this.configuration?.decimate || {}; + updateContourPolyline( annotation, { @@ -459,7 +461,13 @@ function completeClosedContourEdit(element: HTMLDivElement) { closed: true, targetWindingDirection: ContourWindingDirection.Clockwise, }, - viewport + viewport, + { + decimate: { + enabled: !!decimateConfig.enabled, + epsilon: decimateConfig.epsilon, + }, + } ); // If any manual update, triggered on an annotation, then it will be treated as non-autogenerated. diff --git a/packages/tools/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts b/packages/tools/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts index 0d20855cf3..c090303eb4 100644 --- a/packages/tools/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +++ b/packages/tools/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts @@ -562,13 +562,21 @@ function completeOpenContourEdit(element: HTMLDivElement) { ) : fusedCanvasPoints; + const decimateConfig = this.configuration?.decimate || {}; + updateContourPolyline( annotation, { points: updatedPoints, closed: false, }, - viewport + viewport, + { + decimate: { + enabled: !!decimateConfig.enabled, + epsilon: decimateConfig.epsilon, + }, + } ); const worldPoints = annotation.data.contour.polyline;