From 4f83ec127d1536c2c41c4058ffd55004645807d2 Mon Sep 17 00:00:00 2001 From: "Helmut (Oertel) Hoffer von Ankershoffen" Date: Sun, 10 Nov 2024 14:10:31 +0100 Subject: [PATCH 1/2] perf(bulkAnnotations): cache affine --- src/bulkAnnotations/utils.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bulkAnnotations/utils.js b/src/bulkAnnotations/utils.js index 41824e4..32c66c8 100644 --- a/src/bulkAnnotations/utils.js +++ b/src/bulkAnnotations/utils.js @@ -468,6 +468,12 @@ export const getFeaturesFromBulkAnnotations = ({ const { topLeft, bottomRight } = getViewportBoundingBox({ view, pyramid, affine }) + const affine = getAffineBasedOnPyramidLevel({ + affine, + pyramid, + annotationGroup + }) + const features = [] for ( @@ -492,11 +498,7 @@ export const getFeaturesFromBulkAnnotations = ({ if (annotationCoordinateType === '2D') { firstCoordinate = mapPixelCoordToSlideCoord({ point: [firstCoordinate[0], firstCoordinate[1]], - affine: getAffineBasedOnPyramidLevel({ - affine, - pyramid, - annotationGroup - }) + affine: affine }) } From cd22fef11f796dbb3a543a2738fb5010ea2409f0 Mon Sep 17 00:00:00 2001 From: "Helmut (Oertel) Hoffer von Ankershoffen" Date: Mon, 11 Nov 2024 22:32:53 +0100 Subject: [PATCH 2/2] fix: typo --- src/bulkAnnotations/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bulkAnnotations/utils.js b/src/bulkAnnotations/utils.js index 32c66c8..38d5030 100644 --- a/src/bulkAnnotations/utils.js +++ b/src/bulkAnnotations/utils.js @@ -468,7 +468,7 @@ export const getFeaturesFromBulkAnnotations = ({ const { topLeft, bottomRight } = getViewportBoundingBox({ view, pyramid, affine }) - const affine = getAffineBasedOnPyramidLevel({ + const cachedAffine = getAffineBasedOnPyramidLevel({ affine, pyramid, annotationGroup @@ -498,7 +498,7 @@ export const getFeaturesFromBulkAnnotations = ({ if (annotationCoordinateType === '2D') { firstCoordinate = mapPixelCoordToSlideCoord({ point: [firstCoordinate[0], firstCoordinate[1]], - affine: affine + affine: cachedAffine }) }