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 catmaid_skids

Examples

if (FALSE) {
# Write selection file for neurons defined by annotation or name
write_catmaid_selection("PN", "pns.json")
write_catmaid_selection("name:AV6", "name:av6.json")

pns=read.neurons.catmaid("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)
}