open_fafb_ngl | R Documentation |
Construct Neuroglancer URL based on 3D location data
open_fafb_ngl(
x,
s = rgl::select3d(),
zoomFactor = 8,
coords.only = FALSE,
open = interactive() && !coords.only,
sample = NULL,
reference = NULL,
sampleurl = NULL,
...
)
x |
A numeric vector OR any object compatible with
|
s |
Optional selection function of the type returned by
|
zoomFactor |
The Neuroglancer zoomFactor (bigger means zoomed out) |
coords.only |
Return raw coordinate string for pasting into Neuroglancer position widget (top left of screen) |
open |
Whether or not to open the URL in a browser - this defaults to
|
sample , reference |
Template space of the input object |
sampleurl |
A sample URL that defines your Neuroglancer dataset. |
... |
Additional arguments passed to |
Neuroglancer scenes seem to be specified in a single URL that encodes a json object defining layers to display, position etc. This function works by taking a sample URL defining such a scene and then editing it to point to a new 3D location / adjust zoom.
This package comes with 4 different default scene urls specified via
choose_segmentation
or with_segmentation
. This
is the easiest way to choose a particular segmentation. You can also
specify a different sample URL via the sampleurl
argument; it will
be remembered for the rest of the R session. If you regularly use a
particular kind of scene URL, you can set options(fafbseg.sampleurl)
in your Rprofile
file.
A character vector with a Neuroglancer URL or coordinate string
(invisibly when open=TRUE
)
Other neuroglancer-urls:
flywire_ids()
,
flywire_scene()
,
ngl_blank_scene()
,
ngl_decode_scene()
,
ngl_encode_url()
,
ngl_segments()
u=paste0("https://fafb.catmaid.virtualflybrain.org/?pid=2&zp=131280&",
"yp=170014.98879622458&xp=426584.81386896875&tool=navigator&sid0=2&s0=-1")
# translate URL but don't open browser
open_fafb_ngl(u, open=FALSE)
# produce an x,y,z string to paste into Neuroglancer
open_fafb_ngl(u, coords.only=TRUE)
# translate URL converting from FAFB14 to FlyWire coordinates
# (only a small shift)
open_fafb_ngl(u, sample="FAFB14", reference="FlyWire", open=FALSE)
## Not run:
# copy CATMAID URL from clipboard and Neuroglancer coords to clipboard
clipr::write_clip(open_fafb_ngl(clipr::read_clip(), coords.only=TRUE))
# Open a location in MB peduncle with current preferred segmentation
open_fafb_ngl(c(433440, 168344, 131200))
# choose a particular segmentation (Google FAFB)
with_segmentation("20190805", open_fafb_ngl(c(433440, 168344, 131200),
zoomFactor=2))
# or FlyWire
with_segmentation("flywire", open_fafb_ngl(c(433440, 168344, 131200)))
# ... and translate FAFB14 to FlyWire coordinates
with_segmentation("flywire", open_fafb_ngl(c(433440, 168344, 131200),
sample="FAFB14", reference="FlyWire", zoomFactor=2))
# open a CATMAID URL in Neuroglancer
open_fafb_ngl(u)
# Set an existing scene URL (pointing to any old location) to act as
# the template for open_fafb_ngl
# nb the package sets one for you on startup if you haven't set yourself
options(fafbseg.sampleurl="https://<neuroglancerlurl>")
# Edit your R profile if you want to set a different default
usethis::edit_r_profile()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.