[FieldTrip] Warped Source plots and High Source Power Values

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Mon May 20 20:49:46 CEST 2024


Hi Alex,

You mention yourself that there might be a coregistration issue. I don’t know whether the ’seg’ you used for the headmodel is the same as the ’segmentedmri’ that you use for the interpolation (which is to be used in turn for the visualizaiton). At the moment things are getting a bit murky, so I am wondering whether it makes more sense that you consult with your local support team (e.g. your daily supervisor), who can sit next to you at a computer and go with you through your code line-by-line so that they can see what is going on.

Good luck,
Jan-Mathijs


On 20 May 2024, at 19:29, Alex Williams via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hi again Dr. Schoffelen,


 Thanks again for responding and I apologize if there was a misunderstanding on my part.  The dipole positions (according to sourcemodel.pos) are around 3.43 milliion dipoles. The dipole positions on the inside of the compartment (according to sourcemodel.inside) are the exact same number as the total dipole positions at 3.43 million dipoles. This is for the source model created from ft_prepare_sourcemodel, where the source model uses 'mm' as a unit without any conversion or user-based parameterization. And according to the ft_prepare_sourcemodel base code, it looks as though the units for the grad object unit is used primarily by FieldTrip to determine the source model unit. And the grad model is in 'mm'. I also looked at the inside and outside source dipoles that were returned within both the initial and tight grids of the source model:

creating 3D grid with 1 mm resolution
initial 3D grid dimensions are [225 265 182]
1736359 dipoles inside, 9115391 dipoles outside brain
making tight grid
1736359 dipoles inside, 1697357 dipoles outside brain

Since the unit seems to be in 'mm' for the primary object used for the source model units and the number of dipoles inside and outside seem sensible, I was unsure if I should still run the model with a change cfg. resolution parameter. It seems as though the number of dipoles inside are a little bit more than half of the outer dipole sources for the tight grid and I wasn't sure if that would be expected of the source model.

-Alex



On Mon, May 20, 2024 at 9:03 AM Schoffelen, J.M. (Jan Mathijs) via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
OK, perhaps I was not clear enough in my earlier reply: if somehow in the underlying computations (i.e. in the creation of the sourcemodel) FieldTrip ends up with using ‘m’ as unit, then the sourcemodel will only have a single grid point. You should inspect the sourcemodel (after creating it with ft_prepare_sourcemodel), and only proceed if it contains a decent number of dipole positions (sourcemodel.pos), a large portion of which is in the ‘inside’ compartment (sourcemodel.inside). If this is not the case, you may want to change cfg.resolution into 0.01, rather than 1.

Good luck,
Jan-Mathijs


On 17 May 2024, at 17:08, Alex Williams via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hi Dr. Schofflen,

  Thanks so much for the response! I checked the metric units of the source model, head model and the grad parameter. All of them are in 'mm'. However, I ended up checking how SPM processed the meeg data and returned its D structure. It seems as though the grad parameter within the datareg subfield is in 'mm' but within the forward subfield of the SPM-processed structure, the grad parameter is in 'm'. The same goes for the vol parameter in the forward subfield (in 'm').

-Alex

On Fri, May 17, 2024 at 4:02 AM Schoffelen, J.M. (Jan Mathijs) via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
 Hi Alex,

The first thing I would check, is whether the metric units of the sourcemodel/grad are as implicitly expected by you. The cfg.resolution argument before calling ft_prepare_sourcemodel is interpreted by ‘FieldTrip’ in the metric units that the primary geometric object is expressed in. I don’t know by heart which one of the geometric objects (in this case headmodel and grad) is primary in determing this (you need to read the code for that), but things might become strange if it actually is the grad, and if the grad is expressed in ‘m’. Because this would result in a 3D-grid with a 1 meter spacing between dipoles.

Best wishes,
Jan-Mathijs



On 14 May 2024, at 17:15, Alex Williams via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello there FieldTrip Community,


  I'm Alex Williams, a neuroengineering graduate student at Florida Institute of Technology. I'm relatively new to source reconstruction methods and was wondering if there may be any pointers or advice that may help guide me through the tutorials and documentation. I've been trying to resolve an issue with the beamformer for some time. Currently, I'm using an LCMV beamformer to source fit participant MEG data and compare those results to source results that were obtained in SPM12.  Though I'm trying to create a pipeline for analyzing this data set, the results I've obtained seem to have discrepancies in source variance and virtual channel signal alongside having warped sourceplots when plotting source variance.  The meeg data, D, I'm using has been converted from SPM to fieldtrip using the function. spm2fieldtrip(). The converted data itself has been defined, and has undergone pre-processing and time-locking in SPM.

Steps I used:

1. The converted meeg data, D, I'm using has been converted from SPM to fieldtrip using the function. spm2fieldtrip(). The converted data itself has been defined, and has undergone pre-processing and epoching in SPM. Since I wasn't able to find the covariance matrix within the D structure I was using, I applied a time-lock analysis to the D structure I had and used only the covariance matrix from those results as the cfg.cov parameter within the D matrix pre-time lock.

2. ft_read_mri() used a .nifti MRI file and an empty configuration. Fiducials were taken and used in the configuration to realign the MRI using ft_volumerealign() with cfg.coordsys='neuromag'. After, segmentation was done using ft_volumesegment(), again with an empty configuration.

3. Headmodel computed using following parameters:
cfg = [];
cfg.method = 'singleshell';
cfg.siunits = 'yes';
cfg.feedback = 'yes';
headmodel = ft_prepare_headmodel(cfg, seg);
headmodel = ft_convert_units(headmodel, 'mm');

3. Gradiometer array was defined with ft_read_sens using the path of the meeg file. These were the parameters of the source model.

cfg = [];
cfg.grad = grad;
cfg.headmodel = headmodel;
cfg.resolution = 1;
cfg.inwardshift = 0;
sourcemodel = ft_prepare_sourcemodel(cfg);

Plotting leads to this segmented mri figure (segmented mri) and headmodel-sensor model (headmodel, sourcemodel mesh and sensor array)


<image.png>

<Screenshot 2024-05-12 at 10.08.53 PM.png>
4. After the forward model was run with prepare_leadmatrix () with following parameters:
cfg = [];
cfg.grad = grad;
cfg.headmodel = headmodel;
cfg.sourcemodel = sourcemodel;
cfg.channel = {'MEG'};
cfg.singleshell.batchsize = 2000;
lf = ft_prepare_leadfield(cfg,D);
5. And then the source model was run using an LCMV beamformer:
if isfield(D,'cov')
[~, sr, ~]=svd(D.cov);
clif=-diff(log10(diag(sr)));
kappa=find(clif==max(clif));
end
cfg = [];
cfg.method = 'lcmv';
cfg.headmodel = headmodel; % volume conduction model (headmodel)
cfg.sourcemodel = lf; % leadfield
cfg.lcmv.keepfilter = 'yes';
cfg.grad=D.grad;
cfg.keepleadfield = 'yes';
cfg.lcmv.fixedori = 'yes'; % project on axis of most variance using SVD
cfg.lcmv.kappa.      =kappa;
Which returns a source structure that seems to produce warped source variance plots and blown-up source variance values after iusing source interpolation using:                 ft_sourceinterpolate(cfg, source, segmentedmri):

<Screenshot 2024-05-12 at 10.37.15 PM.png>

<Screenshot 2024-05-12 at 10.49.16 PM.png>
I'm currently trying different parameters within the beamformer including using different weight normalization parameters to compensate for possible depth bias alongside using different lambda values. However, based on the final source plots, I wasn't too sure if there may have also been an issue with the coregistration of the mri or perhaps with the final source model.

-Alex Williams
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C13c974a0b0de40d9a42908dc78fd9ea4%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638518277890233828%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Rjagi%2F2WQiOk5LIr8xqYuqmH5OZ5YcSb27d5bDAP8%2Fg%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C13c974a0b0de40d9a42908dc78fd9ea4%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638518277894140214%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=JzaOxH4QznWnPPBeGFDHytUpJNb5DWOtCs%2FjSiWJ%2BK8%3D&reserved=0>

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C13c974a0b0de40d9a42908dc78fd9ea4%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638518277894140214%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=DwKPCdO2N8G9uPiWD%2FYKoQ2XF8c78HNM5lzioDqN%2Bm4%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C13c974a0b0de40d9a42908dc78fd9ea4%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638518277894296545%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=FH1XGkAZ6Wg1KzVD%2FFRBwjA%2FBRCK9jFMANGvJ%2FagW0s%3D&reserved=0>
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C13c974a0b0de40d9a42908dc78fd9ea4%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638518277894296545%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=5pF5ekOCpa70i03MDeuj6z%2BIkDHcQnEl8EmfkLq9YL4%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C13c974a0b0de40d9a42908dc78fd9ea4%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638518277894296545%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=FH1XGkAZ6Wg1KzVD%2FFRBwjA%2FBRCK9jFMANGvJ%2FagW0s%3D&reserved=0>

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C13c974a0b0de40d9a42908dc78fd9ea4%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638518277894296545%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=5pF5ekOCpa70i03MDeuj6z%2BIkDHcQnEl8EmfkLq9YL4%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C13c974a0b0de40d9a42908dc78fd9ea4%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638518277894296545%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=FH1XGkAZ6Wg1KzVD%2FFRBwjA%2FBRCK9jFMANGvJ%2FagW0s%3D&reserved=0>
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C13c974a0b0de40d9a42908dc78fd9ea4%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638518277894296545%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=5pF5ekOCpa70i03MDeuj6z%2BIkDHcQnEl8EmfkLq9YL4%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240520/1f8c9839/attachment.htm>


More information about the fieldtrip mailing list