Skip to contents

neurosurf (development version)

New features

  • surface_palette() returns the colours neurosurf uses for statistical maps (two-sided, positive, negative), and with limits and threshold the exact lookup table of the CPU renderer, so RGL scenes, report widgets and static figures can share one colour language.

  • surface_panels() lays out render_surface_rgba() panels as small multiples on one scale, with labels, the shared colour key and optional reference swatches. surface_colorbar_grob() returns that key on its own for hand-made layouts. Panels now record their palette, overlay opacity and opacity ramp in provenance.

  • load_fsaverage_cortex() returns the cortical domain of the bundled fsaverage5 template (everything except the medial wall), for cortex_mask. It reads FreeSurfer’s Destrieux 2009 parcellation of fsaverage5, now bundled unmodified from TemplateFlow (32 kB); provenance is in inst/extdata/PROVENANCE.md.

Changes

  • The bundled browser runtime is surfview 3.3.0 (byte-identical to the npm release). Switching surface variants in a report viewer now honours a switch back mid-animation, and shading and bounds follow the changing shape.

  • view_surface() and the plot() methods shade the surface by its curvature by default (sulci dark, gyri light) instead of flat light grey, and choose surface_palette() (diverging when the colour range spans zero) instead of rainbow() or grey. With thresh, colour now fades in over a short band past the threshold instead of stepping at each vertex. The legacy surfwidget() shortcuts likewise default to surface_palette() instead of jet.

  • surface_figure(): the colour key has its title centred above the ramps, larger type, at most one interior tick per ramp, and shows an opacity ramp as it appears on the cortex. Row labels read horizontally, and a figure with a single panel drops its hemisphere and view headers.

  • Report widgets draw a graphical colour key (with the threshold gap) instead of a text range, show the anatomical views as a segmented control with the opening view selected, and use a compact fullscreen button.

  • medial_wall = "outline" draws a darker, two-pixel boundary.

Bug fixes

  • render_surface_rgba(medial_wall = "mask") no longer reveals the far side of the hemisphere through the masked region; masked triangles still occlude and are drawn as background.

  • show() for a SurfaceGeometry reported a wrong surface area (it summed dot products instead of cross-product norms). It now reports the area in mm^2 and the mean edge length in mm, computes its metrics vectorised, and no longer prints ASCII art.

  • smooth() for a NeuroSurface called the undeclared package purrr.

  • The RGL walkthrough (“Displaying surfaces with RGL”) is now a website-only article (vignettes/articles/): its live scenes carried about 4 MB of mesh data. Installed documentation drops from about 8 MB to under 4 MB; the other vignettes link to the article online. write_surface_rgba() writes opaque panels without an alpha channel, and the README figure is regenerated at 150 dpi with the current figure style.

  • Roxygen markdown is enabled, so [topic] links, code and bold in the documentation render instead of appearing as literal brackets and backticks.

  • load_fsaverage_std8() documents that its meshes share fsaverage (MNI305) coordinates with the fsaverage5 surfaces (a rigid fit between the two white surfaces moves them by less than half a millimetre).

  • view_surface() documented zoom and thresh backwards; curvature() now documents that it returns mean curvature rescaled to [0, 1], higher on gyri.

  • surfwidget.yaml now declares the bundled runtime as surfview 3.2.0; 0.1.0.9001 shipped the 3.2.0 bundle under a 3.1.0 label. tools/rebuild-surfview-runtime.py --repin now updates the label from the pin, and a test checks they agree.

New features

  • The bundled browser runtime is surfview 3.2.0 (was 2.2.0.9002). Report scenes use its colour management, headlight and curvature defaults; binary references are written as surfview.scene.v2 (boundary = "midpoint", no colour scale), and the local runtime patch is gone.

  • surface_scene(variants =, variant =) ships alternative embeddings of the same meshes (for example pial and white beside inflated). Report viewers can switch between them; values and curvature are shared.

  • surface_layer(magnitude_opacity =) fades a map’s colours by |value| in the viewer, following live threshold and range changes. render_surface_rgba(magnitude_opacity =) applies the same rule to static rasters; the CPU rasterizer now honours the overlay LUT’s alpha.

  • normalize_surface_anatomy(style = "soft") and render_surface_rgba(anatomy_style = "soft") give a smooth gyral/sulcal two-tone: crisp folds without the binary style’s vertex-step edges.

Changes

  • Scene curvature keeps its documented meaning, higher values lighter (gyri): the manifest writer negates it because surfview 3 reads curvature in the FreeSurfer polarity. Pass FreeSurfer curv/sulc negated, as before.

  • The medial wall of static surface rasters is drawn as one flat tone midway between the sulcal and gyral greys of the anatomy, instead of a fixed mid-grey, so it recedes behind the surrounding cortex.

  • The bundled fsaverage5 template now includes the pial surface (pial_left.gii.gz, pial_right.gii.gz, unmodified from the same pinned nilearn commit). load_fsaverage("fsaverage5", "pial") loads it, so vol_to_surf() can sample a volume through the cortical ribbon on the 10,242-vertex fsaverage5 mesh instead of only on std.8. load_fsaverage_bundle() also accepts density = "fsaverage5" (#102).

Bug fixes

  • series() on a NeuroSurfaceVector now returns a T x length(i) matrix (time in rows, vertices in columns) for a single integer index, as it already did for double indices and as neuroim2::series() does for NeuroVec. Previously series(x, 2L) returned 1 x T while series(x, 2) returned T x 1; this also made series_roi(x, <single integer>) fail with an invalid ROISurfaceVector. Code that relied on the old 1 x T result for a single integer index must drop its transpose (#93).

  • neighbor_graph() on a SurfaceGeometry now accepts double-stored node indices (e.g. nodes = c(1, 2)) as well as integer ones; previously only integer nodes had a method and doubles failed dispatch (#93).

Documentation

  • conn_comp() and cluster_threshold() now document that threshold is two-tailed: vertices with values <= threshold[1] or >= threshold[2] are retained (#94).

  • SurfaceSearchlight() now documents that distance_type defaults to "euclidean" (not geodesic, as its title and radius docs claimed), and that this differs from neighbor_graph() and RandomSurfaceSearchlight(), which use geodesic distance. The default itself is unchanged (#94).

  • series() documents its return orientation correctly: T x length(i) for a NeuroSurfaceVector and 1 x length(i) for a NeuroSurface (#94).

  • The Rd file for the FreesurferSurfaceGeometryMetaInfo class is now named man/FreesurferSurfaceGeometryMetaInfo-class.Rd, matching the name roxygen generates. The tracked file still used the old FreeSurfer... casing, so devtools::document() deleted it on case-insensitive filesystems and renamed it on case-sensitive ones. The class name is unchanged (#95).

Searchlights and continuous integration

  • RandomSurfaceSearchlight() now accepts distance_type, with geodesic as its default. SurfaceSearchlight() keeps its Euclidean default to preserve existing analyses. Pass the same metric explicitly to both constructors when comparing sampling strategies. Existing positional calls are unchanged (#96).
  • The pkgcheck workflow is advisory: it retains the rOpenSci findings and reports failures in the log and job summary without failing the workflow. R CMD check remains the package check. The pkgcheck job now sets RGL_USE_NULL=TRUE before installation for headless runners (#97).

neurosurf 0.1.0

Interactive report scenes

  • The bundled surfview runtime is repinned to surfviewjs 2d9f786. Report scenes gain an anatomical whole-brain layout with a data-driven overview pose, a report preset (sulcal two-tone underlay, camera-attached lighting, anti-aliased threshold isolines), overlay-aware camera framing, and fixes for self-overlap artefacts on inflated surfaces, ignored curvature restyling, and hover picks that reported a hidden hemisphere. The runtime patch is now empty: every former patch hunk is upstream.

  • The bundled surfview runtime is repinned to surfviewjs 1dfed43. Threshold edges are drawn one-sided, between shown and hidden vertices; picking only hits surfaces that are drawn (GPU pick meshes carry their source surface’s layers, and the selected surface wins ties); figure export uses the viewer background and the active layer’s colour key, including dual-threshold and volume layers. The widget dependency version is bumped to 2.2.0.9002 so browsers do not serve the previous bundle from cache.

Parcel maps

  • New publication parcel-map renderer: prepare_surface_parcels() and render_surface_parcels() rasterize a labelled surface with deferred per-pixel shading. Parcel boundaries follow smoothed label memberships, so they are smooth and antialiased rather than stair-stepped along triangle edges; the underlay combines a sulcal-depth proxy with soft Lambert lighting; filled parcels get a thin outline and the medial wall is drawn flat. surface_parcel_style() collects the settings, and surface_sulcal_proxy() estimates sulcal depth from white and inflated meshes.

Static surface figures

render_surface_rgba() and surface_figure() produce substantially better figures by default:

  • Surfaces are lit with interpolated normals (two-light Blinn-Phong with hemispheric ambient), so cortical form is visible. lighting = FALSE restores flat rendering; a named list tunes it. Overlay shading is normalized so camera-facing overlay matches the colour bar.
  • Coarse meshes are subdivided for display (subdivide = "auto") with an interpolating butterfly scheme. Original vertex values are preserved and new values are clamped to their edge’s endpoints, so no suprathreshold region appears that linear interpolation would not show.
  • Palettes span only the suprathreshold range, so the weakest displayed value is clearly coloured. New defaults suit each tail; the positive palette runs light to dark.
  • The anatomy underlay is lighter, with sulci darker than gyri. anatomy_invert = "auto" detects metrics that are larger in sulci (FreeSurfer sulc, curv) and inverts them.
  • The silhouette contour is anti-aliased, the default background is white, and the default supersampling is 3.
  • Medial views are now true camera views (the left hemisphere’s anterior pole is on the right). Previously they were mirror images.
  • surface_figure() shows dorsal and ventral views of both hemispheres in one bilateral panel beside the lateral/medial rows, adds hemisphere and view headers (labels), and draws a colour bar with only the suprathreshold segments, labelled at limits and thresholds.
  • Overlay colour stays within a few percent of its colour-bar colour at any viewing angle; lighting conveys form, the palette conveys value.
  • Bilateral dorsal and ventral panels carry anterior/posterior markers.

Templates and I/O

  • The fsaverage5 template (inflated and white surfaces, sulcal depth) is bundled: load_fsaverage("fsaverage5") and load_fsaverage_sulc(). The README and figure vignette use it instead of the legacy std.8 mesh.
  • read_surf_geometry() reads gzipped GIFTI (.gii.gz) surfaces; it previously failed on them.

Package distribution

  • Initial CRAN submission.
  • Require CRAN neuroim2 0.19.1. Replace the unattributed optional downloads with small synthetic GIFTI/NIML fixtures generated locally in a versioned cache. neurosurf_download_testdata() remains a compatibility wrapper.
  • Ship compact vignettes and complete viewer source and third-party notices.