nipoppy.config

User/pipeline configurations.

Submodules

Package Contents

class nipoppy.config.BasePipelineConfig(/, **data)

Bases: nipoppy.config.container.SchemaWithContainerConfig, abc.ABC

Base schema for processing/BIDS pipeline configuration.

Parameters:

data (Any)

CONTAINER_INFO: nipoppy.config.container.ContainerInfo
DESCRIPTION: str | None
NAME: str
STEPS: list[nipoppy.config.pipeline_step.ProcPipelineStepConfig | nipoppy.config.pipeline_step.BidsPipelineStepConfig]
VERSION: str
get_descriptor_file(step_name=None)

Return the path to the descriptor file for the given step.

If step is None, return the descriptor file for the first step.

Parameters:

step_name (Optional[str])

Return type:

pathlib.Path | None

get_fpath_container()

Return the path to the pipeline’s container.

Return type:

pathlib.Path

get_invocation_file(step_name=None)

Return the path to the invocation file for the given step.

Is step is None, return the invocation file for the first step.

Parameters:

step_name (Optional[str])

Return type:

pathlib.Path | None

get_step_config(step_name=None)

Return the configuration for the given step.

If step_name is None, return the configuration for the first step.

Parameters:

step_name (Optional[str])

Return type:

nipoppy.config.pipeline_step.BasePipelineStepConfig

validate_after()

Validate the pipeline configuration after creation.

Specifically: - If STEPS has more than one item, make sure that each step has a unique name.

class nipoppy.config.BasePipelineStepConfig(/, **data)

Bases: nipoppy.config.container.SchemaWithContainerConfig, abc.ABC

Schema for processing pipeline step configuration.

Parameters:

data (Any)

DESCRIPTOR_FILE: pathlib.Path | None
INVOCATION_FILE: pathlib.Path | None
NAME: str | None
class nipoppy.config.BidsPipelineConfig(/, **data)

Bases: BasePipelineConfig

Schema for BIDS pipeline configuration.

Parameters:

data (Any)

model_config
get_update_doughnut(step_name=None)

Return the update doughnut flag for the given step.

If step is None, return the flag for the first step.

Parameters:

step_name (Optional[str])

Return type:

pathlib.Path | None

class nipoppy.config.BidsPipelineStepConfig(/, **data)

Bases: BasePipelineStepConfig

Schema for BIDS pipeline step configuration.

Parameters:

data (Any)

UPDATE_DOUGHNUT: bool | None
model_config
class nipoppy.config.BoutiquesConfig(/, **data)

Bases: nipoppy.config.container.SchemaWithContainerConfig

Schema for custom configuration within a Boutiques descriptor.

Parameters:

data (Any)

CONTAINER_SUBCOMMAND: str
model_config
class nipoppy.config.Config(/, **data)

Bases: nipoppy.config.container.SchemaWithContainerConfig

Schema for dataset configuration.

Parameters:

data (Any)

BIDS_PIPELINES: list[nipoppy.config.pipeline.BidsPipelineConfig]
CUSTOM: dict
DATASET_NAME: str
DICOM_DIR_MAP_FILE: pathlib.Path | None
DICOM_DIR_PARTICIPANT_FIRST: bool | None
PROC_PIPELINES: list[nipoppy.config.pipeline.ProcPipelineConfig]
SESSION_IDS: list[str] | None
SUBSTITUTIONS: dict[str, str]
VISIT_IDS: list[str]
model_config
apply_substitutions_to_json(json_obj)

Apply substitutions to a JSON object.

Parameters:

json_obj (dict | list)

Return type:

dict | list

classmethod check_input(data)

Validate the raw input.

Specifically: - If session_ids is not given, set to be the same as visit_ids

Parameters:

data (Any)

get_pipeline_config(pipeline_name, pipeline_version)

Get the config for a BIDS or processing pipeline.

Parameters:
  • pipeline_name (str)

  • pipeline_version (str)

Return type:

nipoppy.config.pipeline.ProcPipelineConfig

get_pipeline_version(pipeline_name)

Get the first version associated with a pipeline.

Parameters:

pipeline_name (str) – Name of the pipeline, as specified in the config

Returns:

The pipeline version

Return type:

str

classmethod load(path, apply_substitutions=True)

Load a dataset configuration from a file.

Parameters:

path (nipoppy.env.StrOrPathLike)

Return type:

typing_extensions.Self

propagate_container_config()

Propagate the container config to all pipelines.

Return type:

typing_extensions.Self

save(fpath, **kwargs)

Save the config to a JSON file.

Parameters:

fpath (nipoppy.env.StrOrPathLike) – Path to the JSON file to write

validate_and_process()

Validate and process the configuration.

Return type:

typing_extensions.Self

class nipoppy.config.ContainerConfig(/, **data)

Bases: pydantic.BaseModel

Schema for container configuration.

Does not include information about the container image.

Parameters:

data (Any)

ARGS: list[str]
COMMAND: str
ENV_VARS: dict[str, str]
INHERIT: bool
model_config
add_bind_path(path_local, path_inside_container=None, mode='rw')

Add a bind path.

Parameters:
  • path_local (nipoppy.env.StrOrPathLike)

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

  • mode (str)

merge(other, overwrite_command=False)

Combine with another ContainerConfig instance.

By default this only changes arguments and environment variables, and no information is overwritten: - Arguments from other are appended to arguments of the current instance - Environment variables from other do not overwrite those of the current instance

If overwrite_command is True, the command of the current instance is replaced with that of the other instance.

Parameters:

other (Any)

class nipoppy.config.ProcPipelineConfig(/, **data)

Bases: BasePipelineConfig

Schema for processing pipeline configuration.

Parameters:

data (Any)

TRACKER_CONFIG_FILE: pathlib.Path | None
model_config
get_pybids_ignore_file(step_name=None)

Return the list of regex patterns to ignore when building the PyBIDS layout.

If step is None, return the patterns for the first step.

Parameters:

step_name (Optional[str])

Return type:

pathlib.Path | None

class nipoppy.config.ProcPipelineStepConfig(/, **data)

Bases: BasePipelineStepConfig

Schema for processing pipeline step configuration.

Parameters:

data (Any)

PYBIDS_IGNORE_FILE: pathlib.Path | None
model_config
class nipoppy.config.TrackerConfig(/, **data)

Bases: pydantic.BaseModel

Schema for tracker configuration.

Parameters:

data (Any)

NAME: str
PATHS: list[pathlib.Path]
model_config
validate_after()

Validate the configuration after instantiation.

Specifically: - Make sure PATHS is not an empty list