navis.make_dotprops¶
- navis.make_dotprops(x, k=20, resample=False, threshold=None)[source]¶
Produce dotprops from neurons or x/y/z points.
This is following the implementation in R’s nat library.
- Parameters:
x (Neuron | NeuronList | pandas.DataFrame | numpy.ndarray) – Data/object to generate dotprops from. DataFrame must have ‘x’, ‘y’ and ‘z’ columns.
k (int (> 1), optional) –
Number of nearest neighbours to use for tangent vector calculation:
k=0
ork=None
is possible but only forTreeNeurons
where we then use the midpoints between child -> parent nodes and their vectorsk
is only guaranteed if the input has at leastk
pointsk
includes self-hits and whilek=1
is not strictly forbidden, it makes little sense and will likely produce nonsense dotprops
resample (float | int | str, optional) –
If provided will resample neurons to the given resolution:
for
MeshNeurons
,VoxelNeurons
and point clouds, we are usingtrimesh.points.remove_close
to remove surface vertices closer than the given resolution. Note that this is only approximate and also means thatMesh/VoxelNeurons
can not be up-sampled!if the neuron has
.units
set you can also provide this as string, e.g. “1 micron”.
threshold (float, optional) – Only for
VoxelNeurons
: determines which voxels will be converted to dotprops points.parallel (bool) – If True and input is NeuronList, use parallel processing. Requires pathos.
n_cores (int, optional) – Numbers of cores to use if
parallel=True
. Defaults to half the available cores.progress (bool) – Whether to show a progress bar. Overruled by
navis.set_pbars
.omit_failures (bool) – If True will omit failures instead of raising an exception. Ignored if input is single neuron.
- Returns:
If input is multiple neurons, will return a
NeuronList
ofDotprops
.- Return type:
Examples
>>> import navis >>> n = navis.example_neurons(1) >>> dp = navis.make_dotprops(n) >>> dp type navis.Dotprops name DA1_lPN_R id 1734350788 k 20 units 8 nanometer n_points 4465 dtype: object