open_fafb: Generate URLs to open FAFB CATMAID in browser at a given XYZ...

View source: R/open_fafb.R

open_fafbR Documentation

Generate URLs to open FAFB CATMAID in browser at a given XYZ location

Description

Generate URLs to open FAFB CATMAID in browser at a given XYZ location

Usage

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,
  ...
)

mirror_fafb_url(url, ...)

Arguments

x

A numeric vector or any object compatible with xyzmatrix (see details)

s

Optional selection function of the type returned by select3d

mirror

Whether to mirror the point to the opposite side of the brain

sample

The template brain space associated with the coordinates in x

rowwise

When rowwise=TRUE each point in x is converted to a separate URL.

open

Whether to open the url in the browser or simply return it. Defaults to TRUE when R is running in interactive mode.

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 catmaid_connection that specifies the server URL (otherwise a hardcoded URL will be used).

...

Additional arguments to be added to URL or sent to mirror_brain.

url

a CATMAID URL.

Details

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.

See Also

xform_brain, catmaid_get_treenodes_detail

Examples

open_fafb(c(316, 143, 26), sample=JFRC2013, open=FALSE)
library(nat)
## Not run: 
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())

## End(Not run)


# make one URL for each row of the input
open_fafb(matrix(runif(n=6, max=1000), ncol = 3), rowwise=TRUE)



## 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, conn = catmaid::vfbcatmaid('fafb'))
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)


## Not run: 
# copy results to clipboard e.g. to paste into a spreadsheet
library(clipr)
write_clip(tagged_details)

## End(Not run)

jefferis/elmr documentation built on Sept. 9, 2023, 1:54 p.m.