Dissection and display#
The model is drawn from one set of published meshes under a viewer state: a colour mode, a hemisphere and cortex setting, a set of hidden regions, an isolated region and a Focus ghost. Only the cortical shading is computed at build time: sulcal depth, cortical openness and ribbon T1 are baked into every cortical vertex of the subject’s pial surface and drive fold occlusion and tissue colour in the shader. The shading is illustrative; it is not a measured optical or histological property.
Fig. 4 | Five colour modes and three dissection states on one hemisphere. a–e, Colour set to Tissue (a), T1 MRI (b), Regions, Destrieux (c), Yeo 7 networks (d) and Arterial territories (e). f, Eight Destrieux parcels of the left central region hidden (precentral, postcentral and middle frontal gyri; central, precentral and postcentral sulci; middle frontal sulcus): the subject’s own white surface is exposed. g, The left hippocampal formation (teaching set) isolated; the camera frames the region. h, The same region with Focus: the rest of the model is a grey ghost at opacity 0.15. Subject CDMD sub_013, left view, Destrieux atlas; f–h in Regions colour.#
Data#
Attribute |
Written to |
Storage |
Meaning |
|---|---|---|---|
|
|
|
FreeSurfer |
|
|
|
Cosine-weighted share of the sky a pial vertex sees past its own hemisphere |
|
|
|
|
|
|
|
Yeo 7 network (0 unassigned); arterial territory index |
Sources are the subject’s lh/rh.pial, lh/rh.white, lh/rh.sulc and mri/orig.mgz. The ranges are recorded once in the manifest as appearance.field_ranges; on CDMD, _SULC −14.05 to 17.40, _OPENNESS \(2.6 \times 10^{-5}\) to 1.0 and _T1 38.99 to 203.24. The first cortical atlas measures them and the others are encoded to the same span, so one decode serves all five files. Colour tables come from the cortical atlases, functional networks and arterial territories layers; nothing is written for the colour modes.
Method#
Sulcal depth and ribbon T1#
lh/rh.sulc is read unchanged. orig.mgz is sampled trilinearly (map_coordinates, order 1, no prefilter) at the midpoint of each corresponding pial and white vertex in tkregister RAS; a midpoint outside the grid fails the build. Both fields, and openness, are carried onto the atlas partition by partition_vertex_field, linear on the barycentric partition, so a field is continuous across parcel borders.
Cortical openness#
For each pial vertex with unit normal \(\mathbf{n}\) (cortical_openness):
\(N\) =
occlusion.direction_count= 256 unit directions \(\mathbf{d}_k\) on a Fibonacci lattice, so the field is deterministic.Weights \(w_k = \max(0, \mathbf{n} \cdot \mathbf{d}_k)\).
A ray from 0.01 mm along \(\mathbf{n}\) is cast along each \(\mathbf{d}_k\) with \(w_k > 0\) against the hemisphere’s own pial mesh (embreex, batches of 2,000,000 rays). A hit at distance \(r_k\) has reach \(\min(r_k / R, 1)\) with \(R\) =
occlusion.radius_mm= 10 mm; a miss has reach 1.\(O = \sum_k w_k\,\text{reach}_k \big/ \sum_k w_k\): 1 on a bare crown, near 0 deep in a fold.
The mesh must be outward-wound (positive volume) or the build fails.
Encoding#
encode.py quantises each field to uint16 over its range, \(x = v/65535\,(h - l) + l\); a value outside a supplied range is refused, not clamped. Positions are float32; normals are int16 normalised under KHR_mesh_quantization, declared required so a reader without it fails.
The site serves the model layers with their positions and triangle indices under EXT_meshopt_compression (web/build/meshopt-glb.ts, at build time; public/ keeps the files encode.py wrote). The encoding is lossless and keeps order: ATTRIBUTES for positions and INDICES, not TRIANGLES, which would rotate each triangle’s corners. The decoded buffers are the published bytes, and a layer is about 28% smaller over gzip for a detail level, 7% for a cortical atlas. The atlas comparison geometry is served as published, since the app checks it against the SHA-256 its comparison file records.
Tissue shading#
In the cortical shader (createAnatomicalMaterial, addFoldShading):
Direct diffuse light is scaled by \(1 - 0.48 f\), indirect diffuse and specular by \(1 - 0.78 f\) (folds). In Tissue colour only, the diffuse colour is scaled by \(1 + 0.28\,(2I - 1)\) with \(I = \operatorname{clamp}((T_1 - 85)/(180 - 85), 0, 1)\) (intensity.surface_strength); under a published palette the factor is 1. The tissue palette is cortex #c4a897, grey #a68d80, white #e5dbc5, fluid #67777c, unlabelled #c4a897 (roughness 0.62, clearcoat 0.08, ior 1.38). A region takes its tissue; otherwise cortex is cortex, a name matching ventricle, vent or CSF is fluid, one matching white, CC_ or callosum is white, and anything else is grey. Tone mapping is Khronos PBR Neutral.
Visibility#
visibilityOf(region, settings) decides whether each region is drawn, testing in order: no registered MRI under T1 colour (no-mri); a tissue region below cut resolution, one the colouring (other-colour) or the detail level (other-detail) keeps off the cut’s labels, or with no cut; a structure of another detail level or a surface of another atlas; another internal system; the hemisphere; cortex hidden or at opacity 0; internal anatomy hidden; the medial wall while internal anatomy is shown; the spinal cord hidden; a hidden region (removed); and any region but the isolated one (isolated). Meshes and the Anatomy tree read the same answer.
Dissection and exposed white matter#
Dissection holds a validated set of hidden region ids, one history entry per hide, show or restore. When hidden cortical parcels of the shown atlas open a hemisphere, and the cortex is shown and not isolated, that hemisphere’s native white surface from tissue-envelopes.glb is drawn in the tissue white (exposedWhiteMatter), so the exposed face is the subject’s own grey–white boundary.
Focus#
Focus requires a selection and a published see_through_opacity (0.15). A region is ghosted unless it is the selection, one of its constituent_regions or a painted region (ghosted). A ghost is drawn in the luminance of its tissue colour, \(0.2126R + 0.7152G + 0.0722B\), without hue. The cortex ghost takes \(\min(0.15, \text{cortex opacity})\); deep ghosts take 0.15. Deep ghosts are sorted after other translucent surfaces, nearest first and writing depth, so each pixel takes one ghost layer; the cortex ghost comes last without depth write (transparentOrder). Cut faces are greyed by the same rule (sections and cuts).
Exploded view#
Each structure is moved whole by a translation; no vertex moves within it. Each region of the shown detail level is one piece, except that the Brainstem and Cerebellum systems (labelOf) each move as one, the spinal cord with the brainstem. A piece moves by DEEP_SPREAD = 0.6 times the offset of its box centre from the centre of the deep anatomy’s box, so every distance between piece centres grows by 60% and each piece keeps its direction from the centre (deepShifts). Each pair of pieces is first tested at those offsets: where a mesh of one would cross a mesh of the other (their surfaces intersecting, tested on the meshes’ bounding-volume hierarchies) or the box of one would contain the other’s, the two are joined and move by the offset of their joint box. A join also joins the pieces’ mirror images, the structures of the same name in the other hemisphere, so a clearance narrower on one side does not send a structure off alone while its counterpart stays put (before this, the MNI template’s right amygdala and left fornix each left alone). Passes repeat until none is joined, so no piece crosses or contains another and none is moved off its own direction. The shown atlas’s hemispheres then move along the brain’s own left–right axis just far enough that each stands HEMISPHERE_GAP = 3 mm clear of the spread anatomy’s extent along that axis, and never inward (hemisphereShifts). The layout is computed once for each atlas, detail level and loaded cord. The axis runs from the left hemisphere’s vertex centroid to the right’s. The scan holds CDMD’s head turned, so the axis is the scan’s x rotated 2.6° in roll (the right side lower) and 1.9° in yaw (the right side further back); the head’s rotation in its FreeSurfer MNI305 affine gives 2.6° and 2.4°. The named views, the opening view, the orbit and the orientation letters square to this axis, exploded or assembled, so left and right sit level; the scan’s pitch is kept, as cuts and the linked MRI keep the scan’s planes. An exposed white surface moves with its hemisphere.
The move rides the camera’s critically damped spring (response 0.38 s), so the refit around it arrives with it. A reversal turns the pieces where they are, carrying their speed, and never takes them past where they are going. Under reduced motion the change lands with the next frame, under the camera’s 160 ms dissolve. Seen within 45° of the left–right axis, the hemispheres would part toward and away from the reader, so turning the view on faces the anterior view, and turning it off while that view is still held returns to the view before.
Whatever reads the anatomy reads it where it lies: cut sources, region lookup, an overlay’s region course, the T1 scan and a reader’s map on a surface (the shaders subtract the shift) and a clicked coordinate. Turning the view on closes an open cut first. A cut and the visual-field map put the brain back at once and cannot open on it exploded; a lesion, a stroke case, a lesion’s streamlines, Tracts and a route put it back on the same spring. Lesion marks, stroke cases, streamlines and route marks are hidden while it is exploded.
Names on the brain#
chooseNames (region-names.ts) names, once the stage comes to rest, up to MAX_NAMES = 24 of the regions facing the reader. A surface region’s size on screen is \(\sqrt{A_v}\,s\) px, with \(s\) the scale bar’s pixels per mm and \(A_v\) how much of its surface is turned toward the camera (EngineModel.facingArea): its published surface area times the mean, over 48 points spread over its most open vertices (_openness), of the cosine between a point’s normal and the way to the eye, none for a point turned away; a convex body shows a quarter of its surface on average, so a region turned square to the reader counts in full and one turned away not at all, whatever stands in front. A cut face’s is \(\sqrt{A \cos\phi}\,s\), with \(A\) its area on the cut and \(\phi\) the angle at which its open side is seen. Regions of at least NAMED_SIZE_PX = 48 px are taken largest first, so zooming in names smaller ones. A name already shown is taken before any new one and kept while it spans at least KEPT_SIZE_PX = 36 px, so a small turn or zoom renames nothing and a part coming into view waits for room; a kept name whose point is still in sight (EngineModel.inSight) stays at that point. Others are asked in batches of the names still wanted where they show (EngineModel.facing): first at the point of the region’s side in view nearest its middle on screen, so the dot stands in the region’s visible middle; after a miss at points out from it, then at the points farthest from every miss, which find the part a nearer region leaves showing; the label point last. A call spends at most two rays per region past each first. A name whose point falls off the visible stage is left out, and so is one whose dot would stand within DOT_APART_PX = 14 px of a name’s already chosen. A name is written once: of two that read the same, such as the two sides’ frontal lobes or putamina, only the first in that order is drawn. The selection is named first whenever it faces the reader, whatever its size. Under Lobes colour the lobes are named instead of their regions, each at the largest of its three largest regions that faces the reader on the stage (a kept lobe first at the region it stood on), and the selection as itself; a lobe’s name is drawn only, since the key lists the lobes. Each region’s name is a button that selects it.
Between rests the camera carries the names, each in its column; a name changes column only once its own no longer holds it, and one whose place moves more than 160 px fades out and in at the new place rather than crossing the stage (shorter moves glide, time constant 70 ms). A few a frame (at most LOOK_MS = 1 ms of rays) are asked whether their point is still in sight, so a name turned away or hidden behind other anatomy fades out rather than standing over the wrong region, and fades back when its point returns. A cut moved along its normal carries the names on its faces to where the plane now passes, each asked first; a cut turned, reversed or closed takes them down until the next rest. A name the rest drops fades out where it stood; under reduced motion names come and go at once.
Where the stage leaves at least OPEN_COLUMN_PX = 112 px between the anatomy’s extent (EngineCamera.anatomyRect, from a sample of the vertices framing fits) and its edge, kept open down to KEEP_COLUMN_PX = 80 px, the names stand in columns there, as an atlas plate labels its figure (placeColumns, name-columns.ts). Each is wrapped to its column (at most 14 em), level with its dot where it can be, pushed apart in its dots’ order where names crowd and clear of the stage’s chrome; its leader meets the middle of its edge toward the anatomy, and two neighbours change places wherever that leaves fewer leaders in conflict (crossing, or passing within 9 px of another name’s dot). A leader runs at most 60 % of the anatomy’s width, the selection’s excepted. When the stage comes to rest, a name starts in the column it stood in last, else on its dot’s side, and moves to the other while that lowers the plate’s cost: how far each name is pushed off its dot’s level, half how far its leader runs across, 24 px to switch columns and 48 px for each two leaders in conflict; a full column leaves out its lowest-priority names. Zoomed in past that room, the names stand beside their dots as the route landmarks do, each keeping the side it stood on while that is clear (placeLabels); a name with no clear place is left out. Names take the route landmarks’ haloed type, dots and leaders. None is drawn while the brain is exploded, the tract reference is shown alone, a lesson’s whole route is on the stage or the visual-field map is open.
Highlights#
Highlight, under More in a region’s sheet, marks the region in one of six colours, the deficits’ finding colours in order: Blue, Raspberry, Green, Amber, Violet and Pink. A new region takes the colour the fewest hold, the first on a tie, so the first three take the three that stay apart under colour-vision deficiency; at most MAX_HIGHLIGHTS = 12 regions are highlighted, each once. The highlights are a paint (highlightPaint): each region in its colour, every other in its tissue colour, keyed on the stage as Your highlights, whose note says they are the reader’s own marks, not data. They are set aside while the tab in front shows evidence (an open function, deficit, lesson or map, or one of Anatomy’s paints) or a reader’s map is drawn, and return when it closes; a masthead colour chosen over them lifts them until a region is added or recoloured or the reader draws them again (highlightStatus). Your highlights, above the panel, lists each region with its side, a swatch that offers the six colours and a remove; a region the layers on screen do not hold stays listed and says so. A link carries them as mark (sharing).
Display#
Colour chooses Tissue, T1 MRI, Lobes, Regions, Yeo 7 networks, CAB-NP networks (switches the atlas to HCP-MMP), Striatal networks, Cerebellar functions or Arterial territories (Fig. 1a–e shows five of them); the subcortical maps and the territories also choose the labels a cut samples (sections and cuts); while a paint is shown, Colour reads its name: Functions, Deficit, Lesion, Your highlights, Connectivity, Disorder or Layer IV. Over T1 MRI a paint is drawn on the scan, which stays wherever nothing is painted: a painted surface takes the scan’s light, a painted cut face shows its paint unlit in the key’s colours, and painted parcels feather only into each other. T1 MRI shows the linked MRI scan through the same window, with tone mapping off. A cut face is unlit, the grey of the plane it lies on, so it matches the linked MRI; a pointed-at or selected face is marked with the theme accent (MRI_MARK: lift 0.33, tint 1.8) because the scan owns luminance. A surface shows the tissue it bounds: the cortex its _T1 (orig.mgz at the pial/white midpoint), any other surface the scan 1 mm inside itself (SURFACE_DEPTH_MM; on the surface itself, trilinear reads mix in the neighbour: 31 of 106 teaching-set structures read more than 10 from their interior median, the lateral ventricles 107 against 48, while 1 mm in all read within 7). Surfaces are lit by the stage’s own diffuse light on white, clamped at 1. The stage reaches 1 where a surface faces it squarely (99th percentile 1.00–1.03 over four views), so a surface reads its scan grey there and darker elsewhere, never brighter; specular is left out, and a reader’s map over the scan takes the same light. Published colours darker than OKLab lightness 0.45 are drawn lifted linearly into 0.30–0.45 with hue kept (stageLegible); exports keep the published value. Parcel borders fade into the neighbour over FEATHER_RADIUS = 1.5 mm on the stage only; picking keeps the exact border.
Lobes gives each cortical region the colour of the group the Anatomy list places it in, and keys the groups on the stage: Frontal, Central, Parietal, Occipital, Temporal, Lateral fissure, Insula, Cingulate and Limbic for Destrieux (destrieux-labels.ts); the same without Lateral fissure for Desikan-Killiany (desikan-labels.ts) and for Julich-Brain, whose areas join those groups through the location in each name (julich-labels.ts). A group is a navigation aid, not a measured boundary: in Destrieux, Central holds the central sulcus and the paracentral and subcentral regions, and the precentral gyrus is listed under Frontal; in Desikan-Killiany, Central holds the precentral, postcentral and paracentral gyri. Regions in no group (deep structures, the medial wall, cortex Julich-Brain has not mapped) keep their tissue colour, as do cut labels that are not regions of the shown atlas. The nine colours are Paul Tol’s “muted” qualitative scheme and belong to the interface: no atlas publishes them (LOBE_COLORS, web/src/lib/core/catalog/lobes.ts). HCP-MMP and Schaefer group their areas by network, so they offer no lobes: there the option says “Atlas becomes Destrieux” under its name, and choosing either atlas while Lobes is on returns the colour to Regions. A page opened without a link shows Destrieux in Regions, and Start over returns to Destrieux in Regions from any atlas; a link shows the colour it was written with, and one that names no colour (colors) means Regions.
Where a structure crosses the cortex, some samples hold the same depth for both. Opaque surfaces draw in three.js order, except that the cortical atlas comes first, so the structure takes those samples, as its cut face does over the ribbon’s, whichever layer finished loading first (opaqueOrder).
Display holds Hemisphere, Cortex with its opacity and Cortex surface, Internal anatomy, Spinal cord, Exploded view and Names on the brain (keys H, C, U, S, E, N); the exploded view is absent, and E does nothing, while the visual-field map is open. Names on the brain is not counted as a change to the display. It is off by default, a page opened without a link included; a link shows names only if it says so. On a phone the popover ends with the settings away from their defaults and Reset display, which a wider screen’s status bar shows instead. Cortex surface moves the shown atlas’s parcels onto the subject’s pial, mid-thickness (halfway, vertex by vertex) or white surface from tissue-envelopes.glb. It is the same setting as the Overlay’s (overlays): the pial while a cut is open, back to the pial on Reset display or Start over, and not written into the link. The eye beside each Anatomy row hides a region or group; Focus (F) and, under More in a region’s sheet, Isolate (I), Hide and Highlight act on the selection. A cortical region chosen by name in the Anatomy list, with nothing isolated, is focused when framed, so it stands out from the atlas’s colours; one clicked on the brain is not. A selection beneath fully opaque, shown cortex, with nothing isolated, is focused when framed (beneathCortex): a structure of the forebrain’s deep systems, or one inside the brainstem or cerebellum (nuclei such as the arousal nuclei, red nucleus, substantia nigra and dentate, peduncles, white matter), not their outer parts (aseg’s brainstem and cerebellar cortex, NextBrain’s midbrain, pons and medulla, structures built on them, CerebNet’s lobules). URL keys: colors, hemi, cortex, opacity, internal, cord, explode, names, hidden, isolate, focus and mark.
The model turns with a drag or, once the stage has focus (Tab), the arrow keys. Shift with the arrows, a right-drag or a drag with Shift moves it across the view, as a two-finger drag does on a touch screen. Scroll or pinch zooms toward the point under the pointer, and + and − zoom while the stage has focus; a double-click or double-tap centres the view on the point of the model under it, which the model then turns about. Keyboard shortcuts (?) lists these under Mouse and touch.
Validation#
Test |
Criterion |
Result |
|---|---|---|
Positions ( |
Error < \(2 \times 10^{-5}\) mm |
\(5.04 \times 10^{-6}\) mm |
Normals ( |
Component error ≤ half an |
\(1.53 \times 10^{-5}\) (bound \(1.54 \times 10^{-5}\)) |
Sulcal depth ( |
≤ half a |
\(2.40 \times 10^{-4}\) |
Openness ( |
Re-cast field within \(10^{-3}\) for at least 99.5% of vertices |
maximum error \(7.66 \times 10^{-6}\); 0.0% outliers |
Ribbon T1 ( |
≤ half a |
\(1.26 \times 10^{-3}\) |
Shading fields ( |
Partitioned fields continuous; openness 1 on a bare surface, falling with a nearer fold, unchanged by folds beyond \(R\) |
passes |
Encoding ( |
Shared ranges used; out-of-range values refused; quantised normals require the extension |
passes |
Viewer ( |
Shader terms, draw order, feathering, exposure and dissection history |
passes |
Exploded view ( |
Interlocking and enclosed regions joined, not rearranged, and their mirror images joined alike; hemispheres slide along the brain’s axis only far enough to clear the internal anatomy; shapes kept; a reversal turns the pieces where they are; cut, lookup and pick read the anatomy; the cord stays on the brainstem |
passes |
Focus when framed ( |
Deep structures and the insides of brainstem and cerebellum count as hidden by the cortex, their outer parts do not |
passes |
Names on the brain ( |
Facing regions past 48 px, largest first, at most 24; names shown kept first, down to 36 px, at their points while in sight; each name written once; the selection named first; lobes under Lobes colour; cut faces; sized by the area turned toward the reader; dots 14 px apart; columns beside the anatomy, wrapped, in their dots’ order, without leaders crossing or over a dot, moved across where that is cheaper but not mid-turn, lowest priority left out; beside the dot keeping its side when zoomed in; a hidden part or closed cut fades its names at once; none over the dock, a key or the gizmo; none while not drawn |
passes |
Highlights ( |
Strip names each region with its side and colour, recolours, removes, says when set aside or lifted; the key and the image caption say they are the reader’s marks |
passes |
The openness tolerance exists because the field is re-cast in float32 on the validating machine: where the pial surface touches itself a ray origin can fall on either side of the contact. A vertex jitter of \(3 \times 10^{-5}\) mm moved 0.16% of CDMD vertices past the tolerance; a 5% radius error moves 78% and one direction fewer 23% (validation.openness in config/model.yaml).
Limitations#
T1 brightness, fold shading and tissue colours are illustrative, not measured albedo.
The baked fields exist on the cortical meshes only.
Openness counts occlusion by the vertex’s own hemisphere only.
The MRI and FreeSurfer labels are 1 mm; label boundaries are not anti-aliased.
A parcel narrower than 3 mm never reaches full colour on the stage.
Hidden regions do not change the linked MRI planes.
Code availability#
Code |
|
Configuration |
|
Tests |
|
uv run python -m brain_model.build --anatomy cdmd
uv run python -m brain_model.validate --anatomy cdmd
uv run pytest tests/test_shading.py tests/test_encode.py
npm test --prefix web -- render tissues dissection explode labels region-names stage-keys
npm run test:browser --prefix web -- src/features/stage/RegionNames.svelte.test.ts src/features/highlights/HighlightStrip.svelte.test.ts
Figure state (Fig. 1h): https://planumatlas.com/#anatomy=cdmd&atlas=destrieux&colors=atlas&view=left®ion=learning:left:hippocampus&focus=1