Created
October 20, 2016 18:01
-
-
Save valentina-s/87922dfef4fd9f87d3ea99297312ca8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
im = plt.imread('cells.png') | |
fig = plt.figure() | |
ax = fig.add_subplot(111) | |
# ax.add_image(im) | |
plt.imshow(im) | |
coords = [] | |
import cell_magic_wand | |
def onclick(event): | |
global ix, iy | |
ix, iy = event.xdata, event.ydata | |
print 'x = %d, y = %d'%( | |
ix, iy) | |
mask = cell_magic_wand.cell_magic_wand_single_point(im,(ix,iy),5,200,roughness=5)[0] | |
plt.contour(mask) | |
print(mask) | |
cid = fig.canvas.mpl_connect('button_press_event', onclick) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment