diff --git a/DESCRIPTION b/DESCRIPTION index 723360cb..76bf63c1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: threeBrain Type: Package Title: 3D Brain Visualization -Version: 1.0.1.9021 +Version: 1.0.1.9022 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")), diff --git a/R/class_brain.R b/R/class_brain.R index 25483e1f..c1f732fc 100644 --- a/R/class_brain.R +++ b/R/class_brain.R @@ -892,7 +892,8 @@ Brain2 <- R6::R6Class( plot_electrodes_on_slices = function( electrodes_to_plot = "all", volume = NULL, elec_table = NULL, - zoom = 1, electrode_color = "green", electrode_size = 2, ..., + zoom = 1, adjust_brightness = NA, + electrode_color = "green", electrode_size = 2, ..., decoration = function(i, j) { graphics::points(0, 0, pch = 20, col = electrode_color, cex = electrode_size) @@ -936,14 +937,19 @@ Brain2 <- R6::R6Class( # load up volume and adjust brightness - adjust_brightness <- TRUE + if(is.null(volume)) { volume <- self$volumes$T1$object$group$group_data$volume_data$absolute_path - adjust_brightness <- FALSE + if(is.na(adjust_brightness)) { + adjust_brightness <- FALSE + } } if(!inherits(volume, "threeBrain.volume")) { volume <- read_volume(volume) } + if(is.na(adjust_brightness)) { + adjust_brightness <- TRUE + } if( adjust_brightness ) { qt <- quantile(volume$data, c(0, 0.95), na.rm = TRUE) volume$data[] <- (volume$data - qt[[1]]) / (qt[[2]] - qt[[1]]) * 255