Changelog
Source:NEWS.md
neurosurf (development version)
New features
surface_palette()returns the colours neurosurf uses for statistical maps (two-sided, positive, negative), and withlimitsandthresholdthe exact lookup table of the CPU renderer, so RGL scenes, report widgets and static figures can share one colour language.surface_panels()lays outrender_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 inprovenance.load_fsaverage_cortex()returns the cortical domain of the bundled fsaverage5 template (everything except the medial wall), forcortex_mask. It reads FreeSurfer’s Destrieux 2009 parcellation of fsaverage5, now bundled unmodified from TemplateFlow (32 kB); provenance is ininst/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 theplot()methods shade the surface by its curvature by default (sulci dark, gyri light) instead of flat light grey, and choosesurface_palette()(diverging when the colour range spans zero) instead ofrainbow()or grey. Withthresh, colour now fades in over a short band past the threshold instead of stepping at each vertex. The legacysurfwidget()shortcuts likewise default tosurface_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 aSurfaceGeometryreported 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 aNeuroSurfacecalled 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,codeand 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()documentedzoomandthreshbackwards;curvature()now documents that it returns mean curvature rescaled to [0, 1], higher on gyri.surfwidget.yamlnow 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 --repinnow 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")andrender_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/sulcnegated, 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, sovol_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 acceptsdensity = "fsaverage5"(#102).
Bug fixes
series()on aNeuroSurfaceVectornow returns aT x length(i)matrix (time in rows, vertices in columns) for a single integer index, as it already did for double indices and asneuroim2::series()does forNeuroVec. Previouslyseries(x, 2L)returned1 x Twhileseries(x, 2)returnedT x 1; this also madeseries_roi(x, <single integer>)fail with an invalidROISurfaceVector. Code that relied on the old1 x Tresult for a single integer index must drop its transpose (#93).neighbor_graph()on aSurfaceGeometrynow accepts double-stored node indices (e.g.nodes = c(1, 2)) as well as integer ones; previously only integernodeshad a method and doubles failed dispatch (#93).
Documentation
conn_comp()andcluster_threshold()now document thatthresholdis two-tailed: vertices with values<= threshold[1]or>= threshold[2]are retained (#94).SurfaceSearchlight()now documents thatdistance_typedefaults to"euclidean"(not geodesic, as its title andradiusdocs claimed), and that this differs fromneighbor_graph()andRandomSurfaceSearchlight(), which use geodesic distance. The default itself is unchanged (#94).series()documents its return orientation correctly:T x length(i)for aNeuroSurfaceVectorand1 x length(i)for aNeuroSurface(#94).The Rd file for the
FreesurferSurfaceGeometryMetaInfoclass is now namedman/FreesurferSurfaceGeometryMetaInfo-class.Rd, matching the name roxygen generates. The tracked file still used the oldFreeSurfer...casing, sodevtools::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 acceptsdistance_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=TRUEbefore 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
reportpreset (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()andrender_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, andsurface_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 = FALSErestores 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 (FreeSurfersulc,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")andload_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.