@@ -148,7 +148,7 @@ function closeSecondaryViewer(){
148148 minor . classList . add ( 'none' ) ;
149149 minor . classList . remove ( 'right' ) ;
150150 $CAMIC . viewer . controls . bottomright . style . display = '' ;
151-
151+
152152 const li = $UI . toolbar . getSubTool ( 'sbsviewer' ) ;
153153 li . querySelector ( 'input[type="checkbox"]' ) . checked = false ;
154154 Loading . close ( ) ;
@@ -192,7 +192,7 @@ function heatmapSettingChanged(data){
192192 } else {
193193 $CAMIC . viewer . heatmap . changeMode ( data . mode ) ;
194194 }
195-
195+
196196}
197197
198198function heatmapOpacityChanaged ( data ) {
@@ -305,15 +305,15 @@ function toggleHeatMapDataList(e){
305305 break ;
306306 // default:
307307 // console.warn('Editor error');
308- // break;
308+ // break;
309309 }
310310}
311311
312312function heatMapEditedListOn ( ) {
313313 $UI . editedListSideMenu . open ( ) ;
314314 const li = $UI . toolbar . getSubTool ( 'editeddate' )
315315 li . querySelector ( 'input[type=checkbox]' ) . checked = true ;
316- toggleHeatMapSettings ( { checked :false , isOpen :false } ) ;
316+ toggleHeatMapSettings ( { checked :false , isOpen :false } ) ;
317317 heatmapEditorOff ( ) ;
318318 measurementOff ( ) ;
319319 magnifierOff ( ) ;
@@ -322,7 +322,7 @@ function heatMapEditedListOn(){
322322function heatMapEditedListOff ( ) {
323323 $UI . editedListSideMenu . close ( ) ;
324324 const li = $UI . toolbar . getSubTool ( 'editeddate' )
325- li . querySelector ( 'input[type=checkbox]' ) . checked = false ;
325+ li . querySelector ( 'input[type=checkbox]' ) . checked = false ;
326326
327327}
328328
@@ -336,7 +336,7 @@ function toggleHeatMapEditor(e){
336336 break ;
337337 // default:
338338 // console.warn('Editor error');
339- // break;
339+ // break;
340340 }
341341}
342342
@@ -349,7 +349,7 @@ function heatMapEditorOn(){
349349 measurementOff ( ) ;
350350 magnifierOff ( ) ;
351351 if ( ! $CAMIC . viewer . canvasDrawInstance ) return ;
352-
352+
353353 const data = $UI . heatmapEditorPanel . getCurrentOperation ( ) ;
354354 if ( data ) {
355355 $CAMIC . viewer . canvasDrawInstance . style . color = data [ 3 ] ;
@@ -362,7 +362,7 @@ function heatmapEditorOff(){
362362 const li = $UI . toolbar . getSubTool ( 'editor' ) ;
363363 li . querySelector ( 'input[type=checkbox]' ) . checked = false ;
364364 $CAMIC . viewer . canvasDrawInstance . drawOff ( ) ;
365-
365+
366366}
367367
368368/*
@@ -373,19 +373,20 @@ function heatmapEditorOff(){
373373async function onUpdateHeatmapFields ( ) {
374374 if ( ! confirm ( 'Do You Want To Update Threshold?' ) ) return ;
375375 Loading . open ( document . body , 'Saving Threshold ... ' ) ;
376-
376+
377377 const setting = {
378378 mode :$CAMIC . viewer . heatmap . mode
379379 } ;
380-
380+
381381 if ( $CAMIC . viewer . heatmap . mode == 'gradient' ) setting . field = $CAMIC . viewer . heatmap . _currentField . name
382-
382+
383383 const fields = $D . heatMapData . provenance . analysis . fields ;
384- const subject = $D . heatMapData . provenance . image . subject_id ;
385- const caseid = $D . heatMapData . provenance . image . case_id ;
386- const exec = $D . heatMapData . provenance . analysis . execution_id ;
387- const rs = await $CAMIC . store . updateHeatmapFields ( subject , caseid , exec , JSON . stringify ( fields ) , JSON . stringify ( setting ) ) ;
388-
384+ const specimen = $D . heatMapData . provenance . image . specimen ;
385+ const slide = $D . heatMapData . provenance . image . slide ;
386+ const study = $D . heatMapData . provenance . image . study ;
387+ const exec = $D . heatMapData . provenance . analysis . execution_id ;
388+ const rs = await $CAMIC . store . updateHeatmapFields ( slide , exec , JSON . stringify ( fields ) , JSON . stringify ( setting ) ) ;
389+
389390 //const rs = await $CAMIC.store.updateHeatmap
390391 Loading . close ( ) ;
391392} ;
@@ -406,7 +407,7 @@ async function onExportEditData(){
406407 data :editData
407408 }
408409 // let data = JSON.parse(window.localStorage.getItem("mark"))
409-
410+
410411 // let text = ""
411412 // if (data) {
412413 // text = JSON.stringify(data.filter(x => {
@@ -433,17 +434,18 @@ function editorPenChange(data){
433434}
434435
435436async function saveEditData ( ) {
436-
437+
437438 if ( ! $CAMIC . viewer . canvasDrawInstance . _draws_data_ . length ) {
438439 alert ( 'No Data Edited!' ) ;
439440 return ;
440441 }
441442 Loading . open ( document . body , `Saving Edit Data ...` ) ;
442443 // does data exist
443- // user, subject , case, execution, data
444+ // user, specimen , case, execution, data
444445 const user = getUserId ( ) ;
445- const subject = $D . heatMapData . provenance . image . subject_id ;
446- const caseid = $D . heatMapData . provenance . image . case_id ;
446+ const specimen = $D . heatMapData . provenance . image . specimen ;
447+ const slide = $D . heatMapData . provenance . image . slide ;
448+ const study = $D . heatMapData . provenance . image . study ;
447449 const exec = $D . heatMapData . provenance . analysis . execution_id ;
448450
449451 // get draw lines info
@@ -466,14 +468,14 @@ async function saveEditData(){
466468 // add new one or update old one
467469 const now = getDateInString ( ) ;
468470 const editData = $D . editedDataClusters . toJSON ( )
469-
471+
470472
471473 // delete old one
472474 let create_date = now ;
473475
474476 if ( ImgloaderMode != 'imgbox' ) {
475477 // find editor data
476- const data = await $CAMIC . store . findHeatmapEdit ( user , subject , caseid , exec ) ;
478+ const data = await $CAMIC . store . findHeatmapEdit ( user , slide , exec ) ;
477479 // error
478480 if ( ! Array . isArray ( data ) && data . hasError && data . hasError == true ) {
479481 $UI . message . addError ( data . message ) ;
@@ -483,7 +485,7 @@ async function saveEditData(){
483485
484486 if ( data . length !== 0 ) {
485487 create_date = data [ 0 ] . create_date ;
486- const del = await $CAMIC . store . deleteHeatmapEdit ( user , subject , caseid , exec ) ;
488+ const del = await $CAMIC . store . deleteHeatmapEdit ( user , slide , exec ) ;
487489 // error
488490 if ( del . hasError && del . hasError == true ) {
489491 $UI . message . addError ( del . message ) ;
@@ -541,10 +543,10 @@ function getDateInString(){
541543function locateEditData ( data ) {
542544 const cluster = data . cluster ;
543545 const index = data . index ;
544-
546+
545547 const rect = getViewRect (
546548 data . cluster . editDataArray [ index ] ,
547- $D . heatMapData . provenance . analysis . size ,
549+ $D . heatMapData . provenance . analysis . size ,
548550 $CAMIC . viewer
549551 ) ;
550552
@@ -564,16 +566,17 @@ async function onDeleteEditData(data){
564566
565567 // delete data
566568 const user = getUserId ( ) ;
567- const subject = $D . heatMapData . provenance . image . subject_id ;
568- const caseid = $D . heatMapData . provenance . image . case_id ;
569- const exec = $D . heatMapData . provenance . analysis . execution_id ;
570-
569+ const specimen = $D . heatMapData . provenance . image . specimen ;
570+ const slide = $D . heatMapData . provenance . image . slide ;
571+ const study = $D . heatMapData . provenance . image . study ;
572+ const exec = $D . heatMapData . provenance . analysis . execution_id ;
573+
571574 let rs = null ;
572575 if ( ImgloaderMode != 'imgbox' ) {
573576 if ( $D . editedDataClusters . isEmpty ( ) ) {
574- rs = await $CAMIC . store . deleteHeatmapEdit ( user , subject , caseid , exec ) ;
577+ rs = await $CAMIC . store . deleteHeatmapEdit ( user , slide , exec ) ;
575578 } else {
576- rs = await $CAMIC . store . updateHeatmapEdit ( user , subject , caseid , exec , JSON . stringify ( $D . editedDataClusters . toJSON ( ) ) ) ;
579+ rs = await $CAMIC . store . updateHeatmapEdit ( user , slide , exec , JSON . stringify ( $D . editedDataClusters . toJSON ( ) ) ) ;
577580 }
578581 // error
579582 if ( rs . hasError && rs . hasError == true ) {
@@ -585,17 +588,17 @@ async function onDeleteEditData(data){
585588 }
586589 }
587590 Loading . close ( ) ;
588-
591+
589592
590593
591594 // refresh UI
592595 $UI . heatmapEditedDataPanel . __refresh ( ) ;
593596 $CAMIC . viewer . heatmap . updateView ( 0 ) ;
594597
595598 // close pen panel
596-
599+
597600 // open list panel
598-
601+
599602}
600603
601604function findPenInfoByColor ( color , info ) {
@@ -612,7 +615,7 @@ function getViewRect(points , size, viewer){ // points in normalized, size in no
612615
613616
614617 return viewport . imageToViewportRectangle ( min [ 0 ] , min [ 1 ] , max [ 0 ] - min [ 0 ] , max [ 1 ] - min [ 1 ] ) ;
615-
618+
616619}
617620
618621function getBounds ( points ) { // return x,y,w,h
@@ -633,4 +636,3 @@ function getBounds(points){ // return x,y,w,h
633636 max :max
634637 } ;
635638}
636-
0 commit comments