Skip to content

Commit a64cea9

Browse files
Merge branch 'fix-flow-prob-save' of https://github.com/qin-yu/cellpose into qin-yu-fix-flow-prob-save
2 parents 35357ad + 95e2f60 commit a64cea9

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

cellpose/gui/io.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ def _load_image(parent, filename=None, load_seg=True, load_3D=False):
140140

141141

142142
def _initialize_images(parent, image, load_3D=False):
143-
""" format image for GUI
144-
143+
""" format image for GUI
144+
145145
assumes image is Z x channels x W x H
146-
146+
147147
"""
148148
load_3D = parent.load_3D if load_3D is False else load_3D
149149
parent.nchan = 3
@@ -580,10 +580,16 @@ def _save_flows(parent):
580580
""" save flows and cellprob to tiff """
581581
filename = parent.filename
582582
base = os.path.splitext(filename)[0]
583+
print("GUI_INFO: saving flows and cellprob to tiff")
583584
if len(parent.flows) > 0:
584-
imsave(base + "_cp_flows.tif", parent.flows[4][:-1])
585-
imsave(base + "_cp_cellprob.tif", parent.flows[4][-1])
586-
585+
imsave(base + "_cp_cellprob.tif", parent.flows[1])
586+
for i in range(3):
587+
imsave(base + f"_cp_flow_{i}.tif", parent.flows[0][..., i])
588+
if len(parent.flows) > 2:
589+
imsave(base + "_cp_flow.tif", parent.flows[2])
590+
print("GUI_INFO: saved flows and cellprob")
591+
else:
592+
print("ERROR: no flows or cellprob found")
587593

588594
def _save_rois(parent):
589595
""" save masks as rois in .zip file for ImageJ """

0 commit comments

Comments
 (0)