mrsiprep.registration.subject_template

Subject-level longitudinal template construction and template-to-MNI registration.

Builds one unbiased ANTs template across a subject's sessions (via antsMultivariateTemplateConstruction2.sh), then registers that template to MNI once (via antsRegistrationSyN.sh). Session-to-MNI transforms are then composed as (session -> template) + (template -> MNI), instead of registering each session directly to MNI. Mirrors the algorithm used by the mrsitoolbox_package research pipeline's registration_multivisit.sh.

Functions

build_subject_template(config, subject, ...)

Build (or reuse) a subject-level template and its MNI registration.

Classes

SubjectTemplateResult(template_path, ...)

class mrsiprep.registration.subject_template.SubjectTemplateResult(template_path: 'Path', per_session_forward: 'dict[str, list[Path]]', template_to_mni_forward: 'list[Path]', template_to_mni_inverse: 'list[Path]')[source]

Bases: object

Parameters:
  • template_path (Path)

  • per_session_forward (dict[str, list[Path]])

  • template_to_mni_forward (list[Path])

  • template_to_mni_inverse (list[Path])

per_session_forward: dict[str, list[Path]]
template_path: Path
template_to_mni_forward: list[Path]
template_to_mni_inverse: list[Path]
mrsiprep.registration.subject_template.build_subject_template(config, subject, session_t1_paths)[source]

Build (or reuse) a subject-level template and its MNI registration.

session_t1_paths maps session label -> that session's registration_t1w path (the same T1w each session already registers MRSI onto). Returns None when fewer than 2 sessions are given (single session: no template to build, caller falls back to direct per-session T1-to-MNI registration).

Parameters:
  • subject (str)

  • session_t1_paths (dict[str, Path])

Return type:

SubjectTemplateResult | None