Make a CATMAID selection file based on neuronlist or skids

write_catmaid_selection(x, f, color = NULL, opacity = NULL, ...)

Arguments

x

A neuronlist, data.frame or vector of skids

f

Path to output file (usually ends in .json)

color

Optional vector of colours in any format understood by col2rgb

opacity

Optional vector of opacities (alpha values) in range 0-1

...

Additional arguments passed to toJSON

See also

read_catmaid_selection

Examples

# NOT RUN {
pns=read.neurons.catmaid("annotation:^PN$")
# extract the glomerulus from the name
pns[, 'glomerulus'] = stringr::str_match(pns[, 'name'],
                                         ".*glomerulus ([A-z0-9]+) .*")[, 2]
pns[, 'glomerulus']=addNA(factor(pns[, 'glomerulus']))
# get the same colours that nat would normally use in a plot
plotres=plot3d(pns, col=glomerulus)
cols=attr(plotres,'df')$col
# write out selection file with those colours
write_catmaid_selection(pns, f='pns-by-glom.json', color=cols)
# }