Learn R Programming

fsbrain (version 0.0.3)

vis.labeldata.on.subject: Visualize a label on the surface of a subject.

Description

Visualizes a label. Note that a label is just a set of vertices, and that you can use this function to visualize sets of vertices, e.g., to see where on the mesh a certain vertex lies. It may be helpful the visualize the vertex with its neighbors, because otherwise it may be too small to spot. Use the function [fsbrain::mesh.vertex.neighbors] to get them. It is advisable to set the view to the interactive 'si' mode and use the 'inflated' surface to identify single vertices.

Usage

vis.labeldata.on.subject(subjects_dir, vis_subject_id, lh_labeldata,
  rh_labeldata, surface = "white", colormap = squash::rainbow2,
  views = c("t4"), rgloptions = list(), rglactions = list(),
  draw_colorbar = FALSE)

Arguments

subjects_dir

string. The FreeSurfer SUBJECTS_DIR, containing the subdir of vis_subject_id, the subject that you want to use for visualization.

vis_subject_id,

string The subject identifier from which to obtain the surface for data visualization. Example: 'fsaverage'.

lh_labeldata

integer vector of vertex indices for the left hemisphere

rh_labeldata

integer vector of vertex indices for the right hemisphere

surface

string. The display surface. E.g., "white", "pial", or "inflated". Defaults to "white".

colormap

a colormap. See the squash package for some colormaps. Defaults to jet.

views

list of strings. Valid entries include: 'si': single interactive view. 't4': tiled view showing the brain from 4 angles. 't9': tiled view showing the brain from 9 angles.

rgloptions

option list passed to par3d. Example: rgloptions = list("windowRect"=c(50,50,1000,1000))

rglactions

named list. A list in which the names are from a set of pre-defined actions. The values can be used to specify parameters for the action.

draw_colorbar

logical, whether to draw a colorbar. WARNING: The colorbar is drawn to a subplot, and this only works if there is enough space for it. You will have to increase the plot size using the 'rlgoptions' parameter for the colorbar to show up. Defaults to FALSE. See coloredmesh.plot.colorbar.separate for an alternative.

Value

list of coloredmeshes. The coloredmeshes used for the visualization.

See Also

Other label functions: apply.label.to.morphdata, apply.labeldata.to.morphdata, vis.subject.label

Other visualization functions: vis.data.on.fsaverage, vis.data.on.subject, vis.mask.on.subject, vis.region.values.on.subject, vis.subject.annot, vis.subject.label, vis.subject.morph.native, vis.subject.morph.standard, vislayout.from.coloredmeshes

Examples

Run this code
# NOT RUN {
   fsbrain::download_optional_data();

  # Define the data to use:
  subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
  lh_labeldata = c(1000, 1001, 1002);   # only the vertices, will be tiny.
  subject_id = 'subject1';
  surface = 'white'; # Should use 'inflated', but we do not currently
                     # ship it for the example subject to reduce download size.

  # For the right hemi, extend them to neighborhood for better visibility:
  rh_labeldata = c(500, 5000);
  rh_surface = subject.surface(subjects_dir, subject_id, surface, 'rh');
  rh_labeldata_neighborhood = mesh.vertex.neighbors(rh_surface, rh_labeldata);
  vis.labeldata.on.subject(subjects_dir, subject_id, lh_labeldata,
   rh_labeldata_neighborhood$vertices, surface=surface, views=c('si'));
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab