diff --git a/apps/labeling/roiMarking.js b/apps/labeling/roiMarking.js index 4c56c25a..84f20b68 100644 --- a/apps/labeling/roiMarking.js +++ b/apps/labeling/roiMarking.js @@ -13,7 +13,7 @@ const annotationType = { '#0000FF': 'lymphocytes', '#00FFFF': 'plasma', }; -let $CAMIC = null; +$CAMIC = null; // for all instances of UI components const $UI = {}; @@ -209,7 +209,7 @@ function initCore() { } try { - let slideQuery = {}; + slideQuery = {}; slideQuery.id = $D.params.slideId; slideQuery.name = $D.params.slide; slideQuery.location = $D.params.location; @@ -473,7 +473,7 @@ async function saveAnnotation(annotation) { const {x, y} = $CAMIC.viewer.viewport.getContainerSize(); annotation.viewer_size = {width: x, height: y}; annotation.viewer_mag = $CAMIC.viewer.viewport.viewportToImageZoom($CAMIC.viewer.viewport.getZoom()); - let nowTime = new Date; + nowTime = new Date; annotation.create_date = nowTime.toISOString(); $CAMIC.viewer.cazoomctrlInstance.base; const rs = await $CAMIC.store.addLabelingAnnotation(annotation).then( (d) => d ); @@ -651,7 +651,7 @@ async function loadingData() { const labelData = await $CAMIC.store.findLabeling({_id: labelId}).then((d)=>d[0]); - let sublabels = []; + sublabels = []; if (labelData.subrois&&Array.isArray(labelData.subrois)) { sublabels =[]; // await $CAMIC.store.findLabelByIds(labelData.subrois).then((d)=>d); } @@ -960,14 +960,14 @@ function addROIFormEvent() { // override labeling code // holding place for annotations -let labelsToSave = []; +labelsToSave = []; // deps function convertToNormalized(points, size, viewer) { //const height = Math.round(viewer.imagingHelper.imgHeight); //const width = Math.round(viewer.imagingHelper.imgWidth); - let width = 0.001; - let height = 0.001; + width = 0.001; + height = 0.001; // convert const normalizedPoints = points.map((p) => [p[0] / width, p[1] / height]); const normalizedSize = [size[0] / width, size[0] / height]; @@ -1025,12 +1025,12 @@ async function storePresetLabel(labelData) { notes: labelData.type, }; - for (let i=0; i< $CAMIC.viewer.canvasDrawInstance.getImageFeatureCollection() + for (i=0; i< $CAMIC.viewer.canvasDrawInstance.getImageFeatureCollection() .features.length; i++){ - let feature = $CAMIC.viewer.canvasDrawInstance.getImageFeatureCollection() + feature = $CAMIC.viewer.canvasDrawInstance.getImageFeatureCollection() .features[i]; - let collectionName = (await $CAMIC.store.getCollection($CAMIC.slideData.collections[0]))[0].name - let annotJson = { + collectionName = (await $CAMIC.store.getCollection($CAMIC.slideData.collections[0]))[0].name + annotJson = { creator: getUserId(), created_date: new Date(), collectionId: $CAMIC.slideData['collections'][0], @@ -1079,17 +1079,17 @@ async function storePresetLabel(labelData) { } } -let camicOverrides = ()=>{ +camicOverrides = x=>{ // bypass spen and mttool, otherwise in ../../common/smartpen/autoalign.js $CAMIC.viewer.canvasDrawInstance.removeHandler('stop-drawing', addAnnotaiton); - let spen = {} + spen = {} spen.initcanvas = console.log spen.alignR = x=>x - let mtool = {} + mtool = {} mtool.hash = x=>x mtool.populate = x=>x mtool.distance = x=>x - let prevLabel = false + prevLabel = false function startLabeling(l) { // each time switching label, store prev if applicable. @@ -1131,7 +1131,7 @@ let camicOverrides = ()=>{ } } - let meowlabel = { + meowlabel = { "id": "999", "type":"Meowing", "mode": "free", @@ -1140,21 +1140,21 @@ let camicOverrides = ()=>{ } - let lymphLabel = { + lymphLabel = { "id": "903", "type":"Lymphocyte", "mode": "point", "color": "#67a9cf" } - let stromaLabel = { + stromaLabel = { "id": "902", "type":"Stroma", "mode": "free", "color": "#f1a340" } - let tumorLabel = { + tumorLabel = { "id": "901", "type":"Tumor_Cluster", "mode": "free", @@ -1208,8 +1208,8 @@ let camicOverrides = ()=>{ function multiAnnotationRender(ctx, data) { const imagingHelper = this.viewer.imagingHelper; const lineWidth = (imagingHelper.physicalToDataX(2) - imagingHelper.physicalToDataX(0))>> 0; - for (let index=0; index{ async function renderPrevAnnots(){ - let data = await $CAMIC.store.findMark($D.params.slideId); - for (let d in data){ + data = await $CAMIC.store.findMark($D.params.slideId); + for (d in data){ // check if creator is the same, only show if so. if (getUserId() == d.creator){ showAnnotation(d)