diff --git a/NAMESPACE b/NAMESPACE index e3e543d..ec49eb4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -65,6 +65,7 @@ export(banc_segid_from_cellid) export(banc_set_token) export(banc_side_view) export(banc_to_JRC2018F) +export(banc_updateids) export(banc_upload_mesh) export(banc_view) export(banc_vnc_side_view) diff --git a/R/ggplot2.R b/R/ggplot2.R index adb85c8..74d9b6e 100644 --- a/R/ggplot2.R +++ b/R/ggplot2.R @@ -17,6 +17,7 @@ #' @param filename Optional. If provided, the plot will be saved to this file. If NULL (default), the plot will be displayed but not saved. #' @param width Numeric. The width of the output plot in inches. Default is 16. #' @param height Numeric. The height of the output plot in inches. Default is 16. +#' @param alpha Vector of alpha values for neurons 1, 2 and 3. If a single value, applied to all. #' #' @return If filename is NULL, the function returns a ggplot object. If filename is provided, the function saves the plot and returns invisibly. #' diff --git a/R/ids.R b/R/ids.R index 325af59..681ff0a 100644 --- a/R/ids.R +++ b/R/ids.R @@ -63,7 +63,7 @@ banc_leaves <- function(x, integer64=TRUE, ...) { #' @examples #' \dontrun{ #' # a point from neuroglancer, should map to 648518346498932033 -#' banc_xyz2id(cbind(34495, 82783, 1954), rawcoords=TRUE) +#' banc_xyz2id(cbind(438976,985856,215955), rawcoords=FALSE) #' } banc_xyz2id <- function(xyz, rawcoords=FALSE, @@ -111,7 +111,6 @@ banc_islatest <- function(x, timestamp=NULL, ...) { with_banc(flywire_islatest(x=x, timestamp = timestamp, ...)) } - #' Find the latest id for a banc root id #' #' @inheritParams fafbseg::flywire_latestid @@ -128,6 +127,17 @@ banc_latestid <- function(rootid, sample=1000L, cloudvolume.url=NULL, Verbose=FA with_banc(fafbseg::flywire_latestid(rootid=rootid, sample = sample, Verbose=Verbose, ...)) } +#' @export +#' @rdname banc_latestid +banc_updateids <- function(rootid, ...){ + old <- !banc_islatest(rootid, ...) + old[is.na(old)] <- TRUE + #cat("latest/outdated: ",table(old)) + updated <- banc_latestid(x[old], ...) + rootid[old] <- updated + rootid +} + #' Return a vector of banc root ids from diverse inputs #' #' @param x A data.frame, URL or vector of ids @@ -141,7 +151,7 @@ banc_latestid <- function(rootid, sample=1000L, cloudvolume.url=NULL, Verbose=FA #' banc_ids(data.frame(rootid="648518346474360770")) banc_ids <- function(x, integer64=NA) { if(is.data.frame(x)) { - colstocheck=c("rootid", "id", "pre_id", "post_id") + colstocheck=c("rootid", "id", "pre_id", "post_id", "root_id") for(col in colstocheck) { if(col %in% colnames(x)) return(banc_ids(x[[col]], integer64 = integer64)) diff --git a/man/banc_latestid.Rd b/man/banc_latestid.Rd index 0c52b33..b8709c0 100644 --- a/man/banc_latestid.Rd +++ b/man/banc_latestid.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/ids.R \name{banc_latestid} \alias{banc_latestid} +\alias{banc_updateids} \title{Find the latest id for a banc root id} \usage{ banc_latestid( @@ -11,6 +12,8 @@ banc_latestid( Verbose = FALSE, ... ) + +banc_updateids(rootid, ...) } \arguments{ \item{rootid}{One ore more FlyWire rootids defining a segment (in any form diff --git a/man/banc_neuron_comparison_plot.Rd b/man/banc_neuron_comparison_plot.Rd index 68c9622..0658509 100644 --- a/man/banc_neuron_comparison_plot.Rd +++ b/man/banc_neuron_comparison_plot.Rd @@ -15,6 +15,7 @@ banc_neuron_comparison_plot( banc_brain_neuropil = NULL, banc_vnc_neuropil = NULL, banc_neuropil = NULL, + alpha = 0.5, filename = NULL, width = 16, height = 16 @@ -41,6 +42,8 @@ banc_neuron_comparison_plot( \item{banc_neuropil}{A mesh object representing the entire neuropil. Default is banc_neuropil.surf.} +\item{alpha}{Vector of alpha values for neurons 1, 2 and 3. If a single value, applied to all.} + \item{filename}{Optional. If provided, the plot will be saved to this file. If NULL (default), the plot will be displayed but not saved.} \item{width}{Numeric. The width of the output plot in inches. Default is 16.} diff --git a/man/banc_xyz2id.Rd b/man/banc_xyz2id.Rd index e53a725..15fd4a3 100644 --- a/man/banc_xyz2id.Rd +++ b/man/banc_xyz2id.Rd @@ -38,7 +38,7 @@ voxel coordinates must be set to 4.25 in x-y to give the correct answers. \examples{ \dontrun{ # a point from neuroglancer, should map to 648518346498932033 -banc_xyz2id(cbind(34495, 82783, 1954), rawcoords=TRUE) +banc_xyz2id(cbind(438976,985856,215955), rawcoords=FALSE) } } \seealso{