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

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


from skimage import measure
from skimage.color import rgb2gray
from skimage import io
from skimage import filters
from skimage.filters import median, sato, meijering, frangi, hessian
from skimage.morphology import disk
from skimage import feature
from skimage import exposure
from skimage.util import crop 
In [4]:
image = io.imread("../images/retina-image.jpg")
grayscale = rgb2gray(image)
In [5]:
fig, ax = plt.subplots(figsize=(8, 8))
plt.imshow(grayscale, cmap=plt.cm.gray)
Out[5]:
<matplotlib.image.AxesImage at 0x7fa746209550>

Apply a median filter for denoising

In [6]:
image_med = median(grayscale, disk(13))
In [7]:
ig, ax = plt.subplots(figsize=(8, 8))
plt.imshow(grayscale, cmap=plt.cm.gray)
Out[7]:
<matplotlib.image.AxesImage at 0x7fa746456950>

Comparison of vessel detectors

In [8]:
vessels_frangi = frangi(grayscale)
vessels_sato = sato(grayscale)
vessels_meijering = meijering(grayscale)
vessels_hessian = hessian(grayscale, black_ridges=False)

The scaling of the frangi detector is very weak. We use the histogram equalization to scale the image appropriately

In [9]:
vessels_frangi = crop(vessels_frangi, 10)
vessels_frangi = exposure.equalize_hist(vessels_frangi)
In [10]:
fig, ax = plt.subplots(figsize=(12, 12))
ax = plt.subplot(2,2,1)
plt.imshow(vessels_frangi, cmap='gray')
ax.set_title('Frangi Filter', y=1.05, fontsize=18)

ax = plt.subplot(2,2,2)
plt.imshow(vessels_sato, cmap='gray')
ax.set_title('Sato Filter', y=1.05, fontsize=18)

ax = plt.subplot(2,2,3)
plt.imshow(vessels_meijering, cmap='gray')
ax.set_title('Meijering Filter', y=1.05, fontsize=18)


ax = plt.subplot(2,2,4)
plt.imshow(vessels_hessian, cmap='gray')
ax.set_title('Hessian', y=1.05, fontsize=18)
Out[10]:
Text(0.5, 1.05, 'Hessian')
In [ ]:
 
In [ ]: