Skip to content

Commit

Permalink
try no declare
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Jan 30, 2025
1 parent db8a601 commit b9cd976
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions apps/labeling/roiMarking.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const annotationType = {
'#0000FF': 'lymphocytes',
'#00FFFF': 'plasma',
};
let $CAMIC = null;
$CAMIC = null;
// for all instances of UI components
const $UI = {};

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1131,7 +1131,7 @@ let camicOverrides = ()=>{
}
}

let meowlabel = {
meowlabel = {
"id": "999",
"type":"Meowing",
"mode": "free",
Expand All @@ -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",
Expand Down Expand Up @@ -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<data.geometries.features.length; index++){
let polygon = data.geometries.features[index];
for (index=0; index<data.geometries.features.length; index++){
polygon = data.geometries.features[index];
const type = polygon.geometry.type;
const color = polygon.properties.style.color;

Expand Down Expand Up @@ -1271,8 +1271,8 @@ let camicOverrides = ()=>{


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)
Expand Down

0 comments on commit b9cd976

Please sign in to comment.