<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7653.38">
<TITLE>[FIELDTRIP] Neuromag-fif-mri from mne to fieldtrip.</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>

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

</BODY>
</HTML>
<p>----------------------------------</p>
<p>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.</p>
<p>  http://listserv.surfnet.nl/archives/fieldtrip.html</p>
<p>  http://www.ru.nl/fcdonders/fieldtrip/</p>