Repository: mlcommons/GaNDLF

Issue:
[FEATURE] Standardize the CLI option for output directory 
### Is your feature request related to a problem? Please describe.
Currently, there are multiple types of "output" used in CLI, which can get confusing.

### Describe the solution you'd like
For anything related to output directory, it should be `outputdir` or something similar.

### Describe alternatives you've considered
N.A.

### Additional context
Update documentation as well.



Discussion:

Resolving patch:
diff --git a/GANDLF/entrypoints/optimize_model.py b/GANDLF/entrypoints/optimize_model.py
--- a/GANDLF/entrypoints/optimize_model.py
+++ b/GANDLF/entrypoints/optimize_model.py
@@ -36,7 +36,7 @@ def _optimize_model(model: str, config: Optional[str]):
 )
 @append_copyright_to_help
 def new_way(model: str, config: Optional[str]):
-    """ "Generate optimized versions of trained GaNDLF models."""
+    """Generate optimized versions of trained GaNDLF models."""
     _optimize_model(model=model, config=config)
 
 
diff --git a/GANDLF/entrypoints/patch_miner.py b/GANDLF/entrypoints/patch_miner.py
--- a/GANDLF/entrypoints/patch_miner.py
+++ b/GANDLF/entrypoints/patch_miner.py
@@ -12,8 +12,8 @@
 from GANDLF.entrypoints import append_copyright_to_help
 
 
-def _mine_patches(input_path: str, output_path: str, config: Optional[str]):
-    patch_extraction(input_path, output_path, config)
+def _mine_patches(input_path: str, output_dir: str, config: Optional[str]):
+    patch_extraction(input_path, output_dir, config)
     logging.info("Finished.")
 
 
@@ -27,11 +27,11 @@ def _mine_patches(input_path: str, output_path: str, config: Optional[str]):
     help="input path for the tissue",
 )
 @click.option(
-    "--output-path",
+    "--output-dir",
     "-o",
     type=click.Path(file_okay=False, dir_okay=True),
     required=True,
-    help="output path for the patches",
+    help="output directory for the patches",
 )
 @click.option(
     "--config",
@@ -42,9 +42,9 @@ def _mine_patches(input_path: str, output_path: str, config: Optional[str]):
     "otherwise defaults to 16 and (256, 256), respectively.",
 )
 @append_copyright_to_help
-def new_way(input_csv: str, output_path: str, config: Optional[str]):
+def new_way(input_csv: str, output_dir: str, config: Optional[str]):
     """Construct patches from whole slide image(s)."""
-    _mine_patches(input_path=input_csv, output_path=output_path, config=config)
+    _mine_patches(input_path=input_csv, output_dir=output_dir, config=config)
 
 
 @deprecated(
@@ -88,7 +88,7 @@ def old_way():
 
     args = parser.parse_args()
     _mine_patches(
-        input_path=args.input_path, output_path=args.output_path, config=args.config
+        input_path=args.input_path, output_dir=args.output_path, config=args.config
     )
 
 
diff --git a/GANDLF/entrypoints/preprocess.py b/GANDLF/entrypoints/preprocess.py
--- a/GANDLF/entrypoints/preprocess.py
+++ b/GANDLF/entrypoints/preprocess.py
@@ -13,21 +13,21 @@
 def _preprocess(
     config: str,
     input_data: str,
-    output: str,
+    output_dir: str,
     label_pad: str,
     apply_augs: bool,
     crop_zero: bool,
 ):
     print(f"{config=}")
     print(f"{input_data=}")
-    print(f"{output=}")
+    print(f"{output_dir=}")
     print(f"{label_pad=}")
     print(f"{apply_augs=}")
     print(f"{crop_zero=}")
     preprocess_and_save(
         data_csv=input_data,
         config_file=config,
-        output_dir=output,
+        output_dir=output_dir,
         label_pad_mode=label_pad,
         applyaugs=apply_augs,
         apply_zero_crop=crop_zero,
@@ -54,7 +54,7 @@ def _preprocess(
     help="Data csv file that is used for training/inference",
 )
 @click.option(
-    "--output",
+    "--output-dir",
     "-o",
     type=click.Path(file_okay=False, dir_okay=True),
     required=True,
@@ -84,7 +84,7 @@ def _preprocess(
 def new_way(
     config: str,
     input_data: str,
-    output: str,
+    output_dir: str,
     label_pad: str,
     apply_augs: bool,
     crop_zero: bool,
@@ -93,7 +93,7 @@ def new_way(
     _preprocess(
         config=config,
         input_data=input_data,
-        output=output,
+        output_dir=output_dir,
         label_pad=label_pad,
         apply_augs=apply_augs,
         crop_zero=crop_zero,
@@ -184,7 +184,7 @@ def old_way():
     _preprocess(
         config=args.config,
         input_data=args.inputdata,
-        output=args.output,
+        output_dir=args.output,
         label_pad=args.labelPad,
         apply_augs=args.applyaugs,
         crop_zero=args.cropzero,


Test patch:
diff --git a/testing/entrypoints/test_patch_miner.py b/testing/entrypoints/test_patch_miner.py
--- a/testing/entrypoints/test_patch_miner.py
+++ b/testing/entrypoints/test_patch_miner.py
@@ -25,7 +25,7 @@
         should_succeed=True,
         new_way_lines=[
             # full command
-            "--input-csv input.csv --output-path output/ --config config.yaml",
+            "--input-csv input.csv --output-dir output/ --config config.yaml",
             # tests short arg aliases
             "-i input.csv -o output/ -c config.yaml",
         ],
diff --git a/testing/entrypoints/test_preprocess.py b/testing/entrypoints/test_preprocess.py
--- a/testing/entrypoints/test_preprocess.py
+++ b/testing/entrypoints/test_preprocess.py
@@ -25,7 +25,7 @@
         should_succeed=True,
         new_way_lines=[
             # full command
-            "--config config.yaml --input-data input.csv --output output/ --label-pad constant --apply-augs --crop-zero",
+            "--config config.yaml --input-data input.csv --output-dir output/ --label-pad constant --apply-augs --crop-zero",
             # tests short arg aliases
             "-c config.yaml -i input.csv -o output/ -l constant -a -z",
             # checks --label-pad is optional with `constant` default value