Skip to content

Commit

Permalink
removing print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
carsen-stringer committed Oct 26, 2024
1 parent 91d4ab7 commit 0921404
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions cellpose/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,6 @@ def remove_stroke(self, delete_points=True, stroke_ind=-1):
stroke = np.array(self.strokes[stroke_ind])
cZ = self.currentZ
inZ = stroke[0, 0] == cZ
print(inZ.sum())
if inZ:
outpix = self.outpix[cZ, stroke[:, 1], stroke[:, 2]] > 0
self.layerz[stroke[~outpix, 1], stroke[~outpix, 2]] = np.array([0, 0, 0, 0])
Expand Down Expand Up @@ -1688,7 +1687,6 @@ def add_set(self):
color = self.colormap[self.ncells, :3]
median = self.add_mask(points=self.current_point_set, color=color)
if median is not None:
print(median)
self.removed_cell = []
self.toggle_mask_ops()
self.cellcolors = np.append(self.cellcolors, color[np.newaxis, :],
Expand Down Expand Up @@ -1728,7 +1726,6 @@ def add_mask(self, points=None, color=(100, 200, 50), dense=True):
ar, ac = ar + vr.min() - 2, ac + vc.min() - 2
# get dense outline
contours = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
print(contours[-2][0].shape)
pvc, pvr = contours[-2][0][:,0].T
vr, vc = pvr + vr.min() - 2, pvc + vc.min() - 2
# concatenate all points
Expand All @@ -1745,15 +1742,13 @@ def add_mask(self, points=None, color=(100, 200, 50), dense=True):
mask[ar - vr.min() + 2, ac - vc.min() + 2] = 1
contours = cv2.findContours(mask, cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_NONE)
print(contours[-2][0].shape)
pvc, pvr = contours[-2][0][:,0].T
vr, vc = pvr + vr.min() - 2, pvc + vc.min() - 2
ars = np.concatenate((ars, ar), axis=0)
acs = np.concatenate((acs, ac), axis=0)
vrs = np.concatenate((vrs, vr), axis=0)
vcs = np.concatenate((vcs, vc), axis=0)
print("HI", ars, acs)


self.draw_mask(z, ars, acs, vrs, vcs, color)
median.append(np.array([np.median(ars), np.median(acs)]))

Expand Down
4 changes: 2 additions & 2 deletions cellpose/gui/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ def _masks_to_gui(parent, masks, outlines=None, colors=None):
fastremap.renumber(masks, in_place=True)
outlines = None
masks = masks.reshape(shape)
outlines = None
if masks.ndim == 2:
outlines = None
masks = masks.astype(np.uint16) if masks.max() < 2**16 - 1 else masks.astype(
np.uint32)
if parent.restore and "upsample" in parent.restore:
Expand Down Expand Up @@ -650,7 +651,6 @@ def _save_sets(parent):
"diameter":
parent.diameter
}
print(dat["masks"].shape)
if parent.restore is not None:
dat["img_restore"] = parent.stack_filtered
np.save(base + "_seg.npy", dat)
Expand Down

0 comments on commit 0921404

Please sign in to comment.