In [1]:
%run ../common.ipynb


Populating the interactive namespace from numpy and matplotlib

In [5]:
img = imread('../MP.tiff')
# make a circle mask
r = 30
size = 2*r
x,y = np.meshgrid(range(size), range(size))
R = np.sqrt((x-r)**2+(y-r)**2)
mask = np.ones((size,size), bool)
mask[R>r] = 0
# discard values below 30
img[img<30]=0

# closing
imshow(ndimage.binary_closing(img, structure=mask))


Out[5]:
(<matplotlib.figure.Figure at 0x108bb79d0>,
 <matplotlib.axes._subplots.AxesSubplot at 0x112dcaf10>,
 <matplotlib.image.AxesImage at 0x116932a50>)

In [ ]: