Ejemplo n.º 1
0
chapter 3 of [4]_  (please cite [3]_, [4]_ if you are using this code).

The algorithm to suppress Gibbs oscillations can be imported from the denoise
module of dipy:
"""

from dipy.denoise.gibbs import gibbs_removal

"""
We first apply this algorithm to T1-weighted dataset which can be fetched
using the following code:
"""

from dipy.data import fetch_tissue_data, read_tissue_data

fetch_tissue_data()

t1_img = read_tissue_data(contrast='T1 denoised')

t1 = t1_img.get_data()

"""
Let's plot a slice of this dataset.
"""

import matplotlib.pyplot as plt
import numpy as np

axial_slice = 88
t1_slice = t1[..., axial_slice]
Ejemplo n.º 2
0
in FAST-FSL and ANTS-atropos, respectively.

Here we will use a T1-weighted image, that has been previously skull-stripped
and bias field corrected.
"""

import numpy as np
import matplotlib.pyplot as plt
from dipy.data import fetch_tissue_data, read_tissue_data
from dipy.segment.tissue import TissueClassifierHMRF

"""
First we fetch the T1 volume from the Syn dataset and determine its shape.
"""

fetch_tissue_data()
t1_img = read_tissue_data()
t1 = t1_img.get_data()
print('t1.shape (%d, %d, %d)' % t1.shape)

"""
We have fetched the T1 volume. Now we will look at the axial and the coronal
slices of the image.
"""

fig = plt.figure()
a = fig.add_subplot(1, 2, 1)
img_ax = np.rot90(t1[..., 89])
imgplot = plt.imshow(img_ax, cmap="gray")
a.axis('off')
a.set_title('Axial')