ggseg3d (development version)
Bug fixes
Cortical surfaces are oriented from what the mesh records rather than from which package it came from. A surface carrying a
mesh_space()is taken at its word; one without falls back to the historical rotation, so an old and a newggseg.meshesboth render correctly and neither has to be installed in step with this package (ggsegverse/ggseg3d#83).The test suite no longer opens an rgl window.
options(rgl.useNULL = TRUE)sat on line 1 oftest-rayshader.R, buttestthatrunstest-add-points.Rfirst and that opens a device, so the window appeared before the option was set. It is now insetup.R, which also lets the suite run headless.Region boundary edges are drawn again, on both cortical and cerebellar atlases. Splitting faces at parcel borders (2.1.2.9009) left every face with a single region, which is what makes the borders exact – and left
find_boundary_edges()with no face whose vertices differ, soset_edges(),edge_byand the default edges all silently produced nothing. Edges are now computed before the split.label_byworks on cortical and cerebellar atlases. It was validated against the data and then ignored, solabel_by = "label"hovered region names. Subcortical and tract atlases always honoured it.
Bug fixes
- Requires
ggseg.formats (>= 0.0.4.9025), the first version carrying the rebuilttracula. The previous floor was satisfied by versions whose tracula was mirrored left-to-right, so an installed 0.0.4.9022 upgraded nothing andggseg3d(atlas = tracula(), hemisphere = "left")drew the anatomical right hemisphere under the left label – while ggseg, floored higher, drew it correctly in the same session.
New features
mesh_to_mni()andmni_to_mesh()convert between the coordinates a plot draws in and MNI305 or MNI152, so a position can be looked up rather than guessed at. The surfaces are fsaverage5, and so already MNI305 apart from the shift that moves each hemisphere to the midline; the shift is read from the mesh rather than assumed. Inflated and spherical surfaces are refused, since a position on them corresponds to nowhere in the brain.add_points()draws markers at coordinates of your own – electrode and sensor positions, stimulation sites. This was done with plotly’sadd_trace()up to ggseg3d 1.6.5 and had no replacement after the move off plotly (ggsegverse/ggseg3d#23).add_atlas()draws a second atlas into an existing plot, so a subcortical atlas can sit inside a cortical one (ggsegverse/ggseg3d#25).Parcel borders follow the parcellation rather than the mesh triangulation. Faces straddling a border are cut at the crossed edges’ midpoints, removing the ~3 mm fringe along every border on an fsaverage5 surface. Turn it off with
split_boundaries = FALSEfor a smaller widget (ggsegverse/ggseg3d#9).The read-only atlas accessors from
ggseg.formatsare re-exported, soatlas_palette(),atlas_regions(),atlas_meshes()and their siblings work afterlibrary(ggseg3d)and an atlas package, without attachingggseg.formats. Requiresggseg.formats (>= 0.0.4.9015)(ggsegverse/ggseg#183).
Bug fixes
An atlas whose vertex indices do not fit the mesh it is drawn on warns instead of rendering silently wrong. The warning names how many fall outside and says the 2D geometry is unaffected.
Atlases whose colour table gives every region the same colour no longer render as a single indistinguishable brain. Region colours come from
ggseg.formats::atlas_plot_palette(), which substitutes distinguishable colours and warns that the atlas colour table is what needs fixing.na_alphadoes what it documents: regions with no value fade per vertex on surfaces and per mesh on structures and tracts. It was accepted and ignored in every previous release. Values outside 0-1 are an error.Transparent meshes are drawn front-faces-only and without depth writes, so a requested opacity renders as asked rather than blending against its own back faces.
Data with a single distinct value no longer colours every region as if it had data: regions with no value keep
na_colour, and the legend shows a single swatch.A duplicated
labeldraws its region once, with a warning naming the duplicates, instead of once per duplicate row at double darkness.A
colour_by,label_byortext_bycolumn not in the atlas raises one error naming the typo and the columns available.Mesh face indices follow the
face_index_baseattributeggseg.meshespublishes, falling back to the smallest index used. The previous heuristic inspected only theicolumn.add_glassbrain()accepts the"lh"/"rh"spellings the rest of the package takes, and errors on an unrecognised one.surface = "midthickness"reachesggseg.meshes; the surface shipped but no function would accept the name.A numeric
colour_bycolumn matching no atlas region no longer fails with'from' must be a finite number.ggseg3d()says why an atlas it rejects is invalid, reporting the structural complaint rather than “must be a<ggseg_atlas>object with 3D data”.print()on aggsegrayobject returns the object invisibly. It still renders the scene.
Documentation
surfaceis documented once, inresolve_brain_mesh(), instead of four inconsistent lists;sphere,smoothwmandorigare documented where aggseg3d()user looks.The documented
tube_radiusandtube_segmentsdefaults were wrong in both places they appeared; they are 2 and 10.surface_opacityappears in the “Type-specific arguments” section, and the nine widget modifiers cross-reference each other.Vignette examples passed a
displayname where aregionwas expected, and full tract names for tracula; neither joined. Figures regenerated.Roxygen markdown is enabled, so cross-references and the lifecycle badges render as intended.
The error raised for a non-atlas input points at
ggseg.extra::create_cortical_from_labels(); the function it named before does not exist.
Internal
All atlas reads go through the
ggseg.formatsaccessors rather than reaching intoatlas$core,atlas$paletteandatlas$data. This requires a newerggseg.formats;DESCRIPTIONcarries the floor.Atlas objects predating the unified
ggseg_atlaslayout are rejected up front rather than failing deeper in rendering. No released atlas package ships that layout.pngandrayshadermoved fromSuggeststoConfig/Needs/website.Test fixtures resolve region names via
ggseg.formats::atlas_regions()rather than hard-coding schema-specific strings. Geometry snapshots skip on CRAN.
ggseg3d 2.1.2
CRAN release: 2026-07-02
- decouples tests from ggseg.formats internal workings.
- No user changes.
ggseg3d 2.1.1
CRAN release: 2026-04-22
Bug fixes
- Cortical hemispheres are now rendered anatomically side-by-side (LH at negative x, RH at positive x, medial edges at the midline) regardless of the mesh source. Previously, both hemispheres overlapped at the origin because
ggseg.formatsinflated meshes andggseg.meshespial/white/etc. surfaces arrived in different axis conventions.resolve_brain_mesh()now normalises to the sharedx = LR,y = AP,z = SIframe and separates hemispheres atx = 0. -
set_positioning()no longer wrongly shifts subcortical meshes whose region names happen to contain “Left”/“Right” (e.g.Left-Thalamus); it only repositions cortical meshes named"<hemi> <surface>". -
add_glassbrain()warns and skips when the widget already contains a flat (2D) mesh such as a cerebellar flatmap, since flatmaps share no coordinate frame with anatomical 3D meshes. -
add_glassbrain()now defaults tosurface = "inflated"so it works withoutggseg.meshesinstalled (inflated ships withggseg.formats).
Documentation
- Replaced
\dontrun{}wrappers in widget-construction examples with executable code so examples run underR CMD checkand render inline in pkgdown. Examples that requirergl(Suggests) are now gated with@examplesIf rlang::is_installed("rgl"). - Added
LICENSE.notedocumenting the bundled Three.js and OrbitControls libraries and credited their authors inAuthors@R.
ggseg3d 2.1.0
CRAN release: 2026-04-09
Cerebellar atlas support
- New
cerebellar_atlasclass withprepare_brain_meshes.cerebellar_atlas()method for rendering SUIT cerebellar surfaces with vertex-based colouring. - Mixed vertex+mesh rendering for deep cerebellar nuclei: the SUIT surface renders at 30% opacity with opaque per-region meshes for deep structures.
-
surface_opacityparameter controls cerebellar surface transparency when deep nuclei are present. - Cortical mesh data moved to the ‘ggseg.meshes’ package, removing bundled
sysdata.rda.
ggseg3d 2.0.0
CRAN release: 2026-02-20
Major changes
- Complete rewrite using htmlwidgets with Three.js instead of plotly
- New pipe-friendly API with chainable addition functions
- Support for unified brain_atlas format from ggseg.formats package
New features
-
set_background()- set background colour -
set_legend()- control legend visibility -
set_dimensions()- set widget width and height -
set_edges()- add region boundary edges -
set_flat_shading()- disable lighting for exact colours -
set_orthographic()- use orthographic projection -
pan_camera()- position camera at standard anatomical views -
add_glassbrain()- add translucent brain surface overlay -
snapshot_brain()- save widget as PNG image -
edge.byparameter for edge grouping by data columns
ggseg3d 1.6.3
CRAN release: 2021-06-01
- Prepare for CRAN
- Remove white surface from
dk_3dto reduce size and pass CRAN checks - Update github urls to new org
ggseg3d 1.5
- Changed atlas.info to function
atlas_info() - Changed brain.pal to function
brain_pal() - Reduced code necessary for
brain_pals_info - Simplified
display_brain_pal() - Moved palettes of ggseg.extra atlases to ggseg.extra package
- Added a
NEWS.mdfile to track changes to the package - Changes all
dataoptions to.datato decrease possibility of column naming overlap - Added compatibility with
groupeddata.frames - Reduced internal atlases, to improve CRAN compatibility
- Added function to install extra atlases from github easily
- Changes vignettes to comply with new functionality