Back to the main page.

Bug 1513 - grid and vol different units (neuromag data)

Status CLOSED FIXED
Reported 2012-06-11 10:58:00 +0200
Modified 2012-07-12 10:41:10 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Hanneke van Dijk - 2012-06-11 10:58:23 +0200

Created attachment 273 data used in my script When I prepare mni-realigned sourcemodels and afterwards plot grid and vol, they are at different places in the plot (attached). My analysis in short: %after creating template_grid and template_vol; 1. ft_read_mri 2. ft_mri_realign (cfg.fiducial) 3. ft_volumesegment %After this the error occurs; 4. ft_prepare_headmodel 5. ft_prepare_sourcemodel (using cfg.grid.warpmni='yes', and template_grid) %----------------------------------------------------- %script: %----------------------------------------------------- mrifile = ('/mri/sets/mri.fif'); mri = ft_read_mri(mrifile); [RPA,NAS,LPA] = vs_read_landmarks(s); cfg = []; cfg.method = 'fiducial'; cfg.fiducial.lpa = LPA; cfg.fiducial.nas = NAS; cfg.fiducial.rpa = RPA; cfg.coordsys = 'neuromag' ; mri_real = ft_volumerealign(cfg,mri); % segment the anatomical MRI cfg = []; cfg.template = '/data/apps/fieldtrip/latest/external/spm8/templates/T1.nii'; cfg.coordsys = 'neuromag'; cfg.write = 'no'; cfg.name = 'temp'; cfg.sourceunits = 'm'; segmentedmri = ft_volumesegment(cfg, mri_real); % construct volume conductor model (i.e. head model) for each subject % this is optional, you can also use another model, e.g. a single sphere model cfg = []; cfg.method = 'singleshell'; cfg.sourceunits = 'cm'; cfg.coordsys = 'neuromag'; vol = ft_prepare_headmodel(cfg,segmentedmri); % create the subject specific grid, using the template grid that has just been created load(strcat(basepath,'templates/template_grid.mat')); cfg = []; cfg.grid.warpmni = 'yes'; cfg.grid.template = template_grid; cfg.grid.nonlinear = 'yes'; % use non-linear normalization cfg.coordsys = 'neuromag'; cfg.mri = mri_real; cfg.sourceunits = 'm'; cfg.vol = vol; grid = ft_prepare_sourcemodel(cfg); %%%%%%%%%%%%%%%%%%%%% function [RPA,NAS,LPA] = vs_read_landmarks(s); fid = fopen(/mri/landmarks_voxel.txt')); frewind(fid) T1=fgets(fid); T2=fgets(fid); LPA = str2num(fgets(fid)); RPA = str2num(fgets(fid)); NAS = str2num(fgets(fid));


Hanneke van Dijk - 2012-06-11 11:05:09 +0200

Created attachment 274 figure


Hanneke van Dijk - 2012-06-11 11:17:24 +0200

I have also tried using the 'vol' in stead of 'mri_real' to prepare the grid. This results in nicely overlapping data. However the inwardshift of -1.5 that I used in the template_grid gets lost. I guess the points that are normaly a bit outside of the vol, are now inside. This is not supposed to happen of course.


Hanneke van Dijk - 2012-06-11 11:21:54 +0200

There are also a lot less grid points when I use the vol in stead of mri_real (642 instead of 5780)(In reply to comment #2)


Hanneke van Dijk - 2012-06-14 13:23:09 +0200

Doing ft_convert_units(mri_real,'mm'), before doing ft_prepare_sourcemodel solved the problem.


Jan-Mathijs Schoffelen - 2012-07-07 20:28:13 +0200

TO DO: ensure the mri data to have 'mm' units prior to doing the normalisation.


Jan-Mathijs Schoffelen - 2012-07-09 16:21:14 +0200

changed in revision 6254