ngl_segments | R Documentation |
ngl_segments<-
replaces neuroglancer segments in a
neuroglancer scene parsed by ngl_decode_scene
.
ngl_segments(
x,
as_character = TRUE,
include_hidden = FALSE,
must_work = TRUE,
unique = FALSE,
...
)
ngl_segments(x) <- value
x |
Neuroglancer ids either as a vector of ids (character vector or
|
as_character |
Whether to return segments as character rather than numeric vector (the default is character for safety). |
Whether to include | |
must_work |
if |
unique |
When |
... |
Additional arguments passed to |
value |
Segment ids in any form understandable by |
For simple vector inputs, ngl_segments
will treat the values
"NA", "NAN", "NULL"
(all case insensitive) and ""
as NA.
ngl_segments<-
chooses the FlyWire style
segmentation_with_graph
layer if it exists otherwise the first
visible segmentation layer. Note that hiddenSegment will be removed
in this process
.
Numeric (or character) vector of segment ids, taken from the first segmentation layer (with a warning) if the scene contains more than one.
Other neuroglancer-urls:
flywire_ids()
,
flywire_scene()
,
ngl_blank_scene()
,
ngl_decode_scene()
,
ngl_encode_url()
,
open_fafb_ngl()
# -> character
ngl_segments(c(10950626347, 10952282491, 13307888342))
# turns these into numeric
ngl_segments(c("10950626347", "10952282491", "13307888342"), as_character=FALSE)
u="https://ngl.flywire.ai/?json_url=https://globalv1.flywire-daf.com/nglstate/5409525645443072"
ngl_segments(u, as_character = TRUE)
sc=ngl_decode_scene(u)
# set segments
ngl_segments(sc) <- c("720575940621039145")
# or a shortcut to add ids
sc=sc+c("720575940621039145", "720575940626877799")
sc
## Not run:
# paste resultant URL to clipboard to use in neuroglancer
clipr::write_clip(as.character(sc))
## End(Not run)
# you can also modify the URL directly
ngl_segments(u)=c("720575940621039145", "720575940626877799")
## Not run:
browseURL(u)
## Summary of different classes of input
# from clipboard
ngl_segments(clipr::read_clip())
# URL
ngl_segments("<ngl-scene-url>")
# path to file on disk
ngl_segments("/path/to/scene.json")
# R list
ngl_segments(scenelist)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.