[FieldTrip] ft_prepare_sourcemodel from localspheres

Kirandeep Kaur kkaur.aiims at gmail.com
Mon Jun 27 20:28:43 CEST 2022


Dear all, I am relatively new to fieldtrip, so any help would be
greatly appreciated!
I am trying to construct a source model using the following code from a MEG
co-registered MRI.

------------------------------------------------------
%% starting from segmentation

%% segment mri

cfg = [];

cfg.tissue = 'brain';

cfg.spmversion = 'spm12';

seg = ft_volumesegment(cfg, mri_realigned);



save ('seg');



% cfg = [];

cfg.tissue = 'brain';

cfg.spmversion = 'spm12';

brain_mesh = ft_prepare_mesh(cfg, seg);



cfg = [];

cfg.method = 'localspheres';

cfg.grad = data.grad;

headmodel = ft_prepare_headmodel(cfg, brain_mesh);



save ('headmodel')

clear seg



%% construction of source model

cfg = [];

cfg.resolution = 0.005;

cfg.unit = 'm';

cfg.headmodel = headmodel;

cfg.grad = data.grad;

sourcemodel = ft_prepare_sourcemodel(cfg);



save ('sourcemodel')


------------------------------------------------------



This code runs well up to the construction of the head model, but I get the
following error while trying to make the source-model (a screenshot of the
same is attached). When I run this code using 'singleshell' head
model instead of 'localsheres' it works just fine.



----------------------------------------------------------

Error using headsurface (line 155)
there should be just as many spheres as coils

Error in ft_prepare_sourcemodel (line 380)
        pos = headsurface(headmodel, sens);

-----------------------------------------------------------


Could anyone suggest how to resolve this. Thanks a lot!


Kind regards

Kirandeep Kaur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220627/e98095a6/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2022-06-26 at 11.45.21 PM.png
Type: image/png
Size: 250181 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220627/e98095a6/attachment-0001.png>


More information about the fieldtrip mailing list