R/open_fafb.R
open_fafb.Rd
Generate URLs to open FAFB CATMAID in browser at a given XYZ location
open_fafb( x, s = rgl::select3d(), mirror = FALSE, sample = elmr::FAFB, rowwise = NA, open = interactive() & !rowwise, zoom = 1, active_skeleton_id = NULL, active_node_id = NULL, server = NULL, ... )
x | A numeric vector or any object compatible with
|
---|---|
s | Optional selection function of the type returned by
|
mirror | Whether to mirror the point to the opposite side of the brain |
sample | The template brain space associated with the coordinates in
|
rowwise | When |
open | Whether to open the url in the browser or simply return it.
Defaults to |
zoom | The CATMAID zoom factor (defaults to 1) |
active_skeleton_id, active_node_id | Set highlighted skeleton and node in CATMAID. |
server | Optional string or |
... | Additional arguments to be added to URL. |
Note that the default behaviour is that if object x
contains
exactly one point then a single URL will be generated and by default
CATMAID will be opened immediately at that location. If there is more than
1 point, by default the function will stop and wait for the user to make an
interactive selection in a rgl
window.
You can control this behaviour by using the open
and rowwise
arguments. When open=FALSE
, then the URLs will be returned but not
opened in a web browser. If rowwise=TRUE
(i.e. multiple URLs are
being generated) then open
will be set to FALSE
.
When rowwise=TRUE
each point in x
is converted to a separate
URL. As a special case, if x
is a data.frame generated by
catmaid_get_treenodes_detail
then URLs will be generated for every
row (i.e. each treenode). See examples for details.
xform_brain
,
catmaid_get_treenodes_detail
#> [1] "https://neuropil.janelia.org/tracing/fafb/v14/?pid=1&zp=61259&yp=291206&xp=580356&tool=tracingtool&sid0=5&s0=1.000000"library(nat) if (FALSE) { open3d() plot3d(kcs20) # waits for user to draw a selection rectangle open_fafb(kcs20, sample=FCWB) # same but mirrors selected points to opposite hemisphere open_fafb(kcs20, sample=FCWB, mirror=TRUE) open_fafb(kcs20, sample=FCWB, server="https://bigbrain.org/tracing") # Uses last CATMAID connection to specify URL to open open_fafb(kcs20, sample=FCWB, server=catmaid_login()) } # \donttest{ # make one URL for each row of the input open_fafb(matrix(runif(n=6, max=1000), ncol = 3), rowwise=TRUE)#> [1] "https://neuropil.janelia.org/tracing/fafb/v14/?pid=1&zp=7&yp=601&xp=81&tool=tracingtool&sid0=5&s0=1.000000" #> [2] "https://neuropil.janelia.org/tracing/fafb/v14/?pid=1&zp=466&yp=157&xp=834&tool=tracingtool&sid0=5&s0=1.000000"# } # \donttest{ ## Special case using catmaid_get_treenodes_detail() as input # fetch a neuron and extract the node ids for a given tag n=read.neuron.catmaid(16) tagged = n$tags[['TODO']] tagged_details <- catmaid_get_treenodes_detail(tagged) # now find FAFB URLs tagged_details$url <- open_fafb(tagged_details) # take a look at results head(tagged_details)#> treenode_id parent_id x y z confidence radius skid #> 1 3068665 3068660 466368.6 232377.5 41360 5 -1 16 #> 2 3068677 3068676 466173.1 234684.7 40000 5 -1 16 #> 3 3068690 3068688 466321.6 231542.7 40080 5 32 16 #> 4 3068757 3068753 464086.1 240916.5 39280 5 32 16 #> 5 3068829 3068826 465499.3 244390.8 35480 5 81 16 #> 6 3073189 3073187 463303.9 248051.1 33320 5 198 16 #> edition_time user_id #> 1 1459444379 26 #> 2 1459444409 26 #> 3 1568560341 26 #> 4 1568560345 26 #> 5 1568560341 26 #> 6 1568560341 61 #> url #> 1 https://neuropil.janelia.org/tracing/fafb/v14/?pid=1&zp=41360&yp=232377&xp=466369&tool=tracingtool&sid0=5&s0=1.000000&active_skeleton_id=16&active_node_id=3068665 #> 2 https://neuropil.janelia.org/tracing/fafb/v14/?pid=1&zp=40000&yp=234685&xp=466173&tool=tracingtool&sid0=5&s0=1.000000&active_skeleton_id=16&active_node_id=3068677 #> 3 https://neuropil.janelia.org/tracing/fafb/v14/?pid=1&zp=40080&yp=231543&xp=466322&tool=tracingtool&sid0=5&s0=1.000000&active_skeleton_id=16&active_node_id=3068690 #> 4 https://neuropil.janelia.org/tracing/fafb/v14/?pid=1&zp=39280&yp=240916&xp=464086&tool=tracingtool&sid0=5&s0=1.000000&active_skeleton_id=16&active_node_id=3068757 #> 5 https://neuropil.janelia.org/tracing/fafb/v14/?pid=1&zp=35480&yp=244391&xp=465499&tool=tracingtool&sid0=5&s0=1.000000&active_skeleton_id=16&active_node_id=3068829 #> 6 https://neuropil.janelia.org/tracing/fafb/v14/?pid=1&zp=33320&yp=248051&xp=463304&tool=tracingtool&sid0=5&s0=1.000000&active_skeleton_id=16&active_node_id=3073189# } if (FALSE) { # copy results to clipboard e.g. to paste into a spreadsheet library(clipr) write_clip(tagged_details) }