<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Dear Fieldtrip community,<br>
    <br>
    I am a second year PhD student from Slovenia, looking for some help.
    As the title suggests, I am trying to project simulated source
    activity to the surface (EEG data simulation from sources).<br>
    <br>
    Up to now, I have simulated 90 timeseries at the source level using
    Jansen-Rit neuronal mass models, based on the AAL volumetric atlas
    (activity is placed in each center of the 90 regions), so I have
    90x3000 matrix (sources x time points). I have decided to project
    the source activity to 128 channel standard Biosemi 128 EEG setup.
    Now I have issues with defining forward model from the AAL sources
    to the EEG channels. <br>
    <br>
    <p>Currently, I have followed your online examples to create
      headmodel (BEM) and the forward model, with the important part of
      the code being: <br>
    </p>
    <div class="lineNode">
      <div class="rtcContent">
        <div class="lineNode"><span style="white-space: pre"><span>headmodel = ft_read_headmodel(</span><span style="color: rgb(167, 9, 245);">'standard_bem.mat'</span><span>);</span><span style="color: rgb(0, 128, 19);">
</span></span></div>
        <div class="lineNode"><span style="white-space: pre"><span>[headmodel, sens] = ft_prepare_vol_sens(headmodel, sens);</span><span style="color: rgb(0, 128, 19);">
</span></span></div>
        <div class="lineNode"><span style="white-space: pre"><span>[lf] = ft_compute_leadfield(atlas_rois, sens, headmodel);      where atlas_rois is a 90x3 double, with 3d positions of source dipoles (at AAL centers)</span></span></div>
      </div>
    </div>
    <p>
      <style type="text/css">.rtcContent { padding: 30px; }.lineNode {font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-style: normal; font-weight: normal; }</style></p>
    <p>What I don't understand is the output of the function <i><span style="white-space: pre"><span>ft_compute_leadfield</span></span></i>,
      which is a 128x270 double. Could you please explain what it
      represents? As far as I understand, the surface EEG should be
      obtained by the equation <i>surface_time_series = </i><i><i><i>forward_model
            * </i>source_time_serie</i><i>s</i></i>, meaning that the
      dimensions should have been <i>[</i><i><span style="color: rgb(55, 65, 81); font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgb(247, 247, 248); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">number of electrodes) x (number of time points)</span>]
        = [</i><i><span style="color: rgb(55, 65, 81); font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgb(247, 247, 248); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">number of electrodes) x (number of sources)</span>]
        * [(</i><i><span style="color: rgb(55, 65, 81); font-family: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgb(247, 247, 248); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">number of sources) x (number of time points</span>],
        which comes down to: [128x3000] = [128x90] * [90x3000]....   </i>Is
      there a reason 3*90=270? Do source (dipole) orientations play a
      role?<br>
    </p>
    <p>Additionally for clarification, to obtain the final EEG
      projection, would it be then correct to directly apply the
      equation <i>surface_time_series = </i><i><i><i>forward_model * </i>source_time_serie</i><i>s,
        </i></i>with forward model being the variable <i>"</i><span style="white-space: pre"><span>lf</span></span><i>"</i>?<br>
    </p>
    <p>I have tried various toolboxes for this simulated sources to EEG
      projection (TVB, MNE, SPM, Fieldtrip) and had issues everywhere,
      but came the furthest with Fieldtrip, so I would really appreciate
      your help. General recommendations on this topic would also be
      greatly appreciated.</p>
    <p>Thank you very much!<br>
    </p>
    <p>Kind regards,</p>
    <p>Nina Omejc<br>
    </p>
    <br>
    <br>
  </body>
</html>