Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coordinates seem to be wrongly read from MouseLight neuron loaded as .swc #181

Closed
harshk95 opened this issue Nov 30, 2021 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@harshk95
Copy link

harshk95 commented Nov 30, 2021

Hi,
I tried to run the neruons.py example from the examples folder and downloaded the .swc file for one of the neurons in the Mouse Light database from the MouseLight neuron browser. However, the neuron is strangely oriented and seems to be switching 2 of the coordinates. The ID of the neuron shown in the figure attached is AA1544.
This has been run on a Windows machine with the latest version of brainrender on Python 3.7
image

Any help is much appreciated!
Thanks!

@harshk95 harshk95 added the bug Something isn't working label Nov 30, 2021
@harshk95
Copy link
Author

harshk95 commented Nov 30, 2021

Additionally, upon running the mouselight api to fetch the metadata from neurons.py , I get the following error:

Querying MouseLight API...
... fetched metadata for 1110 neurons in 2.03s
allen mouse atlas (res. 25um)
From: http://www.brain-map.org (Wang et al 2020, https://doi.org/10.1016/j.cell.2020.04.007 )
... selected 257 neurons out of 1110
Downloading neurons
Working... ---------------------------------------- 100% 0:00:00
Error in sys.excepthook:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\pyinspect\utils.py", line 140, in read_single_line
for i, line in enumerate(f):
File "C:\Users\kanohars\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 1470: character maps to

Original exception was:
Traceback (most recent call last):
File "neurons.py", line 25, in
neurons = scene.add(*make_neurons(*neurons, neurite_radius=12))
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\brainrender\actors\neurons.py", line 31, in make_neurons
for n in neurons
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\brainrender\actors\neurons.py", line 31, in
for n in neurons
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\brainrender\actors\neurons.py", line 69, in init
mesh = self._from_morphapi_neuron(neuron)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\brainrender\actors\neurons.py", line 81, in _from_morphapi_neuron
soma_radius=self.soma_radius,
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\morphapi\morphology\morphology.py", line 256, in create_mesh
actors.append(Tube(coords, r=neurite_radius))
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\vedo\shapes.py", line 1328, in init
if len(p)==3:
TypeError: object of type 'numpy.float64' has no len()

@seitay seitay mentioned this issue Dec 7, 2021
@FedeClaudi
Copy link
Collaborator

Hi,

Is this still an issue? Is the problem there with all neurons or particular ones?

@harshk95
Copy link
Author

Hi Federico,
Yes, this is still an issue. It was the case for at least the 5 neurons from the Mouse Light database I looked at. I tried to play around with swapping the coordinates but did not really change anything.
Would appreciate any help with this. Thanks!

@IgorTatarnikov
Copy link
Member

Fixed in #281

Screenshot 2023-11-28 171107

Screenshot 2023-11-28 171156

@harshk95
Copy link
Author

This issue persists for neurons from other datasets that are now available and has to do with the Neuron actor hardcoding the invert_dims = True
in MorphoNeuron form the morphapi.morhology.morpholgy

The issue can be resolved by allowing the user to set the invert_dims when creating the Brainrender Neuron actor

@IgorTatarnikov
Copy link
Member

Hi @harshk95, thanks for your suggestion! The invert_dims parameter should now be exposed in the Neuron constructor.

This fix is now in the latest version of brainrender (update with pip install brainrender -U).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

5 participants