brain_pipe.cli.default.DefaultCLI

class DefaultCLI

Bases: CLI

Default CLI for brain_pipe.

Attributes

BRAIN_PIPE_STRS

DEFAULT_PARSERS

INPUT_STR

PARSER_FILES_STR

PARSER_STR

__init__()

Methods

__init__()

add_arguments_to_argparser(argparser)

Add arguments to the argparser.

get_argparser([description])

Load the argparser.

get_parser(cli_info)

Find an appropriate parser based on the command line information.

get_run_options(parser, cli_info)

Extract a runner and Pipelines with their DataLoaders using the parser.

parse_cli_arguments([args])

Parse the command line arguments.

parse_cli_arguments_for_parser(parser, cli_info)

Parse the command line arguments.

run([args])

Run the command line interface.

add_arguments_to_argparser(argparser: ArgumentParser)

Add arguments to the argparser.

Parameters:

argparser (argparse.ArgumentParser) – Argparser to add arguments to.

Returns:

Argparser with added arguments.

Return type:

argparse.ArgumentParser

get_argparser(description='Preprocess brain imaging data')

Load the argparser.

Returns:

Argparser.

Return type:

argparse.ArgumentParser

get_parser(cli_info: Dict[str, Any])

Find an appropriate parser based on the command line information.

Parameters:

cli_info (Dict[str, Any]) – The parsed command line arguments.

Returns:

A parser that can be used to create Pipelines and runners.

Return type:

Parser

get_run_options(parser: Parser, cli_info: Dict[str, Any])

Extract a runner and Pipelines with their DataLoaders using the parser.

Parameters:
  • parser (Parser) – The parser to use to create the Pipelines and runner.

  • cli_info (Dict[str, Any]) – The parsed command line arguments.

Returns:

A runner and a list of tuples containing a Pipeline and its DataLoader.

Return type:

Tuple[Runner, List[Tuple[Pipeline, DataLoader]]]

parse_cli_arguments(args=None)

Parse the command line arguments.

Parameters:

args (Any) – Arguments received from the command line. If None, the arguments should be parsed from sys.argv directly

Returns:

A dictionary containing the parsed arguments.

Return type:

Dict[str, Any]

parse_cli_arguments_for_parser(parser: Parser, cli_info: Dict[str, Any], args: Any | None = None) Dict[str, Any]

Parse the command line arguments.

Parameters:
  • parser (Parser) – The parser to use to create the Pipelines and runner.

  • cli_info (Dict[str, Any]) – The parsed command line arguments.

  • args (Any) – Arguments received from the command line. If None, the arguments should be parsed from sys.argv directly

Returns:

A dictionary containing the parsed arguments.

Return type:

Dict[str, Any]

run(args: Any | None = None) List[List[Dict[str, Any]]]

Run the command line interface.

Parameters:

args (Any) – Arguments received from the command line. If None, the arguments should be parsed from sys.argv directly

Returns:

A list of lists of data_dicts containing the results of the Pipelines.

Return type:

List[List[Dict[str, Any]]]