[FieldTrip] Leadfield calculations result in NaNs

Jeff Stout jstout211 at yahoo.com
Mon May 9 22:12:15 CEST 2011

I am having trouble generating leadfields for source analysis.  I am using data from a 4D magnetometer system (Magnes 3600), at St. Louis University.
The data is averged time domain data.
  The volume conductor is a single shell model generated from the headshape file(~4000 vert. and 8000 triangles).  I have vizualized the volume conductor, sensors, and "inside" grid and they appear to be in the correct locations relative to each other.  I have performed this analysis using the default source space for 4D ('m') and I have tried it scaling the headshape and sensors into cm to conform with the ctf source space.   Below is part of my code and the warning thrown by matlab.  After the calculation of the leadfields, it is apparent that they are all NaN's, so I am unable to generate source activations.
cfg = [];cfg.headshape = shape;shape.pnt = shape.pnt*100;shape.unit  =
 'cm';[vol,cfg] = ft_prepare_singleshell(cfg)
cfg                 = [];cfg.grad            = avg.grad; cfg.grad.pnt = cfg.grad.pnt*100;cfg.grad.unit  = 'cm';cfg.vol             = vol;cfg.sourceunits = 'cm';cfg.coordsys   = 'ctf';cfg.reducerank      ='no';  cfg.channel         = {'MEG'};cfg.grid.resolution = 2[vol, sens] = ft_prepare_vol_sens(vol, cfg.grad)[grid] = ft_prepare_leadfield(cfg)   
>> [grid] = ft_prepare_leadfield(cfg)using headmodel
 specified in the configurationusing gradiometers specified in the configurationcomputing surface normalsWarning: Matrix is singular, close to singular or badly scaled.   <<<<<<<<<<         Results may be inaccurate. RCOND = NaN. > In forward/private/meg_ini>getcoeffs at 111  In forward/private/meg_ini at 53  In ft_prepare_vol_sens at 275  In fieldtrip-20110507/private/prepare_headmodel at 114  In ft_prepare_leadfield at 150creating dipole grid based on automatic 3D grid with specified resolution3528 dipoles inside, 0 dipoles outside brainmaking tight grid3528 dipoles inside, 0 dipoles outside braincomputing leadfieldcomputing leadfield 1/3528computing leadfield 2/3528computing leadfield 3/3528computing leadfield 4/3528 ......

The leadfield data generated is a matrix of NaN's, which appear to be an issue when evaluating bas and gradbas in the get_coeffs subfunction  [bas,gradbas]=legs(x1,n1,order,scale).
Does anyone know how to resolve this issue? Any help will be greatly appreciated.
Jeff Stout

Open in Google Docs ViewerOpen link in new tabOpen link in new windowOpen link in new incognito windowDownload fileCopy link addressEdit PDF File on PDFescape.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110509/ebbcd59d/attachment-0001.html>

More information about the fieldtrip mailing list