Incorrect coordinates?

Jared Van Snellenberg jaredvs at GMAIL.COM
Mon Oct 23 22:28:28 CEST 2006


Hi Robert,

I just wanted to let you know that your suggestion was correct (I was
working on a deadline for Friday, otherwise I would've responded sooner),
the problem was created by the fact that the out of brain voxels were not
masked out in the BESA data. The results of the analysis after masking
appropriately were drastically different, and were all within-brain and make
sense in light of the experimental task.

I used the following code to obtain the mask:


inside=[];

for k=1:length(files)

src(k)=besa2fieldtrip([files(k).name]);

in=find(src(k).avg.pow);

inside(end+1:end+length(in))=in;

end

inside=unique(inside);

outside=1:49708;

outside(inside)=[];

for k=1:length(files)

src(k).inside=inside;

src(k).outside=outside;

end
This ensured that all the subjects had the same mask, and only values that
were 0 in all the subjects were masked out. I manually checked all the
subjects and there was at most a difference of 3 in the number of nonzero
voxels in any two subjects.

You might want to document this somewhere for other users, as it's not
immediately apparent that specification of the .inside and .outside fields
in the source structure are critical for further processing steps to behave
correctly.

Thanks for your help,

-Jared




On 10/16/06, Robert Oostenveld <r.oostenveld at fcdonders.ru.nl> wrote:
>
> Hi Jared,
>
> On 15 Oct 2006, at 0:12, Jared Van Snellenberg wrote:
> > I've rerun the analysis with mri's that were reoriented to MNI, and
> > the same problem has emerged.
>
> I would guess that the anatomical MRIs themselves do not influence
> the coordinate system of the source reconstruction. That would
> influence the interpolation though.
>
> If you do
>   source = besa2fieldtrip(filename1)
> and
>   mri = read_fcdc_mri(filename)
> then the source structure is defined using the source.pos field that
> describes the position of each source. SInce in this case the
> positions are on a regular 3D grid, there is additional structure in
> the arrangement of source.pos, which is described using source.xgrid,
> source.ygrid, source.zgrid.
>
> If you do
>   tmp = reshape(source.avg.pow, source.dim)
> you will get a 3D array with along the first dimension the voxels
> along the x-axis, etc. The 1..Nth voxels along the xasix have the X
> coordinates source.xgrid(1)..source.xgrid(N). Similar for the Y and Z
> coordinates. That allows you to determine the coordinate of each voxel.
>
> Since the anatomical MRI is typically of much higher resolution, you
> can use sourceinterpolate which interpolates the source (or stat)
> volumes onto the voxel locations that are in the anatomical MRI. I.e.
> sourceinterpolate upsamples the functional data to the anatomical
> MRI. Normally you would do sourceinterpolate AFTER calling
> sourcestatistics, since the source positions in all subjects are all
> based on the same standard realistic head moidel in BESA and hence
> the source positions in all subjects are the same (please check
> whether positions are all the same over subjects/conditions).
>
> If you work with MEG or with EEG individual headmodels, the source
> positions in all subjects are all different, which requires
> sourceanalysis->sourceinterpolate->volumenormalize as shown in the
> schema for http://www2.ru.nl/fcdonders/fieldtrip/doku.php?
> id=fieldtrip:documentation:analysis_protocols#source_reconstruction_for_
> multiple_subjects
>
> > The typo you noted in your last email was indeed the reason for the
> > empty src plot. Plotting src, interp, volume, and grandavg,
> > everything looks ok. The 'pow' parameter values all appear within
> > the brain. The tscore and p values in stat, however, are all messed
> > up. I've attached .bmp's from using sourceplot on grandavg and stat
> > to this email. The quality is poor (matlab's figure window doesn't
> > ever save bmp's very well), but it should demonstrate the problem
> > clearly. Note all the large values outside of the brain.
>
> In your case you should be able to do besa2fieldtrip ->
> sourcestatistics, and then the source positions with the statistical
> data on them should stll be the same as the positions with the
> original functional data on them. After doing the statistics (or
> after doing sourcegrandaverage), you can interpolate the functional/
> statistical data onto the MRI. But since the statistical data and the
> functional (beamed power) data are on the same coordinates, there
> should not be a difference between them.
>
> > Any comments you have would be greatly appreciated. I've considered
> > just masking out everything that's not in the brain, but I'm not
> > confident that the within-brain values are accurate.
>
> Looking at the bitmaps, I cannot see teh anatomy, but I do see a
> brain-shaped outline with some blobs in them. I cannot recognise the
> problem from these figures, to me they seem ok. The only problem that
> I can see is the one that you also mention, and that is for the
> masking. In the original source data (i.e. output from
> besa2fieldtrip) there is an source.inside and source.outside field.
> Those should contain the indices of the voxels (linear indices, so
> voxel [1 1 1] has index 1 and voxel [2 1 1] has index 2...) of the
> sources that are inside the brain and outside the brain. Only the
> inside voxels are considered for sourcestatistics and for
> sourceinterpolation. However, the problem with BESA data is that it
> does not describe the inside/outside voxels and therefoer by default
> all voxels are marked as inside. Perhaps you can determine the inside/
> outside voxels manually, e.g.
>   source.inside  = find(source.avg.pow(:)>eps);
>   source.outside = find(source.avg.pow(:)<eps);
> After fixing the inside/outside, you can rerun sourcestatistics and
> the rest. See the related FAQ http://www2.ru.nl/fcdonders/fieldtrip/
> doku.php?
> id=fieldtrip:documentation:frequently_asked_questions#why_is_there_a_rim
> _around_the_brain_for_which_the_source_reconstruction_is_not_computed
>
> To me it seems that the outside brain mess is caused by an
> interpolation artifact, which can well be explained by the missing
> inside/outside specification of besa. After fixing the inside/outside
> vectors in the source structure, and passing it through
> sourceinterpolate, you will get an interp.inside 3D boolean volume
> with 0s and 1s for outside and inside voxels. You can element-wise
> multiply the data with it, to mask the outside, or you can specify
> cfg.mask='inside' in sourceplot (which uses opacity).
>
> Hope this helps, if not, please put some data (source, mri, stat,
> interp) in a zip file on ftp://ftp.fcdonders.nl/pub/incoming
>
> Robert
>



--
Jared Van Snellenberg
Social Cognitive Affective Neuroscience Unit
http://scan.psych.columbia.edu
(212) 854-7858 p
(212) 854-3609 f
Department of Psychology, Columbia University
406 Schermerhorn Hall
1190 Amsterdam Avenue, Mail Code 5501
New York, NY 10027
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20061023/7855712d/attachment.html>


More information about the fieldtrip mailing list