Skip to content

Commit

Permalink
Merge pull request #58 from hoechenberger/transform
Browse files Browse the repository at this point in the history
Cleanup and add some comments
  • Loading branch information
hoechenberger authored Apr 26, 2020
2 parents a1389e0 + c0aff57 commit c986879
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions dipole_sim/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@


def gen_ras_to_head_trans(head_to_mri_t, t1_img):
mri_to_head_t = invert_transform(head_to_mri_t)

# RAS <> VOXEL
# RAS -> VOXEL
ras_to_vox_t = Transform(fro='ras', to='mri_voxel',
trans=np.linalg.inv(t1_img.header.get_vox2ras()))
# trans=t1_img.header.get_ras2vox())

# VOXEL -> MRI
vox_to_mri_t = Transform(fro='mri_voxel', to='mri',
trans=t1_img.header.get_vox2ras_tkr())

# RAS <> MRI
# MRI -> HEAD
mri_to_head_t = invert_transform(head_to_mri_t)

# Now we have generated all the required transformations
# to go from RAS to MNE Head coordinates. Let's combine
# the transforms into a single transform. This requires
# two calls to `combine_transforms()`.

# RAS -> MRI
ras_to_mri_t = combine_transforms(ras_to_vox_t,
vox_to_mri_t,
fro='ras', to='mri')

# RAS -> HEAD
ras_to_head_t = combine_transforms(ras_to_mri_t,
mri_to_head_t,
fro='ras', to='head')
Expand Down

0 comments on commit c986879

Please sign in to comment.