<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Lin,
<div class=""><br class="">
</div>
<div class="">Not exactly. Apologies that I was not clear enough. What I meant with  'the neighbourhood is implicit in their order’ is the following:</div>
<div class=""><br class="">
</div>
<div class="">if you take the spatial dimension of your data - including the outsiders - and you would reshape it into the 3D volume, by doing something like reshape(datavector, source.dim); then for a given dipole indexed with the triplet of volumetric indices
 (ix,iy,iz) has its neighbours at (ix+1,iy,iz), (ix, iy+1, iz), (ix, iy, iz+1) etc. </div>
<div class=""><br class="">
</div>
<div class="">Now, if you want to manually define for each of the dipole positions their (6 18 or 26? neighbours, depending on whether you include only the center faces, the edges or the corners of the 3x3x3 cube) you probably would want to loop through the
 three dimensions and identify for each of the dipoles which are the indices of their direct neighbours. To this end, you could start with creating a ‘dummy’ variable that contains the dipole indices in a volume, i.e. reshape(1:5780, [17 20 17]), and then loop
 through all positions in the volume to identify the neighbours</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">neighbours = cell([17 20 17]);</div>
<div class="">for i = 2:16</div>
<div class="">for j = 2:19</div>
<div class="">for k =2:16</div>
<div class=""><br class="">
</div>
<div class="">tmp = dummy(i+[-1:1], j+[-1:1],k+[-1:1]); % this needs to be adjusted according to which part of the cube you desire in your searchlight</div>
<div class="">neighbours{i,j,k} = tmp(:);</div>
<div class=""><br class="">
</div>
<div class="">end</div>
<div class="">end</div>
<div class="">end</div>
<div class=""><br class="">
</div>
<div class="">On a side note, I would think that doing a spatial searchlight on source reconstructed MEG data is a little bit of an overkill, unless you have reason to suspect that you have some local very high spatial resolution. As an alternative, you could
 consider chunking your data into parcels -e.g. based on a(n) (refined) anatomical atlas- and use those parcels as your spatial searchlight.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""> </div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 22 Mar 2021, at 17:19, Lin Wang <<a href="mailto:wanglinsisi@gmail.com" class="">wanglinsisi@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">Hi Jan-Mathijs,</div>
<div class=""><br class="">
</div>
<div class="">Thank you very much for your response.</div>
<div class=""><br class="">
</div>
<div class="">I defined the dipole positions with a regular 3D grid, with a dimension of 17*20*17 (following
<a href="https://www.fieldtriptoolbox.org/tutorial/sourcemodel/" class="">https://www.fieldtriptoolbox.org/tutorial/sourcemodel/</a>). This gives me 5780 grid points in total, with 2982 grid points inside of the brain.</div>
<div class=""><br class="">
</div>
<div class="">You mentioned that 'the neighbourhood is implicit in their order', so can I do the following for the searchlight type of analysis:</div>
<div class="">(1) select only the activation of the 2982 grid points</div>
<div class="">(2) conduct analysis to every 10 grid points that are next to each other</div>
<div class="">(3) loop through all the 2982 grid points</div>
<div class=""><br class="">
</div>
<div class="">Thank you again for your input!</div>
<div class="">Lin</div>
<div class=""><br class="">
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, 19 Mar 2021 at 03:57, Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl" class="">jan.schoffelen@donders.ru.nl</a>> wrote:<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;" class="">Hi Lin,
<div class=""><br class="">
</div>
<div class="">The answer to your question depends on the topology of the source space.</div>
<div class="">If the dipole positions are defined on a regular 3D grid, the neighbourhood is implicit in their order.</div>
<div class="">If the dipole positions are defined on a cortical mesh (that includes a triangulation), the neighbourhood can be determined from the triangulation.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 18 Mar 2021, at 01:59, Lin Wang <<a href="mailto:wanglinsisi@gmail.com" target="_blank" class="">wanglinsisi@gmail.com</a>> wrote:</div>
<br class="">
<div class="">
<div dir="ltr" class="">
<div style="margin:0in;font-family:Calibri;font-size:11pt" class="">Hi field excerpts,</div>
<div style="margin:0in;font-family:Calibri;font-size:11pt" class=""><br class="">
</div>
<div style="margin:0in;font-family:Calibri;font-size:11pt" class="">I'd like to implement a searchlight type of multivariate analysis in the MEG source localized data, but I don’t know where to find the information about neighboring voxels for each voxel.</div>
<div style="margin:0in;font-family:Calibri;font-size:11pt" class=""><br class="">
</div>
<div style="margin:0in;font-family:Calibri;font-size:11pt" class="">I guess this is also relevant to the definition of the neighborhood when conducting cluster-based permutation tests in the source space.</div>
<div style="margin:0in;font-family:Calibri;font-size:11pt" class=""><br class="">
</div>
<div style="margin:0in;font-family:Calibri;font-size:11pt" class="">Could anyone help me?</div>
<div style="margin:0in;font-family:Calibri;font-size:11pt" class=""><br class="">
</div>
<div style="margin:0in;font-family:Calibri;font-size:11pt" class="">Thank you very much!</div>
<div style="margin:0in;font-family:Calibri;font-size:11pt" class="">Lin</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" target="_blank" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</blockquote>
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://doi.org/10.1371/journal.pcbi.1002202<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>