Skip to content

Commit 9cf1374

Browse files
committed
allow relative savedir path
1 parent a477c8a commit 9cf1374

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cellpose/io.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ def save_masks(images, masks, flows, file_names, png=True, tif=False, channels=[
692692
save_outlines (bool, optional): Save outlines of masks. Defaults to False.
693693
dir_above (bool, optional): Save masks/flows in directory above. Defaults to False.
694694
in_folders (bool, optional): Save masks/flows in separate folders. Defaults to False.
695-
savedir (str, optional): Absolute path where images will be saved. If None, saves to image directory. Defaults to None.
695+
savedir (str, optional): Absolute or relative path where images will be saved. If None, saves to image directory. Defaults to None.
696696
save_txt (bool, optional): Save masks as list of outlines for ImageJ. Defaults to False.
697697
save_mpl (bool, optional): If True, saves a matplotlib figure of the original image/segmentation/flows. Does not work for 3D.
698698
This takes a long time for large images. Defaults to False.
@@ -724,11 +724,11 @@ def save_masks(images, masks, flows, file_names, png=True, tif=False, channels=[
724724

725725
if savedir is None:
726726
if dir_above:
727-
savedir = Path(file_names).parent.parent.absolute(
728-
) #go up a level to save in its own folder
727+
savedir = Path(file_names).parent.parent#go up a level to save in its own folder
729728
else:
730-
savedir = Path(file_names).parent.absolute()
729+
savedir = Path(file_names).parent
731730

731+
savedir = Path(savedir).resolve()
732732
check_dir(savedir)
733733

734734
basename = os.path.splitext(os.path.basename(file_names))[0]

0 commit comments

Comments
 (0)