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

Allen bbp ccfv3a entire mouse brain, improve mesh utils, and add metadata filtering to wrapup #500

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

PolarBean
Copy link
Member

Here I add the extended and improved CCFv3 annotation and Nissl atlas of the entire mouse brain by Piluso and colleagues (full disclosure I'm also an author).

I have also integrated the filtering script we have previously talked about that automatically removes metadata regions that do not exist in the annotation, previously a point of friction in integration scripts. I moved int into the wrapup script.

Another addition here is the addition of a annotation + region dictionary to mesh function. This code is the same in every script I submit and is a large effectively boiler plate function that is copy and pasted between them. By moving it into mesh utils we make atlas integration easier and the integration scripts cleaner.

@PolarBean
Copy link
Member Author

given that this relies on changes to mesh utils you need to pip install --upgrade -e . in the main brainglobe directory before running the integration script

@PolarBean
Copy link
Member Author

Found an error. Closed until I fix

@PolarBean PolarBean reopened this Feb 14, 2025
@PolarBean
Copy link
Member Author

Ok fixed some orientation problems, but another issue was the datatype. It seems all brainglobe atlases must be 16 bit unsigned integers. Is this in the integration docs? definitely something to add, not sure where though.

Ive also started using dataclasses here, I was thinking about upstreaming them into brainglobe and importing the atlas_metadata class in future atlas requests.

Theres this dictionary here that could be replaced by a dataclass if youd like and imported as needed https://github.com/brainglobe/brainglobe-atlasapi/blob/main/brainglobe_atlasapi/descriptors.py

@adamltyson
Copy link
Member

Ok fixed some orientation problems, but another issue was the datatype. It seems all brainglobe atlases must be 16 bit unsigned integers. Is this in the integration docs? definitely something to add, not sure where though.

Don't think it's documented anywhere. It should probably go somewhere here.

Copy link
Member

@alessandrofelder alessandrofelder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @PolarBean! Generally, looks very nice, in particular the additional helper functions 🙌

Could you remove left-over docstrings from the template script, and replace them with descriptions of this atlases idiosyncrasies (many of which you already detail in code comments), please?

Then I can run and validate locally too :)

Comment on lines +60 to +69
METADATA = AtlasMetadata(
version=0,
name="allen_bbp_ccfv3a_entire_mouse_brain",
citation="https://doi.org/10.1101/2024.11.06.622212",
atlas_link="https://zenodo.org/api/records/14034334/files-archive",
species="Mus musculus",
orientation="spr",
root_id=997,
resolution=25,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a strong opinion, but maybe a worry would be that using a dataclass (while nice syntactic sugar for more experienced developers) introduces a small barrier for novice programmers to contribute atlases in the future (because they need to understand what e.g. METADATA.name refers to)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting point, I don't think its so difficult for novices but its hard to say. I think the main point of this change is to organise all the metadata in one place with detailed descriptions of what each field requires and what type of data it expects. I think doing this with constants and comments in a template file is less than ideal perhaps but I'm open to opinions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, it's a trade-off. Not sure - will bring up at dev meeting tomorrow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would vote against dataclasses. Atlas contributors tend to be the least experienced contributors we have (some have no Python experience). Anything we can do to simplify this process is good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair point! should I remove it from this script or is it ok

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove it for consistency across packaging scripts?

Comment on lines 285 to 287
closing_n_iters = 2
decimate_fraction = 0
smooth = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether these should be exposed as parameters, with default values, so we can re-use this function across more packaging scripts (as and when we need to, moving to version 2)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

absolutely

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I exposed these parameters. I havent tested it yet as im currently generating demba files (and will be for a while!). There is the option to expose all of the parameters of extract mesh from mask but I'm not to familiar with that function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it runs :)

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

Successfully merging this pull request may close these issues.

3 participants