Neuromag-fif-mri from mne to fieldtrip.

Hanneke Van Dijk Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE
Thu Jul 9 20:26:58 CEST 2009


Dear all,

An update on my progress reading .fif mri's with fieldtrip (using the mne toolbox). I'm happy to announce it worked! Thanks to Roberts new script and Jan-Mathijs' suggestion to swap the x and y coordinates of the vol.bnd.pnt variable. 

I used the realignment to mni template which can be found in one of the example scripts (I think that is a creation of Ingrids) and found out that also the x and y coordinates of the normalized-to-mni mri should be swapped. My batch script can now be found at: 

http://fieldtrip.fcdonders.nl/example/read_neuromag_mri_and_create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space 

I hope that helps more neuromag-meg-people!

Thanks for your help!

Yours,

Hanneke

-----Ursprüngliche Nachricht-----
Von: FieldTrip discussion list im Auftrag von jan-mathijs schoffelen
Gesendet: Mi 08.07.2009 10:22
An: FIELDTRIP at NIC.SURFNET.NL
Betreff: Re: [FIELDTRIP] AW: [FIELDTRIP] Neuromag-fif-mri from mne to fieldtrip.
 
Hi Hanneke,

Please note that the X and Y axis in the neuromag head-coordinate  
system are swapped with respect to the CTF and 4D convention; i.e. X  
axis through the ears, and Y-axis to the nose.
What usually works for me is discarding the mri.transform (mri =  
rmfield(mri, 'transform'), and call volumerealign in the interactive  
mode. You can then specify the location of the fiducials yourself
and the output mri of the function will contain a transformation  
matrix according to ctf convention. This at least ensures that  
volumesegment etc kind of work properly. Yet, it is important to know  
that of course the gradiometer positions in the data are defined in  
neuromag convention, so after preparing your volume conduction model  
you probably have to swap the x and y coordinates of the vol.bnd.pnt  
(assuming you use a singleshell as volume conductor model), before  
proceeding to visualization (headmodelplot; just to check whether the  
head fits in the helmet), leadfield computation (only makes sense if  
the head fits in the helmet), and sourceanalysis (idem).

Yours,

JM




On Jul 8, 2009, at 9:09 AM, Robert Oostenveld wrote:

> Hi Hanneke,
>
> I have tried importing another MRI fif file which I still had on  
> disk using the following modification of the fieldtrip/fileio/ 
> read_mri.m code
>
>   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
> %%%%%%%%%%%%%%
> elseif filetype(filename, 'neuromag_fif') && hastoolbox('mne')
>   % use the mne functions to read the Neuromag MRI
>   hdr = fiff_read_mri(filename);
>   img = cat(3, hdr.slices.data);
>   hdr.slices = rmfield(hdr.slices, 'data'); % remove the image data  
> to save memory
>   transform = hdr.trans.trans;
>
> and then slightly further down in the code
>
> % set up the axes of the volume in voxel coordinates
> nx = size(img,1);
> ny = size(img,2);
> nz = size(img,3);
> mri.dim = [nx ny nz];
> % store the anatomical data
> mri.anatomy = img;
> % store the header with all fileformat specific details
> mri.hdr = hdr;
> try
>   % if present, store the homogenous transformation matrix
>   mri.transform = transform;
> end
>
> This results in a warning of the MNE fiff_read_mri function
>
> >> mri = read_mri('lp_mri_headcoords.fif')
> 	Reading slice information and pixel data..50..100..126..[done]
> 	The slices are not equally spaced. Voxel transformation will not  
> be included
>
> mri =
>           dim: [256 256 126]
>       anatomy: [256x256x126 int16]
>           hdr: [1x1 struct]
>     transform: [4x4 double]
>
> and the resulting coordinate transformation matrix is not fully  
> correct. You can check the coordinates by plotting it intreactively  
> in sourceplot (after converting the image data from int16 into  
> double).
>
> Perhaps one of the Neuromag experts on the list can help you further.
>
> best regards,
> Robert
>
> PS atatched is the latest read_mri function, which includes the  
> call to fiff_read_mri.
>
>
> On 8 Jul 2009, at 9:49, Robert Oostenveld wrote:
>
>> Hi Hanneke,
>>
>> The mri.fif file that you sent only contains the header  
>> information, but not the slice/image information.
>>
>> >> fiff_read_mri('mri.fif')
>> 	Reading slice information and pixel data.??? Error using ==>  
>> fiff_read_mri at 116
>> Could not locate pixel file /neuro/mri/k/kahlbrock_nina/slices/ 
>> MR1.3.12.2.1107.5.2.32.35204.2008010817494654069656329
>>
>> Please also send the corresponding slice data.
>>
>> Robert
>>
>>
>> On 8 Jul 2009, at 9:01, Hanneke Van Dijk wrote:
>>
>>> Hi Robert,
>>>
>>> Thanks for your reply. I have tried the meg_pd function loadmri  
>>> (via read_mri in fieldtrip) but I got the feedback: 'error  
>>> loading mri-file'. So I have no idea what is going wrong. I will  
>>> send you the example mri-file right now. It is probably not to  
>>> difficult to work something out but I want to be sure that the  
>>> mri head coordinates end up in the right way as device coordinates.
>>>
>>> Thanks in advance!
>>> Viele Gruße aus Düsseldorf ;-)
>>>
>>> Hanneke
>>
>> ----------------------------------
>> The aim of this list is to facilitate the discussion between users  
>> of the FieldTrip  toolbox, to share experiences and to discuss new  
>> ideas for MEG and EEG analysis. See also http:// 
>> listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/ 
>> neuroimaging/fieldtrip.
>>
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users  
> of the FieldTrip  toolbox, to share experiences and to discuss new  
> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/ 
> archives/fieldtrip.html and http://www.ru.nl/neuroimaging/ 
> fieldtrip.<read_mri.m>

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.


----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.



More information about the fieldtrip mailing list