mrsiprep.workflows.participant

Participant workflow orchestration.

Functions

collect_recordings(config)

Resolve the (subject, session) recordings a run should process.

run_participant_workflow(config)

Run the full mrsiprep pipeline for every recording matched by config.

validate_participant_inputs(config)

Dry-run input validation for every recording matched by config.

Classes

RecordingStatus(subject, session, status[, ...])

Outcome of processing (or validating) one subject/session recording.

class mrsiprep.workflows.participant.RecordingStatus(subject, session, status, outputs=<factory>, error=None)[source]

Bases: object

Outcome of processing (or validating) one subject/session recording.

Variables:
  • subject -- BIDS subject label, without the sub- prefix.

  • session -- BIDS session label without the ses- prefix, or None for session-less datasets.

  • status -- One of "skipped" (failed validation before processing started), "success", or "failed" (raised during Nipype execution).

  • outputs -- Output paths produced for this recording, keyed by a short name (e.g. "t1w", "qc_summary", "regional_table"); empty for skipped recordings.

  • error -- Human-readable error message, set when status is "skipped" or "failed".

Parameters:
  • subject (str)

  • session (str | None)

  • status (str)

  • outputs (dict)

  • error (str | None)

error: str | None = None
outputs: dict
session: str | None
status: str
subject: str
mrsiprep.workflows.participant.collect_recordings(config)[source]

Resolve the (subject, session) recordings a run should process.

Resolution order: an explicit --participants-file (one sub[,ses] pair per line) takes precedence; otherwise --participant-label/--session-label are combined pairwise; otherwise every recording is discovered by scanning config.bids_dir.

Parameters:

config -- Run-wide mrsiprep.config.settings.MRSIPrepConfig.

Returns:

List of mrsiprep.io.bids.Recording, not yet validated -- validity is checked later, per-recording, by run_participant_workflow()/validate_participant_inputs().

Return type:

list[Recording]

mrsiprep.workflows.participant.run_participant_workflow(config)[source]

Run the full mrsiprep pipeline for every recording matched by config.

This is the top-level entry point called by the CLI (mrsiprep.cli.run) for participant-level runs. Steps:

  1. Ensure work/derivative directories exist.

  2. Resolve recordings via collect_recordings() and validate each one's inputs; failures are recorded as "skipped" and excluded from processing (other recordings still run).

  3. If config.longitudinal, build one subject-level T1w template per subject with 2+ ready sessions, used to seed each session's T1w→MNI registration.

  4. Dispatch all ready recordings to the Nipype execution engine (mrsiprep.workflows.nipype_engine.run.execute_recordings_nipype()), which runs each recording's per-step cached workflow and reports "success"/"failed" per recording.

Parameters:

config -- Run-wide mrsiprep.config.settings.MRSIPrepConfig.

Returns:

One RecordingStatus per recording matched by config (empty list if none matched).

Return type:

list[RecordingStatus]

mrsiprep.workflows.participant.validate_participant_inputs(config)[source]

Dry-run input validation for every recording matched by config.

Same discovery/validation logic as run_participant_workflow() (including the same preflight input-availability table) but never builds subject templates or dispatches to Nipype -- used by --validate-only to report which recordings are ready without running the pipeline.

Parameters:

config -- Run-wide mrsiprep.config.settings.MRSIPrepConfig.

Returns:

One RecordingStatus per recording matched by config, with status either "failed" (validation failed; outputs empty) or "success" (validation passed; outputs populated with keys "t1w", "metabolites", "snr", "linewidth", "brainmask" -- nothing is actually processed).

Return type:

list[RecordingStatus]