Replaces the type of a brain atlas. The type is held in three coupled
places: the type field, the leading <type>_atlas class, and the
ggseg_data_<type> class of the data payload. This setter reconstructs the
atlas through ggseg_atlas() so all three stay in agreement – assigning
the type field directly leaves the subclass stale and
is_tract_atlas() and friends disagreeing with atlas_type().
Details
Because type and payload are coupled, the new type must match the data the
atlas already carries: a "tract" atlas needs ggseg_data_tract()
(centerlines), a "subcortical" atlas needs ggseg_data_subcortical()
(meshes). Retyping an atlas whose payload does not match is an error –
rebuild the payload with the matching ggseg_data_*() constructor first.
See also
atlas_type() to read the type.
Other atlas setters:
set_atlas_palette()
Examples
a <- aseg()
a <- set_atlas_type(a, "subcortical")
atlas_type(a)
#> [1] "subcortical"
