Skip to content

Commit

Permalink
Add man pagea and bump to 1.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolphpienaar committed Apr 26, 2024
1 parent d4ba921 commit 1a2d797
Showing 1 changed file with 83 additions and 1 deletion.
84 changes: 83 additions & 1 deletion spleenseg/spleenseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from chris_plugin import chris_plugin, PathMapper

__version__ = "1.2.4"
__version__ = "1.2.6"

DISPLAY_TITLE = r"""
Expand All @@ -51,6 +51,12 @@
""",
formatter_class=ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
"--man",
default=False,
action="store_true",
help="If specified, print a manual page",
)
parser.add_argument(
"--mode",
type=str,
Expand Down Expand Up @@ -119,6 +125,79 @@
)


def manPage_print() -> None:
print(DISPLAY_TITLE)
print(
"""
NAME
spleenseg
SYNOPSIS
spleenseg --mode <inference|training> \\
[--man] \\
[--version] \\
[--logTransformVols] \\
[--useModel <modelFile>] \\
[--trainImageDir <train> --trainLabelsDir <label>] \\
[--testImageDir <dir>] \\
[--device <device>] \\
[--determinismSeed <seed>] \\
[--maxEpochs <count>] \\
[--validateSize <size>]
DESCRIPTION
"spleenseg" is a stand-alone app/ChRIS-plugin that can perform the training
and inference modes on detecting the spleen from abdominal images. It is based
on the project MONAI `spleen_segmentation` notebook exemplar. This app represents
a complete rewrite of the notebook code to allow for more functionality, telemetry
and re-usability.
ARGS
--mode <inference|training>
The mode of operation. If the "training" text has any additional characters,
then the epoch training is skipped and only the post-training logic is executed.
[--man]
If specified, print this help page and quit.
[--version]
If specified, print the version and quit.
[--logTransformVols]
If specified, log a set of intermediary NIfTI volumes as used for training,
validation, spacing, and inference.
[--useModel <modelFile>]
If specified, use <modelFile> for inference or continued training.
[--trainImageDir <train> --trainLabelsDir <label>]
In the <inputDir>, the name of the directory containing files for training
with their corresponding label targets.
[--testImageDir]
In the <inputDir> the name of the directory containing images for inference.
[--device <device>]
The device to use, typically "cpu" or "cuda:0".
[--determinismSeed <seed>]
Set the training seed.
[--maxEpochs <count>]
The max number of training epochs.
[--validateSize <size>]
In the training space, the number of images that should be used for validation
and not training.
"""
)


def trainingData_prep(options: Namespace) -> list[dict[str, str]]:
"""
Generates a list of dictionary entries, each of which is simply the name
Expand Down Expand Up @@ -169,6 +248,9 @@ def envDetail_print(options: Namespace, **kwargs):
"""
Custom version of print_config() that suppresses the optional dependencies message.
"""
if options.man:
manPage_print()
sys.exit(1)
print(DISPLAY_TITLE)
f = Figlet(font="doom")
print(f.renderText(f"{options.mode}"))
Expand Down

0 comments on commit 1a2d797

Please sign in to comment.