From 8526c84727ec202cecaecc64c797f314755ea491 Mon Sep 17 00:00:00 2001 From: Carsen Stringer Date: Mon, 10 Feb 2025 09:26:01 -0500 Subject: [PATCH] adding output_name option to replace _cp_masks with user-input (#1100) --- cellpose/__main__.py | 4 +++- cellpose/cli.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cellpose/__main__.py b/cellpose/__main__.py index c48afb39..03a27d25 100644 --- a/cellpose/__main__.py +++ b/cellpose/__main__.py @@ -240,7 +240,9 @@ def main(): diams=diams, restore_type=restore_type, ratio=1.) if saving_something: - io.save_masks(image, masks, flows, image_name, png=args.save_png, + suffix = args.output_name if len(args.output_name) > 0 else "_cp_masks" + io.save_masks(image, masks, flows, image_name, + suffix=suffix, png=args.save_png, tif=args.save_tif, save_flows=args.save_flows, save_outlines=args.save_outlines, dir_above=args.dir_above, savedir=args.savedir, diff --git a/cellpose/cli.py b/cellpose/cli.py index a4032fc6..64dec0bb 100644 --- a/cellpose/cli.py +++ b/cellpose/cli.py @@ -146,6 +146,9 @@ def get_arg_parser(): output_args.add_argument( "--save_tif", action="store_true", help="save masks as tif and outlines as text file for ImageJ") + output_args.add_argument( + "--output_name", default=[], type=str, + help="suffix for saved masks, default is _cp_masks") output_args.add_argument("--no_npy", action="store_true", help="suppress saving of npy") output_args.add_argument(