FastSurferCNN.utils.parser_defaults

Contains the ALL_FLAGS dictionary, which can be used as follows to add default flags.

>>> parser = argparse.ArgumentParser()
>>> ALL_FLAGS["allow_root"](parser, dest="root")
>>> args = parser.parse_args()
>>> allows_root = args.root  # instead of the default dest args.allow_root

Values can also be extracted by >>> print(ALL_FLAGS[“allow_root”](dict, dest=”root”) >>> # {‘flag’: ‘–allow_root’, ‘flags’: (’–allow_root’,), ‘action’: ‘store_true’, >>> # ‘dest’: ‘root’, ‘help’: ‘Allow execution as root user.’}

class FastSurferCNN.utils.parser_defaults.CanAddArguments(*args, **kwargs)[source]

Methods

add_argument(*args, **kwargs)

Add an argument to the object.

add_argument(*args, **kwargs)[source]

Add an argument to the object.

class FastSurferCNN.utils.parser_defaults.SubjectDirectoryConfig(orig_name='mri/orig.mgz', pred_name='mri/aparc.DKTatlas+aseg.deep.mgz', conf_name='mri/orig.mgz', in_dir=None, csv_file=None, sid=None, search_tag='*', brainmask_name='mri/mask.mgz', remove_suffix='', out_dir=None)[source]

This class describes the ‘minimal’ parameters used by SubjectList.

Attributes

csv_file

in_dir

out_dir

sid

FastSurferCNN.utils.parser_defaults.add_arguments(parser, flags)[source]

Add default flags to the parser from the flags list in order.

Parameters:
parserT_AddArgs

The parser to add flags to.

flagsIterable[str]

The flags to add from ‘device’, ‘viewagg_device’.

Returns:
T_AddArgs

The parser object.

Raises:
RuntimeError

If parser does not support a call to add_argument.

FastSurferCNN.utils.parser_defaults.add_plane_flags(parser, configtype, files, defaults_path)[source]

Add plane arguments.

Arguments will be added for each entry in files, where the key is the “plane” and the values is the file name (relative for path relative to FASTSURFER_HOME.

Parameters:
parserargparse.ArgumentParser

The parser to add flags to.

configtypeLiteral[“checkpoint”, “config”]

The type of files (for help text and prefix from “checkpoint” and “config”. “checkpoint” will lead to flags like “–ckpt_{plane}”, “config” to “–cfg_{plane}”.

filesMapping[Plane, Path | str]

A dictionary of plane to filename. Relative files are assumed to be relative to the FastSurfer root directory.

defaults_pathPath, str

A path to the file to load defaults from.

Returns:
argparse.ArgumentParser

The parser object.