R/neuron.R
stitch_neurons.Rd
Stitch multiple fragments into single neuron using nearest endpoints
stitch_neurons(x, prefer_soma = TRUE, sort = TRUE, warndist = 1000)
A neuronlist containing fragments of a single neuron
When TRUE (the default) the fragment tagged as the soma will be used as the master neuron.
When TRUE (the default) the fragments will be sorted by the number of nodes they contain before stitching.
If distance is greater than this value, create a warning.
A single neuron
object containing all input fragments.
Neurons will be ordered by default such the largest (by node count)
neuron with a soma tag is the master
neuron - i.e. the one
containing the root node. Fragments are joined recursively in this sort
order each time simply picking the closest fragment to the current
master. Closest is here defined by the distance between nearest
endpoints.
if (FALSE) {
dl1_main=simplify_neuron(dl1neuron, n = 1, invert = FALSE)
dl1_branches=simplify_neuron(dl1neuron, n = 1, invert = TRUE)
dl1_branches1=simplify_neuron(dl1_branches, n = 1, invert = FALSE)
dl1_branches2=simplify_neuron(dl1_branches, n = 1, invert = TRUE)
dl1_fragment <- list(dl1_main,dl1_branches1,dl1_branches2)
dl1_fragment <- as.neuronlist(dl1_fragment)
dl1_whole = stitch_neurons(dl1_fragment)
}