[FieldTrip] Coordsys issue ft_sourceplot

Andreas Sauer sauer.mpih at googlemail.com
Wed Jun 15 14:31:49 CEST 2016


Dear Jan,

thank you for your email and the example code!

I tried both ways to convert the coord systems, but unfortunately it still
doesn't work.

Since I used the tutorial procedure to create my sourcemodel (
http://www.fieldtriptoolbox.org/tutorial/sourcemodel#subject-specific_grids_that_are_equivalent_across_subjects_in_normalized_space)
I tried first with the easy way of only replacing the .pos field. But the
plots don't change, the sources are still rotated by 90 degrees. Actually,
the .pos fields are already the same before replacing it (see pic). Is
there some error in my code?


*% Step1: Load mri file*
*mri =
ft_read_mri('/data/home1/asauer/Projects/RPScZ/Analysis/Beamforming/MRI/HSM12_V2.mri');*

*% Step 2: Segment the template brain and construct a volume conduction*
*% model (i.e. head model): this is needed for the inside/outside detection
of voxels*
*cfg = [];*
*cfg.output = 'brain';*
*segmentedmri = ft_volumesegment(cfg,anatomy);*

*cfg = [];*
*cfg.method = 'singleshell';*
*vol = ft_prepare_headmodel(cfg,segmentedmri);*
*vol = ft_convert_units(vol,'m');*
*figure; ft_plot_sens(sens,'style','*b'); hold on; ft_plot_vol(vol)*

*% Step 3: Load sourcemodel *
*load(fullfile(ft_path,'template/sourcemodel/standard_sourcemodel3d5mm'));*
*template_grid = sourcemodel;*
*clear sourcemodel*

*% Step 4: Make sourcemodel*
*cfg = [];*
*cfg.grid.warpmni = 'yes';*
*cfg.grid.template = template_grid;*
*cfg.grid.nonlinear = 'yes';*
*cfg.mri = mri;*
*cfg.grid.unit = 'm';*
*grid = ft_prepare_sourcemodel(cfg);*
*figure; hold on;*
*ft_plot_vol(vol,'facecolor','cortex','edgecolor','none'); alpha 0.5;
camlight;*
*ft_plot_mesh(grid.pos(grid.inside,:));*


The only thing that is different from the tutorial is the unit
conversion...

After that I tried the transformation. All worked well until the source
interpolation. ft_sourceinterpolation throws this error:

*Attempted to access sel(1); index out of bounds because numel(sel)=0.*

*Error in ft_sourceinterpolate>my_interpn (line 508)*
*  ft_progress(sel(1)/num, 'interpolating %.1f%%\n', 100*sel(1)/num);*

*Error in ft_sourceinterpolate (line 393)*
*    interp.inside( sel) = my_interpn(double(functional.inside), ax(sel),
ay(sel), az(sel), 'nearest', cfg.feedback);*


which, to be honest, I don't really understand. Sorry...

Best wishes,

Andreas


2016-06-14 9:41 GMT+02:00 Schoffelen, J.M. (Jan Mathijs) <
jan.schoffelen at donders.ru.nl>:

> Dear Andreas,
>
> after having calculated the sources of a MMN paradigm (4D-system), I’d
> like to plot the results on one of the anatomy template files in the
> fieldtrip directory (single_subj_T1_1mm.nii) or alternatively on a MNI T1
> template file (mni_icbm152_t1_tal_nlin_sym_09a.nii). Unfortunately, this is
> not working well… As you can see on the attached picture, the functional
> data is rotated by 90 degrees.
>
> I guess that something gets mixed because of the different coordsystems of
> functional and anatomical data. The functional data is 4D, which means ALS
> orientation. The anatomical is MNI, so RAS orientation. The plotting works
> fine, if I use a mri file which was converted in field trip (V2.mri) and
> therefore is also in ALS orientation. However, the anatomy doesn’t look
> very pretty…
>
>
> Is there any way that I can transform the functional data to RAS
> orientation or the anatomical data to ALS orientation, respectively?
>
>
> I tried with ft_volumerealign. However, since the template file has no
> fiducials, it is hard to really precisely do this.
>
>
> Fair point. I would however do it the other way around, using the V2 to
> get the transformation from voxel space to MNI-RAS, and then use the
> inverse of the transformation on the functional data: in this case you
> could use ft_volumenormalise, with cfg.nonlinear = ‘no’. Alternatively, if
> you are using this procedure:
> http://www.fieldtriptoolbox.org/tutorial/sourcemodel#subject-specific_grids_that_are_equivalent_across_subjects_in_normalized_space,
> you could directly replace the source.pos of your functional data with the
> template.pos and then do the interpolation.
>
> To summarize:
>
> either:
>
> mri = ft_read_mri(‘V2.mri’);
> mri.coordsys = ‘bti’;
>
> cfg = [];
> cfg.nonlinear=’no’;
> mrin = ft_volumenormalise(cfg, mri);
>
> transform_vox2bti = mri.transform;
> transform_vox2spm = mrin.transform;
> transform_bti2spm = transform_vox2spm/transform_vox2bti
> source = ft_transform_geometry(transform_bti2spm, source);
>
> source_int = ft_sourceinterpolate(somecfg, source, niceanatomical);
>
> or:
>
> source.pos = templat.pos;
> source_int = ft_sourceinterpolate(somecfg, source, niceanatomical);
>
> Best,
> JM
>
>
>
> Any input on how to plot the sources on one of these nice anatomical files
> is highly appreciated!
>
> Thanks and best regards,
>
> Andreas
>
>
> --
> Dipl.-Psych. Andreas Sauer
> Max Planck Institute for Brain Research
> Deutschordenstraße 46
> 60528 Frankfurt am Main
> Germany
>
> T: +49 69 96769 278
> F: +49 69 96769 327
> Email: sauer.mpih at gmail.com
> www.brain.mpg.de
> <Rotated_Source.png>_______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>



-- 
Dipl.-Psych. Andreas Sauer
Max Planck Institute for Brain Research
Deutschordenstraße 46
60528 Frankfurt am Main
Germany

T: +49 69 96769 278
F: +49 69 96769 327
Email: sauer.mpih at gmail.com
www.brain.mpg.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160615/8c7fcbff/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pos_fields.png
Type: image/png
Size: 81877 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160615/8c7fcbff/attachment.png>


More information about the fieldtrip mailing list