In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from skimage.morphology import disk, dilation, erosion
from ipywidgets import StaticInteract, RangeWidget
In [2]:
edges = 1- np.loadtxt('edges.txt', delimiter=',')
alpha = dilation(edges, disk(1))
bravo = dilation(alpha, disk(1))
charlie = erosion(bravo, disk(1))
delta = erosion(charlie, disk(1))

images = np.dstack((edges, alpha, bravo, charlie, delta))
#images.shape
In [3]:
def plotter(step=0):
    fig = plt.figure(figsize=(5, 5))
    ax = fig.add_subplot(1, 1, 1)
    plt.imshow(images[:,:,step], cmap='gray', interpolation = 'none')
    ax.set_xticks([])
    ax.set_yticks([])
    return fig

StaticInteract(plotter, step=RangeWidget(0,4,1))
Out[3]:
step: