brainglobe / morphapi

A lightweight python package to download neuronal morphologies
https://brainglobe.info/documentation/morphapi/index.html
MIT License
17 stars 6 forks source link

Allow swc files without a soma to be loaded #62

Closed IgorTatarnikov closed 5 months ago

IgorTatarnikov commented 5 months ago

Before submitting a pull request (PR), please read the contributing guide.

Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)

Description

What is this PR

Why is this PR needed? See https://forum.image.sc/t/brainrender-error-when-rendering-my-own-neuron-morphology/95389/5

What does this PR do? Allows the load_from_swc and create_mesh functions to run when the provided swc file/Neuron object has no soma.

References

Please reference any existing issues/PRs that relate to this PR.

How has this PR been tested?

Tested using the user provided swc file, along with the standard brainrender swc test file. Both are able to be rendered without errors now.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

No.

Checklist:

adamltyson commented 5 months ago

@IgorTatarnikov when I run it on the data without a soma, I get:

morphio._morphio.MissingParentError: Sample id: 1 refers to non-existant parent ID: 0

Am I missing something?

IgorTatarnikov commented 5 months ago

Hmm, that's odd. Which swc file are you using?

adamltyson commented 5 months ago

wl3_local_registered.swc from the image.sc issue. Running it with the latest brainrender & this branch of morphapi:

from brainrender import Scene
from brainrender.actors import Neuron

scene = Scene()
scene.add(Neuron('wl3_local_registered.swc'))
scene.render()
IgorTatarnikov commented 5 months ago

I'm able to run it with the same file. I'll try downloading the file again and running it in a fresh environment.

IgorTatarnikov commented 5 months ago

I can't seem to replicate it, everything runs smoothly in a fresh environment.

adamltyson commented 5 months ago

Ok finally after starting from scratch with everything, it works fine. No idea what's going on with my system.

adamltyson commented 5 months ago

Will release and report back on image.sc.