Saving output of convert_forward_solution?

External Email - Use Caution

Hi,

Is there any way to save a converted forward solution obtained from
mne.convert_forward_solution?

Thanks and Best Regards,
Gladia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20181010/f0684f2f/attachment.html

Hi Gladia,

You should be able to do this by using the mne module rather than trying to call it from the forward solution object.

mne.write_forward_solution(fname, fwd) # fname should be the filename of your choice, fwd is the output from convert_forward_solution

See:
https://martinos.org/mne/dev/generated/mne.write_forward_solution.html

Cheers,
Josh

Joshua Bear, MD, MA | Assistant Professor, Pediatric Neurology and Epilepsy
University of Colorado and Children?s Hospital Colorado
13123 East 16th Avenue, Box B-155 | Aurora, CO 80045 | Phone: 720-777-6138 | Fax: 720-777-7285

        External Email - Use Caution

Hi,

Is there any way to save a converted forward solution obtained from mne.convert_forward_solution?

Thanks and Best Regards,
Gladia
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20181010/81d057ac/attachment-0002.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1521 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20181010/81d057ac/attachment-0001.bin
-------------- next part --------------
        External Email - Use Caution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20181010/81d057ac/attachment-0003.html

External Email - Use Caution

Hi Joshua,

Thanks for your reply! If I try to save a converted forward solution using
write_forward_solution, write_forward_solution saves the original forward
(before conversion), and issues a warning that I should reapply the
conversion after loading the saved forward model. I'm trying to use the
converted forward solution with MNE Matlab, which as far as I know doesn't
have a convert_forward_solution function, so I need to save the converted
forward solution in Python then load it in Matlab. I don't think
write_forward_solution works for my application, unless it has saving
options that I don't know about?

Best,
Gladia

External Email - Use Caution

Hi Gladia,

Yes, you?re right ... I hadn?t noticed that. It looks like the write function is checking fwd['_orig_source_ori'] to decide about how to write the file. You might be able to hack that value (set it equal to the new source orientation), but I?m not sure that wouldn?t break something else ... you would, at the least, probably also need to overwrite the fwd['_orig_sol'] with your new solution to interrupt the reversion.

I?ll defer to the experts. :wink:

Josh

Hi Gladia,

If the ultimate goal is to use the inverse operator in Matlab, please look
at the following gist

https://gist.github.com/SherazKhan/1104f67ba79b188088f6021b1dbc130e

Use pickNormal to set loose or fixed orientation in the inverse operator

Thanks

Sheraz