Skip to content

Commit

Permalink
fix_electrode_color is exclusive by default; fixed color fixing iss…
Browse files Browse the repository at this point in the history
…ue for naive sphere electrodes
  • Loading branch information
dipterix committed May 26, 2024
1 parent 1dea870 commit 963859e
Show file tree
Hide file tree
Showing 5 changed files with 13 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
* `7b7a327b (HEAD -> master)` [_`dipterix`_]: Changed logo message
* `1e70580a (origin/master, origin/HEAD)` [_`dipterix`_]: Using better `RAVE` logo and fixed style issues; Changed shortcut `p` to toggling the visibility and `shift+p` to switching surface types
* `9db50120 (HEAD -> master)` [_`dipterix`_]: `fix_electrode_color` is exclusive by default; fixed color fixing issue for naive sphere electrodes
* `1dea870f (origin/master, origin/HEAD)` [_`dipterix`_]: Changed logo message
* `1e70580a` [_`dipterix`_]: Using better `RAVE` logo and fixed style issues; Changed shortcut `p` to toggling the visibility and `shift+p` to switching surface types
* `9b76fa41` [_`dipterix`_]: Added logo to control panel to advertise the project
* `226994ba` [_`dipterix`_]: Added export `GLTF` binary format; Separate `3D` and `2D` canvas;
* `e556d025` [_`dipterix`_]: Converts `*h.pial.gii` to `FreeSurfer` format when the files are missing
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.0.9016
Version: 1.1.0.9017
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("aut", "res")),
Expand Down
10 changes: 7 additions & 3 deletions R/class_brainelectrodes.R
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ BrainElectrodes <- R6::R6Class(
#| \code{inclusive=false} (exclusive), then only \code{names} will
#| be fixed
#|
fix_electrode_color = function(number, color, names = NULL, inclusive = TRUE) {
fix_electrode_color = function(number, color, names = NULL, inclusive = FALSE) {

number <- as.integer(number)
if( !is.finite(number) || number <= 0 ) { return() }
Expand All @@ -727,11 +727,15 @@ BrainElectrodes <- R6::R6Class(
maps = list()
)
n_names <- length(names)
if(length(color) != n_names && n_names > 0) {
if(length(color) != n_names) {
if( n_names == 0 ) {
names <- "[None]"
n_names <- 1
}
color <- rep(color, ceiling(n_names / length(color)))
color <- color[seq_len(n_names)]
color_settings$maps <- structure(as.list(color), names = names)
}
color_settings$maps <- structure(as.list(color), names = names)
fixed_colors[[as.character(number)]] <- color_settings
}

Expand Down
2 changes: 1 addition & 1 deletion inst/threeBrainJS/dist/threebrain-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/threeBrainJS/dist/threebrain-main.js.map

Large diffs are not rendered by default.

0 comments on commit 963859e

Please sign in to comment.