<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi all,<br>
      <br>
      Just had a brain wave, I'll share it for people with similar
      situation that might be interested in this thread. I think I
      should just get a random structural MRI that extends lower
      (includes ears and bit below), optimally of a subject with a head
      similar to the MNI template. Make a BEM model (hmm, have to fix
      these errors I mentioned earlier then, well, should be doable on
      linux using dipoli). Then use ft_electroderealign to align the
      electrodes to this MRI, do the source analysis for all subjects
      using this model, and subsequently use ft_volumenormalise to
      normalize to MNI template if I want to use any atlas
      functionality.<br>
      <br>
      If anyone did this already using FieldTrip and has a pre-made BEM
      (just like the standard_bem), would be really nice if you're
      willing to share :) <br>
      If not, I'll make my own, and people with low electrodes and no
      structural MRI and or no linux access can email me if they want to
      use it.<br>
      <br>
      Cheers,<br>
      Ingrid<br>
      <pre class="moz-signature" cols="72">-- 
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305</pre>
      On 4/10/2013 10:17 AM, Ingrid Nieuwenhuis wrote:<br>
    </div>
    <blockquote cite="mid:51659E90.4020805@berkeley.edu" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">Hi Lilla and Imali,<br>
        <br>
        Thanks for your replies. In my case, the problem is not the
        aligning. My nasion electrode is on the nasion, and Cz is on Cz,
        everything is where it should be. The EGI 128 electrode net
        really has these low electrodes, which are there specifically to
        make source analysis better by capturing more of the electric
        field. So I would have the best solution if I'd leave them
        there. However, in the model as derived from the MNI template,
        the skin part does not go down low enough.<br>
        <br>
        I looked at the picture after ft_prepare_vol_sens (see
        attachement, black is before, red is after), and indeed, this is
        not good. The low electrodes are squeezed up, and this will make
        source analysis worse. So I should indeed remove these
        electrodes (which is a pity), or find a better MNI template.<br>
        <br>
        <b>So my question is:</b><br>
        Does anyone know of a template in MNI space that extends more
        down? This template comes from SPM8, is there a version that
        extends lower? Or could I extend the skin roughly downwards with
        some triangular magic?<br>
        <br>
        I'm also a bit confused about the statement on this wiki page: <a
          moz-do-not-send="true"
href="http://fieldtrip.fcdonders.nl/template/headmodel?s[]=standard&s[]=bem">http://fieldtrip.fcdonders.nl/template/headmodel?s[]=standard&s[]=bem</a><br>
        under "revision information" header "skin" is says: "This skin
        surface is not used in the BEM model itself for computational
        reasons, but can be used for visualization."<br>
        But this does not seem to be the case, since my electrode
        positions are modified based on till where the skin goes. So the
        skin surface does significantly influence the source analysis. <br>
        <br>
        Anyway, thanks for all the help, and worse case, I just get rid
        of the low fellows.<br>
        <br>
        Cheers,<br>
        Ingrid<br>
        <br>
        <pre class="moz-signature" cols="72">-- 
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305</pre>
        On 4/10/2013 9:05 AM, Magyari, Lilla wrote:<br>
      </div>
      <blockquote cite="mid:51658DAE.9080207@mpi.nl" type="cite">hi
        Ingrid and Imali, <br>
        <br>
        <br>
        I think it is a really good question what to do in Ingrid's
        case. I do not know the "right" answer, but I would like to
        share my thoughts about it. <br>
        <br>
        The ft_prepare_vol_sens is indeed projects the electrode
        positions closer to the headsurface as Imali wrote. But this
        function called automatically when you create your leadfield, so
        you do not have to do it separately (unless you want to
        visualize the corrected electrode positions). <br>
        <br>
        However, I have been advised to rely on this projection
        carefully if electrode positions are far from the skin and
        specially, if the inaccuracies (distance from the skin) are not
        equally distributed across the electrodes, because that can
        cause a spatial bias. <br>
        <br>
        Therefore, my question would be: why are those electrodes so
        low? Are those positions reflect the actual positions of the
        electrodes during the measurement? If yes, I would not change
        their positions, I would rather try to extend my headmodel e.g.
        by using another template. (or another (but quite suboptimal)
        possibility is maybe to exclude those electrodes (and the data)
        from the analysis if they are anyway far from the brain.) <br>
        <br>
        If the position of the electrodes should be higher up on the
        head, then instead of relying on projection, I would try first
        to scale the electrodes to fit them into the headsurface with
        the ft_electroderealign function. <br>
        <br>
        I looked to the standard_bem file in the template directory, and
        I also load in the standard_1020.elc, and those electrodes
        perfectly fit the vol. So, it seems that the extension of the
        standard bem headsurface is suitable for the area which is
        covered by the those template electrodes. And I do not know if
        the electrode set you use should cover a larger surface of the
        head, or if it should be just adjusted to the given headsurface.
        <br>
        <br>
        Lilla <br>
        <br>
        <br>
        <br>
        <br>
        IMALI THANUJA HETTIARACHCHI wrote: <br>
        <blockquote type="cite">Hi Ingrid, <br>
          <br>
          I had a similar issue a few weeks ago, where my lower most
          electrodes <br>
          started floating after electrode realign using the
          ft_electroderealign <br>
          function. <br>
          <br>
          I used the ft_prepare_vol_sens as, <br>
          [vol, elecR]=ft_prepare_vol_sens (col,elecR) and this did the
          trick and <br>
          brought the electrodes on to the skin. <br>
          <br>
          Hope this helps...! <br>
          <br>
          Regards <br>
          Imali <br>
          <br>
          <br>
          *From:* <a moz-do-not-send="true"
            class="moz-txt-link-abbreviated"
            href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a>
          <br>
          [<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
            href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a>]
          on behalf of Ingrid Nieuwenhuis <br>
          [<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
            href="mailto:inieuwenhuis@berkeley.edu">inieuwenhuis@berkeley.edu</a>]
          <br>
          *Sent:* Wednesday, 10 April 2013 9:29 AM <br>
          *To:* <a moz-do-not-send="true"
            class="moz-txt-link-abbreviated"
            href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>
          <br>
          *Subject:* Re: [FieldTrip] source analysis EEG data without
          MRI <br>
          <br>
          Hi all, <br>
          <br>
          A follow up on this and some new issues: <br>
          <br>
          1) I first tried Jörn's approach by creating my own BEM,
          always fun to <br>
          make it yourself ;) However, I did not succeed since: <br>
          a) the dipoli method does not work on Windows <br>
          b) I downloaded the openmeeg toolbox, but got an error
          "om_minverser.exe <br>
          has stopped working" I've emailed their buglist <br>
          c) bemcp did run, but the result was not ok (see attachement).
          I also <br>
          got the warning "% Warning: Matrix is singular, close to
          singular or <br>
          badly scaled. Results may be inaccurate." several times, so
          that might <br>
          be the problem. <br>
          d) and asa gave the following error: % Error using
          ft_prepare_headmodel <br>
          (line 201) % You must supply a valid cfg.hdmfile for use with
          ASA headmodel <br>
          <br>
          And away went my determination to do it myself, so I continued
          using <br>
          thestandard_bem.mat <br>
          <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="http://fieldtrip.fcdonders.nl/template/headmodel?s[]=standard&s[]=bem"><http://fieldtrip.fcdonders.nl/template/headmodel?s[]=standard&s[]=bem></a>.
          <br>
          (I did not know this existed, I've added this link to note in
          the <br>
          headmodel tutorial <br>
          <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="http://fieldtrip.fcdonders.nl/tutorial/headmodel_eeg?&#background"><http://fieldtrip.fcdonders.nl/tutorial/headmodel_eeg?&#background></a>
          to <br>
          make it easier to find, thanks Tzvetan for pointing this
          out!). <br>
          <br>
          2) This worked and after some fiddling to get the electrodes
          aligned it <br>
          looks okay (see attached). <br>
          However, as you can see in the figures, I have several very
          low <br>
          electrodes, that are lower than the skin mesh. So I was
          wondering if <br>
          this is a problem? Since for accurate calculation of how the
          currents <br>
          flow from these low electrodes, I assume one needs the skin to
          go till <br>
          there? What happens when I have electrodes floating in thin
          air? <br>
          *So my question is:* <br>
          a) will this cause great inaccuracies? <br>
          b) if so, how can I extend the skin to go lower? The template
          MRI only <br>
          goes that far to the bottom... Trick anyone? <br>
          <br>
          Thanks again, <br>
          Ingrid <br>
          <br>
          <br>
          On 4/9/2013 9:39 AM, Ingrid Nieuwenhuis wrote: <br>
          <blockquote type="cite">Thanks Jörn and Tzvetan for the
            scripts! I'll try it out and put it on <br>
            the wiki. <br>
            Have a great day, <br>
            Ingrid <br>
            <br>
            On 4/9/2013 12:32 AM, Tzvetan Popov wrote: <br>
            <blockquote type="cite">Dear Ingrid, <br>
              <br>
              in addition to Jorn's approach since you don't have MR and
              digitized <br>
              elec position's you can load and realign the electrodes to
              the <br>
              standard bem. Subsequently you can calculate the lead
              field and <br>
              continue with your analysis pipeline. <br>
              Good luck <br>
              tzvetan <br>
              %% read electrodes <br>
              elec = ft_read_sens('/your <br>
              path/fieldtrip-20130324/template/electrode/GSN-HydroCel-128.sfp');

              <br>
              %% read headmodel <br>
              templateheadmodel = '/your <br>
              path/fieldtrip-20130324/template/headmodel/standard_bem.mat';

              <br>
              load(templateheadmodel); <br>
              %% electrode realign as good as possible <br>
              % i.e. translate 0 -2 1.5 <br>
              cfg=[]; <br>
              cfg.method = 'interactive'; <br>
              cfg.elec = elec; <br>
              cfg.headshape = vol.bnd(1).pnt; <br>
              elecR = ft_electroderealign(cfg); <br>
              %% verify how the electrodes fit toghether with the brain
              volume <br>
              cfg=[]; <br>
              cfg.method = 'interactive'; <br>
              cfg.elec = elecR; <br>
              cfg.headshape = vol.bnd(3).pnt; <br>
              elecR = ft_electroderealign(cfg); <br>
              <br>
              <br>
              <blockquote type="cite">Hi Ingrid, <br>
                <br>
                I just happen to done this a few weeks back, I changed
                things in the <br>
                meanwhile, but I hope that the below steps are complete:
                <br>
                /% read in the template MRI <br>
                if isunix <br>
                mri = <br>
                ft_read_mri('/home/common/matlab/fieldtrip/external/spm8/templates/T1.nii');

                <br>
                elseif ispc <br>
                mri = ft_read_mri(fullfile('M:', 'FieldTrip', 'trunk',
                'external', <br>
                'spm8', 'templates', 'T1.nii')); <br>
                end <br>
                <br>
                <br>
                % segment the MRI <br>
                cfg = []; <br>
                cfg.output = {'brain' 'skull' 'scalp'}; <br>
                segmentedmri = ft_volumesegment(cfg, mris); <br>
                <br>
                <br>
                % create the headmodel (BEM) <br>
                cfg = []; <br>
                %cfg.method ='openmeeg'; % TODO FIXME download openmeeg
                <br>
                if isunix <br>
                cfg.method ='dipoli'; % dipoli only works under linux <br>
                else <br>
                disp('TODO FIXME stick to dipoli for now or download
                openmeeg\n'); <br>
                keyboard; <br>
                end <br>
                hdm = ft_prepare_headmodel(cfg, segmentedmri); <br>
                <br>
                elec = ft_read_sens('standard_1020.elc'); <br>
                hdm = ft_convert_units(hdm, elec.unit); <br>
                <br>
                cfg = []; <br>
                cfg.grid.xgrid = -125:8:125; <br>
                cfg.grid.ygrid = -125:8:125; <br>
                cfg.grid.zgrid = -125:8:125; <br>
                cfg.grid.tight = 'yes'; <br>
                cfg.grid.unit = hdm.unit; <br>
                cfg.inwardshift = -1.5; <br>
                cfg.vol = hdm; <br>
                grid = ft_prepare_sourcemodel(cfg) <br>
                grid = ft_convert_units(grid, elec.unit); <br>
                <br>
                figure; <br>
                hold on; <br>
                ft_plot_mesh(hdm.bnd(1), 'facecolor',[0.2 0.2 0.2],
                'facealpha', <br>
                0.3, 'edgecolor', [1 1 1], 'edgealpha', 0.05); <br>
                ft_plot_mesh(grid.pos(grid.inside, :)); <br>
                <br>
                % this step is not necessary, cause you will see that
                everything is <br>
                already aligned <br>
                cfg = []; <br>
                cfg.method = 'interactive'; <br>
                cfg.elec = elec; <br>
                cfg.headshape = hdm.bnd(1); <br>
                tmp = ft_electroderealign(cfg); <br>
                elec = tmp; % I had a bug here that I couldn't assign
                elec directly <br>
                <br>
                %% verify location of occipital electrodes <br>
                <br>
                occ_elec = elec; <br>
                occ_chan = ft_channelselection({'O*', 'PO*', 'Cz*',
                'Fz*'}, elec.label); <br>
                occ_idx = match_str(elec.label, occ_chan); <br>
                occ_elec.chanpos = occ_elec.chanpos(occ_idx, :); <br>
                occ_elec.elecpos = occ_elec.elecpos(occ_idx, :); <br>
                occ_elec.label = occ_elec.label(occ_idx, :); <br>
                figure; <br>
                ft_plot_sens(occ_elec) <br>
                hold on; <br>
                ft_plot_vol(ft_convert_units(hdm, elec.unit))/ <br>
                <br>
                <br>
                Afair, that's all that is needed. Of course you need to
                adjust <br>
                folder and file names. <br>
                <br>
                Greetings <br>
                Jörn <br>
                <br>
                On 4/9/2013 2:04 AM, Ingrid Nieuwenhuis wrote: <br>
                <blockquote type="cite">Hi all, <br>
                  <br>
                  I'd like to do source analysis (loreta and or DICS) on
                  my EEG data. <br>
                  I don't have anatomical MRIs and I don't have a
                  measurement of the <br>
                  scalp surface. So I'd like to use a template MRI or a
                  template head <br>
                  model that is located in the FieldTrip template
                  directory. I have <br>
                  EGI (128 channels) data and electrode positions (not
                  subject <br>
                  specific, just the standard file also available in
                  FieldTrip <br>
                  electrode template, GSN-HydroCel-128.sfp), but I'm
                  kind of stuck <br>
                  how to start. I don't see any examples on the
                  FieldTrip page of how <br>
                  to make a headmodel and volume conduction model giving
                  only this <br>
                  limited data. I'd be happy to make it into a example
                  Matlab script <br>
                  on the FieldTrip page after I got it to work. Would
                  someone be able <br>
                  to give me some pointers, or example code? <br>
                  <br>
                  Thanks a lot! <br>
                  Ingrid <br>
                  <br>
                </blockquote>
                <br>
                <br>
                -- <br>
                Jörn M. Horschig <br>
                PhD Student <br>
                Donders Institute for Brain, Cognition and Behaviour <br>
                Centre for Cognitive Neuroimaging <br>
                Radboud University Nijmegen <br>
                Neuronal Oscillations Group <br>
                FieldTrip Development Team <br>
                <br>
                P.O. Box 9101 <br>
                NL-6500 HB Nijmegen <br>
                The Netherlands <br>
                <br>
                Contact: <br>
                <a moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:E-Mail:jm.horschig@donders.ru.nl">E-Mail:jm.horschig@donders.ru.nl</a>
                <br>
                Tel:+31-(0)24-36-68493 <br>
                Web:<a moz-do-not-send="true"
                  class="moz-txt-link-freetext"
                  href="http://www.ru.nl/donders">http://www.ru.nl/donders</a>
                <br>
                <br>
                Visiting address: <br>
                Trigon, room 2.30 <br>
                Kapittelweg 29 <br>
                NL-6525 EN Nijmegen <br>
                The Netherlands <br>
                _______________________________________________ <br>
                fieldtrip mailing list <br>
                <a moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
                <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                  href="mailto:fieldtrip@donders.ru.nl"><mailto:fieldtrip@donders.ru.nl></a>
                <br>
                <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>
                <br>
              </blockquote>
              <br>
              ******************************************* <br>
              Tzvetan Popov <br>
              Clinical Psychology <br>
              University of Konstanz <br>
              Box 23 <br>
              78457 Konstanz, GERMANY <br>
              Phone: 0049-7531-883086 <br>
              Fax: 0049-7531-884601 <br>
              Email: <a moz-do-not-send="true"
                class="moz-txt-link-abbreviated"
                href="mailto:tzvetan.popov@uni-konstanz.de">tzvetan.popov@uni-konstanz.de</a>
              <br>
              <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                href="mailto:tzvetan.popov@uni-konstanz.de"><mailto:tzvetan.popov@uni-konstanz.de></a>
              <br>
              ******************************************* <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              _______________________________________________ <br>
              fieldtrip mailing list <br>
              <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
                href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
              <br>
              <a moz-do-not-send="true" class="moz-txt-link-freetext"
                href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>
              <br>
            </blockquote>
            <br>
            -- <br>
            Ingrid Nieuwenhuis PhD <br>
            Postdoctoral Fellow <br>
            Sleep and Neuroimaging Laboratory <br>
            Department of Psychology <br>
            University of California, Berkeley <br>
            California 94720-1650 <br>
            Tolman Hall, room 5305 <br>
            <br>
            <br>
            _______________________________________________ <br>
            fieldtrip mailing list <br>
            <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
              href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
            <br>
            <a moz-do-not-send="true" class="moz-txt-link-freetext"
              href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>
            <br>
          </blockquote>
          <br>
          -- <br>
          Ingrid Nieuwenhuis PhD <br>
          Postdoctoral Fellow <br>
          Sleep and Neuroimaging Laboratory <br>
          Department of Psychology <br>
          University of California, Berkeley <br>
          California 94720-1650 <br>
          Tolman Hall, room 5305 <br>
          <br>
          <br>
          <br>
          _______________________________________________ <br>
          fieldtrip mailing list <br>
          <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
            href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
          <br>
          <a moz-do-not-send="true" class="moz-txt-link-freetext"
            href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>
          <br>
        </blockquote>
        _______________________________________________ <br>
        fieldtrip mailing list <br>
        <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
          href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
        <br>
        <a moz-do-not-send="true" class="moz-txt-link-freetext"
          href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>
        <br>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
fieldtrip mailing list
<a class="moz-txt-link-abbreviated" href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
<a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></pre>
    </blockquote>
    <br>
  </body>
</html>