[FieldTrip] ft_headmodelplot coordinate system origin problem

Ion Lavado lavado at gmail.com
Tue Jan 3 14:22:34 CET 2012


Thank you very much Jan! Now everything fits using ft_headmodelplot(cfg).
You solved our problem of the week.

Just one final problem we have:

- we are doing the beamformig source analisys.

- our vol, grid and grad fits ok.

-we have the   sourcePre  = ft_sourceanalysis(cfg, freqPre);
                     sourcePost = ft_sourceanalysis(cfg, freqPost);

-we then interpolate the data with

cfg            = [];
cfg.downsample = 2;
sourcePostInt  = ft_sourceinterpolate(cfg, sourcePost , mri_real);

- finally we use method SLICE to plot the results: (WITH  MRI_REAL)

%METHOD SLICE:
sourceDiff = sourcePost;
sourceDiff.avg.pow = (sourcePost.avg.pow - sourcePre.avg.pow) ./
sourcePre.avg.pow;
cfg            = []
cfg.downsample = 2;
sourceDiffInt  = ft_sourceinterpolate(cfg, sourceDiff , mri_real);
cfg = [];
cfg.method        = 'slice';
cfg.interactive   = 'yes';
cfg.funparameter  = 'avg.pow';
cfg.maskparameter = cfg.funparameter;
cfg.funcolorlim   = [0 2];
cfg.opacitylim    = [0 2];
cfg.opacitymap    = 'rampup';
figure('Name', 'SLICE Method')
ft_sourceplot(cfg, sourceDiffInt);


The problem comes now (not before), that when plotting the result don't fit
the mri in the figure. I send you the .jpg so you can see it and try to
help us whith this FINAL problem! In the script i send you, the problem i
think starts after line 156.

You are really kind, and thank you very much for your usefull help.

Ion








2012/1/3 jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl>

> Hi Ion,
>
> If the positive z-axis (denoted by +Z in the figure that is created by
> ft_determine_coordsys) is not pointing to the top of the head you made an
> error in ft_volumerealign and probably exchanged left with right in setting
> the lpa and rpa locations. This results in the coordinate system being a
> left-handed one and causes all kind of trouble later on. If this is the
> case, you need to repeat ft_volumerealign (with the original MRI) and type
> 'l' where you typed 'r', and the other way around. Ft_volumesegment relies
> on spm for the segmentation, which relies on the mri-data being defined in
> a meaningful right-handed coordinate system (which can be either mni-based,
> or MEG system based).
>
>  If however the +Z is just pointing downward but the anatomy is
> 'upside-down'  (neck pointing to the ceiling) then the coordinate system is
> a valid, i.e. a right-handed RAS (right-anterior-superior) coordinate
> system. If this is the case then I wouldn't know what's going on, because I
> would suspect that ft_volumesegment  Perhaps some other neuromag
> aficionados could jump to the rescue here?
>
> As such ft_determine_coordsys does not change the coordinate system of
> your mri, it just changes the coordsys field, which helps FieldTrip in the
> interpretation of the real-world coordinates. The mapping of voxel
> locations to real-world locations is defined by mri.transform which can be
> changed by ft_volumerealign.
>
> Best wishes,
>
> JM
>
>
> On Jan 3, 2012, at 1:20 PM, Ion Lavado wrote:
>
> The Z axis is pointing to the oposite direction (inferior), so i have the
> mri upside down. How can i change this? When Matlab plots the figure it
> asks me this:
>
> The positive x-axis is pointing towards the right
> The positive y-axis is pointing towards anterior
> The positive z-axis is pointing towards superior
> Do you want to change the anatomical labels for the axes [y, N]?
>
> I then mark to change the axis and mark the positive z-axis as
> (i)inferior, but when plotting again is as the begginig... What do i have
> to do?
>
> Thank you very much Jan.
>
>
>
> 2012/1/3 jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl>
>
>> Hi Ion,
>>
>> I'd suggest first to have a look at mri_real. How does it look in
>> ft_determine_coordsys?
>> In particular, is the z-axis pointing in the correct direction?
>>
>> JM
>>
>>
>> On Jan 3, 2012, at 12:45 PM, Ion Lavado wrote:
>>
>> Hi Jan,
>> I am sorry, I have been trying with your method but now what is incorrect
>> is the segmentation.
>> Here is the script. Maybe you understand better the problem...I am
>> getting crazy. The problem comes from line 53
>> Thank you very much,
>> Best,
>> Ion
>>
>>
>>
>> 2012/1/3 jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl>
>>
>>> Hi Ion,
>>>
>>> What is the coordinate system in which the vol and mri are defined? To
>>> me it does not look like the neuromag coordinate system, but rather like
>>> MNI-space. I would expect the origin to be a bit (~4 cm) lower and a bit
>>> more anterior (because the origin is defined on the line going through the
>>> pre-auricular points. In the 'vol.jpg' it seems that the origin is in the
>>> anterior commissure. Although in principle it shouldn't matter, it is
>>> convention to express the coordinates in the MEG-system's coordinate
>>> system, i.e. in neuromag space in this case. Therefore I would say that the
>>> vol and grid variables need to be adjusted, rather than the sensor
>>> positions. As mentioned in my previoius message, this can be achieved by
>>> coregistering the anatomy to the neuromag coordinate system using
>>> ft_volumerealign. You need to manually identify the locations of the
>>> fiducials that define the coordinate system, i.e. the nasion, lpa and rpa.
>>> The required cfg is: cfg.interactive = 'yes', cfg.coordsys = 'neuromag'.
>>> Once the anatomy is coregistered you can proceed with creating the vol and
>>> grid variables.
>>>
>>> Best,
>>>
>>> Jan-Mathijs
>>>
>>>
>>> On Jan 3, 2012, at 11:38 AM, Ion Lavado wrote:
>>>
>>> Thank you for your help Jan. I tried all you told but i continue with my
>>> problem. The coordinates for the head (volume) and mri are the same, with
>>> the function ft_determine_coordsys i see this.
>>> I think that the problem is about the sensor (helmet) origin of
>>> coordinates. Please see the images i adjunt here,* the sensors origin
>>> is very low*(nearly out of the helmet) and when ploting everything i
>>> suppose that every origin align to each other, so that the brain comes a
>>> little bit low.
>>>
>>> Best whishes,
>>>
>>> Ion
>>>
>>> 2012/1/2 jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl>
>>>
>>>> Dear Ion,
>>>>
>>>> Are you sure that the sensor positions are defined in the same
>>>> coordinate system as are the volume conductor model and the source
>>>> positions? If not, then this is the likely cause of the shift. You can have
>>>> a look here for more information about the different coordinate systems:
>>>> http://fieldtrip.fcdonders.nl/faq/how_are_the_different_head_and_mri_coordinate_systems_defined
>>>>
>>>> In order to coregister the anatomical mri to the sensor array, you can
>>>> use ft_volumerealign.
>>>>
>>>> Best wishes,
>>>>
>>>> Jan-Mathijs
>>>>
>>>>
>>>> On Jan 2, 2012, at 5:11 PM, Ion Lavado wrote:
>>>>
>>>> Hello, i'm working with MEG data from Elekta Neuromag. My problem comes
>>>> when i try to plot the headmodel with the function ft_headmodelplot(cfg).
>>>> This should plot the head model(volume) + brain grid + sensors. As you can
>>>> see in the adjunted image, my head volume and grid is not centered and part
>>>> of the head could not be read by the sensors. Is it possible to modify this
>>>> so i can center the head in the sensors(helmet)?
>>>> Thank you very much.
>>>>
>>>> Ion Lavado
>>>> <headmodelplot.jpg>_______________________________________________
>>>> fieldtrip mailing list
>>>> fieldtrip at donders.ru.nl
>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>>
>>>>
>>>>    Jan-Mathijs Schoffelen, MD PhD
>>>>
>>>> Donders Institute for Brain, Cognition and Behaviour,
>>>> Centre for Cognitive Neuroimaging,
>>>> Radboud University Nijmegen, The Netherlands
>>>>
>>>> Max Planck Institute for Psycholinguistics,
>>>> Nijmegen, The Netherlands
>>>>
>>>> J.Schoffelen at donders.ru.nl
>>>> Telephone: +31-24-3614793
>>>>
>>>>
>>>> _______________________________________________
>>>> fieldtrip mailing list
>>>> fieldtrip at donders.ru.nl
>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>>
>>>
>>> <helmet.jpg><vol.jpg>_______________________________________________
>>>
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>>
>>>    Jan-Mathijs Schoffelen, MD PhD
>>>
>>> Donders Institute for Brain, Cognition and Behaviour,
>>> Centre for Cognitive Neuroimaging,
>>> Radboud University Nijmegen, The Netherlands
>>>
>>> Max Planck Institute for Psycholinguistics,
>>> Nijmegen, The Netherlands
>>>
>>> J.Schoffelen at donders.ru.nl
>>> Telephone: +31-24-3614793
>>>
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>
>> <script.m>_______________________________________________
>>
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>    Jan-Mathijs Schoffelen, MD PhD
>>
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>>
>> Max Planck Institute for Psycholinguistics,
>> Nijmegen, The Netherlands
>>
>> J.Schoffelen at donders.ru.nl
>> Telephone: +31-24-3614793
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> Jan-Mathijs Schoffelen, MD PhD
>
> Donders Institute for Brain, Cognition and Behaviour,
> Centre for Cognitive Neuroimaging,
> Radboud University Nijmegen, The Netherlands
>
> Max Planck Institute for Psycholinguistics,
> Nijmegen, The Netherlands
>
> J.Schoffelen at donders.ru.nl
> Telephone: +31-24-3614793
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120103/dfaeab45/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot.jpg
Type: image/jpeg
Size: 24158 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120103/dfaeab45/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: script.m
Type: application/octet-stream
Size: 5145 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120103/dfaeab45/attachment-0002.obj>


More information about the fieldtrip mailing list