Construct a validated portable surface scene
Usage
surface_scene(
left = NULL,
right = NULL,
layers,
curvature = NULL,
variants = NULL,
variant = "default",
selected_layer = NULL,
id = "surface-scene",
metadata = list(),
provenance = list(),
fallback,
alt_text,
preset = "paper-light",
mode = c("report", "viewer"),
asset_mode = c("inline", "directory")
)Arguments
- left, right
Optional left and right
SurfaceGeometryorSurfaceSetobjects. Supply at least one.- layers
A
surface_layerobject or a list of them.- curvature
Optional numeric vector for a unilateral scene or named hemisphere list. Values are display anatomy: higher values render lighter (gyri), as returned by
normalize_surface_anatomy. Negate FreeSurfercurv/sulc(positive in sulci) first.- variants
Optional alternative embeddings of the same meshes that a report viewer can switch between, for example
list(pial = list(left = lh_pial, right = rh_pial)). Each entry gives aSurfaceGeometry,SurfaceSetor n x 3 coordinate matrix per hemisphere with the stored geometry's vertex order. Curvature and layer values are shared by every embedding.- variant
Name of the embedding passed as
left/right(default"default"); it is shown first. Used only withvariants.- selected_layer
Initially selected layer name. Defaults to the first visible layer, then the first layer.
- id
Stable scene identifier.
- metadata, provenance
Arbitrary lists carried into the manifest.
- fallback
Required plain-text fallback content.
- alt_text
Required alternative text for the interactive figure.
- preset
Visual appearance preset.
"paper-light"is intended for light-background figures and does not change widget behavior.- mode
"report"for curated controls and fallback behavior, or"viewer"for a bare interactive viewer.- asset_mode
Default serialization mode: inline base64 or adjacent content-addressed files.
Details
A scene owns the portable report description, not the statistical analysis.
preset changes appearance; mode changes viewer behavior. Inline and
adjacent asset modes encode the same typed-array bytes and preserve missing
values. Use surfwidget inside an R Markdown or Quarto document
and write_surface_scene for an ordinary HTML page.
Examples
geometry <- example_surface_geometry()
scene <- surface_scene(
left = geometry,
layers = surface_layer(
"effect", seq_len(nrow(coords(geometry))), limits = c(1, 4)
),
fallback = "Static left-hemisphere surface figure.",
alt_text = "Left cortical surface colored by an example effect."
)
scene
#> SurfaceScene 'surface-scene'
#> hemispheres: left
#> layers: effect
#> selected: effect