nipoppy.workflows.pipeline.BasePipelineWorkflow

class nipoppy.workflows.pipeline.BasePipelineWorkflow(dpath_root, name, pipeline_name, pipeline_version=None, pipeline_step=None, participant_id=None, session_id=None, write_list=None, fpath_layout=None, verbose=False, dry_run=False)

A workflow for a pipeline that has a Boutiques descriptor.

Parameters:
  • dpath_root (nipoppy.env.StrOrPathLike)

  • name (str)

  • pipeline_name (str)

  • pipeline_version (Optional[str])

  • pipeline_step (Optional[str])

  • participant_id (str)

  • session_id (str)

  • write_list (Optional[nipoppy.env.StrOrPathLike])

  • fpath_layout (Optional[nipoppy.env.StrOrPathLike])

  • verbose (bool)

check_dir(dpath)

Create directory if it does not exist.

Parameters:

dpath (pathlib.Path)

check_pipeline_step()

Set the pipeline step name based on the config if it is not given.

check_pipeline_version()

Set the pipeline version based on the config if it is not given.

generate_fpath_log(dnames_parent=None, fname_stem=None)

Generate a log file path.

Parameters:
  • dnames_parent (Optional[str | list[str]])

  • fname_stem (Optional[str])

Return type:

pathlib.Path

abstractmethod get_participants_sessions_to_run(participant_id, session_id)

Return participant-session pairs to loop over with run_single().

This is an abstract method that should be defined explicitly in subclasses.

Parameters:
  • participant_id (Optional[str])

  • session_id (Optional[str])

process_template_json(template_json, participant_id, session_id, bids_participant_id=None, bids_session_id=None, objs=None, return_str=False, **kwargs)

Replace template strings in a JSON object.

Parameters:
  • template_json (dict)

  • participant_id (Optional[str])

  • session_id (Optional[str])

  • bids_participant_id (Optional[str])

  • bids_session_id (Optional[str])

  • objs (Optional[list])

  • return_str (bool)

run_cleanup()

Log a summary message.

run_main()

Run the pipeline.

run_setup()

Run pipeline setup.

abstractmethod run_single(participant_id, session_id)

Run on a single participant/session.

This is an abstract method that should be defined explicitly in subclasses.

Parameters:
  • participant_id (Optional[str])

  • session_id (Optional[str])

set_up_bids_db(dpath_pybids_db, participant_id=None, session_id=None)

Set up the BIDS database.

Parameters:
  • dpath_pybids_db (nipoppy.env.StrOrPathLike)

  • participant_id (Optional[str])

  • session_id (Optional[str])

Return type:

bids.BIDSLayout

property boutiques_config

Get the Boutiques configuration.

property descriptor: dict

Load the pipeline step’s Boutiques descriptor.

Return type:

dict

property dpath_pipeline: pathlib.Path

Return the path to the pipeline’s derivatives directory.

Return type:

pathlib.Path

property dpath_pipeline_bids_db: pathlib.Path

Return the path to the pipeline’s BIDS database directory.

Return type:

pathlib.Path

property dpath_pipeline_output: pathlib.Path

Return the path to the pipeline’s output directory.

Return type:

pathlib.Path

property dpath_pipeline_work: pathlib.Path

Return the path to the pipeline’s working directory.

Return type:

pathlib.Path

property dpaths_to_check: list[pathlib.Path]

Directory paths to create if needed during the setup phase.

Return type:

list[pathlib.Path]

property fpath_container: pathlib.Path

Return the full path to the pipeline’s container.

Return type:

pathlib.Path

property invocation: dict

Load the pipeline step’s Boutiques invocation.

Return type:

dict

n_success = 0
n_total = 0
participant_id = None
property pipeline_config: nipoppy.config.pipeline.ProcPipelineConfig

Get the user config for the pipeline.

Return type:

nipoppy.config.pipeline.ProcPipelineConfig

pipeline_name
pipeline_step = None
property pipeline_step_config: nipoppy.config.pipeline_step.ProcPipelineStepConfig

Get the user config for the pipeline step.

Return type:

nipoppy.config.pipeline_step.ProcPipelineStepConfig

pipeline_version = None
property pybids_ignore_patterns: list[str]

Load the pipeline step’s PyBIDS ignore pattern list.

Note: this does not apply any substitutions, since the subject/session patterns are always added.

Return type:

list[str]

session_id = None
property tracker_config: nipoppy.config.tracker.TrackerConfig

Load the pipeline step’s tracker configuration.

Return type:

nipoppy.config.tracker.TrackerConfig

write_list = None