# Transform stc from head to MRI coordinate system?

**URL:** <https://mne.discourse.group/t/transform-stc-from-head-to-mri-coordinate-system/1533>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [May 28, 2018, 9:42pm UTC](https://mne.discourse.group/t/transform-stc-from-head-to-mri-coordinate-system/1533 "2018-05-28T21:42:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 28, 2018, 9:42pm UTC](https://mne.discourse.group/t/transform-stc-from-head-to-mri-coordinate-system/1533/1 "2018-05-28T21:42:10Z")

</div>

External Email - Use Caution

Hi, I would like my volumetric source estimate to be in MRI  
coordinates, is there a way to easily transform my stc, before I save  
it into nifti?  
Thank you for any advice!  
Best,  
Lori

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 29, 2018, 4:12pm UTC](https://mne.discourse.group/t/transform-stc-from-head-to-mri-coordinate-system/1533/2 "2018-05-29T16:12:44Z")

</div>

External Email - Use Caution

I think that if you constructed your volume source space with the `mri`  
argument and `add_interpolator=True`, then you should be able to do  
`stc.save_as_volume(...)` or `as_volume` that will already properly be in  
the same MRI coordinates as the `mri` you originally supplied. Does that  
help?

Eric

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 29, 2018, 7:45pm UTC](https://mne.discourse.group/t/transform-stc-from-head-to-mri-coordinate-system/1533/3 "2018-05-29T19:45:32Z")

</div>

External Email - Use Caution

Thanks Eric! I will give it a try.  
Best,  
Lori

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 30, 2018, 9:15pm UTC](https://mne.discourse.group/t/transform-stc-from-head-to-mri-coordinate-system/1533/4 "2018-05-30T21:15:08Z")

</div>

External Email - Use Caution

Unfortunately, it seems to revert back to head coordinates at the fwd  
step. Any other possibilities?  
Thanks,  
Lori

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 30, 2018, 9:56pm UTC](https://mne.discourse.group/t/transform-stc-from-head-to-mri-coordinate-system/1533/5 "2018-05-30T21:56:56Z")

</div>

External Email - Use Caution

Hi Lori,

Are you definitely using the volume source space to compute the forward  
solution and inverse operator? There's not a separate '\_volume\_' function  
for the forward solution or inverse inverse operator, so if you're also  
setting up the surface models in the same script it would be very easy to  
inadvertently use the surface model or even overwrite the volume output  
files (speaking from experience...). Here's what mine currently looks like:

head = setup\_volume\_source\_space(subject, mri=fname\_t1, bem=fname\_bem,  
mindist=mindist,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subjects\_dir=subjects\_dir, add\_interpolator=True)  
mne.write\_source\_spaces(fname\_volsrc, head, overwrite=True)

forward = mne.make\_forward\_solution(fname\_raw, fname\_trans, head, fname\_bem,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;meg=True, eeg=False, mindist=mindist,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;n\_jobs=8)  
mne.write\_forward\_solution(fname\_volfwd, forward, overwrite=True)

inverse\_operator = make\_inverse\_operator(raw.info, forward, noise\_cov,  
loose=1, depth=None, fixed=False)  
write\_inverse\_operator(fname\_volinv, inverse\_operator, verbose=True)

Jon
