voxel
tit.atlas.voxel ¶
Voxel (volumetric) atlas discovery and region listing.
VoxelAtlasManager ¶
VoxelAtlasManager(freesurfer_mri_dir: str = '', seg_dir: str = '', masks_dir: str = '', fastsurfer_mri_dir: str = '')
Discovers and queries volumetric atlas files.
All discovery methods use the same canonical atlas-name lists from
:mod:tit.atlas.constants so that the analyzer, flex-search and NIfTI
viewer show identical atlases.
Search order for a name present in both trees: fastsurfer_mri_dir
first, then freesurfer_mri_dir. The two never collide in practice --
FastSurfer writes aparc.DKTatlas+aseg.deep.* and recon-all writes
aparc.DKTatlas+aseg.mgz -- but the order is fixed so a project that
holds both offers the current pipeline's output first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
freesurfer_mri_dir
|
str
|
Path to a FreeSurfer |
''
|
fastsurfer_mri_dir
|
str
|
Path to the FastSurfer |
''
|
seg_dir
|
str
|
Path to m2m_{subject}/segmentation/ directory. |
''
|
masks_dir
|
str
|
Path to m2m_{subject}/masks/, holding user-supplied custom label volumes. Optional; most subjects have no such directory. |
''
|
Source code in tit/atlas/voxel.py
list_atlases ¶
Discover available voxel atlas files for a subject.
Checks FastSurfer mri/ first, then a legacy FreeSurfer mri/,
then segmentation/ for charm's own labeling.nii.gz, then
masks/ for any user-supplied label volume. Used by the analyzer
tab, the flex subcortical tab and the NIfTI viewer.
Returns:
| Type | Description |
|---|---|
list[tuple[str, str]]
|
List of (display_name, full_path) tuples, first match per name. |
Source code in tit/atlas/voxel.py
list_custom_masks ¶
Discover user-supplied label volumes in the subject's masks/ dir.
Any *.nii.gz/*.nii/*.mgz file dropped into
m2m_{subject}/masks/ is offered for targeting. Display names are
prefixed with masks/ so custom entries are distinguishable from
the curated atlases. A missing directory yields no entries.
Returns:
| Type | Description |
|---|---|
list[tuple[str, str]]
|
Sorted list of (display_name, full_path) tuples. |
Source code in tit/atlas/voxel.py
list_regions ¶
List regions in a voxel atlas.
Pure-Python replacement for shelling out to FreeSurfer's
mri_segstats: labels present in the volume come from
:func:~tit.atlas.segstats.compute_segstats (nibabel + numpy),
named via :func:~tit.atlas.segstats.resolve_lut_for_atlas (a
sidecar colour table next to the atlas, else the bundled standard
FreeSurfer colour table). Validated voxel-for-voxel against live
mri_segstats output on real recon-all data -- see
docs/dev/DECISIONS.md § 2026-09-03 (One Docker image and a real development loop).
Caches the label file next to the atlas, in mri_segstats
--sum's own text layout (other modules parse this exact sidecar
filename), so subsequent calls skip recomputation.
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of "RegionName (ID: N)" strings. |
Source code in tit/atlas/voxel.py
detect_mni_atlases
staticmethod
¶
Detect available MNI atlases in an assets directory.
The list, its order and every atlas's kind/licence come from
resources/atlas/manifest.json (:mod:tit.atlas.manifest); a
manifest entry whose file is absent is skipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atlas_dir
|
str
|
Path to the atlas resources directory. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of full paths to found MNI atlas files. |
Source code in tit/atlas/voxel.py
parse_region_label ¶
Extract the integer label from a :meth:VoxelAtlasManager.list_regions
entry, e.g. "Hippocampus (ID: 17)" -> 17.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region_display
|
str
|
A |
required |
Returns:
| Type | Description |
|---|---|
int
|
The integer label. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If region_display does not end in |