unspike | R Documentation |
Remove artefactual spikes in neuron tracing due to registration errors
unspike(x, threshold, ...)
## S3 method for class 'neuron'
unspike(x, threshold, ...)
## S3 method for class 'neuronlist'
unspike(x, threshold, ...)
x |
A neuron, or neuronlist |
threshold |
A numeric threshold for an XY distance that would be considered suspicious. |
... |
arguments passed to methods |
unspike
currently uses a very simple algorithm to remove big
jumps: it just looks for XY jumps bigger than a specified distance and
removes the first associated node. It currently cannot deal with two
slightly more difficult situations:
When there are two or more points that are far out of register.
When there a branch or end points that are out of register.
Handling consecutive points or end points should be a fairly straightforward addition. Branch points require a little more thought.
A neuron or neuronlist with artefactual spikes removed. Segments that cannot currently be fixed are left untouched with a warning issued.
unspike has the side effect of losing the CATMAID node ids in the output neuron. connector/tag information is retained although the node ids are translated to the new numbering system.
smooth_neuron
da1pns=read.neurons.catmaid("annotation:^glomerulus DA1$", conn=vfbcatmaid("fafb"))
# set threshold to 5000 nm
da1pns.fix=unspike(da1pns, threshold=5000)
plot(da1pns, col='red', WithNodes=FALSE)
# overplot fixed neuron leaving red spikes visible
plot(da1pns.fix, col='black', WithNodes=FALSE, add=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.