[FieldTrip] Extracting virtual EEG channel from a patch
Babaeeghazvini, P.
p.babaeeghazvini at vu.nl
Mon Dec 7 20:20:15 CET 2015
Hi Julian,
Thank you very much for your help now it is completely clear for me.
Parinaz.
________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Julian Keil [julian.keil at gmail.com]
Sent: Monday, December 07, 2015 5:57 PM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] Extracting virtual EEG channel from a patch
Hi Parinaz,
My problem is how I should use the output of volumelookup here for cfg.grid.xgrid, cfg.grid.ygrid and cfg.grid.zgrid.
You don't. You compute your virtual channels for a regular grid (something like -20:1:20 for x,y and z) and select the virtual channels in your ROI in a second step.
This might be a bit of an overkill, as you don't use most of your channels later on, but maybe you want to extend your analysis to other cortical areas - you never know.
Anyways, to be more clear: You compute your virtual electrodes on a predefined grid. To find your ROI, you use ft_volumelookup to get a binary matrix which tells you, which voxels of the standard MRI are in your ROI. Then you build a high-resolution grid based on the standard MRI (It's important to use one grid point per voxel). Using pythagoras, you can now find the closest high-resolution grid points for each of your virtual electrodes. As soon as you have these, you can see which of them have a value of 1 in your binary matrix of ft_volumelookup. Now you know which virtual electrodes are inside your ROI.
So for example, you have 2000 virtual electrodes on a -20:1:20 regular grid. You then compute a binary matrix and a high-resolution grid based on the standard MRI resulting in ~900000 grid points on a 91x109x91 grid. Using pythagoras, you find that grid point 6000 is closest to virtual electrode #1. Then you can see if element 6000 from your binary matrix is a 1. If so, your virtual electrode #1 is in your ROI, if not, your virtual electrode is not in your ROI.
How I can find the atlas position to this maximum point in my code
Do you want to have the coordinates or the actual label? A while ago, I hacked the ft_sourceplot-function to give me the coordinate position as an output, but I can't find the code anymore. I'm sure you can edit the function to also output the label, as this has to be included as a text element somewhere in the function. But please be aware that editing the FT-functions can severely compromise the functionality.
Good luck,
Julian
Am 07.12.2015 um 12:52 schrieb Babaeeghazvini, P.:
Hi Julian,
Thank you very much for your kind reply. Yes I want to compute virtual channel from an atlas area like whole Precentral_L (not from one voxel in this area). So your second explanation helps me. If I understood correctly in the code below I should use all grid points belong to atlas:
cfg = []
cfg.atlas = atlas;
cfg.roi = atlas.tissuelabel(1)
cfg.inputcoord = 'mni';
mas = ft_volumelookup(cfg,grid);
cfg = [];
cfg.method = 'lcmv';
cfg.vol = hdm;
cfg.grid.xgrid =
cfg.grid.ygrid =
cfg.grid.zgrid =
cfg.grid.inside = 1:size(cfg.grid.pos, 1);
cfg.grid.outside = [];
cfg.keepfilter = 'yes';
source_idx = ft_sourceanalysis(cfg, tlock);
My problem is how I should use the output of volumelookup here for cfg.grid.xgrid, cfg.grid.ygrid and cfg.grid.zgrid.
an other question that I have is that: when I compute the maximum index from
[maxvalr, maxpowindxr] = max(srcetask.avg.pow)
How I can find the atlas position to this maximum point in my code (I can see this atlas label in the figure that I get from sourceplot, but I want to report this label in matlab)
Regards,
Parinaz.
From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>] on behalf of Julian Keil [julian.keil at gmail.com<mailto:julian.keil at gmail.com>]
Sent: Monday, December 07, 2015 9:30 AM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] Extracting virtual EEG channel from a patch
Hi Parinaz,
I'm not sure if I understood your question correctly.
Do you want to find the atlas label to a given virtual channel? Or do you want to compute a virtual channel on a given atlas label?
In the first case, you can simply interpolate your virtual EEG channels to the standard MRI and use source plot with an atlas to find the corresponding label.
In the second case, it's a tad more complicated, but here's how I do it:
1. Compute the virtual channels for all grid points in the cortex
2. If you have computed the virtual channels on an individual MRI, make sure that the positions correspond to the standard MRI (I think that's described in the source analysis-tutorial)
3. Build a high-resolution 3D-Grid on the standard MRI
4. Select all grid points from the grid of step 3 which belong to an atlas (see ft_volumelookup)
5. Use pythagoras to find the virtual channels from step 2 closest to the grid points from step 4.
I hope this helps, let me know otherwise.
Julian
Am 04.12.2015 um 20:14 schrieb Babaeeghazvini, P.:
Hello
I want to reconstruct a source signal the same as below in page http://www.fieldtriptoolbox.org/tutorial/shared/virtual_sensors
cfg = [];
cfg.method = 'lcmv';
cfg.vol = hdm;
cfg.grid.pos = sourcemodel.pos([maxcohindx maxpowindx], :);
cfg.grid.inside = 1:size(cfg.grid.pos, 1);
cfg.grid.outside = [];
cfg.keepfilter = 'yes';
source_idx = ft_sourceanalysis(cfg, tlock);
Not from the voxel indicating maximum power ([maxval, maxpowindx] = max(source_diff.avg.pow);), but from the atlas area which this voxel belongs to, such as Supp_Motor_Area_L. So my question is: How I can get the atlas range and atlas label belong to a voxel, and how I can use this atlas area range in this code to reconstruct a signal instead of using (cfg.grid.pos = sourcemodel.pos([maxcohindx maxpowindx], :)).
Regards,
Parinaz.
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151207/4b6e6fe6/attachment-0001.html>
More information about the fieldtrip
mailing list