volume_segmantics.utilities

1from volume_segmantics.utilities.arg_parsing import get_2d_training_parser, get_2d_prediction_parser
2from volume_segmantics.utilities.base_data_utils import Quality
3
4__all__ = [get_2d_training_parser, get_2d_prediction_parser, Quality]
def get_2d_training_parser() -> argparse.ArgumentParser:
40def get_2d_training_parser() -> argparse.ArgumentParser:
41    """Argument parser for scripts that train a 2d network on a 3d volume.
42
43    Returns:
44        argparse.ArgumentParser: An argument parser with the appropriate
45        command line args contained within.
46    """
47    parser = argparse.ArgumentParser(
48        usage="%(prog)s --data <path(s)/to/data/file(s)> --labels <path(s)/to/segmentation/file(s)> --data_dir path/to/data_directory",
49        description="Train a 2d model on the 3d data and corresponding"
50        " segmentation provided in the files.",
51    )
52    parser.add_argument(
53        "-v", "--version", action="version", version=f"{parser.prog} version 1.0.0"
54    )
55    parser.add_argument(
56        "--" + cfg.TRAIN_DATA_ARG,
57        metavar="Path(s) to training image data volume(s)",
58        type=str,
59        action=CheckExt(cfg.TRAIN_DATA_EXT),
60        nargs="+",
61        required=True,
62        help="the path(s) to file(s) containing the imaging data volume for training",
63    )
64    parser.add_argument(
65        "--" + cfg.LABEL_DATA_ARG,
66        metavar="Path(s) to label volume(s)",
67        type=str,
68        action=CheckExt(cfg.LABEL_DATA_EXT),
69        nargs="+",
70        required=True,
71        help="the path(s) to file(s) containing a segmented volume for training",
72    )
73    parser.add_argument(
74        "--" + cfg.DATA_DIR_ARG,
75        metavar="Path to settings and output directory (optional)",
76        type=str,
77        nargs="?",
78        default=Path.cwd(),
79        help='path to a directory containing the "volseg-settings", data will be also be output to this location',
80    )
81    return parser

Argument parser for scripts that train a 2d network on a 3d volume.

Returns

argparse.ArgumentParser: An argument parser with the appropriate command line args contained within.

def get_2d_prediction_parser() -> argparse.ArgumentParser:
 84def get_2d_prediction_parser() -> argparse.ArgumentParser:
 85    """Argument parser for scripts that use a 2d network to predict segmenation for a 3d volume.
 86
 87    Returns:
 88        argparse.ArgumentParser: An argument parser with the appropriate
 89        command line args contained within.
 90    """
 91    parser = argparse.ArgumentParser(
 92        usage="%(prog)s path/to/model/file.zip path/to/data/file [path/to/data_directory]",
 93        description="Predict segmentation of a 3d data volume using the 2d"
 94        " model provided.",
 95    )
 96    parser.add_argument(
 97        "-v", "--version", action="version", version=f"{parser.prog} version 1.0.0"
 98    )
 99    parser.add_argument(
100        cfg.MODEL_PTH_ARG,
101        metavar="Model file path",
102        type=str,
103        action=CheckExt(cfg.MODEL_DATA_EXT),
104        help="the path to a zip file containing the model weights.",
105    )
106    parser.add_argument(
107        cfg.PREDICT_DATA_ARG,
108        metavar="Path to prediction data volume",
109        type=str,
110        action=CheckExt(cfg.PREDICT_DATA_EXT),
111        help="the path to an HDF5 file containing the imaging data to segment",
112    )
113    parser.add_argument(
114        "--" + cfg.DATA_DIR_ARG,
115        metavar="Path to settings and output directory (optional)",
116        type=str,
117        nargs="?",
118        default=Path.cwd(),
119        help='path to a directory containing the "volseg-settings", data will be also be output to this location',
120    )
121    return parser

Argument parser for scripts that use a 2d network to predict segmenation for a 3d volume.

Returns

argparse.ArgumentParser: An argument parser with the appropriate command line args contained within.

class Quality(enum.Enum):
22class Quality(Enum):
23    LOW = 1
24    MEDIUM = 3
25    HIGH = 12

An enumeration.

LOW = <Quality.LOW: 1>
MEDIUM = <Quality.MEDIUM: 3>
HIGH = <Quality.HIGH: 12>
Inherited Members
enum.Enum
name
value