Skip to contents

Create an HTML widget from a portable SurfaceScene or adapt a legacy single-surface object to one. Use SurfaceScene for bilateral viewers, multiple named maps, authored fallbacks, and portable report assets.

Usage

surfwidget(x, width = NULL, height = NULL, ...)

# S4 method for class 'SurfaceGeometry'
surfwidget(
  x,
  width = NULL,
  height = NULL,
  data = NULL,
  cmap = jet_colors(256),
  irange = NULL,
  thresh = c(0, 0),
  vertexColors = NULL,
  alpha = 1,
  curvature = NULL,
  colorbar = TRUE,
  colorbar_label = NULL,
  layers = NULL,
  config = list(),
  ...
)

# S4 method for class 'NeuroSurface'
surfwidget(
  x,
  width = NULL,
  height = NULL,
  cmap = jet_colors(256),
  irange = NULL,
  thresh = c(0, 0),
  vertexColors = NULL,
  alpha = 1,
  curvature = NULL,
  colorbar = TRUE,
  colorbar_label = NULL,
  layers = NULL,
  config = list(),
  ...
)

# S4 method for class 'ColorMappedNeuroSurface'
surfwidget(
  x,
  width = NULL,
  height = NULL,
  thresh = NULL,
  vertexColors = NULL,
  alpha = 1,
  curvature = NULL,
  colorbar = TRUE,
  colorbar_label = NULL,
  layers = NULL,
  config = list(),
  ...
)

# S4 method for class 'VertexColoredNeuroSurface'
surfwidget(
  x,
  width = NULL,
  height = NULL,
  alpha = 1,
  curvature = NULL,
  colorbar = TRUE,
  colorbar_label = NULL,
  layers = NULL,
  config = list(),
  ...
)

# S4 method for class 'SurfaceScene'
surfwidget(x, width = NULL, height = NULL, config = list(), ...)

Arguments

x

A SurfaceScene, SurfaceGeometry, NeuroSurface, ColorMappedNeuroSurface, or VertexColoredNeuroSurface.

width

Optional widget width.

height

Optional widget height.

...

Arguments passed to the method for x.

data

Optional. Numeric vector of data values for each vertex.

cmap

Optional. Color map for data visualization.

irange

Optional. Intensity range for data visualization.

thresh

Optional. Threshold range for data visualization.

vertexColors

Optional. Vector of colors for each vertex.

alpha

Opacity of the surface (0 to 1).

curvature

Optional numeric vector of curvature values for each vertex. If not supplied for a SurfaceGeometry object, it is computed via curvature(x).

colorbar

Logical; if TRUE (default), render a colorbar when a colormap is used.

colorbar_label

Optional character label shown alongside the colorbar.

layers

Legacy list of additional single-surface data layers. New code should pass surface_layer objects to surface_scene.

config

Configuration for legacy single-surface calls:

preset

Appearance preset used while adapting the object. The default is "paper-light".

mode

"report" for the curated report toolbar or "viewer" for a bare viewer.

shininess

Numeric between 0 and 100. Controls the shininess of the material. Higher values create a more polished appearance. Default is 30.

specularColor

Character. Hex color code for the specular highlights. Default is "#111111".

flatShading

Logical scalar. If TRUE, uses flat shading; if FALSE, uses smooth shading. Default is FALSE.

ambientLightColor

Character. Hex color code for the ambient light. Default is "#404040".

directionalLightColor

Character. Hex color code for the directional light. Default is "#ffffff".

directionalLightIntensity

Numeric between 0 and 1. Intensity of the directional light. Default is 0.5.

Unknown elements are ignored with a warning. showControls and controlType are deprecated; report widgets do not load Tweakpane.

Value

An htmlwidget containing the local surfview runtime and scene.

Details

The browser renders the values supplied by R. Perform statistical thresholding, capping, atlas projection, and other scientific transformations before constructing the widget. The legacy single-surface methods create a one-hemisphere SurfaceScene; they do not expose the full bilateral and portable-scene contract.

preset = "paper-light" controls appearance. mode = "report" controls behavior and enables the compact map, anatomical-view, reset, and PNG controls. Set these fields on surface_scene for an explicit scene.

Examples

# \donttest{
geom <- example_surface_geometry()
surfwidget(geom)

# }