Exemple #1
0
fetch_cenir_multib(with_raw=False)
"""
For this example we select only the shell with b-values equal to the one of the
Human Connectome Project (HCP).

data contains the voxel data and gtab contains a GradientTable
object (gradient information e.g. b-values). For example, to show the b-values
it is possible to write print(gtab.bvals).

For the values of the q-space
indices to make sense it is necessary to explicitly state the big_delta and
small_delta parameters in the gradient table.
"""

bvals = [1000, 2000, 3000]
img, gtab = read_cenir_multib(bvals)
big_delta = 0.0365  # seconds
small_delta = 0.0157  # seconds
gtab = gradient_table(bvals=gtab.bvals,
                      bvecs=gtab.bvecs,
                      small_delta=big_delta,
                      big_delta=small_delta)
data = img.get_data()
data_small = data[40:65, 50:51, 35:60]

print('data.shape (%d, %d, %d, %d)' % data.shape)
"""
The MAPMRI Model can now be instantiated. The radial_order determines the
expansion order of the basis, i.e., how many basis functions are used to
approximate the signal.
Exemple #2
0
fetch it once. Parameter ``with_raw`` of function ``fetch_cenir_multib`` is set
to ``False`` to only download eddy-current/motion corrected data:
"""

fetch_cenir_multib(with_raw=False)

"""
Next, we read the saved dataset. To decrease the influence of diffusion signal
Taylor approximation components larger than the fourth order (componets not
taken into account by the diffusion kurtosis tensor), we only select the
b-values up to 2000 $s.mm^{-2}$:
"""

bvals = [200, 400, 1000, 2000]

img, gtab = read_cenir_multib(bvals)

data = img.get_data()

affine = img.get_affine()

"""
Function ``read_cenir_multib`` return img and gtab which contains respectively
a nibabel Nifti1Image object (where the data can be extracted) and a
GradientTable object with information about the b-values and b-vectors.

Before fitting the data, we preform some data pre-processing. We first compute
a brain mask to avoid unnecessary calculations on the background of the image.
"""

maskdata, mask = median_otsu(data, 4, 2, False, vol_idx=[0, 1], dilate=1)