guide
tit.scene.guide ¶
The fixed guide scene — one immutable, project-independent head.
Plan of record: docs/dev/DECISIONS.md § 2026-09-05 (Overview, batch execution and explicit viewing) R4. The three run pages'
3D panes used to draw the first selected research subject. That coupled a
form control to project data in three ways that each cost something real:
- it made the pane useless until a subject had a head model (a first-time project has none, and charm is an hour);
- it made every subject change a cache-cold rebuild of a 184 MB mesh, so ticking a second subject could stall the page for ~12 s;
- and it let a click on one subject's anatomy write a subject-RAS millimetre coordinate into a config that runs on a different subject — the coordinate is silently wrong, and nothing downstream can notice.
So the pane draws a guide instead: prebuilt, packaged, byte-identical on every
machine, and explicitly not in any research subject's coordinate space
(:data:GUIDE_SPACE). It is an anatomical legend for choosing names —
electrodes, nets, atlas regions — never coordinates.
What is packaged (:mod:tit.scene.guide_build generates it, this module only
reads it):
=========================== =============================================
manifest.json every part, net, atlas and asset, with sizes
surfaces/<part>.tvsc|gii skin and grey matter, within the §S3 budget
labels/<atlas>.gii grey matter + per-vertex labels + label table
legends/<atlas>.json the atlas' legend rows, as /api/scene/regions
nets/<net>.json one EEG net's electrode names and positions
=========================== =============================================
Never packaged: a full m2m_ directory (184 MB of mesh plus volumes), the
label volume, or anything that would have to be rebuilt at runtime. The
whole point is that the server answers a guide request with a file read on a
machine that has no project bound at all.
Provenance and licence: tit/scene/guide/PROVENANCE.md.
GuideUnavailable ¶
Bases: Exception
The packaged guide is missing or unreadable (a broken installation).
GuideAsset
dataclass
¶
One packaged file: its bytes on disk plus what the manifest says of it.
guide_dir ¶
The packaged directory for guide_id, overridable for tests.
TIT_GUIDE_DIR / TIT_GUIDE_MNI_DIR exist so a test can point at a
tiny fixture guide instead of the real ~20 MB ones; nothing in the app sets
them.
Source code in tit/scene/guide.py
manifest ¶
The guide manifest, read once per (path, mtime) pair.
Cached on the manifest's own size+mtime rather than for ever: the file is immutable in an installation, but a developer regenerating it must not have to restart the server to see the new one.
Source code in tit/scene/guide.py
surface ¶
surface(part: str, fmt: str = 'tvsc', guide_id: str = DEFAULT_GUIDE) -> GuideAsset
The packaged surface bytes for part in fmt (tvsc or gii).
Source code in tit/scene/guide.py
labels ¶
labels(atlas: str, fmt: str = 'gii', guide_id: str = DEFAULT_GUIDE) -> GuideAsset
The packaged per-vertex label payload for atlas.
Source code in tit/scene/guide.py
legend ¶
{atlas, space, legend:[…], url, …} for one packaged atlas.
Source code in tit/scene/guide.py
electrodes ¶
{net, space, electrodes:[{name, world}]} for one packaged EEG net.
Source code in tit/scene/guide.py
installed_guide_ids ¶
Guide ids whose package is actually present, in catalogue order.
The MNI guide is built by the same developer tool as the Ernie one, so a checkout mid-rebuild can have one and not the other; asking the filesystem is what stops the pane offering a space whose anatomy is not installed.
Source code in tit/scene/guide.py
iter_assets ¶
iter_assets(guide_id: str = DEFAULT_GUIDE) -> list[tuple[str, GuideAsset]]
Every file the manifest references, as (relative path, asset).
The gate test walks this to prove nothing the manifest advertises is missing from the package.