ngl_decode_scene | R Documentation |
ngl_decode_scene
takes a Neuroglancer scene from your web
browser and turns it into an R list
object that can be
programmatically manipulated e.g. to add/remove segments. Manipulate these
scenes with ngl_segments
, ngl_layers
. See
ngl_encode_url
to turn a scene back into a URL to open in your
browser.
ngl_decode_scene(
x,
return.json = FALSE,
simplifyVector = TRUE,
simplifyDataFrame = FALSE,
...
)
x |
Character vector containing single Neuroglancer URL or a json block |
return.json |
When |
simplifyVector |
coerce JSON arrays containing only primitives into an atomic vector |
simplifyDataFrame |
coerce JSON arrays containing only records (JSON objects) into a data frame |
... |
additional arguments passed to |
An R list with additional class ngscene
describing the scene,
or, when return.json=TRUE
, a character vector.
URLdecode
, fromJSON
Other neuroglancer-urls:
flywire_ids()
,
flywire_scene()
,
ngl_blank_scene()
,
ngl_encode_url()
,
ngl_segments()
,
open_fafb_ngl()
# get sample FlyWire URL
fw_url=with_segmentation('flywire31', getOption('fafbseg.sampleurl'))
# only a 0 (dummy) segment id present
ngl_segments(fw_url)
#
fw_sc=ngl_decode_scene(fw_url)
fw_sc
# add two segments
fw_sc=fw_sc+c("720575940621039145", "720575940626877799")
ngl_segments(fw_sc)
# remove that 0 segment
fw_sc=fw_sc-0
ngl_segments(fw_sc)
# repeated segments are ignored i.e. no duplicates
ngl_segments(fw_sc+"720575940621039145")
# convert back to a URL, nb this depends on choose_segmentation
ngl_encode_url(fw_sc)
## Not run:
# open in your default browser
browseURL(ngl_encode_url(fw_sc))
## End(Not run)
## Not run:
ngl_decode_scene("<someneuroglancerurl>")
# decode scene from URL currently on clipboard
scene=ngl_decode_scene(clipr::read_clip())
# open a Neuroglancer URL in CATMAID
ngu="<someurl>"
library(elmr)
open_fafb(ngl_decode_scene(ngu))
# Or store the URL rather than opening it
cmu=open_fafb(ngl_decode_scene(ngu), open=FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.