<html><head><base href="x-msg://42/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Parinaz,<div><br></div><div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div fpstyle="1" ocsi="0" style="word-wrap: break-word; "><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; "><div>My problem is how I should use the output of volumelookup here for cfg.grid.xgrid, <span style="font-size: 13.3333px; ">cfg.grid.ygrid and </span><span style="font-size: 13.3333px; ">cfg.grid.zgrid.</span></div></div></div></span></blockquote><div><br></div>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.</div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div fpstyle="1" ocsi="0" style="word-wrap: break-word; "><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; "><div><span style="font-size: 10pt; ">How I can find the atlas position to this maximum point in my code</span></div></div></div></span></blockquote><div><br></div>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.</div><div><br></div><div>Good luck,</div><div><br></div><div>Julian<br><br></div><div><br></div><div><br><div><div>Am 07.12.2015 um 12:52 schrieb Babaeeghazvini, P.:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div fpstyle="1" ocsi="0" style="word-wrap: break-word; "><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; ">Hi <font size="2">Julian,</font><div><br></div><div>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 <font size="2">all grid points belong to atlas:</font></div><div><br></div><div><pre class="code" style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; margin-top: 0px; margin-bottom: 1em; margin-left: -10px; font-size: 12px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); overflow-x: hidden; overflow-y: hidden; font-family: Consolas, 'Andale Mono', Menlo, Monaco, monospace; white-space: pre-wrap; width: 640px; text-align: justify; background-color: rgb(247, 249, 250); "><p class="p1">cfg = []</p><p class="p1">cfg.atlas = atlas;</p><p class="p1">cfg.roi = atlas.tissuelabel(1)</p><p class="p1">cfg.inputcoord = <span class="s1">'mni'</span>;</p><p class="p1">mas = ft_volumelookup(cfg,grid);</p></pre><pre class="code" style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; margin-top: 0px; margin-bottom: 1em; margin-left: -10px; font-size: 12px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); overflow-x: hidden; overflow-y: hidden; font-family: Consolas, 'Andale Mono', Menlo, Monaco, monospace; white-space: pre-wrap; width: 640px; text-align: justify; background-color: rgb(247, 249, 250); ">cfg = [];
cfg.method = 'lcmv';
cfg.vol = hdm;
<p class="p1">cfg.grid.xgrid = </p><p class="p1">cfg.grid.ygrid = </p><p class="p1">cfg.grid.zgrid = </p>cfg.grid.inside = 1:size(cfg.grid.pos, 1);
cfg.grid.outside = [];
cfg.keepfilter = 'yes';
source_idx = ft_sourceanalysis(cfg, tlock);</pre></div><div><br></div><div>My problem is how I should use the output of volumelookup here for cfg.grid.xgrid, <span style="font-size: 13.3333px; ">cfg.grid.ygrid and </span><span style="font-size: 13.3333px; ">cfg.grid.zgrid.</span></div><div><span style="font-size: 13.3333px; "><br></span></div><div><span style="font-size: 13.3333px; ">an other question that I have is that: when I compute the maximum index from </span></div><div><span style="font-size: 10pt; "> [maxvalr, maxpowindxr] = max(srcetask.avg.pow)</span></div><div><span style="font-size: 10pt; "><br></span></div><div><span style="font-size: 10pt; ">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)</span></div><div><span style="font-size: 10pt; "><br></span></div><div><span style="font-size: 10pt; ">Regards,</span></div><div><span style="font-size: 10pt; ">Parinaz.</span></div><p class="p2"><br></p><div><br></div><div><br></div><div><div style="font-family: 'Times New Roman'; color: rgb(0, 0, 0); font-size: 16px; "><div id="divRpF885871" style="direction: ltr; "><font face="Tahoma" size="2" color="#000000"><b>From:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a><span class="Apple-converted-space"> </span>[<a href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a>] on behalf of Julian Keil [<a href="mailto:julian.keil@gmail.com">julian.keil@gmail.com</a>]<br><b>Sent:</b><span class="Apple-converted-space"> </span>Monday, December 07, 2015 9:30 AM<br><b>To:</b><span class="Apple-converted-space"> </span>FieldTrip discussion list<br><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [FieldTrip] Extracting virtual EEG channel from a patch<br></font><br></div><div></div><div>Hi Parinaz,<div><br></div><div>I'm not sure if I understood your question correctly.</div><div>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?</div><div><br></div><div>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.</div><div>In the second case, it's a tad more complicated, but here's how I do it:</div><div>1. Compute the virtual channels for all grid points in the cortex</div><div>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)</div><div>3. Build a high-resolution 3D-Grid on the standard MRI</div><div>4. Select all grid points from the grid of step 3 which belong to an atlas (see ft_volumelookup)</div><div>5. Use pythagoras to find the virtual channels from step 2 closest to the grid points from step 4.</div><div><br></div><div>I hope this helps, let me know otherwise.</div><div><br></div><div>Julian</div><div><br><div><div>Am 04.12.2015 um 20:14 schrieb Babaeeghazvini, P.:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; "><div><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; "><div style="font-family: 'Times New Roman'; color: rgb(0, 0, 0); font-size: 16px; "><div id="divRpF893157" style="direction: ltr; "><span style="font-size: 10pt; font-family: Tahoma; ">Hello</span></div><div><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; "><div style="direction: ltr; "><div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt; "><br></div><div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt; ">I want to reconstruct a source signal the same as below in page <a href="http://www.fieldtriptoolbox.org/tutorial/shared/virtual_sensors" target="_blank" style="font-size: 10pt; ">http://www.fieldtriptoolbox.org/tutorial/shared/virtual_sensors</a></div><div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt; "><pre class="code" style="padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; margin-top: 0px; margin-bottom: 1em; margin-left: -10px; font-size: 12px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); overflow-x: hidden; overflow-y: hidden; font-family: Consolas, 'Andale Mono', Menlo, Monaco, monospace; white-space: pre-wrap; width: 640px; text-align: justify; background-color: rgb(247, 249, 250); ">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);</pre></div><div><span style="font-size: 10pt; ">Not from the voxel indicating maximum power (</span><span style="color: rgb(0, 0, 0); font-family: Consolas, 'Andale Mono', Menlo, Monaco, monospace; font-size: 12px; text-align: justify; white-space: pre-wrap; background-color: rgb(247, 249, 250); ">[maxval,
maxpowindx] = max(source_diff.avg.pow);</span><span style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt; ">), but from the atlas area which this voxel belongs to, such as </span>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 (<span style="font-family: Consolas, 'Andale Mono', Menlo, Monaco, monospace; font-size: 12px; text-align: justify; white-space: pre-wrap; background-color: rgb(247, 249, 250); ">cfg.grid.pos
= sourcemodel.pos([maxcohindx maxpowindx], :)</span><span style="font-size: 10pt; ">).</span></div><div><span style="font-size: 10pt; "><br></span></div><div><span style="font-size: 10pt; ">Regards,</span></div><div><span style="font-size: 10pt; ">Parinaz.</span></div></div></div></div></div></div>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div></span></blockquote></div><br></div></div></div></div></div>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div></span></blockquote></div><br></div></body></html>