BlueBrain / NeuroM

Neuronal Morphology Analysis Tool
https://neurom.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
102 stars 55 forks source link

Cannot .get Features from any .swc reconstruction done with neuTube #1065

Closed IzabelaJC closed 2 years ago

IzabelaJC commented 2 years ago

Hi all

I am trying to analyse .swc reconstructions done with neuTube (at least neuTube_win64.2018.07.12), and attempting to extract some features. With neuroM 3.2 number_of_terminations, soma_radii, segment_length, soma_surface_areas, number_of_bifurcations and at this point I think any other Features cannot be extracted. Additional info: While typing this issue, I decided to update neuroM from 3.1 to 3.2 just in case. In 3.1 the feature number_of_bifurcations worked, in 3.2 it does not anymore. My code from ~March 2021 supported number_of_terminations, but running it now throws the same error.

For example:

import neurom as nm

nrn = nm.load_morphology(<.swc file path>)
nrn_ap_seg_len = nm.get('segment_lengths', nrn, neurite_type=nm.APICAL_DENDRITE)
nrn_bas_seg_len = nm.get('segment_lengths', nrn, neurite_type=nm.BASAL_DENDRITE)

returns:

Traceback (most recent call last):

  File "C:\Users\Massive\Documents\python\untitled0.py", line 13, in <module>
    nrn_ap_seg_len = nm.get('segment_lengths', nrn, neurite_type=nm.APICAL_DENDRITE)

  File "C:\ProgramData\Anaconda3\lib\site-packages\neurom\features\__init__.py", line 150, in get
    return _get_feature_value_and_func(feature_name, obj, **kwargs)[0]

  File "C:\ProgramData\Anaconda3\lib\site-packages\neurom\features\__init__.py", line 129, in _get_feature_value_and_func
    raise NeuroMError(f'Cant apply "{feature_name}" feature. Please check that it exists, '

NeuroMError: Cant apply "segment_lengths" feature. Please check that it exists, and can be applied to your input. See the features documentation page.

This happens to any feature that I have now randomly tried from https://pythonhosted.org/neurom/morph_stats.html?highlight=features

eleftherioszisis commented 2 years ago

Hello @IzabelaJC and thank you for opening this issue.

Would it be possible to check which python version is used by anaconda3 in your environment?

conda list python -f
IzabelaJC commented 2 years ago

It's python 3.9.7, thanks!

eleftherioszisis commented 2 years ago

I tried to reproduce the error with anaconda and 3.9 python but without success. How is neurom installed?

If not already doing this, could you try uninstalling neurom and installing it like this?

conda config --set pip_interop_enabled True
pip install neurom
IzabelaJC commented 2 years ago

It was installed with pip install neurom but I just uninstalled and reinstalled as per your recommendation. Of the Features I quickly tested, the _number_ofbifurcations now works fine again, but _number_ofterminations or _somaradii generate the same error.

eleftherioszisis commented 2 years ago

ok, I reproduced it for the two last features above. It looks like the names of the features are different than the ones above.

You can get the full list of the available features with:

help(nm.get)
IzabelaJC commented 2 years ago

That did it, thanks so much for the help!