Skip to content

Dorr mri#27

Merged
PolarBean merged 20 commits intoauto-detect-same-space-atlasesfrom
dorr-mri
Feb 9, 2026
Merged

Dorr mri#27
PolarBean merged 20 commits intoauto-detect-same-space-atlasesfrom
dorr-mri

Conversation

@PolarBean
Copy link
Member

@PolarBean PolarBean commented Dec 8, 2025

Description

This adds the dorr mouse mri atlas to ccf translator with a deformation to perens stereotaxic mri created by @saarah815

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

References

brainglobe/brainglobe-atlasapi#657

How has this PR been tested?

ive manually checked that it produces the correct results transforming to and from perens stereotaxic mri and allen

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@alessandrofelder
Copy link
Member

alessandrofelder commented Dec 11, 2025

@IgorTatarnikov has kindly volunteered to have a look at this given his experience of working on the Dorr atlas with @saarah815.

Before this, could you ensure the tests pass, please? (Not sure how busy you are atm)
From a quick look at the CI error message, it looks like brainglobe_ccf_translator/config.py imports click but that is not specified as a dependency in pyproject.toml

@PolarBean
Copy link
Member Author

Hey @alessandrofelder so theres a bit of a backlog of PRs. This is merging into #26 which merges into #23.

I think the tests will always be too heavy to pass in an action, and the repo tests pass offline. But yeah some problems like this click import thing should definitely be fixed. Thank you

@PolarBean
Copy link
Member Author

eventually we will do something like this so that the tests are more light weight and runnable via gh action #28

@PolarBean
Copy link
Member Author

I will run it again offline just to be sure and post the results here

@codecov
Copy link

codecov bot commented Dec 11, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@PolarBean
Copy link
Member Author

genuinely shocked that some of the VMs did not crash and are passing 🎉

@PolarBean
Copy link
Member Author

PolarBean commented Dec 11, 2025

also passes on my machine offline

❯ python -m pytest
=============================================================================== test session starts ================================================================================
platform linux -- Python 3.11.7, pytest-7.4.0, pluggy-1.6.0
rootdir: /home/harryc/github/brainglobe-ccf-translator
configfile: pyproject.toml
plugins: anyio-4.2.0, cov-7.0.0
collected 12 items                                                                                                                                                                 

tests/test_PointSet.py .....                                                                                                                                                 [ 41%]
tests/test_Volume.py ...                                                                                                                           [ 66%]
tests/test_VolumeSeries.py .                                                                                                                       [ 75%]
tests/test_space_utils.py ...                                                                                                                      [100%]

===================================================================== tests coverage =====================================================================
____________________________________________________ coverage: platform linux, python 3.11.7-final-0 _____________________________________________________

Name                                                                           Stmts   Miss  Cover
--------------------------------------------------------------------------------------------------
brainglobe_ccf_translator/PointSet.py                                             57      6    89%
brainglobe_ccf_translator/Volume.py                                               58     14    76%
brainglobe_ccf_translator/VolumeSeries.py                                         72     10    86%
brainglobe_ccf_translator/__init__.py                                              9      2    78%
brainglobe_ccf_translator/config.py                                               65     36    45%
brainglobe_ccf_translator/deformation/__init__.py                                  1      0   100%
brainglobe_ccf_translator/deformation/apply_deformation.py                       190     62    67%
brainglobe_ccf_translator/deformation/forward_transform.py                        50     50     0%
brainglobe_ccf_translator/deformation/interpolation/NearestNDInterpolator.py      59     59     0%
brainglobe_ccf_translator/deformation/interpolation/__init__.py                    1      1     0%
brainglobe_ccf_translator/deformation/route_calculation.py                        40     16    60%
brainglobe_ccf_translator/read_write.py                                           23     23     0%
brainglobe_ccf_translator/space_utils.py                                          35      4    89%
--------------------------------------------------------------------------------------------------
TOTAL                                                                            660    283    57%
============================================================ 12 passed in 1961.65s (0:32:41) =============================================================

@alessandrofelder
Copy link
Member

I think the tests will always be too heavy to pass in an action, and the repo tests pass offline.
so that the tests are more light weight and runnable via gh action #28

OK! Sound like a plan :) I'd suggest noting on future PR descriptions with this situation that you don't expect tests to pass (because reviewers might wait for you to fix them before taking time to review otherwise). (But ideally CI tests pass before anyone is asked to review.)

I'd also (possibly naively) say you can drop the CI runs for Python 3.9 and 3.10 (that were cancelled - maybe because they hit the runner VM limits somehow) - other BrainGlobe tools support Python 3.11+ only anyway.

@PolarBean
Copy link
Member Author

Good idea :) Done

@PolarBean PolarBean changed the base branch from auto-detect-same-space-atlases to main January 14, 2026 12:00
@PolarBean PolarBean changed the base branch from main to auto-detect-same-space-atlases January 14, 2026 12:00
@PolarBean
Copy link
Member Author

Are you ok with me merging this (and the other PR's as theyre sort of merging in a chain).

Copy link
Member

@IgorTatarnikov IgorTatarnikov left a comment

Choose a reason for hiding this comment

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

Sorry it took so long to review!

It looks great, I just left a few comments that aren't blocking. It would be good to avoid storing the shapes of the atlases as hard coded values. It's always best to have one source of truth!


VERSION = "1.0"
voxel_size_micron = 25
perens_shape = np.array((615, 297, 455))
Copy link
Member

Choose a reason for hiding this comment

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

Will perens be a common intermediary? It might be worth saving the metadata for the perens atlas as a constant somewhere to import into other files.

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 can access it through brainglobe it just then requires installing the whole atlas to get the shape. I think this will be fixed in v2 and its also nice to use our tools for things like this so ill change it.

Comment on lines +8 to +9
perens_shape = np.array((615, 297, 455)) * 25
dorr_shape = np.array((701, 361, 538)) * 25
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 if the shapes could be loaded from somewhere.

The shapes could be accessed via brainglobe-atlasapi, however, this would entail downloading the entire atlas which may slow things down. This will be solved with BrainGlobe Atlas V2 as you'd only fetch the metadata file and no data to return the shape.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah aha i see i replied to your other comment before reading this! I am ok with using the api for this :)

Copy link
Member Author

Choose a reason for hiding this comment

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

one really weird issue is the dorr shape here is not actually the shape of dorr! but instead the shape of dorr if it were 25 micron voxels (to match perens). Ill jsut add scaling for this.

@PolarBean
Copy link
Member Author

No stress! and I agree about storing atlas shapes, I'll look into a better alternative

@PolarBean
Copy link
Member Author

the jobs are again running out of resources but the parts of the code theyre testing havent changed since the last time it passed. I just tried to rerun some of them. This is however ready for review. Thank you

Copy link
Member

@IgorTatarnikov IgorTatarnikov left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

Thanks for addressing the comments!

@PolarBean PolarBean merged commit 9bb0b76 into auto-detect-same-space-atlases Feb 9, 2026
11 checks passed
@PolarBean
Copy link
Member Author

Thanks for your review!

@PolarBean PolarBean deleted the dorr-mri branch February 9, 2026 18:54
PolarBean added a commit that referenced this pull request Feb 9, 2026
* implement atlas synonyms to be more compatible with brainglobe

* return atlas synonyms among near misses

* Update README with atlas synonyms

Added information about brainglobe atlas API names and their conversions.

* precommit

* precommit and add documentation about running just one test

* add to ignore words list so that codespell doesnt think the method name is a typo

* include demba api name in autoconvert list

* update metadata and ingestion scripts to include dorr

* update readme

* run graph update script and update readme

* run graph update script and update readme

* update dorr age to p84

* update accessibility text as we are no longer using an image

* update ruff formatting

* run precommit

* precommit

* replace click with print

* add mode arg to suppress future warning

* ruff reformat

* unittest worked but pytest failed, here we introduce a fix for this

* drop workflows for 3.9 and 3.10 as they seem to run out of resources

* use atlas api to access atlas shapes

* remove license to make pre-commit happy

* Dorr mri (#27)

* include demba api name in autoconvert list

* update metadata and ingestion scripts to include dorr

* update readme

* run graph update script and update readme

* run graph update script and update readme

* update dorr age to p84

* update accessibility text as we are no longer using an image

* update ruff formatting

* run precommit

* precommit

* replace click with print

* add mode arg to suppress future warning

* ruff reformat

* unittest worked but pytest failed, here we introduce a fix for this

* drop workflows for 3.9 and 3.10 as they seem to run out of resources

* use atlas api to access atlas shapes

* remove license to make pre-commit happy

* Remove unnecessary whitespace in config.py

---------

Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com>
PolarBean added a commit that referenced this pull request Feb 9, 2026
* remove testing file

* auto publish to pypi on release

* update yml file and python versions

* remove scheduled deploy

* remove twine api key as we can instead set the repo to be a trusted publisher for token less pushing

* run black linter

* enforce line lengths

* enforce 79 char line length

* exclude files that will not be included in pypi

* remove line length from ruff as its failing test (its still specified elsewhere)

* fix issue with test

* update license file to avoid spdx warning

* ruff fixes

* correct line incorrectly removed from ingestion script and caught by precommit

* remove unused variable caught by precommit

* make ruff happy

* ruff reformat

* exclude utilities

* precommit passed locally but failed remotely, updating reqs and license

* move docstring to beginning of file

* tests failing bc of triple quoted comments

* ruff reformat

* test off by 0.5 voxels...

* rename test case

* revert test value

* fix empty last line

* autofix files precommit

* Auto detect same space atlases (#26)

* implement atlas synonyms to be more compatible with brainglobe

* return atlas synonyms among near misses

* Update README with atlas synonyms

Added information about brainglobe atlas API names and their conversions.

* precommit

* precommit and add documentation about running just one test

* add to ignore words list so that codespell doesnt think the method name is a typo

* include demba api name in autoconvert list

* update metadata and ingestion scripts to include dorr

* update readme

* run graph update script and update readme

* run graph update script and update readme

* update dorr age to p84

* update accessibility text as we are no longer using an image

* update ruff formatting

* run precommit

* precommit

* replace click with print

* add mode arg to suppress future warning

* ruff reformat

* unittest worked but pytest failed, here we introduce a fix for this

* drop workflows for 3.9 and 3.10 as they seem to run out of resources

* use atlas api to access atlas shapes

* remove license to make pre-commit happy

* Dorr mri (#27)

* include demba api name in autoconvert list

* update metadata and ingestion scripts to include dorr

* update readme

* run graph update script and update readme

* run graph update script and update readme

* update dorr age to p84

* update accessibility text as we are no longer using an image

* update ruff formatting

* run precommit

* precommit

* replace click with print

* add mode arg to suppress future warning

* ruff reformat

* unittest worked but pytest failed, here we introduce a fix for this

* drop workflows for 3.9 and 3.10 as they seem to run out of resources

* use atlas api to access atlas shapes

* remove license to make pre-commit happy

* Remove unnecessary whitespace in config.py

---------

Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com>

---------

Co-authored-by: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com>
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