Visit the wiki pages to find some additional documentation and instructions on how view an interactive verson of these notebooks using binder.

In [1]:
%matplotlib inline
In [1]:
import math
import numpy as np
import matplotlib.pyplot as plt

from skimage import io

from skimage.morphology import opening
from skimage.morphology import disk

Openging

Change the size of the structural element to understand how the output changes.

In [2]:
def plot_comparison(original, filtered, filter_name):

    fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(10, 10), sharex=True,
                                   sharey=True)
    ax1.imshow(original, cmap=plt.cm.gray)
    ax1.set_title('original')
    ax1.axis('off')
    ax2.imshow(filtered, cmap=plt.cm.gray)
    ax2.set_title(filter_name)
    ax2.axis('off')
In [3]:
image = io.imread("../images/nuclei-dapi.tif")

To study the effect of morphological filters we will work with a binarised verison of the image

In [4]:
threshold = 33
binary = ~(image <= threshold)
In [5]:
selem = disk(4)
opening = opening(binary, selem)
plot_comparison(binary, opening, 'opening')
In [ ]: