<html>
  <head>
    
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Thanks a lot Robert, now I get it!<br>
    Best,<br>
    Ulrich<br>
    <br>
    <br>
    On 07.02.2012 11:34, Robert Oostenveld wrote:
    <blockquote
      cite="mid:93BEC2B0-B372-4EA9-BE41-1D0606B217FF@donders.ru.nl"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="MS Exchange Server version
        08.03.0213.000">
      <title>Re: [FieldTrip] Defining cfg.neighbourdist at source level</title>
      <!-- Converted from text/plain format -->
      <p><font size="2">Dear Ulrich<br>
          <br>
          On 1 Feb 2012, at 13:44, Pomper, Ulrich wrote:<br>
          <br>
          > Dear Robert and Stephan,<br>
          > Thank you for your replies.<br>
          > I guess I use what Robert called the 'regular' 3D grid,
          but I'm not quite sure.<br>
          ...<br>
          > ldf =<br>
          ><br>
          >         xgrid: [-65 -58 -51 -44 -37 -30 -23 -16 -9 -2 5
          12 19 26 33 40 47 54 61 68]<br>
          >         ygrid: [-107 -100 -93 -86 -79 -72 -65 -58 -51 -44
          -37 -30 -23 -16 -9 -2 5 12 19 26 33 40 47 54 61 68 75]<br>
          >         zgrid: [-52 -45 -38 -31 -24 -17 -10 -3 4 11 18 25
          32 39 46 53 60 67 74 81]<br>
          >           dim: [20 27 20]<br>
          >           pos: [10800x3 double]<br>
          ...<br>
          ><br>
          > In any case, I still don't quite understand how to
          calculate the neighbours to each voxel.<br>
          <br>
          Yes, you are using a regular 3D grid with dipole positions
          that are placed at the center of a large number of voxels
          which jointly fill a cube that spans the head. Just like an
          MRI.<br>
          <br>
          If you look in ldf.pos you will see all positions. Those
          positions form a 20x27x20 regular grid, with the x-, y, and
          z-values according to xgrid/ygrid/zgrid. You have a grid
          spacing of 7mm in each direction.<br>
          <br>
          The first positions is [-65 -107 -52] and its neighbours are
          the grid points that are 7mm to the right, top and front. Just
          think of it as<br>
          functional_data = rand(20, 27, 20)<br>
          i.e. a cube. It is clear for each voxel what the neighbours
          are.<br>
          <br>
          FieldTrip makes use of vectorization, i.e. the 3d matrix with
          the functional data can also be represented by MATLAB as a
          vector.<br>
          functional_data = functional_data(:)<br>
          What you then get is a vector of length 10800, i.e. matching
          all the [x y z] positions as they are specified in ldf.pos.<br>
          <br>
          >  By saying that the "neighbours are trivial to find and
          you do not have to specify a structure", do you mean that I
          don't need to define the cfg.neighbours property at all (given
          that I do use a regular 3D grid)?<br>
          <br>
          correct.<br>
          <br>
          Robert<br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          <br>
          _______________________________________________<br>
          fieldtrip mailing list<br>
          <a class="moz-txt-link-abbreviated" href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
          <a moz-do-not-send="true"
            href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
        </font>
      </p>
    </blockquote>
    <br>
  </body>
</html>