# forward model having only segmentation files

**URL:** <https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [March 8, 2012, 1:31pm UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415 "2012-03-08T13:31:44Z")\
**Posts on this page:** 10\
**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:** [March 8, 2012, 1:31pm UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/1 "2012-03-08T13:31:44Z")

</div>

Dear all,

I want to create forward model in MNE software. But I have only  
segmentation data (skull.mgz, skin. mgz, brain.ngz) got in FSL  
software + EEG electrodes coordinates. Is it possible to do at all? If  
yes, could anyone give me an advice how to do it or refer to some  
tutorial where I could read about. I've read how to do it having 'raw'  
data and using Freesurfer software + MNE. But in my case all I have  
only are segmentation files and file with electrodes positions.

Regards,  
Anton

---

<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:** [March 8, 2012, 4:58pm UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/2 "2012-03-08T16:58:25Z")

</div>

Hello Anton,

it's doable but it's far from trivial as it requires you to understand the  
internal of the MNE anatomical pipeline (where MNE expects to find  
the files etc.). I would seriously consider running freesurfer on my subject  
and rely the automatic / standard pipeline. Freesurfer also gives you  
all the segmentations including the cortical surface for sources' locations.

Alex

---

<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:** [March 9, 2012, 10:27am UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/3 "2012-03-09T10:27:09Z")

</div>

Hello Alex,

Thank you very much for your reply. I completely understand that it is  
better to use Freesurfer first. But I deal with neonatal data. And  
Freesurfer, unfortunately, fails to analyse such kind of data (when I  
tried it even did not create all folders and files, those i could edit  
manually). As far as I got from literature, people (almost) always do  
segmentation of neonatal data manually and then launch Freesurfer. But  
it takes a lot of time to do and is not trivial task. But I have  
already segmentation files done in FSL. So, my idea was somehow to use  
them in MNE to get forward model. What would you recommend? What do  
you think the most optimal way to act in my case?

Regards,  
Anton

??? "Alexandre Gramfort" \<gramfort at nmr.mgh.harvard.edu\>:

---

<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:** [March 9, 2012, 4:59pm UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/4 "2012-03-09T16:59:47Z")

</div>

Hi Anton,

The only thing I can think of would be to use mne\_volume\_source\_space.  
You would still need to generate a couple of surfaces for your BEM, but  
this should not be very difficult. If you need more advice about that,  
please let me know.

D

tokariev at [mappi.helsinki.fi](http://mappi.helsinki.fi) wrote:

---

<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:** [March 9, 2012, 9:09pm UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/5 "2012-03-09T21:09:21Z")

</div>

Hi Anton,

I agree with Dan. You should work with a volume source space.

It's not going to be trivial but the way to go is:

- extract the BEM surfaces and write them a folder matching  
${SUBJECTS\_DIR}/${SUBJECT}/bem

see the mne-sample-data for an example of database layout

you'll probably need to have surface in the  
${SUBJECTS\_DIR}/${SUBJECT}/mri folder to mne\_analyze to be able to do  
the coregistration.

- then you can run the forward computation see:

[https://github.com/mne-tools/mne-scripts/blob/master/sample-data/run\_meg\_volume\_tutorial.sh](https://github.com/mne-tools/mne-scripts/blob/master/sample-data/run_meg_volume_tutorial.sh)

- then with python you can run an inverse computation. See:

[http://www.martinos.org/mne/auto\_examples/inverse/plot\_compute\_mne\_inverse\_volume.html](http://www.martinos.org/mne/auto_examples/inverse/plot_compute_mne_inverse_volume.html)

you should then be able to write a nifty or .mgh file to overlay the  
activations on the volume e.g. with freeview shipped with freesurfer

may the force be with you !

Alex

---

<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:** [March 13, 2012, 2:31pm UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/6 "2012-03-13T14:31:47Z")

</div>

The easiest thing to do would be to play around with the FreeSurfer  
command mri\_watershed

use -surf

For each volume you give it the created outer skin surface will be the  
outermost surface you can use for your bem. Use it serially, re-naming  
the files for use in your BEM. If this is. You may have to play a while  
to get it to work. I suspect you will need to apply the mask to your  
original volume, as it expects non-binary data.

D

tokariev at [mappi.helsinki.fi](http://mappi.helsinki.fi) wrote:

---

<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, 2012, 11:15am UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/7 "2012-05-28T11:15:29Z")

</div>

Hello,

I am trying to create surfaces for BEM. I have done next steps:

1. I have raw MRI images (DICOM). I did segmentation of inner/outer  
skull and outer skin manually. After this, I changed the original MRI  
images to segmented volumes (to keep all DICOM headers). In other  
words, I got MRI images, where instead of original MRI I put inner  
skull segmentation (also I have saved files like that to outer skull  
and outer skin). Each value of the segmented volume were set to 110.

2. I used mri\_convert to get from 3 sets of images in DICOM format,  
those contain segmentations, volumes in .mgz format. So I got  
inner\_skull.mgz, outer\_skull.mgz and outer\_skin.mgz. I put these files  
to the folder: .../freesurfer/subjects/subject/mri/orig

Now I am trying to get surfaces with a help of the command  
'mri\_watershed -surf'. I am using it like this: mri\_watershed -surf  
inner\_skull.mgz inner\_skull\_surf... But the program fails to create  
surfaces. What I am doing wrong on this stage? Could anyone give an  
advise?

Best wishes,  
Anton

Lainaus dgw \<dgwakeman at [gmail.com](http://gmail.com)\>:

---

<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, 2012, 1:47pm UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/8 "2012-05-29T13:47:26Z")

</div>

Hi Anton,

Well mri\_watershed is not designed to deal with segmented data. You need  
to trick it.

tokariev at mappi.helsinki.fi wrote:

> Hello,
> 
> I am trying to create surfaces for BEM. I have done next steps:
> 
> 1. I have raw MRI images (DICOM). I did segmentation of inner/outer  
> skull and outer skin manually. After this, I changed the original MRI  
> images to segmented volumes (to keep all DICOM headers). In other words,  
> I got MRI images, where instead of original MRI I put inner skull  
> segmentation (also I have saved files like that to outer skull and outer  
> skin). Each value of the segmented volume were set to 110.
> 
> 2. I used mri\_convert to get from 3 sets of images in DICOM format,  
> those contain segmentations, volumes in .mgz format. So I got  
> inner\_skull.mgz, outer\_skull.mgz and outer\_skin.mgz. I put these files  
> to the folder: .../freesurfer/subjects/subject/mri/orig

Are these binarized masks? Are they masked at all?

Regardless, you need to put a raw MRI volume saved as 001.mgz in  
/subjects/subject/mri/orig/001.mgz and run autorecon1 (check freesurfer  
wiki for details).

> Now I am trying to get surfaces with a help of the command  
> 'mri\_watershed -surf'. I am using it like this: mri\_watershed -surf  
> inner\_skull.mgz inner\_skull\_surf... But the program fails to create  
> surfaces. What I am doing wrong on this stage? Could anyone give an advise?

First run the above, and let me know what the files are then we can look  
into the subsequent steps (this is a non-standard hack I developed), so  
it will take some time to work through.

D

---

<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, 2012, 4:11pm UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/9 "2012-05-29T16:11:42Z")

</div>

Hi Dan,

Thanx for your reply.

Re masks:

Yes, they are binary masks. But I set '1' values to suitable for  
Freesurfer data (to 110). As far as I know Freesurfer does not work  
with binary data. 'Skin mask' is a contour of skin: on the black  
background is a 1 pixel width countour that repeats skin countour  
(each pixel = 110). 'Skull mask' has the same principle but with other  
width.

Re -autorecon1:

I have done like you wrote. I used 'skin' volume for test. I got in  
folder 'mri' next files:  
error.log  
mri\_nu\_correct.mni.log  
nu.mgz  
orig  
orig.mgz  
rawavg.mgz  
T1.mgz  
transforms

Folder 'transforms' contains files:  
bak  
talairach.auto.xfm  
talairach\_avi.log  
talairach\_avi\_QA.log  
talairach.xfm  
talsrcimg\_to\_711-2C\_as\_mni\_average\_305\_t4\_vox2vox.txt

BW,  
Anton

Lainaus dgw \<dgwakeman at [gmail.com](http://gmail.com)\>:

---

<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, 2012, 4:21pm UTC](https://mne.discourse.group/t/forward-model-having-only-segmentation-files/415/10 "2012-05-29T16:21:56Z")

</div>

Ok,

The first thing you could try is to use mne\_watershed\_bem now. If you  
are happy with those results, you can stop there.

If not the next step would involve using the FreeSurfer MATLAB tools to  
multiply your binary masks to the T1 volume and run mri\_watershed step  
by step on each shell. Unfortunately, this requires you to setup fake  
FreeSurfer directories for each shell. Eventually, you will be able to  
get there though.

See if the initial run helps.

D

tokariev at [mappi.helsinki.fi](http://mappi.helsinki.fi) wrote:
