From 738b6f1aab7769f5d0135e266d4b2e64df4d0edc Mon Sep 17 00:00:00 2001 From: AhmedBasem Date: Mon, 14 Oct 2024 20:13:22 +0300 Subject: [PATCH] Fix selected voxel coordinates --- website/nifti-viewer/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/nifti-viewer/index.js b/website/nifti-viewer/index.js index 482889a..ec7b28c 100644 --- a/website/nifti-viewer/index.js +++ b/website/nifti-viewer/index.js @@ -89,9 +89,9 @@ function handleVoxelClick(currentVoxel) { const [nx, ny, nz, nt] = dims; let [voxelX, voxelY, voxelZ] = currentVoxel; - voxelX = Math.min(Math.max(Math.round(voxelX), 1), nx) - 1; - voxelY = Math.min(Math.max(ny - Math.round(voxelY), 1), ny) - 1; - voxelZ = Math.min(Math.max(nz - Math.round(voxelZ), 1), nz) - 1; + voxelX = Math.min(Math.max(Math.round(voxelX), 1), nx); + voxelY = Math.min(Math.max(ny - Math.round(voxelY), 1), ny); + voxelZ = Math.min(Math.max(nz - Math.round(voxelZ), 1), nz); const voxelValues = getVoxelValuesAcrossTime(voxelX, voxelY, voxelZ, nx, ny, nz, nt); updateVoxelCoordinatesDisplay(voxelX + 1, voxelY + 1, voxelZ + 1);