atlannot.merge.fine module¶
The fine merging of the annotation atlases.
This is the refactored and optimized version of atlas_merge.fine
. 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.fine.explore_voxel(start_pos: tuple, masked_atlas: MaskedArray, *, count: int = -1) int [source]¶
Explore a given voxel.
Ask Dimitri for more details.
Seems like this is a BFS until a voxel with a different value is found or the maximal number of new voxels were seen.
- Parameters:
start_pos – A triplet with the (x, y, z) coordinates of the starting voxel.
masked_atlas – A masked 3D array with the volume data.
count – Maximal number of iterations. A negative value means no limit on the number of iterations.
- Returns:
The value of some voxel in the data volume.
- Return type:
int
- atlannot.merge.fine.manual_relabel_1(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.fine.manual_relabel_2(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.fine.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)
, wherebrain_regions
can be obtained from the “msg” key of thebrain_regions.json
(1.json
) file.
- Returns:
ccfv2_new (np.ndarray) – The merged CCFv2 atlas.
ccfv3_new (np.ndarray) – The merged CCFv3 atlas.