-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add all Kim's DevCCFv1 atlases #441
base: main
Are you sure you want to change the base?
Conversation
Hey @carlocastoldi Thanks a lot!
We are aware that past parallelisation efforts are not robust #428, so if you would like to contribute a better way, even in just for one atlas, that might help us address #429 - so that would be great
I am happy to give my thoughts on code quality and how to download from OneDrive but can I first check (Pardon my naivety!): what is the difference here to the existing Kim Developmental atlas that is already packaged? Could this be an extension of that existing script? |
I think that is an earlier version of the P56 atlas. @carlocastoldi ideally we would add all these atlases, but the number of ages x reference images is very large. In principle though, there's no reason why we can't add them all. Each would have to be a seperate atlas (at least until we built Atlas API V2). Would you be willing to write a script that can add all of these atlases? |
Oh okay, i see that! It's something I may perhaps look into, but for now it can't be my priority...
Oh I tried to understand if the existing "developmental" atlas (it's not really developmental because it's only for P56, when mice are already adult. It's the same age at which Allen developed CCFv3) had any publication associated with it, but as far as i understood, that's only a v0.0.1 of the work they have recently published (v1). I am not 100% sure about it, tho, as i can't find any description/publication about that dataset. Lastly they offer two different resolutions: one at 20µm for LSFM references and one at 31.5µm/40µm/50µm (depending on the age of the atlas) for MRI references and some stereotaxic coordinates (for post-natal atlases).
Thank you a lot! |
That seems sensible, thanks! |
Oh i missed this message, sorry! |
only one question remains: would you be okay if this PR also deleted the scripts for generating ADMBA and old KimP56 atlases? They are all superseded by this new version for the developing mouse. Leaving them all would otherwise overcrowd the list of supported atlases |
For now, I think we should keep them. Although the new atlases may be better, there are still researchers using the old ones for ongoing projects. We also want to ensure that BrainGlobe acts as an archive in case the original files cannot be found for older atlases. Longer term, we will find a solution for making the set of available atlases easier to navigate (e.g. atlas groups). |
Sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for this, @carlocastoldi - and thank you and @adamltyson for your clarifications.
The code looks largely good on a first pass (I haven't run it, but it's promising you could use it in ABBA 🙌 ), made two small comments.
Do either of you know how official the OneDrive folder is? It looks like in the publication they point to this Figshare repo. Using this repo instead would make it easy to use pooch
to download and cache them neatly (and it's likely a more robust place to get data from long-term)?
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
Is the official download page from their website, apparently. One that could get updated and be changed when new versions come out, I imagine. |
Hmmm, I see. I'd still prefer going with the figshare data if possible, because
I'm not sure how standardised new versions published on OneDrive would be? What do you think @carlocastoldi ? |
Sure, i see all the upsides of using figshare. I guess I was worried that we wouldn't notice any update to the published atlas unless we actively search for them, but that's a minor issue! I'll work on this PR by using |
With this last commit, i think this PR is ready for review! |
Thanks @carlocastoldi. The BrainGlobe team is checked out for the holidays now, so we'll take a look in the new year. |
I figured! Happy holidays! ^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this @carlocastoldi - I've tested the script locally on E11 and it's looking great 🎉 :
I can also confirm that the generated atlas (at least at E11) passes all our validation functions successfully.
I have a major comment that should be straightforward to handle (🤞 - happy to help)
The global variables seem to imply that the script handles all MODALITIES, but LSFM is hard-coded later on and we only loop over timepoints. We should document clearly on how the script is intended to be run.
Maybe for this PR, just LSFM is enough?
If we wanted the other modalities (in this PR or as a separate issue for now) Maybe easiest for use is to
- run LSFM by default
- have an argument to specify the modality on the command line: like python kim_devccf_mouse.py --modality MRI-dwi
- replace hard-coded LSFM with modality (and assert modality in MODALITIES
)
This would allow running atlas generation in parallel for each modality on our HPC (as separate SLURM jobs)
I have also suggested removing any obsolete (AFAICT) commented-out code.
Let me know your thoughts :)
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
RESOLUTIONS = (20, 50) | ||
MODALITIES = ( | ||
"LSFM", # Light Sheet Fluorescence Microscopy | ||
"MRI-adc", # MRI Apparent Diffusion Coefficient | ||
"MRI-dwi", # MRI Difusion Weighted Imaging | ||
"MRI-fa", # MRI Fractional Anisotropy | ||
"MRI-MTR", # MRI Magnetization Transfer Ratio | ||
"MRI-T2", # MRI T2-weighted | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are never used AFAICT - what is the intention for them? IIUC they are possible other modalities and resolutions that we don't loop over in the current version... maybe we want them in a later version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason why we can't just add them? We have all the modalities for the P56 atlas already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to add them, no reason why not - my question was more about what the intention of this PR is, because the current code puts the modalities into a list variable that is never used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I meant - can we adapt this PR to include all modalities rather than just deleting this commented out list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existence of this list was intended as ~metadata of Kim's DevCCFv1 reference images, rather than for actual generation of the atlases.
The intent of this PR was to add LSFM only because:
- its the most accurate and at highest resolution (20um vs 50 um of MRI images)
- generating 7×6=42 atlases seemed too overwhelming for an user navigating the atlases through
show_atlases()
(et simil.) output. The atlases are 7, the only thing changing is the reference image. This, in my experience, creates a sort of "bias" and confusions.
That said I think i could do adapt the script to generate those atlases as well, if you confirm me you think it's appropriate! However, i would discourage from officially adding them to BrainGlobe, until #141 is not complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you wish. I modified the script to allow other modalities as well.
Now the last thing remaining is the naming convention of the atlases. What do you prefer?
kim_devccf_mouse_<MODALITY>_<AGE>
kim_devccf_mouse_<AGE>_<MODALITY>
The 2nd option is probably better for navigation
Thank you for the comments! I still have some questions, tho. There are parameters I was a unsure of and for which i chose the default values, when generating the meshes. Could you please help me making and informed decision:
Also: is it correct to use these same parameters for every age (and sizes)? Thank you in advance! |
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
The meshes are meant for visualisation only, so I would suggest smoothing them with and
Correct is probably not the right word, but it's up to us to decide whether one parameter is good enough (in our quality metric) for all ages. I suggest we try and adapt if needed. |
oh i understand! In light of this, do you reckon i should change the it based on the timepoint, since embryonic atlases are much smaller than post-natal?
would it be good if i exported it as an additioanl parameter of the script? |
Yea, potentially... I would experiment a bit. Also, does the resolution change at later timepoints or are all LSFM atlases 20 um? |
All LSFM atlases are at 20µm. At all embryonic and postnatal stages |
What would be the advantage of doing so? Are you suggesting to resample the annotation volume at 20um to 50 um? It looks like there are 50um res annotation already available? |
I guess the advantage would be that we would retain the smaller structures that otherwise would not be visible at a lower resolution. I don't know if this is the case fore Kim's, but i am sure that 25µm Allen's does not display some small regions that instead are present int 10µm annotation volume |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this @carlocastoldi!
It's looking really really good!
I will run the generation of at least the LSFM atlases tomorrow (need to focus on other things today - sorry!). I'll keep this PR open until the atlases are online, so I don't forget.
What would be great is if you could open an issue
- detailing the problems you encountered with the MRI and the ontology (I'm not sure I understand that entirely)
- and any other MRI related problems (different resolution of annotations? Too many atlases?)
so we can tackle those separately to this PR (which already has a long discussion :D )
You are welcome to join our developer meeting later today (or another time) if you're free and would like to discuss the MRI side further - see the BrainGlobe zulip for details.
brainglobe_atlasapi/atlas_generation/atlas_scripts/kim_devccf_mouse.py
Outdated
Show resolved
Hide resolved
brainglobe_atlasapi/atlas_generation/hashes/kim_devccf_mouse.txt
Outdated
Show resolved
Hide resolved
Thank you a lot for the speed, accuracy and time you put into reviewing this!
No worries. I am not in hurry
sure! It would be a pleasure.
perhaps we can first discuss them in the meeting later today and evaluate if they are proper issues. If so, I will open the relative issues here, sure! |
with the last commit i set the atlas naming to Last thing to discuss is whether this PR should include the change of the naming to overlap previous kim atlases in brainglobe (i.e. be it |
I would be in favour of this last change, to make it clearer to BrainGlobe-only users that this is a newer version of the same atlas? @adamltyson may wish to chime in |
Yeah, if no other reason than it's a slightly shorter name. |
right. Does that mean that I should set |
I think so
I think leave it for now, we don't (yet) have a process for this. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I found the issue I had when generating the meshes for embryonic mri atlases. It was pooch having an unintuitive interface, in my opinion, extracting files from archives in a different order from the one you asked. With this, i feel like this PR is finally concluded! 🎉 |
Description
With this draft PR i ask you your opinion and help to first:
Lastly, I have tested this script on two setups: on one computer without parallelization and the other with. The run with parallelization didn't manage the memory properly and run OOM on linux, effectively making the generation of the atlas much slower. Does BrainGlobe offer any help in the management of the parallelization or should I do it myself?
P.S. if needed, I can provide the resulting atlas from this script
What is this PR
Why is this PR needed?
To perfection the support to Kim's developing mouse brain atlases
What does this PR do?
It adds a script for generating Kim's DevCCFv1 mouse atlas. For now, it generates only the P14 altas with LSFM@20µm as reference, ignoring the other ages (E11.5, E13.5, E15.5, E18.5, P4 and P56) and references (they are all MRI@50 µm)
References
#425
How has this PR been tested?
The resulting atlas from the script was used within ABBA
Is this a breaking change?
No.
Does this PR require an update to the documentation?
It does, but it is not included yet in this PR
Checklist: