From 321b91907dd7d810b791690b7d23be5e764031b4 Mon Sep 17 00:00:00 2001 From: Birm Date: Wed, 13 Sep 2023 11:52:46 -0400 Subject: [PATCH] use mpp to get w and h --- apps/labeling/pitfalls.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/labeling/pitfalls.js b/apps/labeling/pitfalls.js index 18491e727..2baf85ee4 100644 --- a/apps/labeling/pitfalls.js +++ b/apps/labeling/pitfalls.js @@ -1371,8 +1371,14 @@ function resetForm() { // TODO the form should start inactive until a roi is created. function addAnnot(e) { if (!$D.activeROI) { - let halfWidth = 1996/2; - let halfHeight = 1996/2; + // defaults in case no mpp + let halfWidth = 1000; + let halfHeight = 1000; + // should be 500 microns; so half is 250 divided by microns per pixel, get width and height in pixels + if ($CAMIC.slideData.mpp){ + halfWidth = 250/$CAMIC.slideData.mpp; + halfHeight = 250/$CAMIC.slideData.mpp; + } let ctr = $CAMIC.viewer.viewport.viewportToImageCoordinates($CAMIC.viewer.viewport.pointFromPixel(e.position, true)); let xCtr = Math.round(ctr.x); let yCtr = Math.round(ctr.y);