Skip to content
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
14 changes: 11 additions & 3 deletions cellpose/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"""

args = get_arg_parser().parse_args(
) # this has to be in a seperate file for autodoc to work
) # this has to be in a separate file for autodoc to work

if args.version:
print(version_str)
Expand Down Expand Up @@ -240,8 +240,16 @@
diams=diams, restore_type=restore_type,
ratio=1.)
if saving_something:
suffix = args.output_name if len(args.output_name) > 0 else "_cp_masks"
io.save_masks(image, masks, flows, image_name,
if args.savedir == None: # (1) If `savedir` is not defined,
if len(args.output_name) > 0: # then must have a non-zero `suffix`
suffix = args.output_name # which takes the value passes as a param.,

Check warning on line 245 in cellpose/__main__.py

View check run for this annotation

Codecov / codecov/patch

cellpose/__main__.py#L245

Added line #L245 was not covered by tests
else: suffix = "_cp_masks" # otherwise is the default value.
else: # (2) If `savedir` is defined,
if args.savedir != args.dir: # and different from `dir` then
suffix = args.output_name # takes the value passed as a param. (which can be empty string),
else: suffix = "_cp_masks" # otherwise is the default value.

Check warning on line 250 in cellpose/__main__.py

View check run for this annotation

Codecov / codecov/patch

cellpose/__main__.py#L248-L250

Added lines #L248 - L250 were not covered by tests

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,
Expand Down
2 changes: 1 addition & 1 deletion cellpose/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_arg_parser():
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")
help="suffix for saved masks, default is _cp_masks, can be empty if `savedir` used and different of `dir`")
output_args.add_argument("--no_npy", action="store_true",
help="suppress saving of npy")
output_args.add_argument(
Expand Down