From 4c1e669d4a459698c39a4777648e8d4f20e5e125 Mon Sep 17 00:00:00 2001 From: dipterix Date: Sun, 13 Oct 2024 17:24:15 -0400 Subject: [PATCH] Fixed non-integer search radius issue --- CHANGELOG.md | 5 +++-- DESCRIPTION | 2 +- R/class_brainelectrodes.R | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2d60bed..daee0a4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changes since last CRAN release -* `675c56c5 (HEAD -> master)` [_`dipterix`_]: Adjust electrode position can be done under volumetric mode to improve user experience; Electrodes with prototype geometries will use the prototype to infer the locations rather than spacial calculation; Added keyboard shortcut for registering from crosshair -* `0c3164e0 (origin/master, origin/HEAD)` [_`dipterix`_]: Added `get_atlas_values` for continuous atlases such as binary or probablistic `ROI`. The radius refers to maximum `RAS` distance instead of voxel indexing distance, hence more accurate when the atlas volume has imbalanced slice count. +* `f9f08bf9 (HEAD -> master)` [_`dipterix`_]: Fixed non-integer search radius issue +* `8b10f9ee (origin/master, origin/HEAD)` [_`dipterix`_]: Adjust electrode position can be done under volumetric mode to improve user experience; Electrodes with prototype geometries will use the prototype to infer the locations rather than spacial calculation; Added keyboard shortcut for registering from crosshair +* `0c3164e0` [_`dipterix`_]: Added `get_atlas_values` for continuous atlases such as binary or probablistic `ROI`. The radius refers to maximum `RAS` distance instead of voxel indexing distance, hence more accurate when the atlas volume has imbalanced slice count. * `161545b2` [_`dipterix`_]: Renamed `active-voxel` to `column-row-slice` * `ad4de70a` [_`dipterix`_]: `Voxel` filter is linear now when displayed at side slices only and when the slice mode is not `active-voxel` * `8f62ef5f` [_`dipterix`_]: Fixed drifting issue when visualizing via active `voxel` mode; Added direction arrow helper to `DBS` (or electrodes with non-zero model up vectors) diff --git a/DESCRIPTION b/DESCRIPTION index 8212fb55..680e8705 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: threeBrain Type: Package Title: Your Advanced 3D Brain Visualization -Version: 1.1.1.9024 +Version: 1.1.1.9025 Authors@R: c( person("Zhengjia", "Wang", email = "dipterix.wang@gmail.com", role = c("aut", "cre", "cph")), person("John", "Magnotti", email = "John.Magnotti@Pennmedicine.upenn.edu", role = c("ctb", "res")), diff --git a/R/class_brainelectrodes.R b/R/class_brainelectrodes.R index 0c9ff68d..c21b6268 100644 --- a/R/class_brainelectrodes.R +++ b/R/class_brainelectrodes.R @@ -459,11 +459,12 @@ BrainElectrodes <- R6::R6Class( if( radius > 0 ) { # columns of ras_to_ijk are incremental steps along voxel-index space max_index_radius <- max(abs(ras_to_ijk[, 1:3])) * radius + max_radius_int <- ceiling(max_index_radius) # IJK offsets deltas <- t(as.matrix(expand.grid( - seq.int(-max_index_radius, max_index_radius), - seq.int(-max_index_radius, max_index_radius), - seq.int(-max_index_radius, max_index_radius) + seq.int(-max_radius_int, max_radius_int), + seq.int(-max_radius_int, max_radius_int), + seq.int(-max_radius_int, max_radius_int) ))) # actual offsets in RAS ras_delta <- atlas$Norig[1:3, 1:3] %*% deltas @@ -479,7 +480,6 @@ BrainElectrodes <- R6::R6Class( } voxel_count <- length(distance) - sel <- distance == 0 unknown_labels <- data.frame( CenterValue = NA_real_, @@ -496,7 +496,7 @@ BrainElectrodes <- R6::R6Class( return(unknown_labels) } values <- atlas$data[ijk0 + deltas] - center_value <- values[ sel ] + center_value <- atlas$data[ijk0] values <- values[!is.na(values)] if(!length(values)) { return(unknown_labels)