initial commit of optional hemispheres - #875
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an explicit hemispheres_available flag to atlas packaging + manifests, enabling atlases to declare that hemisphere information is unavailable (rather than forcing symmetric=True as a workaround). This integrates the new flag through generation, download behavior, runtime accessors, and validation/tests.
Changes:
- Introduces
hemispheres_availableinto generated metadata/manifests and the metadata template, while keeping legacy manifests valid. - Updates atlas packaging and wrapup logic to skip hemisphere stack creation/writing when hemispheres are unavailable.
- Updates runtime API behavior so
Atlas.hemispheresreturnsNone(andhemisphere_from_coordswarns/returnsNone) when hemispheres are unavailable; updates download logic to avoid fetching hemisphere metadata in that case.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/atlasgen/test_validation.py | Adds coverage to ensure legacy manifests missing hemispheres_available still validate. |
| tests/atlasgen/test_metadata_utils.py | Extends metadata generation tests to include/validate hemispheres_available. |
| tests/atlasgen/test_atlas_packaging_data.py | Verifies packaging skips hemisphere generation when unavailable and does not force symmetric. |
| tests/atlasapi/test_core_atlas.py | Adds runtime behavior tests for default availability and unavailable-hemisphere behavior/warnings. |
| tests/atlasapi/test_bg_atlas.py | Ensures download does not request hemisphere metadata when unavailable. |
| brainglobe_atlasapi/descriptors.py | Extends METADATA_TEMPLATE with hemispheres_available. |
| brainglobe_atlasapi/core.py | Makes Atlas.hemispheres return None when hemispheres are unavailable; warns/returns None in hemisphere_from_coords. |
| brainglobe_atlasapi/bg_atlas.py | Skips downloading hemisphere metadata when hemispheres_available is false. |
| brainglobe_atlasapi/atlas_generation/wrapup.py | Gates hemisphere writing/loading on hemispheres_available and writes the new flag into the manifest. |
| brainglobe_atlasapi/atlas_generation/validate_atlases.py | Treats hemispheres_available as optional to support legacy manifests. |
| brainglobe_atlasapi/atlas_generation/metadata_utils.py | Adds hemispheres_available to generated manifest metadata. |
| brainglobe_atlasapi/atlas_generation/atlas_packaging_data.py | Adds hemispheres_available to packaging data and prevents hemisphere stack generation/loading when unavailable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
brainglobe_atlasapi/core.py:376
- This method now returns
Nonewhen hemisphere information is unavailable, but the function signature is still annotated as returningUnion[int, str]. Please update the return type annotation to includeNoneso the public API type contract matches the behavior described in the docstring.
Returns
-------
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
brainglobe_atlasapi/atlas_generation/metadata_utils.py:36
hemispheres_availablewas inserted in the middle ofgenerate_metadata_dict’s positional parameters, which breaks any existing positional callers (e.g. code passingresolutionpositionally will now be bound tohemispheres_available). To keep backward compatibility, add the new parameter at the end (callers can still pass it by keyword).
symmetric: bool,
hemispheres_available: bool = True,
resolution: Tuple[int, int, int] | Tuple[float, float, float],
orientation: str,
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|



closes #644
This adds a hemispheres_available option to the wrapup. There are two cases when hemispheres are not available.
This is increasingly blocking atlases, from being merged. Many atlases that are already integrated have no hemisphere information but to get around this are labelled symmetrical which is suboptimal.
some notes about this PR