Stitch two neurons together at their closest endpoint

stitch_neuron(a, b)

## Arguments

a, b

Neurons to join together

## Details

This function joins two neurons at their nearest point (only one). Let's say you have two neurons a and b. a and b will be joined at one point that are closest to each other. However, when say there are multiple points at a and b which are closer and could be joined, then do not use this function, use the function stitch_neurons_mst, which is slower but will merge at multiple points. Note that for CATMAID neurons the neuron with the soma tag will be treated as the first (master neuron). Furthermore in this case the PointNo (aka node id) should already be unique. Otherwise it will be adjusted to ensure this.

stitch_neurons

## Author

Gregory Jefferis jefferis@gmail.com

## Examples

# \donttest{
dl1_main=simplify_neuron(dl1neuron, n = 1, invert = FALSE)
dl1_branches=simplify_neuron(dl1neuron, n = 1, invert = TRUE)
dl1_whole = stitch_neuron(dl1_main,dl1_branches)
#> Warning: Multiple origins found! Using first origin.
# }