Skip to contents

Combines two brain atlases into a single unified atlas object, preserving all region information and adjusting region IDs to prevent conflicts. This is useful for creating composite atlases that combine different parcellation schemes.

Usage

merge_atlases(atlas1, atlas2)

Arguments

atlas1

The first atlas object to merge

atlas2

The second atlas object to merge

Value

A new atlas object containing:

name

Combined names of input atlases (atlas1::atlas2)

atlas

Combined ClusteredNeuroVol object

cmap

Combined colormap for all regions

ids

Adjusted vector of all region IDs

labels

Combined vector of region labels

orig_labels

Original labels from both atlases

hemi

Combined hemisphere designations

network

Combined network assignments, when either parent has them (e.g. Schaefer); regions from a parent without networks are NA

Other per-region attributes reported by roi_metadata for either parent are carried over in the same way, so roi_metadata() and query_point on the merged atlas report them for the regions that had them.

Details

The merging process:

  • Verifies that both atlases have the same dimensions

  • Adjusts region IDs in the second atlas to avoid overlap

  • Combines color maps, labels, hemisphere information, and other per-region metadata such as Schaefer network assignments

  • Creates a new ClusteredNeuroVol object for the merged atlas

Examples

if (FALSE) { # \dontrun{
# Load two atlases
atlas1 <- get_aseg_atlas()
atlas2 <- get_aseg_atlas()

# Merge the atlases
merged <- merge_atlases(atlas1, atlas2)

# Check the combined regions
print(merged)
} # }