atlas
tit.atlas ¶
Shared atlas module for TI-Toolbox.
Provides mesh (surface) and voxel (volumetric) atlas discovery, region listing, and overlap analysis.
MeshAtlasManager ¶
MeshAtlasManager(seg_dir: str)
Discovers and queries FreeSurfer .annot mesh atlases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seg_dir
|
str
|
Path to m2m_{subject}/segmentation/ directory. |
required |
Source code in tit/atlas/mesh.py
list_atlases ¶
List available mesh atlas names.
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of atlas names (always includes builtins). |
Source code in tit/atlas/mesh.py
list_regions ¶
List regions for a mesh atlas from .annot files.
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of region names with hemisphere suffix (e.g. "precentral-lh"). |
Source code in tit/atlas/mesh.py
find_atlas_file ¶
Find the .annot file path for a given atlas and hemisphere.
Returns:
| Type | Description |
|---|---|
str | None
|
Path to the .annot file, or None if not found. |
Source code in tit/atlas/mesh.py
find_all_atlases ¶
Find all available atlas files for a hemisphere.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
Dict mapping atlas display name to file path. |
Source code in tit/atlas/mesh.py
list_annot_regions ¶
List all regions in a .annot file.
Returns:
| Type | Description |
|---|---|
list[tuple[int, str]]
|
List of (region_index, region_name) tuples. |
Source code in tit/atlas/mesh.py
VoxelAtlasManager ¶
Discovers and queries volumetric atlas files.
All discovery methods use the same canonical VOXEL_ATLAS_FILES list
so that the analyzer, flex-search, and NIfTI viewer show identical atlases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
freesurfer_mri_dir
|
str
|
Path to FreeSurfer mri/ directory. |
''
|
seg_dir
|
str
|
Path to m2m_{subject}/segmentation/ directory. |
''
|
Source code in tit/atlas/voxel.py
list_atlases ¶
Discover available voxel atlas files for a subject.
Checks FreeSurfer mri/ for VOXEL_ATLAS_FILES and segmentation/ for labeling.nii.gz. Used by analyzer tab, flex subcortical tab, and NIfTI viewer.
Returns:
| Type | Description |
|---|---|
list[tuple[str, str]]
|
List of (display_name, full_path) tuples. |
Source code in tit/atlas/voxel.py
list_regions ¶
List regions in a voxel atlas using mri_segstats.
Caches the label file next to the atlas so subsequent calls are fast.
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.
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
atlas_overlap_analysis ¶
atlas_overlap_analysis(sig_mask, atlas_files: list[str], data_dir: str, reference_img=None) -> dict[str, list]
Analyze overlap between significant voxels and atlas regions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sig_mask
|
Binary ndarray (x, y, z) of significant voxels. |
required | |
atlas_files
|
list[str]
|
List of atlas file names. |
required |
data_dir
|
str
|
Directory containing atlas files. |
required |
reference_img
|
nibabel image for resampling (optional). |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, list]
|
Dict mapping atlas names to lists of region overlap dicts. |
Source code in tit/atlas/overlap.py
check_and_resample_atlas ¶
check_and_resample_atlas(atlas_img, reference_img, atlas_name: str)
Check if atlas dimensions match reference, resample if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atlas_img
|
nibabel image of the atlas. |
required | |
reference_img
|
nibabel image of the reference (subject data). |
required | |
atlas_name
|
str
|
Name of atlas for logging. |
required |
Returns:
| Type | Description |
|---|---|
|
Atlas data as integer ndarray in correct dimensions. |