From 54e01c9a3ac561d7158770a35fc2c0e9b9b1266f Mon Sep 17 00:00:00 2001 From: Matteo Visconti di Oleggio Castello Date: Fri, 19 Jul 2024 18:54:04 +0200 Subject: [PATCH] FIX logic for volumes --- cortex/webgl/resources/js/mriview.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/cortex/webgl/resources/js/mriview.js b/cortex/webgl/resources/js/mriview.js index 10f32955..75e5baa6 100644 --- a/cortex/webgl/resources/js/mriview.js +++ b/cortex/webgl/resources/js/mriview.js @@ -691,9 +691,6 @@ var mriview = (function(module) { event.clientY, ) this.svgOn(this.surfs) - if (coords === -1) { - return -1 - } // console.log("coords: " + JSON.stringify(coords)); return coords } @@ -704,7 +701,11 @@ var mriview = (function(module) { if (this.surfs[0].pick && this.surfs[0].surf.picker) { let coords = this.getCoords(event) // console.log(coords) - return this.xyxToI(coords.voxel.x, coords.voxel.y, coords.voxel.z) + if (coords !== -1) { + return this.xyxToI(coords.voxel.x, coords.voxel.y, coords.voxel.z) + } else { + return -1 + } } return -1 }; @@ -833,10 +834,12 @@ var mriview = (function(module) { value = this.active.data[0].verts[0][hemiIdx].array[vertex] } } else { - // Get index of the mosaic to get the value - let mouse_index = this.xyxToI(coords.voxel.x, coords.voxel.y, coords.voxel.z) - if (mouse_index !== -1) { - value = this.active.data[0].textures[0].image.data[mouse_index] + if (coords !== -1) { + // Get index of the mosaic to get the value + let mouse_index = this.xyxToI(coords.voxel.x, coords.voxel.y, coords.voxel.z) + if (mouse_index !== -1) { + value = this.active.data[0].textures[0].image.data[mouse_index] + } } } console.log("Value on click: " + value);