Reduce a subcortical atlas to focus regions on grey anatomical context
Source:R/subcortical_builders.R
aseg_context.RdApplies the post-processing recipe shared by the FreeSurfer subcortical atlases:
Usage
aseg_context(
atlas,
focus,
match_on = c("label", "region"),
remove = aseg_hidden_labels(),
punch_white_matter = TRUE,
cortex = "^cortex",
white_matter = "White-Matter$",
drop_empty_views = TRUE
)Arguments
- atlas
A subcortical
ggseg_atlas, e.g. fromcreate_subcortical_from_volume().- focus
Regex matched (case-insensitively) against
match_onidentifying the regions to keep as coloured core; everything else becomes context.- match_on
Column to match
focusagainst:"label"or"region".- remove
Character vector of
ggseg.formats::atlas_region_remove()patterns to strip before demoting context. Defaults toaseg_hidden_labels(); passcharacter(0)to skip.- punch_white_matter
If
TRUE, subtractwhite_matterfrom thecortexsilhouette. Skipped with a message if either pattern is absent.- cortex, white_matter
Label patterns for the brain silhouette and the cerebral white matter used by the punch.
- drop_empty_views
If
TRUE, remove views containing no focus region.
Details
Punch the cerebral white matter out of the brain silhouette (
ggseg.formats::atlas_region_op()) so slices show the cortical ribbon with the white-matter interior as a hole rather than a solid blob.Remove the structures
asegdoes not draw (aseg_hidden_labels()).Demote every remaining structure that is not matched by
focusto grey context, so only the focus regions are coloured.Optionally drop views left with no focus geometry.
The context demotion matches the leftover core labels exactly and
case-sensitively, so a focus region is never swallowed by a context entry
that happens to be a substring of its name (e.g. Thalamus vs
hypothalamus).
Examples
if (FALSE) { # \dontrun{
atlas <- create_subcortical_from_volume(
input_volume = file.path(
freesurfer::fs_subj_dir(), "fsaverage5", "mri", "aseg.mgz"
),
atlas_name = "aseg"
)
aseg_context(atlas, focus = "Hippocampus")
} # }