Split a neuron using a data.frame of stored split points.

hemibrain_use_splitpoints(x, df, knn = FALSE, ...)

Arguments

x

a nat::neuronlist or nat::neuron object. It is assumed that this neuron has been read in by neuprintr::neuprint_read_neurons or possibly catmaid::read.neurons.catmaid.

df

a data.frame of splitpoints from running flow_centrality, as produced by hemibrain_splitpoints.

knn

logical, whether or not to find corresponding points between df and x$d using a nearest neighbour search in 3D space (TRUE) or just use the given point IDs in df (i.e. if neurons have not been resampled or their skeletons otherwise modified).

...

Additional arguments passed to methods or eventually to nat::nlapply

Value

a neuronlist

See also

Examples

# \donttest{ # Choose neurons ## These neurons are some 'tough' examples from the hemibrain:v1.0.1 ### They will split differently depending on the parameters you use. tough = c("5813056323", "579912201", "5813015982", "973765182", "885788485", "915451074", "5813032740", "1006854683", "5813013913", "5813020138", "853726809", "916828438", "5813078494", "420956527", "486116439", "573329873", "5813010494", "5813040095", "514396940", "665747387", "793702856", "451644891", "482002701", "391631218", "390948259", "390948580", "452677169", "511262901", "422311625", "451987038" ) # for documentation purposes only run first 5 examples tough=tough[1:5] # Get neurons neurons = neuprintr::neuprint_read_neurons(tough) # Now make sure the neurons have a soma marked ## Some hemibrain neurons do not, as the soma was chopped off neurons.checked = hemibrain_skeleton_check(neurons, meshes = hemibrain.surf)
#> Re-rooting 2 neurons without a soma
#> Removing synapses outside the hemibrain neuropil volume for 5 neurons
#> Warning: invalid factor level, NA generated
#> Warning: invalid factor level, NA generated
#> Warning: invalid factor level, NA generated
#> Warning: invalid factor level, NA generated
#> Warning: invalid factor level, NA generated
#> Warning: invalid factor level, NA generated
# Split neuron ## These are the recommended parameters for hemibrain neurons neurons.flow = flow_centrality(neurons.checked, polypre = TRUE, mode = "centrifugal", split = "distance") # Save the results splitpoints = hemibrain_splitpoints(neurons.flow) # Re-use the results neurons.flow.2 = hemibrain_use_splitpoints(neurons, splitpoints, knn = FALSE)
#> Error in if (is.na(dendrite.primary)) { dendrite.primary = dendrite.start[1]}: argument is of length zero
if (FALSE) { # Plot the split to check it nat::nopen3d() nlscan_split(neurons.flow2, WithConnectors = TRUE) }# }