ngl_add_colours | R Documentation |
Add colours to the neuroglancer scene
ngl_add_colours(x, colours, layer = NULL)
x |
neuroglancer scene in any form acceptable to |
colours |
A dataframe with two columns, where the first is the id and
the second is the colour, OR a character vector of colours named by the ids
or one colour which would be added to all the displayed neurons. See
|
layer |
Optional character vector specifying the layer to colour. When
|
A neuroglancer scene object (see ngl_decode_scene
)
fw_url=with_segmentation('flywire31', getOption('fafbseg.sampleurl'))
ngl_add_colours(fw_url, colours=c("720575940614404544"="red"))
## Not run:
# colour all neurons in the URL on the clipboard red.
# Then convert back to URL and open in default browser
browseURL(as.character(ngl_add_colours(clipr::read_clip(), col="red")))
# Let's colour neurons from these 3 scenes in red, green and blue
u1="https://ngl.flywire.ai/?json_url=https://globalv1.flywire-daf.com/nglstate/5695474417795072"
u2="https://ngl.flywire.ai/?json_url=https://globalv1.flywire-daf.com/nglstate/5198787572137984"
u3="https://ngl.flywire.ai/?json_url=https://globalv1.flywire-daf.com/nglstate/5673953041317888"
# sequentially build up a data.frame with the colour information
# note that col will be recycled to the same length as the number of segments
colourdf=data.frame(ids=ngl_segments(u1), col='red')
colourdf=rbind(colourdf, data.frame(ids=ngl_segments(u2), col='green'))
colourdf=rbind(colourdf, data.frame(ids=ngl_segments(u3), col='blue'))
# apply that to the first URL
sc=ngl_add_colours(u1, colourdf)
browseURL(as.character(sc))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.