Problem while using prepare_leadfield with parameterscfg.resolutionand cfg.inwardshift

Ingmar Schneider Ingmar.Schneider at BIO.UNI-GIESSEN.DE
Wed Apr 23 12:21:32 CEST 2008

Hello Robert,

thanks again for the quick reply!
I'm sorry for the sloppy formulation. What I mean by "the field", is the
visible area after source analysis. I calculated the sources two times -
once with a leadfield resolution of 1cm and once with a resolution of
0.5cm - and compared the resulting sliceplots. While the 1cm resolution
resulted in a source analysis covering almost the whole MRI-anatomy, the
0.5cm resolution concentrated only on the central 50% of the anatomy
(Unfortunately I have no saved figures of these constellations, but I'll
try to visualize it in an attached, coarse scetch).
I considered these divergences to result from the underlying leadfield,
but I checked the calculated leadfields as you proposed in your last
mail and the dimensions appear to be just fine.

Probably the original problem is not related to the leadfield at all.

With best regards,

Robert Oostenveld schrieb:
> Hi Ingmar
> On 22 Apr 2008, at 9:52, Ingmar Schneider wrote:
>> what you say is completely right and my problem is related to the
>> problem described in the FAQ. As I tried to explain in the last mail
>> and as you say: A reduction of the inwardshift (i.e. to a negative
>> value) results in a leadfield, that covers the whole anatomy data.
>> But if I simultaneously try to improve the resolution (i.e. to 0.5cm)
>> the resulting field is smaller than the one with the default
>> resolution-value of 1cm. I played with some combinations, but i never
>> really got a suiting leadfield.
> How do you mean "the field is smaller"? The cfg.resolution only
> pertains to the distance between neighbouring grid locations at which
> dipoles will be positioned (using the
> fieldtrip/private/prepare_dipole_grid function). Then the leadfield is
> computed by looping over all dipole positions that are marked as being
> inside the brain. The "inside the brain" detection is influenced by
> cfg.inwardshift.
> If you compare
>  LFgrid_coarse.leafield{i}
> and
>  LFgrid_fine.leafield{j}
> for the two grids that you have constructed, where
>  LFgrid_coarse.pos(i,:)== LFgrid_fine.pos(j,:)
> then you should have exactly the same leadfield. However, the number
> of dipole positions in the grid should be higher for the fine
> resolution than for the coarse resolution (the effect of
> cfg.resolution). If you keep the resolution constant but change
> cfg.inwardshift, then you will primarily see a change in the number of
> dipoles taht is marked inside. Note however that fieldtrip tries to
> keep the "box" encompassing the brain compartment as small as
> possible, so changing cfg.inwardshift might also affect the total
> number of sources (inside+outside).
> Perhaps you should do this to clarify it further
> insidevol = zeros(LFgrid.dim);
> insidevol(LFgrid.inside) = 1;
> insidevol(LFgrid.outside) = 0;
> for slice=1:LFgrid.dim(3) % probably you dont want this in a for loop
>   figure; imagesc(insidevol(:,:,slice));
> end
> You can also see that LFgrid.leadfield is empty (i.e. []) for all
> "outside" gridpoints (that is to save memory, since ~50% of the points
> will be outside the brain).
>> I am using data from a VSM MedTech CTF-MEG with 275 channels and
>> here's an excerpt of the Matlab-code to further specify my analysis.
>> These specifications actually deliver a leadfield, that covers most
>> of the anatomy, but in a poor resolution.
> The leadfield is usually computed on a relatively coarse grid
> (compared to fMRI) because of the computationat time involved, but
> also because the spatial resolution of MEG is not so high anyway
> (assuming a whole-head beamformer source reconstruction or a
> distributed source model). A resolution of 1cm is usually fine to get
> a quick first idea, and I consider a resolution of 0.7cm adequate for
> almost all applications. Mote that decreasing the resolution from 1 to
> 0.7 results in 3x so many dipoles and hence 3x longer computations.
> best regards,
> Robert
> PS your code looks fine to me
> ----------------------------------
> 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

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scetch.png
Type: image/png
Size: 33761 bytes
Desc: not available
URL: <>

More information about the fieldtrip mailing list