<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.E-MailFormatvorlage19
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=DE link=blue vlink=blue style='word-wrap: break-word;-webkit-nbsp-mode: space;
-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Dear JM,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>thanks a lot. I have actually just
realized a few minutes ago that volumesegment and volumerealign are now supporting
neuromag this way. It works just fine.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> I was already surprised that
headcoordinates has a flag for neuromag now, and it should have occured to me
that this means that also the higher-level functions were changed. Could I ask
you to include this new feature in the help? I could also put an example script
online if that is helpful for communicating this aspect (in case it hasn’t
been communicated long ago and I just missed it).<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Best,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>jan<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>Von:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
fieldtrip-bounces@donders.ru.nl [mailto:fieldtrip-bounces@donders.ru.nl] <b><span
style='font-weight:bold'>Im Auftrag von </span></b>jan-mathijs schoffelen<br>
<b><span style='font-weight:bold'>Gesendet:</span></b> Dienstag, 12. April 2011
12:11<br>
<b><span style='font-weight:bold'>An:</span></b> <st1:PersonName w:st="on">Email
 discussion list for the FieldTrip project</st1:PersonName><br>
<b><span style='font-weight:bold'>Betreff:</span></b> Re: [FieldTrip] I think
you solved the problem</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Dear Jan,<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Apart from not being properly aligned, the segmentation looks a bit
strange to me. I suspect that not everything went well here ;o).<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Could you try the following:<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>specify cfg.coordsys = 'neuromag', both in your call to
ft_volumerealign and in your call to ft_volumesegment. The cfg.coordinates for
ft_volumesegment has to be removed (actually it is a deprecated option). The
idea now is that mri-structures in fieldtrip can have a coordsys field, which
allows for more transparent use of the different head coordinate system
conventions. This takes away the need for intermediately coregistering the MRI
in 'ctf'-convention, and would also take away your need to call headcoordinates
later on.<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Best wishes,<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Jan-Mathijs<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Apr 12, 2011, at 11:07 AM, <<a
href="mailto:Jan.Hirschmann@med.uni-duesseldorf.de">Jan.Hirschmann@med.uni-duesseldorf.de</a>>
<<a href="mailto:Jan.Hirschmann@med.uni-duesseldorf.de">Jan.Hirschmann@med.uni-duesseldorf.de</a>>
wrote:<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br>
<o:p></o:p></span></font></p>

<span style='orphans: 2;text-align:auto;widows: 2;-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'><u1:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName">

<div link=blue vlink=blue>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Dear fieldtrip experts,<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>I have two questions
regarding head model creation. As noted on this thread, the volumesegment
function was updated and I tested it for our Neuromag data. The segmentation is
performed, but unfortunately it is not aligned with the MRI in my case. Here is
the code I am using, the fieldtrip is from 9<sup>th</sup><span
class=apple-converted-space> </span>April 2011.<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>%read mri<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>mri               
= ft_read_mri(subject_files.fiff_mri);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>mri.anatomy=double(mri.anatomy);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>%these are the fiducials for this subject
taken from the Neuromag GUI for coregistration<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg=[];<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg.fiducial.rpa=[136.35  
142.80    31.96];<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg.fiducial.nas=[47.84  
101.80   100.10];<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg.fiducial.lpa=[139.22  
146.17   162.69];<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>%define the head coordinate system
according to CTF conventions<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg.method='fiducial';<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>real_mri=ft_volumerealign(cfg,mri);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>%segment<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg               
= [];<u1:p></u1:p></span></font><font color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg.template      
= '/data/apps/spm/spm8/templates/T1.nii';<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg.coordinates    = 'ctf';<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg.keepintermediate = 'no';<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>segmentedmri     =
ft_volumesegment(cfg, real_mri);<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>%plot white matter<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>test=segmentedmri;<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>test.anatomy=real_mri.anatomy;<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg=[];<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cfg.funparameter='white';<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>ft_sourceplot(cfg,test); %see attached
picture<u1:p></u1:p></span></font><font color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>The other issue regards
back-transformation from CTF to Neuromag coordinates, which is necessary to
make the head model fit the sensors. My idea was to create an appropriate
transformation matrix like this.<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>cd
/net/avidya/storage/home/jan/fieldtrip-20110409/private<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>ctfmat=headcoordinates(nas,lpa,rpa,'ctf');<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>nmmat=headcoordinates(nas,lpa,rpa,'neuromag');<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>ctf_to_nm=nmmat/ctfmat;<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>And then to use it on the
head model to bring it back into Neuromag coordinates:<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>%create single shell,
realistic headmodel<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>cfg               
= [];<u1:p></u1:p></span></font><font color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>hdm               
= ft_prepare_singleshell(cfg,segmentedmri);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>% transformation of
headmodel into Neuromag space<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>hdm.bnd.pnt=warp_apply(ctf_to_nm,hdm.bnd.pnt,'homogeneous');<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Does this survive a
sanity check?<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Best regards and thanks a
lot,<u1:p></u1:p></span></font><font color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Jan<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;color:black'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<div>

<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:black;font-weight:bold'>Von:</span></font></b><span
class=apple-converted-space><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:black'> </span></font></span><font
size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
color:black'><a href="mailto:fieldtrip-bounces@donders.ru.nl">fieldtrip-bounces@donders.ru.nl</a><span
class=apple-converted-space> </span>[<a
href="mailto:fieldtrip-bounces@donders.ru.nl">mailto:fieldtrip-bounces@donders.ru.nl</a>]<span
class=apple-converted-space> </span><b><span style='font-weight:bold'>Im
Auftrag von<span class=apple-converted-space> </span></span></b>Jen
Whitman<br>
<b><span style='font-weight:bold'>Gesendet:</span></b><span
class=apple-converted-space> </span>Montag, 28. Februar 2011 22:32<br>
<b><span style='font-weight:bold'>An:</span></b><span
class=apple-converted-space> <st1:personname u2:st="on"></span><st1:PersonName
w:st="on">Email discussion list for the FieldTrip project</st1:personname></st1:PersonName><br>
<b><span style='font-weight:bold'>Betreff:</span></b><span
class=apple-converted-space> </span>[FieldTrip] I think you solved the
problem</span></font><font color=black><span style='color:black'><o:p></o:p></span></font></p>

<u1:p></u1:p></div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'>I just
checked, and when I re-ran my segmentation script with the new Fieldtrip in
order to use an spm8 template image, coordinates got reversed. When I take out
the calls to flipdim, they look fine (see attached screenshots). That certainly
explains the meaningless results I was getting!<br>
<br>
Thanks for figuring that out,<br>
<br>
Jen<u1:p></u1:p><o:p></o:p></span></font></p>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>On Mon, Feb 28, 2011 at 12:36 PM,
jan-mathijs schoffelen <<a href="mailto:jan.schoffelen@donders.ru.nl">jan.schoffelen@donders.ru.nl</a>>
wrote:<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

<div style='word-wrap: break-word'>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Hi Jen,<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>At first glance I have a comment on your
script. You may need to explicitly check the alignment of your segmented volume
and the original anatomy. A while a go some changes were made to
ft_volumesegment, taking away the need to do the flipdim(flipdim...
 operations. I have posted this on the discussion list last January, but
you may not have noticed. <u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Anyway, if you now have used a recent
version of FieldTrip for your segmentation both the location of your dipole
grid, and the volume conductor model will not be adequately coregistered with
the data, which may lead to funky results to begin with. That's most likely not
related to the filetype in which the volumes are saved for later use.<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Best wishes,<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'>Jan-Mathijs<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'> <u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

<div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>On Feb 28, 2011, at 8:59 PM, Jen Whitman
wrote:<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><br>
<br>
<br>
<o:p></o:p></span></font></p>

</div>

<u1:p></u1:p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'>Hello Jan,<span
class=apple-converted-space> </span><br>
<br>
When calling volumesegment, I specified 'ctf' as the coordinate system. The
function I wrote to call volumesegment and prepare_singleshell for each subject
and save the results is pasted below, with a couple of  comments added for
clarity.<br>
Over the weekend I tried specifying the coordinate system in the call to
ft_volumenormalise as 'ctf' rather than 'spm', and commented out all the lines
that said cfg.spmversion = 'spm8'; before calling a function. However, that
created worse results, as each plot involved stripes of activation and empty
voxels, suggesting that 'ctf' was not the correct coordinate system to specify.<br>
<br>
Thanks for the attached script. Looking in that the comments in that, I suspect
that the solution to my problems will be to specify my filetype as nifti_img
rather than nifti. I'll let you know how that goes.<br>
<br>
Jen<br>
<br>
------------------------------------------------------------------------------------------------------------<br>
% the variable subj is simply a string consisting of a subject number (e.g. 's05')
which can be a folder name or part of a filename<br>
function [vol mri segmentedmri
segmentedmriF]=call_volume_segment_function_spm8(subj)<br>
cfg.spmversion = 'spm8';<br>
cfg.template   = '/home/woodwardlab/spm8/templates/EPI.nii';<br>
%cfg.template='/home/common/matlab/spm2/templates/T1.mnc';<span
class=apple-converted-space> </span><br>
<a href="http://cfg.name" target="_blank">cfg.name</a>=[subj '_volseg'];<br>
cfg.write='yes';<br>
cfg.smooth='no';         <span
class=apple-converted-space> </span><br>
cfg.coordinates='ctf';<span class=apple-converted-space> </span><br>
mri=read_mri([subj '/mri/' subj 'head.mri']); % made with CTF mriConverter and
mriViewer software, after fiducials were marked<br>
segmentedmri = volumesegment(cfg, mri);<br>
segmentedmriF = segmentedmri;<br>
segmentedmriF.gray  = flipdim(flipdim(flipdim(segmentedmriF.gray,3),2),1);<br>
segmentedmriF.white = flipdim(flipdim(flipdim(segmentedmriF.white,3),2),1);<br>
segmentedmriF.csf   =
flipdim(flipdim(flipdim(segmentedmriF.csf,3),2),1);<br>
segmentedmriF.transform = mri.transform;<br>
segmentedmriF.anatomy   = mri.anatomy;<br>
cfg = [];<br>
cfg.spmversion = 'spm8';<br>
vol = prepare_singleshell(cfg, segmentedmriF);<br>
eval(['save ' subj '/meg/mrisegmented.mat mri segmentedmri segmentedmriF vol'])<br>
<br>
<br>
<br>
<o:p></o:p></span></font></p>

<u1:p></u1:p>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>On Sat, Feb 26, 2011 at 5:26 AM,
jan-mathijs schoffelen <<a href="mailto:jan.schoffelen@donders.ru.nl"
target="_blank">jan.schoffelen@donders.ru.nl</a>> wrote:<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

<div style='word-wrap: break-word'>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Dear Jen,<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>I do not manage to reproduce your issue,
when only focussing on the ft_volumewrite and visualization part of your
pipeline. See attached script, and yet an updated version of ft_volumewrite
which you need to (hopefully) draw the same conclusion as I did.<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Yet, I only now realize that your question
may pertain to the entire pipeline. It could be that something is going wrong
there. <u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>I only see now that in the part of your
script of which you reported that it gave 'good' results, you specify
cfg.coordinates = 'ctf' before calling ft_volumenormalise. I assume this is
correct, because the coordinate system your source-reconstructed data lives in,
is according to the CTF-convention, and not according to the SPM-convention. On
the other hand, the template for the spatial normalization lives in the
SPM-coordinate system. In order for the spatial normalization to work OK,
Fieldtrip tries to convert from one coordinate system to the other (once again,
this is appropriate behaviour), before doing the actual normalization. It seems
that at least in the script you sent along, in the final (not working version),
you specified cfg.coordinates = 'spm' prior to calling ft_volumenormalise. This
is probably wrong.<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Another important point that should be
mentioned, is that the coordinate systems in which the functional data and the
anatomical data live should be the same for the ft_sourceinterpolate to make
sense. In other words, if your source reconstructed images are defined on a 3D
grid of positions in CTF-space, the mri.transform of your anatomy should
describe a transformation from voxel to CTF-space.<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>I think you may want to revisit step by
step this part of the pipeline; I don't think the problem lies in the writing.<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>A final possibility of course is that
Mricron is misbehaving...<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Best,<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'>Jan-Mathijs<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

<u1:p>

<div style='word-wrap: break-word'>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'> </u1:p><o:p></o:p></span></font></p>

</div>

<div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>On Feb 25, 2011, at 9:44 PM, Jen Whitman
wrote:<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><br>
<br>
<br>
<o:p></o:p></span></font></p>

</div>

<u1:p></u1:p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'>Hi Jan,<br>
<br>
I tried re-running the analysis with the new script you sent me, and the latest
version of fieldtrip (since I needed ft_get_opt as well), but the spm8 images being
written are still producing flawed results. It's the same problem as I
mentioned briefly in my previous post. I am not getting any error messages when
writing these images. Rather, my problem is that the spm8 and spm2 results from
the same data ought to be identical when viewed in mricron, but they're far
from it. When I use mricron to look at the results from the spm8-format images,
combined across participants to create a t-image, I just get a single 'blob'
spanning roughly half the brain. In contrast, when I used spm2-format
previously on the same data, the t-image was much more meaningful; a posterior
alpha power decrease in a set of regions corresponding to the 'task-positive
network' (a network found in the results of an fMRI version of my experiment,
and widely reported in the fMRI literature).<span class=apple-converted-space> </span><br>
<br>
This failure to replicate the spm2 results when using spm8 images from the same
data leads me to suspect that something is wrong with the coordinates for spm8
format. However, after experimenting extensively with different cfg options I
still haven't identified the problem. If I my structural MRIs have been saved
to .mri files using CTF's MRIConverter program, which cfg options, particularly
for coordinates, template images, and filetypes, should I specify before
calling the ft_volumesegment, ft_prepare_singleshell, ft_sourceinterpolate,
ft_volumenormalise, and ft_volumewrite functions? Or should I be calling a
different set of functions now?<br>
<br>
Thanks again for your help,<br>
<br>
Jen<u1:p></u1:p><o:p></o:p></span></font></p>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>On Thu, Feb 24, 2011 at 10:07 AM, Jen
Whitman <<a href="mailto:jenwhitman@gmail.com" target="_blank">jenwhitman@gmail.com</a>>
wrote:<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'>Great,
thanks!<br>
<br>
I'll start the analysis with your new script today and will let you know how it
works out.<br>
</span></font><font color="#888888"><span style='color:#888888'><br>
Jen<u1:p></u1:p></span></font><font color=black><span style='color:black'><o:p></o:p></span></font></p>

<div>

<div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>On Thu, Feb 24, 2011 at 4:44 AM, jan-mathijs
schoffelen <<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>>
wrote:<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

</div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt;
border-width:initial;border-color:initial'>

<div>

<div>

<div style='word-wrap: break-word'>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Dear Jen,<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>I managed to reproduce your problem. The
code was rather buggy and indeed ft_volumewrite did not behave as it should
have. I now fixed it in the code and it should run fine now. Please find the
updated file attached. It will be available on our ftp-server as of tonight.
Please note that I updated the documentation, and changed the names of some of
the options a bit. If you want to save your data in analyze-format, you should
specify cfg.filetype = 'analyze_spm'. If you specify cfg.filetype = 'nifti', it
should write out a volume to nifti-format, using SPM8.<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Best wishes,<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'>Jan-Mathijs<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

</div>

<u1:p>

<div style='word-wrap: break-word'>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

<div>

<div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>On Feb 23, 2011, at 7:44 PM, Jen Whitman
wrote:<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt' type=cite>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'><br>
Dear Jan,<br>
<br>
Thanks for the quick reply. Yes, I have tried it out quite a few times now,
experimenting with different settings in the cfgs. Below I'll paste the code
I've been using to write images - first the code that successfully created spm2
images that produced good results, then the code used for creating nifti format
images from the same data. The comments in this second part are at this point a
bit of a maze of cfg options I've been changing back & forth. Any
insights/suggestions regarding how to set up my cfgs to make this work would be
greatly appreciated.<br>
<br>
Jen<br>
<br>
<br>
%%%%%%%% this code generated spm2-compatible images which did work (producing
results that made sense).<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
<br>
    sourcetemp.avg.pow = (sourcetemp.avg.pow -
sourcePre.avg.pow) ./ sourcePre.avg.pow;<br>
<br>
    cfg = [];<br>
    cfg.downsample = 2;<br>
    sourcetempInt = sourceinterpolate(cfg, sourcetemp , mri);<br>
<br>
    % projecting the plot onto a surface...<br>
    cfg = [];<br>
    cfg.coordinates  = 'ctf';<br>
    cfg.template     =
'/home/common/matlab/spm2/templates/T1.mnc'; %this template is in MNI
coordinates<br>
    sourcetempIntN = volumenormalise(cfg, sourcetempInt);<br>
<br>
    filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_'
int2str(f) 'HzWin' int2str(win) 'width750ms'];<br>
    cfg=[];<br>
    cfg.parameter     = 'avg.pow'; % string,
describing the functional data to be processed, e.g. 'pow', 'coh' or 'nai'<br>
    cfg.filename      = [filename
'.img']; %'testimageoutput_alphafreq'; % filename without the extension<br>
    cfg.filetype      = 'spm';
%'analyze', 'spm', 'vmp' or 'vmr'<br>
    cfg.coordinates   = 'spm'; %'spm, 'ctf' or empty
for interactive (default = [])<br>
    cfg.datatype = 'double'; %'float'; %'double'; %'bit1',
'uint8', 'int16', 'int32', 'float' or 'double'<br>
<br>
    volumewrite(cfg, sourcetempIntN)<br>
<br>
   <span class=apple-converted-space> </span><br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
%%%%% this code below hasn't worked yet...<br>
<br>
% I added    cfg.spmversion = 'spm8';<br>
% in the cfgs for the calls to ft_prepare_leadfield and ft_sourceanalysis,<br>
% and in the call to prepare_singleshell after calling volumesegment<br>
<br>
% I've also ensured that spm8 is the only spm version in my path, even in<br>
% the fieldtrip/external folder, and ensured that spm8 is installed properly<br>
% (files compiled correctly, etc..)<br>
<br>
    sourcetemp.avg.pow = (sourcetemp.avg.pow -
sourcePre.avg.pow) ./ sourcePre.avg.pow;<br>
<br>
    filename=[subj 'run' int2str(r) 'cond' int2str(cond) '_'
int2str(f) 'Hzspm8_FIXv9_Win' int2str(win) 'width750ms.img'];<br>
<br>
    cfg = [];<br>
%     cfg.coordinates  = 'spm'; % changed for version
5<br>
%     cfg.spmversion = 'spm8'; % changed for version 5<br>
    cfg.downsample = 4;<br>
    sourcetempInt = ft_sourceinterpolate(cfg, sourcetemp , mri);<br>
<br>
<br>
    % projecting the plot onto a surface...<br>
    cfg = [];<br>
    %cfg.coordinates  = 'spm'; % changed for version 5<br>
    %cfg.coordinates  = 'ctf'; % changed for version 5<br>
    cfg.coordinates = 'spm'; % changed back to spm for version 9<br>
    cfg.downsample = 4;<br>
    %cfg.spmversion = 'spm8'; % changed for version 6 (because
this gets specified in volumewrite)<br>
    cfg.template = 'Hmatrix/mask.nii.nii'; % basically equivalent
to using spm8/templates/EPI.nii, except that mask.nii (produced from fmri data)
has the desired voxel size<br>
    %<span class=apple-converted-space> </span><a
href="http://cfg.name" target="_blank">cfg.name</a><span
class=apple-converted-space> </span>= [filename]; % changed for version 6<br>
    %cfg.write= 'yes'; % changed for version 6 (when this was
set to 'yes' there was no subsequent call to volumewrite)<br>
    cfg.write= 'no';   % changed for version 6<br>
    sourcetempIntN = ft_volumenormalise(cfg, sourcetempInt);<br>
   <span class=apple-converted-space> </span><br>
    % this whole cfg and function call added for version 6<span
class=apple-converted-space> </span><br>
    cfg=[];<br>
    %   cfg.parameter     =
string, describing the functional data to be processed, e.g. 'pow', 'coh' or
'nai'<br>
%   cfg.filename      = filename without the
extension<br>
%   cfg.filetype      = 'analyze', 'spm',
'vmp' or 'vmr'<br>
%   cfg.vmpversion    = 1 or 2 (default) version of
the vmp-format to use<br>
%   cfg.coordinates   = 'spm, 'ctf' or empty for
interactive (default = [])<br>
    cfg.parameter='pow';<br>
    cfg.filename=filename;<span class=apple-converted-space> </span><br>
    cfg.filetype = 'spm';<br>
    cfg.spmversion = 'SPM8'; % capitalized after first error
message from vers 6<br>
%   cfg.dataformat='nifti';  % added after first error message
from vers 6<br>
                                
% commented out after 2nd error message from vers 6<br>
    %cfg.vmpversion=2; % this is a filetype, like spm, so don't
need to specify unless cfg.filetyp='vmp' <span
class=apple-converted-space> </span><br>
    cfg.coordinates='spm';<br>
    ft_volumewrite(cfg,sourcetempIntN);<br>
<br>
   <span class=apple-converted-space> </span><br>
<br>
<br>
<br>
<o:p></o:p></span></font></p>

<u1:p></u1:p>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>On Wed, Feb 23, 2011 at 7:50 AM,
jan-mathijs schoffelen <<a href="mailto:jan.schoffelen@donders.ru.nl"
target="_blank">jan.schoffelen@donders.ru.nl</a>> wrote:<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Dear Jen,<br>
<br>
I notice that indeed in the documentation section of ft_write_volume there is a
FIXME behind nifti. Yet, nifti format seems to be supported by ft_write_volume
(at least in a recent version of fieldtrip). Did you try it at all (and ran
into problems) or were you held back by the FIXME statement? Could you just try
it out using a recent fieldtrip function?<br>
<br>
Thanks and best wishes<br>
<br>
Jan-Mathijs<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

<div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'><br>
<br>
<br>
On Feb 23, 2011, at 2:21 AM, Jen Whitman wrote:<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt;
border-width:initial;border-color:initial'>

<div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'>Hello,<br>
<br>
While writing beamformed images to spm2 format in a previous version of
fieldtrip (now lost due to a computer crash), I was able to get nice-looking
results; networks of brain regions consistent with existing literature. When I
try to write images from the same dataset and the same analysis to spm8 format,
my results (t-images computed across subjects) end up being single clusters
spanning large sections of the brain (e.g. a 'blob' spanning all of one
hemisphere but not the other). Unfortunately, some aspects of my planned data
analyses cannot be performed on spm2 images, so I have to find a way of writing
to successfully to nifti format.<br>
<br>
I just noticed that in the comments in the ft_write_volume function, which I am
calling via ft_volumewrite, it says 'FIXME' next to nifti under the list of
supported dataformats. Is there by any chance a patch out there for writing
nifti images?<br>
<br>
Thanks!<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</blockquote>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><br>
Dr. J.M. (Jan-Mathijs) Schoffelen<br>
Donders Institute for Brain, Cognition and Behaviour,<br>
Centre for Cognitive Neuroimaging,<br>
Radboud University Nijmegen, The Netherlands<br>
<a href="mailto:J.Schoffelen@donders.ru.nl" target="_blank">J.Schoffelen@donders.ru.nl</a><br>
Telephone: 0031-24-3614793<br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</blockquote>

</div>

</div>

</div>

<div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

<div><span style='word-spacing:0px'>

<div style='word-wrap: break-word'>

<div style='word-wrap: break-word'>

<div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>Dr. J.M.
(Jan-Mathijs) Schoffelen <u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>Donders Institute
for Brain, Cognition and Behaviour, <br>
Centre for Cognitive Neuroimaging,<br>
Radboud University Nijmegen, The Netherlands<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'><a
href="mailto:J.Schoffelen@donders.ru.nl" target="_blank">J.Schoffelen@donders.ru.nl</a><u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>Telephone:
0031-24-3614793<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

</div>

</div>

</div>

</span>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

</div>

</div>

</div>

<div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

</div>

</blockquote>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

<div>

<div style='word-wrap: break-word'>

<div style='word-wrap: break-word'>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Dr. J.M. (Jan-Mathijs) Schoffelen <u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Donders Institute for Brain, Cognition and
Behaviour, <br>
Centre for Cognitive Neuroimaging,<br>
Radboud University Nijmegen, The Netherlands<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><a href="mailto:J.Schoffelen@donders.ru.nl"
target="_blank">J.Schoffelen@donders.ru.nl</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>Telephone: 0031-24-3614793<u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

</div>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

<div><span style='word-spacing:0px'><span style='word-spacing:0px'>

<div style='word-wrap: break-word'>

<div style='word-wrap: break-word'>

<div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>Dr. J.M.
(Jan-Mathijs) Schoffelen <u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>Donders Institute
for Brain, Cognition and Behaviour, <br>
Centre for Cognitive Neuroimaging,<br>
Radboud University Nijmegen, The Netherlands<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'><a
href="mailto:J.Schoffelen@donders.ru.nl" target="_blank">J.Schoffelen@donders.ru.nl</a><u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>Telephone:
0031-24-3614793<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

</div>

</div>

</div>

</span>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'></span><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

</div>

</div>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'><misalignment.png><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><o:p></o:p></span></font></p>

</u1:smarttagtype></div>

</div>

</span>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<span style='orphans: 2;text-align:auto;widows: 2;-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'><span style='orphans: 2;widows: 2;-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>

<div apple-content-edited=true>

<div style='word-wrap: break-word;-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div style='word-wrap: break-word;-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>Dr. J.M.
(Jan-Mathijs) Schoffelen <o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>Donders Institute
for Brain, Cognition and Behaviour, <br>
Centre for Cognitive Neuroimaging,<br>
Radboud University Nijmegen, The Netherlands<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'><a
href="mailto:J.Schoffelen@donders.ru.nl">J.Schoffelen@donders.ru.nl</a><o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=4 color=black face=Helvetica><span
style='font-size:13.5pt;font-family:Helvetica;color:black'>Telephone:
0031-24-3614793<o:p></o:p></span></font></p>

</div>

</div>

</div>

</div>

</span>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</span></div>

</div>

</body>

</html>