<div>Hi Robert,</div>
<div> </div>
<div>I finally had time to edit the page you suggested.</div>
<div> </div>
<div>-Jared<br><br> </div>
<div><span class="gmail_quote">On 10/25/06, <b class="gmail_sendername">Robert Oostenveld</b> <<a href="mailto:r.oostenveld@fcdonders.ru.nl">r.oostenveld@fcdonders.ru.nl</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi Jared,<br><br>Thanks for your detailled feedback. I think that it is a good idea to<br>document these steps for other BESA users. I am rather busy, but
<br>maybe you could do it yourself? The FieldTrip website is a Wiki, and<br>anyone can edit and contribute to it by pressing the "edit this page"<br>button that you see on every page. Regarding this information: I
<br>would put it under a subheading (with some introductory comments,<br>which probably can be copied-pasted from our previous mails) on the<br>BESA-related page, i.e. on <a href="http://www2.ru.nl/fcdonders/fieldtrip/">http://www2.ru.nl/fcdonders/fieldtrip/
</a><br>doku.php?id=fieldtrip:documentation:integrating_with_besa<br><br>best regards,<br>Robert<br><br><br>On 23 Oct 2006, at 22:28, Jared Van Snellenberg wrote:<br><br>> Hi Robert,<br>><br>> I just wanted to let you know that your suggestion was correct (I
<br>> was working on a deadline for Friday, otherwise I would've<br>> responded sooner), the problem was created by the fact that the out<br>> of brain voxels were not masked out in the BESA data. The results
<br>> of the analysis after masking appropriately were drastically<br>> different, and were all within-brain and make sense in light of the<br>> experimental task.<br>><br>> I used the following code to obtain the mask:
<br>><br>> inside=[];<br>><br>><br>> for k=1:length(files)<br>> src(k)=besa2fieldtrip([<br>><br>> files(k).name]);<br>> in=find(src(k).avg.pow);<br>><br>> inside(end+1:end+length(in))=in;<br>
><br>><br>> end<br>> inside=unique(inside);<br>><br>> outside=1:49708;<br>><br>> outside(inside)=[];<br>><br>><br>> for k=1:length(files)<br>> src(k).inside=inside;<br>><br>> src(k).outside=outside;
<br>><br>><br>> endThis ensured that all the subjects had the same mask, and only<br>> values that were 0 in all the subjects were masked out. I manually<br>> checked all the subjects and there was at most a difference of 3 in
<br>> the number of nonzero voxels in any two subjects.<br>><br>> You might want to document this somewhere for other users, as it's<br>> not immediately apparent that specification of the .inside<br>> and .outside fields in the source structure are critical for
<br>> further processing steps to behave correctly.<br>><br>> Thanks for your help,<br>><br>> -Jared<br>><br>><br>><br>><br>> On 10/16/06, Robert Oostenveld <<a href="mailto:r.oostenveld@fcdonders.ru.nl">
r.oostenveld@fcdonders.ru.nl</a>><br>> wrote: Hi Jared,<br>><br>> On 15 Oct 2006, at 0:12, Jared Van Snellenberg wrote:<br>> > I've rerun the analysis with mri's that were reoriented to MNI, and<br>
> > the same problem has emerged.<br>><br>> I would guess that the anatomical MRIs themselves do not influence<br>> the coordinate system of the source reconstruction. That would<br>> influence the interpolation though.
<br>><br>> If you do<br>>   source = besa2fieldtrip(filename1)<br>> and<br>>   mri = read_fcdc_mri(filename)<br>> then the source structure is defined using the source.pos field that<br>> describes the position of each source. SInce in this case the
<br>> positions are on a regular 3D grid, there is additional structure in<br>> the arrangement of source.pos, which is described using source.xgrid,<br>> source.ygrid, source.zgrid.<br>><br>> If you do<br>
>   tmp = reshape(source.avg.pow , source.dim)<br>> you will get a 3D array with along the first dimension the voxels<br>> along the x-axis, etc. The 1..Nth voxels along the xasix have the X<br>> coordinates source.xgrid
(1)..source.xgrid(N). Similar for the Y and Z<br>> coordinates. That allows you to determine the coordinate of each<br>> voxel.<br>><br>> Since the anatomical MRI is typically of much higher resolution, you<br>
> can use sourceinterpolate which interpolates the source (or stat)<br>> volumes onto the voxel locations that are in the anatomical MRI. I.e.<br>> sourceinterpolate upsamples the functional data to the anatomical
<br>> MRI. Normally you would do sourceinterpolate AFTER calling<br>> sourcestatistics, since the source positions in all subjects are all<br>> based on the same standard realistic head moidel in BESA and hence<br>
> the source positions in all subjects are the same (please check<br>> whether positions are all the same over subjects/conditions).<br>><br>> If you work with MEG or with EEG individual headmodels, the source
<br>> positions in all subjects are all different, which requires<br>> sourceanalysis->sourceinterpolate->volumenormalize as shown in the<br>> schema for <a href="http://www2.ru.nl/fcdonders/fieldtrip/doku.php">
http://www2.ru.nl/fcdonders/fieldtrip/doku.php</a> ?<br>> id=fieldtrip:documentation:analysis_protocols#source_reconstruction_fo<br>> r_<br>> multiple_subjects<br>><br>> > The typo you noted in your last email was indeed the reason for the
<br>> > empty src plot. Plotting src, interp, volume, and grandavg,<br>> > everything looks ok. The 'pow' parameter values all appear within<br>> > the brain. The tscore and p values in stat, however, are all messed
<br>> > up. I've attached .bmp's from using sourceplot on grandavg and stat<br>> > to this email. The quality is poor (matlab's figure window doesn't<br>> > ever save bmp's very well), but it should demonstrate the problem
<br>> > clearly. Note all the large values outside of the brain.<br>><br>> In your case you should be able to do besa2fieldtrip -><br>> sourcestatistics, and then the source positions with the statistical
<br>> data on them should stll be the same as the positions with the<br>> original functional data on them. After doing the statistics (or<br>> after doing sourcegrandaverage), you can interpolate the functional/
<br>> statistical data onto the MRI. But since the statistical data and the<br>> functional (beamed power) data are on the same coordinates, there<br>> should not be a difference between them.<br>><br>> > Any comments you have would be greatly appreciated. I've considered
<br>> > just masking out everything that's not in the brain, but I'm not<br>> > confident that the within-brain values are accurate.<br>><br>> Looking at the bitmaps, I cannot see teh anatomy, but I do see a
<br>> brain-shaped outline with some blobs in them. I cannot recognise the<br>> problem from these figures, to me they seem ok. The only problem that<br>> I can see is the one that you also mention, and that is for the
<br>> masking. In the original source data (i.e. output from<br>> besa2fieldtrip) there is an source.inside and source.outside field.<br>> Those should contain the indices of the voxels (linear indices, so<br>> voxel [1 1 1] has index 1 and voxel [2 1 1] has index 2...) of the
<br>> sources that are inside the brain and outside the brain. Only the<br>> inside voxels are considered for sourcestatistics and for<br>> sourceinterpolation. However, the problem with BESA data is that it<br>> does not describe the inside/outside voxels and therefoer by default
<br>> all voxels are marked as inside. Perhaps you can determine the inside/<br>> outside voxels manually, e.g.<br>>   source.inside  = find(source.avg.pow(:)>eps);<br>>   source.outside = find(source.avg.pow
(:)<eps);<br>> After fixing the inside/outside, you can rerun sourcestatistics and<br>> the rest. See the related FAQ <a href="http://www2.ru.nl/fcdonders/fieldtrip/">http://www2.ru.nl/fcdonders/fieldtrip/</a><br>
> doku.php?<br>> id=fieldtrip:documentation:frequently_asked_questions#why_is_there_a_r<br>> im<br>> _around_the_brain_for_which_the_source_reconstruction_is_not_computed<br>><br>> To me it seems that the outside brain mess is caused by an
<br>> interpolation artifact, which can well be explained by the missing<br>> inside/outside specification of besa. After fixing the inside/outside<br>> vectors in the source structure, and passing it through<br>
> sourceinterpolate, you will get an interp.inside 3D boolean volume<br>> with 0s and 1s for outside and inside voxels. You can element-wise<br>> multiply the data with it, to mask the outside, or you can specify
<br>> cfg.mask='inside ' in sourceplot (which uses opacity).<br>><br>> Hope this helps, if not, please put some data (source, mri, stat,<br>> interp) in a zip file on <a href="ftp://ftp.fcdonders.nl/pub/incoming">
ftp://ftp.fcdonders.nl/pub/incoming</a><br>><br>> Robert<br>><br>><br>><br>> --<br>> Jared Van Snellenberg<br>> Social Cognitive Affective Neuroscience Unit<br>> <a href="http://scan.psych.columbia.edu">
http://scan.psych.columbia.edu</a><br>> (212) 854-7858 p<br>> (212) 854-3609 f<br>> Department of Psychology, Columbia University<br>> 406 Schermerhorn Hall<br>> 1190 Amsterdam Avenue, Mail Code 5501<br>> New York, NY 10027
<br></blockquote></div><br><br clear="all"><br>-- <br>Jared Van Snellenberg<br>Social Cognitive Affective Neuroscience Unit<br><a href="http://scan.psych.columbia.edu">http://scan.psych.columbia.edu</a><br>(212) 854-7858 p
<br>(212) 854-3609 f<br>Department of Psychology, Columbia University<br>406 Schermerhorn Hall<br>1190 Amsterdam Avenue, Mail Code 5501<br>New York, NY 10027<br>