brainrender icon indicating copy to clipboard operation
brainrender copied to clipboard

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

Open harshk95 opened this issue 3 years ago • 3 comments

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 avatar Nov 30 '21 21:11 harshk95

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()

harshk95 avatar Nov 30 '21 21:11 harshk95

Hi,

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

FedeClaudi avatar Dec 28 '21 18:12 FedeClaudi

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!

harshk95 avatar Dec 30 '21 10:12 harshk95

Fixed in #281

Screenshot 2023-11-28 171107

Screenshot 2023-11-28 171156

IgorTatarnikov avatar Nov 28 '23 17:11 IgorTatarnikov