Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated CLI options for new API #853

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GANDLF/entrypoints/optimize_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
14 changes: 7 additions & 7 deletions GANDLF/entrypoints/patch_miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")


Expand All @@ -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",
Expand All @@ -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(
Expand Down Expand Up @@ -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
)


Expand Down
14 changes: 7 additions & 7 deletions GANDLF/entrypoints/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion testing/entrypoints/test_patch_miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down
2 changes: 1 addition & 1 deletion testing/entrypoints/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading