Skip to content

Commit

Permalink
Merge branch 'fix-flow-prob-save' of https://github.com/qin-yu/cellpose
Browse files Browse the repository at this point in the history
… into qin-yu-fix-flow-prob-save
  • Loading branch information
carsen-stringer committed Feb 10, 2025
2 parents 35357ad + 95e2f60 commit a64cea9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cellpose/gui/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ def _load_image(parent, filename=None, load_seg=True, load_3D=False):


def _initialize_images(parent, image, load_3D=False):
""" format image for GUI
""" format image for GUI
assumes image is Z x channels x W x H
"""
load_3D = parent.load_3D if load_3D is False else load_3D
parent.nchan = 3
Expand Down Expand Up @@ -580,10 +580,16 @@ def _save_flows(parent):
""" save flows and cellprob to tiff """
filename = parent.filename
base = os.path.splitext(filename)[0]
print("GUI_INFO: saving flows and cellprob to tiff")
if len(parent.flows) > 0:
imsave(base + "_cp_flows.tif", parent.flows[4][:-1])
imsave(base + "_cp_cellprob.tif", parent.flows[4][-1])

imsave(base + "_cp_cellprob.tif", parent.flows[1])
for i in range(3):
imsave(base + f"_cp_flow_{i}.tif", parent.flows[0][..., i])
if len(parent.flows) > 2:
imsave(base + "_cp_flow.tif", parent.flows[2])
print("GUI_INFO: saved flows and cellprob")
else:
print("ERROR: no flows or cellprob found")

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

0 comments on commit a64cea9

Please sign in to comment.