atlannot.merge.coarse module

The coarse merging of the annotation atlases.

This is the refactored and optimized version of atlas_merge.coarse. It uses RegionMeta instead of JSONread and greatly speeds up the merging by optimizing a number of steps. The original logic was designed by Dimitri Rodarie.

atlannot.merge.coarse.manual_relabel(ids_v2: ndarray, ids_v3: ndarray) None[source]

Perform a manual re-labeling step on the CCFv2 and CCFv3 atlases.

The replacements were compiled by Dimitri Rodarie.

Parameters:
  • ids_v2 – The (unique) region IDs of the CCFv2 atlas.

  • ids_v3 – The (unique) region IDs of the CCFv3 atlas.

atlannot.merge.coarse.merge(ccfv2: np.ndarray, ccfv3: np.ndarray, rm: RegionMeta) tuple[np.ndarray, np.ndarray][source]

Perform the coarse atlas merging.

Parameters:
  • ccfv2 – The first atlas to merge, usually CCFv2.

  • ccfv3 – The second atlas to merge, usually CCFv3.

  • rm – The brain region metadata. Usually constructed as follows: RegionMeta.from_dict(brain_regions), where brain_regions can be obtained from the “msg” key of the brain_regions.json (1.json) file.

Returns:

  • ccfv2_new (np.ndarray) – The merged CCFv2 atlas.

  • ccfv3_new (np.ndarray) – The merged CCFv3 atlas.