@@ -13,7 +13,7 @@ const annotationType = {
1313 '#0000FF' : 'lymphocytes' ,
1414 '#00FFFF' : 'plasma' ,
1515} ;
16- $CAMIC = null ;
16+ let $CAMIC = null ;
1717// for all instances of UI components
1818const $UI = { } ;
1919
@@ -209,7 +209,7 @@ function initCore() {
209209 }
210210
211211 try {
212- slideQuery = { } ;
212+ let slideQuery = { } ;
213213 slideQuery . id = $D . params . slideId ;
214214 slideQuery . name = $D . params . slide ;
215215 slideQuery . location = $D . params . location ;
@@ -473,7 +473,7 @@ async function saveAnnotation(annotation) {
473473 const { x, y} = $CAMIC . viewer . viewport . getContainerSize ( ) ;
474474 annotation . viewer_size = { width : x , height : y } ;
475475 annotation . viewer_mag = $CAMIC . viewer . viewport . viewportToImageZoom ( $CAMIC . viewer . viewport . getZoom ( ) ) ;
476- nowTime = new Date ;
476+ let nowTime = new Date ;
477477 annotation . create_date = nowTime . toISOString ( ) ;
478478 $CAMIC . viewer . cazoomctrlInstance . base ;
479479 const rs = await $CAMIC . store . addLabelingAnnotation ( annotation ) . then ( ( d ) => d ) ;
@@ -651,7 +651,7 @@ async function loadingData() {
651651 const labelData = await $CAMIC . store . findLabeling ( { _id : labelId } ) . then ( ( d ) => d [ 0 ] ) ;
652652
653653
654- sublabels = [ ] ;
654+ let sublabels = [ ] ;
655655 if ( labelData . subrois && Array . isArray ( labelData . subrois ) ) {
656656 sublabels = [ ] ; // await $CAMIC.store.findLabelByIds(labelData.subrois).then((d)=>d);
657657 }
@@ -960,14 +960,14 @@ function addROIFormEvent() {
960960// override labeling code
961961
962962// holding place for annotations
963- labelsToSave = [ ] ;
963+ let labelsToSave = [ ] ;
964964
965965// deps
966966function convertToNormalized ( points , size , viewer ) {
967967 //const height = Math.round(viewer.imagingHelper.imgHeight);
968968 //const width = Math.round(viewer.imagingHelper.imgWidth);
969- width = 0.001 ;
970- height = 0.001 ;
969+ let width = 0.001 ;
970+ let height = 0.001 ;
971971 // convert
972972 const normalizedPoints = points . map ( ( p ) => [ p [ 0 ] / width , p [ 1 ] / height ] ) ;
973973 const normalizedSize = [ size [ 0 ] / width , size [ 0 ] / height ] ;
@@ -1025,12 +1025,12 @@ async function storePresetLabel(labelData) {
10251025 notes : labelData . type ,
10261026 } ;
10271027
1028- for ( i = 0 ; i < $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
1028+ for ( let i = 0 ; i < $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
10291029 . features . length ; i ++ ) {
1030- feature = $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
1030+ let feature = $CAMIC . viewer . canvasDrawInstance . getImageFeatureCollection ( )
10311031 . features [ i ] ;
1032- collectionName = ( await $CAMIC . store . getCollection ( $CAMIC . slideData . collections [ 0 ] ) ) [ 0 ] . name
1033- annotJson = {
1032+ let collectionName = ( await $CAMIC . store . getCollection ( $CAMIC . slideData . collections [ 0 ] ) ) [ 0 ] . name
1033+ let annotJson = {
10341034 creator : getUserId ( ) ,
10351035 created_date : new Date ( ) ,
10361036 collectionId : $CAMIC . slideData [ 'collections' ] [ 0 ] ,
@@ -1079,17 +1079,18 @@ async function storePresetLabel(labelData) {
10791079 }
10801080}
10811081
1082- camicOverrides = x => {
1082+ let camicOverrides = x => {
10831083 // bypass spen and mttool, otherwise in ../../common/smartpen/autoalign.js
10841084 $CAMIC . viewer . canvasDrawInstance . removeHandler ( 'stop-drawing' , addAnnotaiton ) ;
1085- spen = { }
1085+ let spen = { }
10861086 spen . initcanvas = console . log
10871087 spen . alignR = x => x
1088- mtool = { }
1088+ let mtool = { }
10891089 mtool . hash = x => x
10901090 mtool . populate = x => x
10911091 mtool . distance = x => x
1092- prevLabel = false
1092+ let prevLabel = false
1093+ }
10931094
10941095 function startLabeling ( l ) {
10951096 // each time switching label, store prev if applicable.
@@ -1131,7 +1132,7 @@ camicOverrides = x=>{
11311132 }
11321133 }
11331134
1134- meowlabel = {
1135+ let meowlabel = {
11351136 "id" : "999" ,
11361137 "type" :"Meowing" ,
11371138 "mode" : "free" ,
@@ -1140,21 +1141,21 @@ camicOverrides = x=>{
11401141 }
11411142
11421143
1143- lymphLabel = {
1144+ let lymphLabel = {
11441145 "id" : "903" ,
11451146 "type" :"Lymphocyte" ,
11461147 "mode" : "point" ,
11471148 "color" : "#67a9cf"
11481149 }
11491150
1150- stromaLabel = {
1151+ let stromaLabel = {
11511152 "id" : "902" ,
11521153 "type" :"Stroma" ,
11531154 "mode" : "free" ,
11541155 "color" : "#f1a340"
11551156 }
11561157
1157- tumorLabel = {
1158+ let tumorLabel = {
11581159 "id" : "901" ,
11591160 "type" :"Tumor_Cluster" ,
11601161 "mode" : "free" ,
@@ -1208,8 +1209,8 @@ camicOverrides = x=>{
12081209 function multiAnnotationRender ( ctx , data ) {
12091210 const imagingHelper = this . viewer . imagingHelper ;
12101211 const lineWidth = ( imagingHelper . physicalToDataX ( 2 ) - imagingHelper . physicalToDataX ( 0 ) ) >> 0 ;
1211- for ( index = 0 ; index < data . geometries . features . length ; index ++ ) {
1212- polygon = data . geometries . features [ index ] ;
1212+ for ( let index = 0 ; index < data . geometries . features . length ; index ++ ) {
1213+ let polygon = data . geometries . features [ index ] ;
12131214 const type = polygon . geometry . type ;
12141215 const color = polygon . properties . style . color ;
12151216
@@ -1271,13 +1272,11 @@ camicOverrides = x=>{
12711272
12721273
12731274 async function renderPrevAnnots ( ) {
1274- data = await $CAMIC . store . findMark ( $D . params . slideId ) ;
1275- for ( d in data ) {
1275+ let data = await $CAMIC . store . findMark ( $D . params . slideId ) ;
1276+ for ( let d in data ) {
12761277 // check if creator is the same, only show if so.
12771278 if ( getUserId ( ) == d . creator ) {
12781279 showAnnotation ( d )
12791280 }
12801281 }
1281- }
1282-
1283- }
1282+ }
0 commit comments