R/read-neurons.R
fc_read_neurons.Rd
Reads FlyCircuit skeletons from http://www.flycircuit.tw/, and bridges them into the FCWB space.
fc_read_neurons(fc.ids, xform = TRUE, ...)
fc.ids | vector of valid FlyCircuit neuron ids. To acquire these in
bulk, see |
---|---|
xform | Whether or not to tranform neurons from their original space to
the |
... | additional arguments passed to methods |
A neuronlist
of FlyCircuit neurons registered in the intersex
FCWB brain space
fc_get_ids
, flycircuit-ids
,
read.neurons
#>#> #>#>#> #>fcn <- fc_read_neurons("Gad1-F-200234") plot3d(fcn) plot3d(FCWB)# NOT RUN { # We can also read all neurons clear3d() # nb this will take tens of minutes to hours fc.ids = fc_get_ids() fcns <- fc_read_neurons(fc.ids) plot3d(fcns) plot3d(FCWB, alpha = 0.1) ## Now mirror all neurons to the right of the brain # estimate whether soma is on left or right of midline # nb this assumes that FCWB brain surface is mirror symmetric # which is apporoximately but not exactly the case left.somas <- function(neuron, surf = FCWB.surf) { bb=boundingbox(surf) midline=(bb[1,1]+bb[2,1])/2 r = nat::rootpoints(neuron) somaposition = nat::xyzmatrix(neuron$d[r,]) somaposition[,"X"]>midline } leftsomas = unlist(nat::nlapply(fcns,left.somas)) fcsleft = nat.templatebrains::mirror_brain(fcns[leftsomas], brain = FCWB) fcns = c(fcns[!names(fcns)%in%names(fcsleft)],fcsleft) # }