Problem while using prepare_leadfield with parameterscfg.resolutionand cfg.inwardshift

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Tue Apr 29 16:44:57 CEST 2008

On 23 Apr 2008, at 12:21, Ingmar Schneider wrote:
> Probably the original problem is not related to the leadfield at all.

Hi Ingmar,

I indeed think that the problem is not related to the leadfields
themselves. I suspect the problem to be due to either the inside/
outside detection (which is done in private/prepare_dipole_grid and
which depends on cfg.inwardshift) or that the problem is related to
some confusion somewhere in the code about the units (cm v.s. mm).

I suggest that you investigate the problem in more detail by
visualising the source reconstruction without sourceinterpolate. I.e.
after sourceanalysis you get a
and you should be able to do
   vol = reshape(source.avg.pow, source.dim);
That gives you a 3D array which you can immediately plot slice-by-
slice, e.g. using
   figure; imagesc(squeeze(vol(:,:,10)));
or by using the matlab montage function if I recall correctly.

What you also can do is explicitely look at the voxels that were
considered in the source reconstruction, by
   vol = zeros(source.dim); % make 3d array
   vol(source.inside)  = 1;
   vol(source.outside) = 0;
and then again use imagesc to look at the slices in the volume.

best regards,

PS please check that your problem is not merely due to colorbar
scaling and a large depth bias as explained on
id=fieldtrip:documentation:tutorial:beamformer#plot_the_result and
downward. See figure
er:beampost.png. The different resolutions you used might just result
in a different colorbar and opacity scaling, which would also result
in a different "amount" of source reconstruction getting visible on
top of the MRI.

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