unspike: Remove artefactual spikes in neuron tracing due to...

View source: R/unspike.R

unspikeR Documentation

Remove artefactual spikes in neuron tracing due to registration errors

Description

Remove artefactual spikes in neuron tracing due to registration errors

Usage

unspike(x, threshold, ...)

## S3 method for class 'neuron'
unspike(x, threshold, ...)

## S3 method for class 'neuronlist'
unspike(x, threshold, ...)

Arguments

x

A neuron, or neuronlist

threshold

A numeric threshold for an XY distance that would be considered suspicious.

...

arguments passed to methods

Details

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.

Value

A neuron or neuronlist with artefactual spikes removed. Segments that cannot currently be fixed are left untouched with a warning issued.

node ids and connectors

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.

See Also

smooth_neuron

Examples



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)


natverse/elmr documentation built on Sept. 2, 2023, 9:30 a.m.