bluebrain / neuror Goto Github PK
View Code? Open in Web Editor NEWA collection of tools to repair morphologies
Home Page: https://neuror.readthedocs.io/
License: GNU Lesser General Public License v3.0
A collection of tools to repair morphologies
Home Page: https://neuror.readthedocs.io/
License: GNU Lesser General Public License v3.0
1: the check of non constant type has a wrong message, it compares with root, not parent section
2: the remove zero lenght should have a hidden warning if it does it, and a strong warning if it removes a root section, as the whole tree will be removed. It removes if only one point is left.
The new version of nptyping
breaks NeuroR.
@mariarv wants to sanitize dendrites for some morphologies, but does not care about soma. Some of her morphs don't have soma, so an option in sanitize such as ignore_soma=False
could be of some use.
In https://github.com/BlueBrain/NeuroR/blob/master/neuror/sanitize.py#L39
it says no soma, but there can be a non valid soma, with for example this morph: https://github.com/BlueBrain/MorphIO/blob/master/tests/data/soma_single_frustum.swc
Maybe write 'no valid soma` instead?
In https://github.com/BlueBrain/NeuroR/blob/master/neuror/main.py#L243
Should be something like axons: Optional[List] = None,
instead of axons: Optional[Path] = None,
.
I found the PR which made sanitize crash: #52
See BlueBrain/NeuroM#977 (comment)
Hi, @Stannislav noticed that during sanitize of a neuron, if a section has zero length subsequent sections are deleted as well. This is probably coming from here:
Line 112 in 79b4394
This should not be the expected behavior for sanitize (imo). Instead when a zero length section is removed subsequent sections should be stitched back to its parent.
Could you please look into this issue? Thanks a lot!
This is a continuation of #99
Running neuror sanitize file simple1.asc out.asc
on
("CellBody"
(Color Red)
(CellBody)
(0.001000000 0.001000000 0.000000000 0.010000000)
(-0.001000000 0.001000000 0.000000000 0.010000000)
(-0.001000000 -0.001000000 0.000000000 0.010000000)
(0.001000000 -0.001000000 0.000000000 0.010000000)
)
( (Color Cyan)
(Axon)
(0.000000000 0.000000000 0.000000000 2.000000000)
(0.000000000 -4.000000000 0.000000000 2.000000000)
(
(0.000000000 -4.000000000 0.000000000 4.000000000)
(0.000000000 -4.000000000 0.000000000 4.000000000)
(0.000000000 -4.000000000 0.000000000 4.000000000)
(
(6.000000000 -4.000000000 0.000000000 4.000000000)
(7.000000000 -5.000000000 0.000000000 4.000000000)
|
(6.000000000 -4.000000000 0.000000000 4.000000000)
(8.000000000 -4.000000000 0.000000000 4.000000000)
)
|
(0.000000000 -4.000000000 0.000000000 4.000000000)
(-5.000000000 -4.000000000 0.000000000 4.000000000)
)
)
Which results in:
[...snip cellbody]
( (Color Cyan)
(Axon)
(0.000000000 0.000000000 0.000000000 2.000000000)
(0.000000000 -4.000000000 0.000000000 2.000000000)
(
(0.000000000 -4.000000000 0.000000000 4.000000000)
(-5.000000000 -4.000000000 0.000000000 4.000000000)
)
)
and doesn't have the correct subtree.
I tried to unravel the morphology of L23_PC_cADpyr_229_2 from the Blue Brain-database but the sections seem to get scattered in the x-direction.
import matplotlib.pyplot as plt
from morphio import Morphology
from neuror.unravel import unravel
def display(morph, color):
for sec in morph.sections:
x = sec.points.T
plt.plot(x[0], x[1], x[2], c=color)
u, _ = unravel('data/morph_7.h5')
u.write('data/morph_7_unr.h5')
plt.subplot(projection='3d')
display(Morphology('data/morph_7.h5'), 'k')
display(Morphology('data/morph_7_unr.h5'), 'tab:blue')
plt.show()
This is related to #105.
Currently, if a 0-length section is found at the soma, sanitize
will drop the entire neurite that is attached to it.
This behavior is not what a normal user could expect, especially because there is no Warning or Error when this dropping takes place during sanitization and the user cannot know that this has happened.
After discussions (@lidakanari @adrien-berchet @mgeplf @eleftherioszisis) we agreed that the solution would be to raise an informative Error (e.g. ValueError("Zero-length section found at the soma ..."
) and terminate the execution of sanitize
.
This change is beyond the scope of #65 and will be treated in a future PR.
The rational is similar to synthesis, where all dendrites of all morphologies of same mtypes are used to synthesize a morphology, to avoid biases from specific features of morphologies. With this improvement, the repaired branches would be more varied, and not be almost a copy of other branches of the current morphology.
numpy==1.25
introduced simd vectorized version of quicksort with: numpy/numpy#23707
That change affects the behavior of the sort and argsort functions when using quicksort (default) based on the existence of the avx-512 instruction set.
In NeuroR, one of the functions that are affected is scipy.optimize.minimize
:
NeuroR/neuror/cut_plane/detection.py
Line 279 in ae52411
which uses internally numpy's argsort in:
https://github.com/scipy/scipy/blob/cfe80116aaa145061246b8aec0e98248fbefb835/scipy/optimize/_optimize.py#L907
See also:
numpy/numpy#24064
Github hosted runners for ubuntu-latest seem to have enabled the aforementioned instruction set as they output different values than the expected ones in the past: https://github.com/BlueBrain/NeuroR/actions/runs/5484236591/jobs/9991722132
Just noticed it is outdated. Also, we need to add the .remove_unifurcations in the code once morphio is updated.
z-range is the thickness of the morpho in the z-direction, corresponding to slice thickness. A small range can be understood as an error from reconstruction
When using neuror.zero_diameter_fixer.fix_zero_diameters
on the attached morphology, I get a segmentation fault.
After some investigation with @arnaudon , it appeared that it happens when the Python recursion limit is updated in the function with sys.setrecursionlimit
and is set to a value greater than the actual stack size (which can be updated using ulimit -s <new_size>
). When increasing the stack size with ulimit
the problem disappears.
Here is a MWE:
First update the stack size in bash then run Python:
ulimit -s 8192
python
Then in Python:
import morphio
from neuror.zero_diameter_fixer import fix_zero_diameters
morph = morphio.mut.Morphology("AA0319.asc")
fix_zero_diameters(morph)
It should end in a segfault while the same with ulimit -s 16384
should pass.
I think the best way to solve this issue would be to change the algorithm to avoid recursion. But it might not be easy...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.