Skip to contents

S3 generic that dispatches to atlas-type-specific preparation methods. Builds mesh data structures and legend data from a ggseg_atlas.

Usage

# S3 method for class 'cortical_atlas'
prepare_brain_meshes(
  atlas,
  .data = NULL,
  surface = "LCBC",
  hemisphere = c("right", "left"),
  label_by = "region",
  text_by = NULL,
  colour_by = "colour",
  palette = NULL,
  na_colour = "darkgrey",
  na_alpha = 1,
  edge_by = NULL,
  brain_meshes = NULL,
  split_boundaries = TRUE,
  ...
)

# S3 method for class 'subcortical_atlas'
prepare_brain_meshes(
  atlas,
  .data = NULL,
  label_by = "region",
  text_by = NULL,
  colour_by = "colour",
  palette = NULL,
  na_colour = "darkgrey",
  na_alpha = 1,
  ...
)

# S3 method for class 'cerebellar_atlas'
prepare_brain_meshes(
  atlas,
  .data = NULL,
  label_by = "region",
  text_by = NULL,
  colour_by = "colour",
  palette = NULL,
  na_colour = "darkgrey",
  na_alpha = 1,
  surface_opacity = NULL,
  split_boundaries = TRUE,
  ...
)

# S3 method for class 'tract_atlas'
prepare_brain_meshes(
  atlas,
  .data = NULL,
  label_by = "region",
  text_by = NULL,
  colour_by = "colour",
  palette = NULL,
  na_colour = "darkgrey",
  na_alpha = 1,
  tract_color = c("palette", "orientation"),
  tube_radius = 2,
  tube_segments = 10,
  ...
)

prepare_brain_meshes(atlas, ...)

Arguments

atlas

A ggseg_atlas object

.data

A data.frame to use for plot aesthetics. Must include a column called "region" corresponding to regions.

surface

Surface type: "inflated", "semi-inflated", "white", "pial", "midthickness", "sphere", "smoothwm" or "orig". ggseg3d() additionally accepts "LCBC", an alias for "inflated".

hemisphere

Character vector of hemispheres: "left", "right". "lh" and "rh" are accepted as well.

label_by

String. Column name used as hover label for each region.

text_by

String. Column name for extra hover text shown below the region label.

colour_by

String. Column name mapped to mesh colours.

palette

Character vector of colour names or hex colours. May instead be a named numeric vector whose names are the colours and whose values are the breakpoints those colours sit at.

na_colour

String. Colour drawn for regions with no value in .data, as a colour name or a hex code.

na_alpha

Numeric between 0 and 1. Opacity of regions with no value in .data: 1 (default) draws them opaque in na_colour, lower values fade them. Cortical and cerebellar surfaces fade per vertex, subcortical structures and tracts per mesh.

edge_by

Column name for region boundary edge grouping

brain_meshes

Optional user-supplied mesh data. Passed through to ggseg.formats::get_brain_mesh() for format details.

split_boundaries

Draw parcel borders where the parcellation puts them, rather than on the nearest mesh edge (TRUE, the default). Faces straddling a border are cut along the crossed edges' midpoints, which removes the roughly one-triangle-wide fringe along every border – about 3 mm on an fsaverage5 surface. It costs around half the vertices again on the surfaces it touches; set FALSE for the smaller widget.

...

Type-specific arguments passed to methods

surface_opacity

Numeric opacity for the cerebellar surface mesh. Defaults to 0.3 when deep nuclei are present and 1 otherwise.

tract_color

"palette" (default) or "orientation" (direction-based RGB colouring)

tube_radius

Numeric tube radius.

tube_segments

Integer tube segment count.

Value

List with meshes (list of mesh entries) and legend_data