Skip to content

nifti_average_config

tit.stats.nifti_average_config

Configuration dataclass for group NIfTI averaging (owner: B4).

Mirrors the fields the "NIfTI Group Averaging" panel collects, so :mod:tit.config_io can generate a JSON Schema for it and a future POST /api/jobs (kind "nifti_average") can validate a request body before submitting the job. Pure Python -- no numpy/nibabel dependency.

Public API

NiftiAverageSpace Which per-subject NIfTI space the group average is computed in. NiftiAverageSubject One subject/simulation/group assignment row. NiftiAverageConfig Configuration for one group NIfTI averaging run.

See Also

tit.stats.nifti_average : Runner entry point that consumes this config (simnibs_python -m tit.stats.nifti_average config.json). tit.stats.nifti.load_grouped_subjects_ti_toolbox : Loads the per-group data.

NiftiAverageSpace

Bases: StrEnum

Which per-subject NIfTI space the group average is computed in.

NiftiAverageSubject dataclass

NiftiAverageSubject(subject_id: str, simulation_name: str, group: str = 'Group1')

One subject/simulation/group assignment row.

Attributes

subject_id : str Subject identifier (without the sub- prefix). simulation_name : str Simulation folder name whose NIfTI is averaged. group : str, optional Group label this subject belongs to. Default is "Group1".

NiftiAverageConfig dataclass

NiftiAverageConfig(output_name: str, subjects: list[NiftiAverageSubject], space: NiftiAverageSpace = MNI, nifti_file_pattern: str | None = None, diff_pairs: list[str] = list())

Configuration for one group NIfTI averaging run.

Attributes

output_name : str Name of the output subdirectory under derivatives/ti-toolbox/nifti_average/ (the GUI's "Analysis Name"). subjects : list of NiftiAverageSubject Subject/simulation/group rows -- at least 2, spanning at least 1 group. space : NiftiAverageSpace, optional Which per-subject NIfTI space to average in. Selects the default nifti_file_pattern when one is not given explicitly. Default is :attr:NiftiAverageSpace.MNI. nifti_file_pattern : str or None, optional Filename pattern with {subject_id}/{simulation_name} placeholders. Defaults to :data:_DEFAULT_PATTERNS [space] when left None. diff_pairs : list of str, optional "GroupA-GroupB" pairs to difference. Empty (the default) means every pairwise combination of the groups present in subjects.

Raises

ValueError If output_name is blank, or fewer than 2 subjects are given.

See Also

tit.stats.nifti_average.main : Consumes this config.