guide_build
tit.scene.guide_build ¶
Generate the packaged guide scene (tit/scene/guide/) from one head model.
This is a developer tool, not part of the running app: it needs SimNIBS,
nibabel and scipy, it reads a 184 MB mesh, and it takes minutes. The server
only ever reads what it wrote (:mod:tit.scene.guide).
Run it inside the toolbox container, where SimNIBS lives::
docker exec ti-toolbox-fad740e5-tit-1 \
/root/SimNIBS-4.6/bin/simnibs_python -m tit.scene.guide_build \
--project /mnt/000 --subject ernie --out /ti-toolbox/tit/scene/guide
What it does, and why in this order:
- Builds the two surfaces and every cortical atlas' labels through the
ordinary :mod:
tit.scene.buildpipeline, into the project's own scene cache. The guide is therefore built by the same code that builds a subject's pane, so a budget or winding fix cannot apply to one and not the other. - Copies those exact cached bytes into the package, renamed to fingerprint-free, stable file names — the packaged guide is immutable, so the fingerprint that keys a cache has no job here.
- Reads every EEG net as JSON (a few hundred rows each; cheap and exact).
- Writes
manifest.jsonenumerating all of it with asha256and a byte count per file, so the gate test can prove that what the manifest advertises is what the package contains.
Never copied: the m2m_ directory, the head mesh, the label volume.
build_label_volume ¶
build_label_volume(source: Path, lut: Path, out: Path, *, part_id: str, atlas_id: str, select_all: bool = False) -> tuple[dict, dict]
Freeze one label volume as a pickable surface plus its legend.
Only the developer build reads a label volume. Runtime requests reuse the same compact binary surface and legend API as cortical atlas requests.
select_all keeps every label the volume contains rather than the
subcortical subset :func:tit.scene.volume_surfaces.default_visible would
show. It is what a packaged MNI atlas wants: its whole point is that the
user picks any of its regions, and the "is this name a deep structure"
heuristic exists for a per-subject labeling.nii.gz, not for CIT168.
Source code in tit/scene/guide_build.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
build_subcortical ¶
The subject's own labeling.nii.gz as the guide's subcortical layer.
Source code in tit/scene/guide_build.py
build_mni_atlases ¶
Every packaged MNI atlas that fits the guide budget, as label surfaces.
Skipped with a printed reason rather than a failure: an atlas with more than
the 256 regions volume_surfaces draws (Glasser's 360 cortical parcels) or
with no colour table is not a reason to have no MNI guide at all. What it
costs is that that atlas cannot be picked in the pane; it is still
selectable in the ROI picker's list, which reads the catalog, not the guide.
Source code in tit/scene/guide_build.py
generate ¶
generate(project: str, subject: str, out: Path, label: str, *, atlas_source: str = 'subject', guide_id: str = 'default') -> dict[str, Any]
Build every guide asset and write out/manifest.json. Returns it.
atlas_source is "subject" for the anatomy guide (the subject's own
cortical parcellations and labeling.nii.gz) or "mni" for the MNI152
guide, whose atlases are the packaged MNI volumes in resources/atlas/.
Source code in tit/scene/guide_build.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |