Skip to content

Commit c986879

Browse files
Merge pull request #58 from hoechenberger/transform
Cleanup and add some comments
2 parents a1389e0 + c0aff57 commit c986879

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

dipole_sim/transforms.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,28 @@
44

55

66
def gen_ras_to_head_trans(head_to_mri_t, t1_img):
7-
mri_to_head_t = invert_transform(head_to_mri_t)
8-
9-
# RAS <> VOXEL
7+
# RAS -> VOXEL
108
ras_to_vox_t = Transform(fro='ras', to='mri_voxel',
119
trans=np.linalg.inv(t1_img.header.get_vox2ras()))
12-
# trans=t1_img.header.get_ras2vox())
10+
11+
# VOXEL -> MRI
1312
vox_to_mri_t = Transform(fro='mri_voxel', to='mri',
1413
trans=t1_img.header.get_vox2ras_tkr())
1514

16-
# RAS <> MRI
15+
# MRI -> HEAD
16+
mri_to_head_t = invert_transform(head_to_mri_t)
17+
18+
# Now we have generated all the required transformations
19+
# to go from RAS to MNE Head coordinates. Let's combine
20+
# the transforms into a single transform. This requires
21+
# two calls to `combine_transforms()`.
22+
23+
# RAS -> MRI
1724
ras_to_mri_t = combine_transforms(ras_to_vox_t,
1825
vox_to_mri_t,
1926
fro='ras', to='mri')
2027

28+
# RAS -> HEAD
2129
ras_to_head_t = combine_transforms(ras_to_mri_t,
2230
mri_to_head_t,
2331
fro='ras', to='head')

0 commit comments

Comments
 (0)