Picture of the author

Removed all internal logic and references related to transforming atlas data to the BrainGlobe orientation, requiring input data to be pre-oriented.

What was done

  • The transformation_mat parameter and the trasform_to_bg key were removed from the generate_metadata_dict function in metadata_utils.py.
  • All orientation transformation logic was removed from the wrapup_atlas_from_data function in wrapup.py. This included removing calls to map_stack_to and map_points_to, and the calculation/storage of a transformation matrix.
  • An assertion was added to wrapup_atlas_from_data to enforce that input stacks and meshes are already oriented to "asr".
  • The orientation field was removed from the metadata template in descriptors.py.
  • Removed the import of brainglobe_space and the instantiation of AnatomicalSpace objects, as they are no longer needed for internal transformations.

Impact

  • Atlas generation now strictly expects input data (stacks and meshes) to be in the "asr" (Anterior-Superior-Right) BrainGlobe orientation, making the API simpler but requiring users to pre-orient their data.
  • This is a breaking change for atlas generators that previously relied on brainglobe-atlasapi to perform orientation transformations.
  • Improved clarity in atlas metadata by removing redundant transformation information.
  • Minor performance gains during atlas generation due to the removal of transformation computations.

Technical details

  • Files touched include brainglobe_atlasapi/atlas_generation/metadata_utils.py, brainglobe_atlasapi/atlas_generation/wrapup.py, and brainglobe_atlasapi/descriptors.py.
  • The generate_metadata_dict function no longer accepts a transformation_mat parameter or adds trasform_to_bg to the metadata.
  • The wrapup_atlas_from_data function was refactored to remove all brainglobe_space dependencies and related orientation logic.
  • The METADATA_TEMPLATE in descriptors.py was updated to no longer include an "orientation" field.
  • The change shifts the responsibility of data orientation to the data provider rather than the atlas packaging utility.
  • #547

Metadata