[FieldTrip] Leadfield calculations result in NaNs

jan-mathijs schoffelen jan.schoffelen at donders.ru.nl
Tue May 10 08:36:51 CEST 2011


Dear Jeff,

 From what you describe I don't really know what's going wrong. Are  
you using the headsurface file generated with the polhemus? It could  
be that this causes the problem. For the singleshell model to work,  
you need a triangulated surface. The headsurface file contains only a  
point cloud. Matlab tries to create a triangulation from this point  
cloud, and I could imagine that this triangulation misbehaves here,  
leading some nans here and there (judging from your message this  
happens when the normals to the triangles are computed), which  
eventually cause nans all over the place. For the time being you could  
try to use a different volume conductor model (localspheres), or you  
may want to use a structural MRI for the singleshell creation (if  
available), to verify that the problem is caused by the headsurface  
file and not by fieldtrip.

Best,

Jan-Mathijs

On May 9, 2011, at 10:12 PM, Jeff Stout wrote:

>
> Hi,
>
> 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 configuration
> using gradiometers specified in the configuration
> computing surface normals
> Warning: 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 150
> creating dipole grid based on automatic 3D grid with specified  
> resolution
> 3528 dipoles inside, 0 dipoles outside brain
> making tight grid
> 3528 dipoles inside, 0 dipoles outside brain
> computing leadfield
> computing leadfield 1/3528
> computing leadfield 2/3528
> computing leadfield 3/3528
> computing 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.
>
> Thanks,
> Jeff Stout
>
>
>
>
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Dr. J.M. (Jan-Mathijs) Schoffelen
Donders Institute for Brain, Cognition and Behaviour,
Centre for Cognitive Neuroimaging,
Radboud University Nijmegen, The Netherlands
J.Schoffelen at donders.ru.nl
Telephone: 0031-24-3614793

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110510/9c8439b2/attachment-0002.html>


More information about the fieldtrip mailing list