<html><head><base href="x-msg://6/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Tyler,<div><br></div><div>sorry if my description was a bit brief, so here's a bit more information.</div><div><br></div><div>You need:</div><div>1) Virtual Electrodes (you have your 1400 electrodes, so I assume you got that far) and the .pos field with the XYZ-coordinates of the virtual electrodes.</div><div>2) A grid with a grid point for each voxel of the MNI brain (That's what you do using ft_prepare_sourcemodel)</div><div>3) A "inside" definition for your VOI (That's what you do with ft_volumelookup).</div><div><br></div><div>Now, given that your steps 1-3 all are in the same coordinate system, you can simply use pythagoras (s = sqrt((X2-X1)^2 + (Y2-Y1)^2 + (Z2-Z1)^2) to find the minimum distance between each virtual channels of step 1 and all grid points of step 2.</div><div><br></div><div>From the min (find the minimum distance) step, you can get the index of closest virtual channel to each grid point. You then apply this index to the output of ft_volumelookup and you have the virtual electrodes inside your ROI.</div><div><br></div><div>Best,</div><div><br></div><div>Julian</div><div><br><div><div>Am 28.05.2014 um 09:05 schrieb Tyler Grummett:</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 dir="ltr"><div id="OWAFontStyleDivID" style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif; "><div style="margin-top: 0px; margin-bottom: 0px; ">I then do the following:<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div>% look up which virtual channels correspond to particular areas</div><div>            % of the brain</div><div>            cfg = [];</div><div>            cfg.atlas = afni;</div><div>            cfg.inputcoord = 'mni';</div><div>            cfg.maskparameter = 'inside';</div><div>            labels = ft_volumelookup( cfg, source);</div><div>            </div><div>            % how many sources found in grey matter</div><div>            [tmp ind] = sort(labels.count,1,'descend');</div><div>            sel = find(tmp);</div><div>            for j = 1:length(sel)</div><div>                found_areas{j,1} = [num2str(labels.count(ind(j))) ': ' labels.name{ind(j)}];</div><div>            end​<br></div><div><br></div><div>However I dont know how to find out what sources are the 'found_areas', after that I dont know how to cluster the source in a particular area.<br></div><div><br></div><div>Tyler<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div name="divtagdefaultwrapper" style="font-family: Calibri, Arial, Helvetica, sans-serif; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-size: 13px; ">*************************<div style="font-family: Tahoma; "><br></div><div><font face="Arial"><i>Tyler Grummett ( BBSc, BSc(Hons I))</i></font></div><div><font face="Arial"><i>PhD Candidate</i></font></div><div><font face="Arial"><i>Brain Signals Laboratory</i></font></div><div><font face="Arial"><i>Flinders University</i></font></div><div><font face="Arial"><i>Rm 5A301</i></font></div><div><font face="Arial"><i>Ext 66124</i></font></div></div></div></div></div></div></div><div dir="ltr" style="color: rgb(40, 40, 40); "><hr tabindex="-1" style="display: inline-block; width: 702px; "><div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size: 11pt; "><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 Tyler Grummett <<a href="mailto:tyler.grummett@flinders.edu.au">tyler.grummett@flinders.edu.au</a>><br><b>Sent:</b><span class="Apple-converted-space"> </span>Wednesday, 28 May 2014 3:53 PM<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] granger causality on beamformer data</font><div> </div></div><div><div id="OWAFontStyleDivID" style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif; "><div style="margin-top: 0px; margin-bottom: 0px; ">Hello Julian,<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">I think I got a few steps further into what I am trying to do, except I dont know whether I have done the correct thing or not, could you check it?<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><p style="margin-top: 0px; margin-bottom: 0px; "></p><div>            % interpolate sources</div><div>            mri = ft_read_mri('Subject01.mri');</div><div>            mri = ft_volumereslice([], mri);</div><div>                        </div><div>            % read in atlas from fieldtrip template</div><div>            afni = ft_read_atlas( fullfile( matlabrootpath, 'Matlab/fieldtrip/template/atlas/afni/TTatlas+tlrc.HEAD'));</div><div>            </div><div>            % construct grid that lies only in grey matter</div><div>            cfg = [];</div><div>            cfg.mri = mri;</div><div>            cfg.grid.warpmni = 'yes';</div><div>            cfg.grid = afni;</div><div>            grid = ft_prepare_sourcemodel( cfg);<br></div><div>            </div><div>            % Source Analysis: without contrasting condition</div><div>            cfg = [];</div><div>            cfg.channel = 'EEG';</div><div>            cfg.method = 'lcmv';</div><div>            cfg.grid = grid;</div><div>            cfg.vol = vol;</div><div>            cfg.keepfilter = 'yes';</div><div>            source = ft_sourceanalysis( cfg, timelock);<br></div><p style="margin-top: 0px; margin-bottom: 0px; ">​</p><div style="margin-top: 0px; margin-bottom: 0px; ">Tyler<br></div><div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div name="divtagdefaultwrapper" style="font-family: Calibri, Arial, Helvetica, sans-serif; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-size: 13px; ">*************************<div style="font-family: Tahoma; "><br></div><div><font face="Arial"><i>Tyler Grummett ( BBSc, BSc(Hons I))</i></font></div><div><font face="Arial"><i>PhD Candidate</i></font></div><div><font face="Arial"><i>Brain Signals Laboratory</i></font></div><div><font face="Arial"><i>Flinders University</i></font></div><div><font face="Arial"><i>Rm 5A301</i></font></div><div><font face="Arial"><i>Ext 66124</i></font></div></div></div></div></div></div></div><div dir="ltr" style="color: rgb(40, 40, 40); "><hr tabindex="-1" style="display: inline-block; width: 702px; "><div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size: 11pt; "><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 Tyler Grummett <<a href="mailto:tyler.grummett@flinders.edu.au">tyler.grummett@flinders.edu.au</a>><br><b>Sent:</b><span class="Apple-converted-space"> </span>Wednesday, 28 May 2014 10:36 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] granger causality on beamformer data</font><div> </div></div><div><div id="OWAFontStyleDivID" style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif; "><div style="margin-top: 0px; margin-bottom: 0px; ">​Hey Julian,<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">Having trouble making sense of that link. Am I correct in saying that I should be downloading the brede toolbox? because it is taking a long time, plus the functions in the brede toolbox dont make a lot of sense.<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">Would you use ft_prepare_sourcemodel instead of ft_prepare_leadfield? or would you run in before running it?<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">Regards,<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">Tyler<br></div><div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div name="divtagdefaultwrapper" style="font-family: Calibri, Arial, Helvetica, sans-serif; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-size: 13px; ">*************************<div style="font-family: Tahoma; "><br></div><div><font face="Arial"><i>Tyler Grummett ( BBSc, BSc(Hons I))</i></font></div><div><font face="Arial"><i>PhD Candidate</i></font></div><div><font face="Arial"><i>Brain Signals Laboratory</i></font></div><div><font face="Arial"><i>Flinders University</i></font></div><div><font face="Arial"><i>Rm 5A301</i></font></div><div><font face="Arial"><i>Ext 66124</i></font></div></div></div></div></div></div></div><div style="color: rgb(40, 40, 40); "><hr tabindex="-1" style="display: inline-block; width: 702px; "><div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size: 11pt; "><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>Wednesday, 28 May 2014 1:55 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] granger causality on beamformer data</font><div> </div></div><div><div dir="ltr"><div><div><div><div><div>Hi Tyler,<br><br></div>I can't comment on the usefulness of directionality between 1400 sources, but keep in mind, that you would have to compute something in the range of 1400*1400<span class="Apple-converted-space"> </span><br>connections, so I hope you have a fast computer.<br><br></div>As for the regions, in case you want to use anatomically defined regions, you an either use the atlases (atlanti? atlae?) that come with fieldtrip or generate a mask from this website:<a href="http://neuro.imm.dtu.dk/services/jerne/ninf/voi.html">http://neuro.imm.dtu.dk/services/jerne/ninf/voi.html</a><br><br></div><div>The general idea is to build a grid with a gridpoint per voxel of your MRI using ft_prepare_sourcemodel. Then you can check which of your virtual channels is closest to the voxel-gridpoints and thus select the virtual channels that are inside your ROI.<br></div><div><br></div>In the first case, you can use ft_volumelookup to find the voxels corresponding to your ROI. In the latter case you can just use the mask and check which voxels are 1 (= inside your ROI).<br><br>I hope that helps, if you have specific questions, feel free to ask.<br><br></div>Best,<br><br></div>Julian<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 27, 2014 at 7:44 AM, Tyler Grummett<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:tyler.grummett@flinders.edu.au" target="_blank">tyler.grummett@flinders.edu.au</a>></span><span class="Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "><div dir="ltr"><div style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif; "><div style="margin-top: 0px; margin-bottom: 0px; ">​Hello fieldtrippers,<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">I was just wondering whether it would be sensible to do granger causality on all 1400 virtual channels, as calculated using beamformer.<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">Or should you do a PCA reduction of some description beforehand.<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">I was also wondering how to create regions of interest. Some of my colleagues think that we should use some kind of spatial ICA technique.<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">Im open to all suggestions.<br></div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; ">Tyler<br></div><div><div style="margin-top: 0px; margin-bottom: 0px; "><br></div><div name="divtagdefaultwrapper"><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-family: Tahoma; font-size: 13px; "><div style="font-size: 13px; ">*************************<div style="font-family: Tahoma; "><br></div><div><font face="Arial"><i>Tyler Grummett ( BBSc, BSc(Hons I))</i></font></div><div><font face="Arial"><i>PhD Candidate</i></font></div><div><font face="Arial"><i>Brain Signals Laboratory</i></font></div><div><font face="Arial"><i>Flinders University</i></font></div><div><font face="Arial"><i>Rm 5A301</i></font></div><div><font face="Arial"><i>Ext 66124</i></font></div></div></div></div></div></div></div></div></div><br>_______________________________________________<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" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div></div></div></div></div></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>