BlueBrain / morph-tool

https://morph-tool.readthedocs.org/
GNU Lesser General Public License v3.0
8 stars 7 forks source link

Correct conversion to .swc #64

Closed asanin-epfl closed 3 years ago

asanin-epfl commented 3 years ago

When converting contour soma to .swc format, we need to convert to an identical cylinder soma. @arnaudon please look if you have time.

arnaudon commented 3 years ago

I need to learn about soma stuff, I don't know much, is this urgent?

asanin-epfl commented 3 years ago

it's not urgent but If you have spare time then it would be good to fix it. I will try to fix it on my own this week as well.

arnaudon commented 3 years ago

if I understand well, the functions here are converters for soma only, right? https://github.com/BlueBrain/morph-tool/blob/master/morph_tool/converter.py

they try to mimic what is done in NEURON? which one should we look at? https://github.com/BlueBrain/morph-tool/blob/master/morph_tool/converter.py#L168

arnaudon commented 3 years ago

now I'm thinking, I can also convert a morphology by just morphio.mut.Morphology('morph.swc').write('morph.asc'), but then the soma is not going to be correctly converted, right?

Not sure what to do then, if these functions should be in morphio, or a warning in morphio saying: be careful, soma may not be converted properly, renaming this convert to convert_soma, and say clearly that this is still not very precise, due to large discrepencies between file formats.

From what I understood, the soma reconstuctions are also fairly bad in most cases, and NEURON does the cylinder approximation, so I'm not sure it is worth a lot of effort to make this really precise, unless somebody has a dataset with good soma, and wants to make sure it is dealt with properly.

Saying that, I would actively wait on such user to fix this code, and just put a warning when somebody uses it saying it may not work as expected.

Alternatively, we can use nrnhines module to compute the soma surface area and volume using NEURON, and fit the size of the cylinder soma we put (or whatever else format) such that these match between file formats, so at least from NEURON point of view, the soma are the 'same'. I don't know exactly what NEURON does to the soma, but it has some internal logic, which moves a bit with NEURON versions, so hard to keep track really.

I stop here, sorry...

asanin-epfl commented 3 years ago

Fixed via #66