atlannot.merge package

Submodules

Module contents

Make CCFv2 and CCFv3 atlases compatible by merging annotated regions.

The CCFv2 and CCFv3 atlases differ in the way the regions are annotated. Sometimes subregions are missing or different region IDs are used. This module offers functionality to modify the region annotations in a pair of CCFv2 and CCFv3 atlases in a way that makes them more compatible and comparable.

At the moment there are two different merging strategies: a “coarse” and a “fine” one and were developed by Dimitri Rodarie. His original merging code can be found in the atlannot.atlas_merge module. This module contains optimized versions of both strategies that have a much faster runtime, but are the same in functionality as the original ones. Therefore the output produced by the original “coarse” and “fine” merging strategies and those implemented in this module should be the same.

The biggest optimization was to not replace labels directly on the atlases but on the set of unique labels, which is much smaller than the atlas volume. The labels in the atlases are remapped at the very end of the whole procedure using fast vectorized numpy operations, see atlas_remap.

Another important optimization was the use of masked numpy arrays instead of copying the entire volume.