[FieldTrip] question about coregistration

jan-mathijs schoffelen jan.schoffelen at donders.ru.nl
Tue Nov 12 10:58:42 CET 2013


Hi Nicola,

Would it make sense to look into the possibility to improve support for using the polhemus info from the .fif file directly? It sounds a bit silly that you have to go through another piece of software to be able to read in the data. From ft_read_headshape it seems that *.fif files are supported, could it be that your data is not recognized as such?

Best,
JM



On Nov 6, 2013, at 11:52 AM, Nicola Molinaro wrote:

> Thanks guys for any possible help. Really appreciate it!
> 
> I will summarize my tests:
> 
> 1. reading the COR-<filename>.fif produced by MRIlab with ft_read_mri
> 
> Well, it seems that ft_read_mri reads the original (not coregistered) .fif file produced in earlier steps of the forward model calculation (COR.fif). For example, if I delete the COR.fif file, ft_read_mri gives an error. ft_read_mri applied to the COR-<filename>.fif should be able to read some header, and for this reason I tried the option suggested by Joram (including ft_volumereslice). However, when I plot the volume head model with 
> 
> hs=ft_read_headshape(<meg_raw_filename>.fif. 'unit','mm'); %get headshape points
> ft_plot_vol(vol)
> ft_plot_headshape(hs)
> 
> There is an evident misalignment between isotrack points and the brain volume. I mean NO coregistration is done. you can also appreciate it when plotting a prearicular instead of the nasion with 
> 
> cfg = [];
> cfg.location = [66.4 0 0];          %%% fill in a fiducial point from the current subject by hand, to check if coregistration went correctly
> cfg.locationcoordinates = 'head';
> ft_sourceplot(cfg,mri);
> 
> Take home message: Fieldtrip does not read the coregistration done in MRIlab, and you have to coregister MEG and MRI again.
> 
> 2. Using 
> 
> cfg.method = 'headshape'
> cfg.headshape = 'XXX.pos'
> 
> for ft_volumerealign. I played with it, but in neuromag the polhemous data are within the header of the <meg_raw_filename>.fif file. You can export the isotrack point however from MRIlab. After importing then with 
> 
> File>Import>Isotrack data
> 
> you can then export them with 
> 
> File>Export>Points 
> 
> and specifying the coordinate system in which you want your point (either Head, or MRI or Voxel). This file cannot be read by ft_volumerealign with the headshape method. However, the first three lines of the resulting .txt file will give you the nasion and the two pre-auricolar points positions. I tried importing the voxel positions of the three points in ft_volumerealign using the method
> 
> cfg.coordsys       = 'neuromag';
> cfg.method         = 'fiducial';
> 
> And it worked, the brain volume is aligned with the isotrack points. This is the only solution that is visually reliable to perform 
> 
> 
> On Wed, Nov 6, 2013 at 10:06 AM, Joram van Driel <joramvandriel at gmail.com> wrote:
> Hi Nicola,
> 
> I also did coregistration in MRI-lab using isotrak data.
> Importing the fif files in fieldtrip worked fine, I don’t think you have to apply ft_volumerealign again. I suspect ft_volumereslice is a crucial ingredient.
> This worked for me:
> 
>     mri = ft_read_mri(<mri.fif>);            %%% read the MRI; the fif file is in mm but FT changes it into meters    
>     mri = ft_convert_units(mri,'mm');        %%% make it mm as it originally was
>     mri = ft_volumereslice([], mri);         %%% after this function the ficual points in the MEG header match the coordinates in the MRI
> 
> Then you should indeed check this with ft_sourceplot, where in the cfg you can fill in fiducial points to check if they make sense, e.g.:
> 
>     cfg = [];
>     cfg.location = [0 90.5 0];          %%% fill in a fiducial point from the current subject by hand, to check if coregistration went correctly
>     cfg.locationcoordinates = 'head';
>     
>     ft_sourceplot(cfg,mri);
> 
> Hope this helps.
> Best,
> Joram
> 
> On 05 Nov 2013, at 09:43, jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl> wrote:
> 
>> Dear Nicola,
>> 
>> I am forwarding your question to the list, "ter lering ende vermaak":
>> 
>> Begin forwarded message:
>> 
>>> From: Nicola Molinaro <nicolaml at gmail.com>
>>> Date: November 4, 2013 2:16:20 PM GMT+01:00
>>> To: jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl>
>>> Subject: mm -> voxels ??
>>> 
>>> Hi Jan,
>>> I am trying to align the T1 images with isotrak data using MRIlab and then import the coregistrated image to fieldtrip. Comparing the headshape points with the volume, we can see that Fieldtrip is not taking into account the coregistration. Thus, we are trying to do the corregistration applying the ft_volumerealign function with the method='fiducial' in Fieldtrip.  I have the information of the landmarks' position obtained with MRIlab in 'mm' and the function ft_volumerealign need them in voxel index. How can you convert that?
>>> I don´t know if you ever used MRIlab to obtain this information or another software (MNE?).
>>> 
>>> Thanks
>>> 
>>> Nicola
>> 
>> 
>> Indeed I have never used MRIlab for coregistration purposes, so I may not be of much help here. However, I suspect that the coregistration procedure in MRIlab allows you to export your MRI after coregistration, thus creating an file with an anatomical image in register with what you want to achieve. If this is the case, then I don't think that you need FieldTrip to coregister again. I am therefore a bit confused with respect to your remark that 'FieldTrip is not taking into account the coregistration'. If you read in an MRI into FieldTrip, the resulting MRI-structure will contain a transform field, that provides the mapping from voxel space into a more meaningful coordinate system. FieldTrip will not 'guess' the nature of this coordinate system: it just takes the values as they are in the file. Once you have read in your MRI, you can use the ft_sourceplot function for visualization. With cfg.method = 'ortho', the figure will also display the coordinates that you click on (both in voxel indices and in real world coordinates). Now, do you mean by 'FieldTrip does not take into account the coregistration' that these real world coordinates are not as expected?
>> To answer your question regarding the conversion of landmark positions in 'mm' back into voxel indices: this requires information from the mri.transform matrix, but this implies that the mri is already in register, so there would be no need anymore to call ft_volumerealign.
>> Either way, you could also do the coregistration entirely in FieldTrip. This requires a two-step approach, calling ft_volumerealign twice (starting from the raw DICOM files, i.e. prior to having used MRIlab). In the first step you will use cfg.interactive = 'yes' and identify the fiducials that define your corodinate system. Assuming that you are working with your MEG data acquired at BCBL, you should also specify cfg.coordsys = 'neuromag'). The output to this funcion call is an MRI structure that is approximately in register with the MEG-device. In the next step you can refine this coregistration by calling ft_volumerealign (with the approximately registered MRI in the input, and) with cfg.method = 'headshape', and cfg.headshape = 'XXX.pos' (the filename of your polhemus file). This should result (providing that the isotrak data can be read ;-) ) in an interactive figure, that allows you to further align the MRI with the polhemus point cloud that describes the headshape. Once you are happy enough, the figure can be closed, and an iterative-closest-point algorithm is applied for further refinement of the coregistration. 
>> I hope this helps, and might inspire you to try out the coregistration in FieldTrip (and give feedback to us about it, in order to make the procedure more robust).
>> 
>> Best wishes,
>> 
>> 
>> 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
>> 
>> http://www.hettaligebrein.nl
>> 
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> 
> 
> 
> 
> -- 
> 
> ------------------------------
> Nicola Molinaro, Phd
> Staff Scientist
> www.bcbl.eu
> 
> Legal disclaimer/Aviso legal/Lege-oharra: www.bcbl.eu/legal-disclaimer
> 
> _______________________________________________
> 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

http://www.hettaligebrein.nl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20131112/67246570/attachment.html>


More information about the fieldtrip mailing list