brainglobe-atlasapi icon indicating copy to clipboard operation
brainglobe-atlasapi copied to clipboard

kim_mouse atlas plots only one hemisphere in brainrender

Open alowet opened this issue 2 years ago • 5 comments

Using kim_mouse_50um, for which scaling issues have been solved (see brainglobe/brainglobe-atlasapi#247), individual brain regions plot in only one hemisphere or the other. Consider this snippet:

from brainrender import Scene

atlas = 'kim_mouse_50um'

# Create a brainrender scene
scene = Scene(screenshots_folder='.', inset=False, atlas_name=atlas)

# add actors
acbc = scene.add_brain_region('Acb', alpha=0.3, color='blue', hemisphere='both')

# render
scene.render(interactive=False, zoom=1)
scene.screenshot(name='example_{}'.format(atlas))

This produces the following output: example_kim_mouse_50um

As you can see, the nucleus accumbens gets plotted only in the left hemisphere. This is contrary to the behavior of allen_mouse_25um and the documented behavior of the hemisphere parameter. As far as I can tell, this behavior does not affect the structure_from_coords function, i.e. that function correctly returns the same region regardless of whether the point is in the left or the right hemisphere. It's currently unclear to me whether this is a problem with the atlas API itself or with brainrender, but I figured I'd report the bug here because of the difference between allen_mouse_25um and kim_mouse_50um. If I should go to the brainrender Github instead, let me know.

alowet avatar Mar 08 '22 17:03 alowet

Hey @alowet, I'm not sure where the error lies, maybe @FedeClaudi has some insight?

Visualising the Acb outside of brainrender (.brainglobe/kim_mouse_50um_v1.0/meshes/56.obj) seems to show both hemispheres.

Screenshot from 2022-03-09 11-31-51

adamltyson avatar Mar 09 '22 11:03 adamltyson

It seems there are some issues with the obj files for the Kim atlas. I sampled a few other random areas and there's a high chance that the obj files only contain one hemisphere.

Local file downloaded by bg-atlasapi: Kim_100_ACB_Local

File downloaded directly from GIN: Kim_100_ACB_GIN

Local copy for the same region in Allen 100 um: Allen_100_ACB

IgorTatarnikov avatar Nov 01 '23 16:11 IgorTatarnikov

image

I can reproduce in brainrender-napari and in Paraview. Is it possible that this affects only mesh files that are supposed to consist of several disconnected parts? Looking eg at Tu1 and Tu2 would support this hypothesis?

Maybe this issue needs to be transferred to bg-atlasgen as it's likely a problem with https://github.com/brainglobe/bg-atlasgen/blob/main/bg_atlasgen/atlas_scripts/kim_mouse.py? @IgorTatarnikov what do you think?

alessandrofelder avatar Nov 02 '23 12:11 alessandrofelder

I would agree, it seems to be an issue with the generation. We should transfer it to bg-atlasgen!

IgorTatarnikov avatar Nov 02 '23 13:11 IgorTatarnikov

Regenerating the meshes seems to fix this issue.

Kim_50_ACB_New_Smooth

IgorTatarnikov avatar Nov 14 '23 13:11 IgorTatarnikov

This has now been fixed.

adamltyson avatar May 13 '24 08:05 adamltyson