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

Integrating atlas validation in wrapup.py #445

Merged
merged 16 commits into from
Feb 11, 2025
Merged

Conversation

viktorpm
Copy link
Member

@viktorpm viktorpm commented Jan 20, 2025

Description

This PR integrates our atlas validation functions in the wrapup section of atlas packaging.

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

Currently, we run the validation functions on finalised atlases. We want to integrate this step with atlas generation to see if an atlas is valid or not immediately.

References

?

How has this PR been tested?

Locally on

  • whs_sd_rat.py
  • princeton_mouse.py
  • admba_3d_dev_mouse.py
  • axolotl_atlas.py
  • cavefish_atlas.py
  • humanatlas.py

Is this a breaking change?

No

Does this PR require an update to the documentation?

Possibly

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

@viktorpm
Copy link
Member Author

Example output for whs_sd_rat.py:

No mesh file exists for: {'name': 'spiral ganglion', 'acronym': 'SpG', 'id': 162, 'structure_id_path': [10000, 1049, 162], 'rgb_triplet': (185, 255, 233)}, ignoring it
In the end, 1 structures with mesh are kept
Finalising atlas
Running atlas validation on whs_sd_rat_39um_v1.2
passed validate_atlas_files
passed catch_missing_structures
passed catch_missing_mesh_files
failed validate_mesh_matches_image_extents: ('Mesh coordinate 955.5 and annotation coordinate 0.0', 'differ by more than 10 times pixel size 39.0')
passed open_for_visual_check
passed validate_checksum
passed validate_image_dimensions
passed validate_additional_references
Saving compressed atlas data at: /home/plattnerv/brainglobe_workingdir/whs_sd_rat/whs_sd_rat_39um_v1.2.tar.gz

Process finished with exit code 0

Catches known error.

@viktorpm viktorpm marked this pull request as ready for review January 20, 2025 17:43
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.

Lovely.

Two small comments for simplification :)

brainglobe_atlasapi/atlas_generation/wrapup.py Outdated Show resolved Hide resolved
brainglobe_atlasapi/atlas_generation/wrapup.py Outdated Show resolved Hide resolved
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 @viktorpm

Sorry - I wasn't clear enough in my description of the changes I suggested, which (if I am right??) would significantly simplify the code even further. (Let's chat if you have questions!).

brainglobe_atlasapi/atlas_generation/validate_atlases.py Outdated Show resolved Hide resolved
brainglobe_atlasapi/atlas_generation/validate_atlases.py Outdated Show resolved Hide resolved
brainglobe_atlasapi/atlas_generation/wrapup.py Outdated Show resolved Hide resolved
@viktorpm viktorpm force-pushed the validation_in_wrapup branch from c057db1 to 1fa55e8 Compare February 7, 2025 13:03
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 @viktorpm - this will be so useful!
I have even more suggestions for simplifying the code 😁

I think the visual_check validation function needs to return True instead of pass for the CI tests to pass.

Please merge once you've considered my suggestions and the tests pass (I am on leave for most of next week :) 🌴 )

brainglobe_atlasapi/atlas_generation/validate_atlases.py Outdated Show resolved Hide resolved
brainglobe_atlasapi/atlas_generation/wrapup.py Outdated Show resolved Hide resolved
brainglobe_atlasapi/atlas_generation/wrapup.py Outdated Show resolved Hide resolved
@viktorpm
Copy link
Member Author

viktorpm commented Feb 7, 2025

Thank you! Enjoy your time off 😊

viktorpm and others added 4 commits February 11, 2025 13:20
- Replaced hardcoded list of validation functions in `wrapup.py` with `get_all_validation_functions()` for better maintainability.
- Modified `validate_atlases.py` to return `True` instead of `pass` for unimplemented validation functions.
@viktorpm viktorpm merged commit 4b5fa64 into main Feb 11, 2025
4 of 10 checks passed
@viktorpm viktorpm deleted the validation_in_wrapup branch February 11, 2025 14:02
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.

2 participants