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

[Feature] How to print all "nicknames" for brain regions in a given atlas? #403

Closed
Eddymorphling opened this issue Jan 22, 2025 · 6 comments
Labels
enhancement New feature or request

Comments

@Eddymorphling
Copy link

Hi all, I am new to brainrender and I have a very simple yet naive q. How do I identify all the "nicknames" for all the brain regions for a given atlas? For example :


scene = Scene(atlas_name="perens_lsfm_mouse_20um", inset=False, title='3D_Brain')

# Get the brain region (Cortex, for example)
region1= scene.add_brain_region("SSp-ll4",  alpha=0.9)
```)

Here SSp-II4 is a one region. I would like to add more regions. What should I pass to print all brains regions and their "nicknames" (SSp-II4) in the perens mouse atlas for example? Could not find this in the examples codes on the main page. Any advise?
Thanks!
@Eddymorphling Eddymorphling added the enhancement New feature or request label Jan 22, 2025
@alessandrofelder
Copy link
Member

You can do this with the BrainGlobe Atlas API:

from brainglobe_atlasapi import BrainGlobeAtlas
atlas  = BrainGlobeAtlas("allen_mouse_100um")
print(atlas.structures_list)

What you are looking for is the "acronym" of each structure.
You can also do fancier things like querying for the children of a certain structure.

@Eddymorphling
Copy link
Author

Eddymorphling commented Jan 22, 2025

Thanks! @alessandrofelder Thats helpful.

Having issues with transparency for the brain regions/points and giving it a different color. Is this the right way to pass it?

# add the brain regions
region1 = scene.add_brain_region("CB", alpha=0.9, color="grey")
region2 = scene.add_brain_region("HY", alpha=0.9, color="blue")
region3 = scene.add_brain_region("TH", alpha=0.9, color="red" )

file_path ="/points/points.npy"
points = load_points_from_file(file_path)

filtered_points_region1 = filter_points_in_region(points, region1)
filtered_points_region2 = filter_points_in_region(points, region2)
filtered_points_region3 = filter_points_in_region(points, region3)

scene.add(Points(filtered_points_region1))
scene.add(Points(filtered_points_region2))
scene.add(Points(filtered_points_region3))

scene.content
scene.render(zoom=1)

This creates something like this where the added regions and points inside that region have the same color.

Image

@adamltyson
Copy link
Member

Are you wanting to change the properties of the points? If so that needs to be passed when you call Points, see this example:

cells = Points(cells_path, radius=45, colors="palegoldenrod", alpha=0.8)

@adamltyson
Copy link
Member

Also, @Eddymorphling if you have usage questions (rather than a bug report), would you mind asking your question over on the image.sc forum, tagging your question with brainglobe and the name of the tool you're using (e.g. brainrender). This makes it much easier for others to benefit from any advice. I'll close this issue, but feel free to ask as many questions as you like on the forum (ideally one post per topic). Thanks!

@Eddymorphling
Copy link
Author

Are you wanting to change the properties of the points? If so that needs to be passed when you call Points, see this example:

brainrender/examples/brainmapper.py

Line 31 in e7d9be6

cells = Points(cells_path, radius=45, colors="palegoldenrod", alpha=0.8)

Thanks, @adamltyson. Actually, I would like to make the brain regions transparent. But that does not seem to work. I will start posting on the Fiji forum, sorry for the hassle.

@alessandrofelder
Copy link
Member

FWIW @Eddymorphling there is a known issue with setting transparency #390 that seems to occur in some situations, but we haven't managed to reproduce fully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants