-
Notifications
You must be signed in to change notification settings - Fork 0
/
play_fitness.py
49 lines (38 loc) · 1.52 KB
/
play_fitness.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import nibabel as nib
from dipy.reconst.gqi import GeneralizedQSamplingModel
from dipy.reconst.dsi import DiffusionSpectrumDeconvModel
from dipy.data import get_sphere
from load_data import (get_train_dsi,
get_train_hardi,
get_train_dti)
from dipy.sims.voxel import SticksAndBall, MultiTensor
# data, affine, gtab = get_train_hardi(30)
mevals = np.array(([0.0015, 0.0003, 0.0003],
[0.0015, 0.0003, 0.0003]))
sphere = get_sphere('symmetric724')
sphere = sphere.subdivide(1)
from dipy.core.gradients import gradient_table
gtab = gradient_table(20000 * np.ones(len(sphere.vertices)),
sphere.vertices)
S, sticks = MultiTensor(gtab,
mevals, S0=100,
angles=[(0, 0), (20, 0)],
fractions=[50, 50],
snr=None)
# S = np.log(S/np.float(S[0]))
S2, sticks2 = MultiTensor(gtab,
mevals, S0=100,
angles=[(0, 0), (35, 0)],
fractions=[50, 50],
snr=None)
# S2 = np.log(S2/np.float(S2[0]))
from dipy.viz import fvtk
r = fvtk.ren()
# fvtk.add(r, fvtk.dots(sphere.vertices, fvtk.red))
fvtk.add(r, fvtk.sphere_funcs(np.vstack((S, S2)),
sphere, scale=30.,
norm=False))
fvtk.add(r, fvtk.sphere_funcs(np.abs(S - S2),
sphere, scale=30.,
norm=False))
fvtk.show(r)