Source localization with minimum norm

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Mon Mar 16 22:19:15 CET 2009

Hi Gatien,

On 9 Mar 2009, at 18:12, Gatien Hocepied wrote:
> I ‘m facing serious problems with this function… How can I define  
> the dip.inside and dip.outside ?

If you access the functino through the fieldtrip sourceanalysis  
function (and not directly as low-level function), the  
prepare_dipole_grid function will set up the 3D grid with all dipoles  
and for each dipole determine whether it is insode or outside the  
brain (based on the volume conduction model). The function that is  
notmally called to determine the inside/outide aspect of each  
gridpoiunt is the inside_vol function (see forwinv/private). If you  
know that all dipoles are inside the brain, then you can specify the  
dip.inside vector as a boolean NdipolesX1 vector with all elements  
being true. Grid positions taht are outside the brain (and that  
therefore should not be included in the inverse estimate) should be  
marked as false. To understand this, please consider a 3D box-like  
grid encompassing the complete brain. The corners of the box will  
always be outside the brain, so using a 3D box-like grid means that  
~30% of the considered grid points is outside the brain and should not  
be scanned (in case of a beamformer method) or included in the  
distributed model (in your case).

>  Besides, for 2 dipoles, this line seems to be incorrect :
> dip.leadfield{i} = compute_leadfield(dip.pos(i,:), grad, vol,  
> 'reducerank', reducerank,'normalize', normalize, 'normalizeparam',  
> normalizeparam) *,i);

dip.pos should be a Ndipoles*3 matrix, causing the leadfield to become  
Nchans*3. That is then (optionally) multiplied with the 3*1 fixed  
dipole orientation (e.g. constrained by the orientation of the  
cortical sheet). The concatenation of the leadfields to  
NchansX(3*Ndipoles) or NchansXNdipoles (in case of fixed orientation)  
is done from line 109 onwards.

best regards,

The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and

More information about the fieldtrip mailing list