Skip to content

Commit

Permalink
Fixed non-integer search radius issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dipterix committed Oct 13, 2024
1 parent 8b10f9e commit 4c1e669
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]", role = c("aut", "cre", "cph")),
person("John", "Magnotti", email = "[email protected]", role = c("ctb", "res")),
Expand Down
10 changes: 5 additions & 5 deletions R/class_brainelectrodes.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -479,7 +480,6 @@ BrainElectrodes <- R6::R6Class(
}

voxel_count <- length(distance)
sel <- distance == 0

unknown_labels <- data.frame(
CenterValue = NA_real_,
Expand All @@ -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)
Expand Down

0 comments on commit 4c1e669

Please sign in to comment.