In [6]:
%matplotlib inline
Load data
In [7]:
from __future__ import division
__author__ = 'Diego'
import os
import nibabel as nib
from scipy import ndimage
import braviz
import numpy as np
import skimage
from skimage import data, filter, color
from skimage.transform import hough_circle
from skimage.feature import peak_local_max
from skimage.draw import circle_perimeter
from skimage.util import img_as_float
import matplotlib
#matplotlib.use("Qt4Agg")
import matplotlib.pyplot as plt
os.chdir(r"C:\Users\Diego\Documents\prueba_free_surf_400")
skull = nib.load("skull.nii.gz")
data = skull.get_data()
#===============
#data2 = data
data2 = ndimage.median_filter(data,size=3)
#data2 = data2 > 50
slices = np.arange(130,165)
data2 = data2[:,slices,:]
data2 = data2 - np.min(data2)
data2 = data2/np.max(data2)
tot_scores = []
Original slices
Canny filter
In [9]:
for s in xrange(data2.shape[1]):
print s
ax = plt.gca()
ax.clear()
slice = data2[:,s,:].squeeze()
image = img_as_float(slice)
edges = filter.canny(image)
ax.imshow(edges, cmap=plt.cm.gray)
plt.show()
In [ ]: