Coder Social home page Coder Social logo

Comments (7)

schlegelp avatar schlegelp commented on June 11, 2024

The APL is a monster of a neuron. When I ran this code it effectively stopped at print(navis.split_axon_dendrite(on)) and started consuming obscene amounts of memory. There must be a bottleneck in the code that simply doesn't scale well. Will have a proper look and let you know. FWIW: smaller neurons should work fine.

from navis.

clbarnes avatar clbarnes commented on June 11, 2024

How big is the neuron when serialised? Might be a useful stress test case to keep around.

from navis.

schlegelp avatar schlegelp commented on June 11, 2024

This APL is ~12Mb pickled.

I've also found the culprit for the @dadanhan's problem: an inefficient path query in navis.flow_centrality (which is called by split_axon_dendrite. Should be able to make some improvements on that end soon.

from navis.

clbarnes avatar clbarnes commented on June 11, 2024

One day I'll fix my rust implementation of Arbor.js... I've been playing around with some linestring smoothing and simplification stuff too.

from navis.

schlegelp avatar schlegelp commented on June 11, 2024

One day I'll fix my rust implementation of Arbor.js... I've been playing around with some linestring smoothing and simplification stuff too.

Oh cool! Slightly parallel effort with what I started here: https://github.com/navis-org/fastcore

from navis.

schlegelp avatar schlegelp commented on June 11, 2024

@dadanhan I pushed a couple changes to the main branch that speed up the flow metrics functions. If you install navis from Github your above code should go through albeit still not super fast: navis.split_axon_dendrite(on, metric='flow_centrality') takes ~7min on my laptop... I would avoid calling it multiple times.

A note on how split_axon_dendrite works: you can play around with the flow_thresh parameter to improve the split. If you do that you can avoid having to re-calculate the flow every time you run the function by calculate it beforehand:

>>> # From your above example
>>> on.reroot(on.soma, inplace=True)
>>> navis.flow_centrality(on)
>>> # `on` now has a "flow_centrality" column in the node table (check e.g. `on.nodes.head()`)
>>> # Splitting now re-uses the column 
>>> splits = navis.split_axon_dendrite(on, metric='flow_centrality', flow_thresh=0.9)

That way the actual navis.split_axon_dendrite call only takes a minutes or so.

Also not sure how well this algorithm works on something like the APL with its many parallel fibres. Here's a screenshot coloured by flow centrality (navis.plot3d(on, color_by='flow_centrality', palette='viridis'). As you can see the neurite with the highest centrality runs the entire length of the peduncle + lobes and then circles around. No clue whether that makes sense for this neuron or whether the skeleton has a messed up topology.

Screenshot 2021-12-02 at 15 38 10

from navis.

dadanhan avatar dadanhan commented on June 11, 2024

Thank you Philipp!

from navis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.