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

[BUG] Cell density (still) not working properly #293

Closed
GuillaumeLeGoc opened this issue Dec 4, 2023 · 3 comments · Fixed by #296
Closed

[BUG] Cell density (still) not working properly #293

GuillaumeLeGoc opened this issue Dec 4, 2023 · 3 comments · Fixed by #296
Assignees
Labels
bug Something isn't working

Comments

@GuillaumeLeGoc
Copy link
Contributor

Describe the bug
PointsDensity does not display the density at the right place.

To Reproduce
Add non-symmetrical cells to a scene, then display the density with PointsDensity. The density mesh is off.

Expected behaviour
Density is shown at the proper place, that is, where the cells are.

Screenshots
With my data :
Capture2

With the provided cell_density example :
Capture

Computer used (please complete the following information):

  • OS: Windows 10
    • python 3.11.6
    • vedo 2023.5.0
    • vtk 9.3.0
    • k3d : 2.16.0
    • bg-atlasapi 1.0.2
    • bg-space 0.6.0
    • brainglobe-utils 0.3.0
    • brainrender 2.1.0

Additional context
Hey,
First I wanted to congratulate you for the mega-fix patch which looked like a pain but you manage and it seems to work (mostly).
I freshly installed it in a new environment with Python 3.11 and it installed without complaining.
But it seems that the weird/black-magic/ununderstood bug in the coordinates with vedo's PointsDensity is still here (although better than before).
I added cells to a scene (allen_mouse_10um) and a density with the following :

from brainrender import Scene
from brainrender.actors import Points, PointsDensity

scene = Scene()
scene.add(Points(coordinates, name="Boutons", colors="green", alpha=0.2, radius=5))
scene.add(PointsDensity(coordinates, dims=10))

Cells are displayed properly but the density seems to be mirrored in the left/right direction (see first screenshot above).

Then I tried the provided cell_density.py example, and that one seemed to work. But I noticed that randomly-generated cells are symmetrical, so I tried removing cells from one side :

condition = coordinates[:, 2] < 5066
coordinates = coordinates[~condition]

scene.add(Points(coordinates, name="CELLS", colors="salmon"))
scene.add(PointsDensity(coordinates))

Again, the density is off, it seems mirrored in some way -- see second screenshot above.
I know it is a known bug that was not well understood and that you/we hoped to have fixed with latest vedo. But it seems there is still something weird hapenning with the coordinates in PointsDensity.
Notice that now, the density is not completely off, eg. it's in the brain but still has a problem...
See :
#261, #243, #217

@GuillaumeLeGoc GuillaumeLeGoc added the bug Something isn't working label Dec 4, 2023
@alessandrofelder
Copy link
Member

Thanks a lot for this detailed description @GuillaumeLeGoc - It may well help to figure out the deeper problem 🤞 I'll have a look.

@GuillaumeLeGoc
Copy link
Contributor Author

You're very welcome. Let me know if I can help.

@GuillaumeLeGoc
Copy link
Contributor Author

Hey,
Just wanted to confirm that the fix #296 works for me 😄

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
None yet
Development

Successfully merging a pull request may close this issue.

2 participants