tissue_analyzer
tit.pre.tissue_analyzer ¶
Tissue analysis for TI-Toolbox.
Analyzes tissue types (CSF, bone, skin) from segmented NIfTI data, calculating volumes, thickness, and generating visualizations (thickness maps and methodology figures).
Public API¶
run_tissue_analysis Run tissue analysis for one or more tissue types for a subject. TissueAnalyzer Low-level class that performs volume, thickness, and visualization analysis on a single tissue type.
See Also¶
tit.pre.structural.run_pipeline : Full preprocessing pipeline. tit.pre.charm : CHARM head-mesh generation (produces the segmentation input consumed here).
TissueAnalyzer ¶
Analyze a single tissue type from segmented NIfTI data.
Loads a labeling NIfTI volume, extracts the requested tissue mask, filters it to the brain region, computes thickness statistics via a 3-D distance transform, and writes a text report plus optional matplotlib visualizations.
Parameters¶
nifti_path : str or pathlib.Path
Path to the segmented labeling NIfTI file (e.g. labeling.nii.gz).
output_dir : str or pathlib.Path
Directory where reports and figures are written.
tissue_type : str
One of 'csf', 'bone', or 'skin'.
logger : logging.Logger
Logger for progress messages.
Attributes¶
tissue_name : str
Human-readable tissue name (e.g. 'CSF').
tissue_labels : list[int]
Segmentation label IDs for this tissue.
voxel_volume : float
Volume of a single voxel in mm^3.
Raises¶
PreprocessError
If tissue_type is not a recognised key in TISSUE_CONFIGS.
See Also¶
run_tissue_analysis : Convenience wrapper that analyses multiple tissues.
Source code in tit/pre/tissue_analyzer.py
analyze ¶
analyze() -> dict
Run the complete tissue analysis.
Returns¶
dict
Analysis results with keys 'volume_cm3', 'volume_mm3',
'thickness' (dict with mean/std/min/max), 'voxels'
(dict with total/filtered), and 'report_path'.
Source code in tit/pre/tissue_analyzer.py
run_tissue_analysis ¶
run_tissue_analysis(project_dir: str, subject_id: str, *, tissues: Iterable[str] = DEFAULT_TISSUES, logger: Logger) -> dict
Run tissue analysis for a subject.
Creates a TissueAnalyzer for each requested tissue type, computes
volume and thickness statistics, and writes reports and visualizations.
Parameters¶
project_dir : str
BIDS project root.
subject_id : str
Subject identifier without the sub- prefix.
tissues : iterable of str, optional
Tissue types to analyze. Defaults to ('bone', 'csf', 'skin').
logger : logging.Logger
Logger for progress output.
Returns¶
dict Mapping of tissue name to per-tissue analysis results (volume, thickness, voxel counts, report path).
Raises¶
PreprocessError If the segmentation labeling file does not exist.
See Also¶
TissueAnalyzer : Low-level analysis for a single tissue type. run_pipeline : Full preprocessing pipeline.