<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Thanks Jörn and Tzvetan for the scripts! I'll try it out and put it
    on the wiki.<br>
    Have a great day,<br>
    Ingrid<br>
    <br>
    <div class="moz-cite-prefix">On 4/9/2013 12:32 AM, Tzvetan Popov
      wrote:<br>
    </div>
    <blockquote
      cite="mid:43CC12AA-D78E-4374-A201-FD4F7B2C8736@uni-konstanz.de"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      Dear Ingrid,
      <div><br>
      </div>
      <div>in addition to Jorn's approach since you don't have MR and
        digitized elec position's you can load and realign the
        electrodes to the standard bem. Subsequently you can calculate
        the lead field and  continue with your analysis pipeline.</div>
      <div>Good luck</div>
      <div>tzvetan</div>
      <div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier;
          color: rgb(37, 153, 45); ">%% read electrodes</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier;
          color: rgb(178, 69, 243); "><span style="color: #000000">elec
            = ft_read_sens(</span>'/your
          path/fieldtrip-20130324/template/electrode/GSN-HydroCel-128.sfp'<span
            style="color: #000000">);</span></div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier;
          color: rgb(37, 153, 45); ">%% read  headmodel</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier;
          color: rgb(178, 69, 243); "><span style="color: #000000">templateheadmodel
            = </span>'/your
          path/fieldtrip-20130324/template/headmodel/standard_bem.mat'<span
            style="color: #000000">;</span></div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">load(templateheadmodel);</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier;
          color: rgb(37, 153, 45); ">%% electrode realign as good as
          possible</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier;
          color: rgb(37, 153, 45); ">% i.e. translate 0 -2 1.5</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">cfg=[];</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">cfg.method
          = <span style="color: #b245f3">'interactive'</span>;</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">cfg.elec
          = elec;</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">cfg.headshape
          = vol.bnd(1).pnt;</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">elecR
          = ft_electroderealign(cfg);</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier;
          color: rgb(37, 153, 45); ">%% verify how the electrodes fit
          toghether with the brain volume</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">cfg=[];</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">cfg.method
          = <span style="color: #b245f3">'interactive'</span>;</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">cfg.elec
          = elecR;</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">cfg.headshape
          = vol.bnd(3).pnt;</div>
        <div style="margin: 0px; font-size: 9px; font-family: Courier; ">elecR
          = ft_electroderealign(cfg);</div>
      </div>
      <div><br>
      </div>
      <div>
        <div><br class="Apple-interchange-newline">
          <blockquote type="cite">
            <meta content="text/html; charset=ISO-8859-1"
              http-equiv="Content-Type">
            <div text="#000000" bgcolor="#FFFFFF">
              <div class="moz-cite-prefix">Hi Ingrid,<br>
                <br>
                I just happen to done this a few weeks back, I changed
                things in the meanwhile, but I hope that the below steps
                are complete:<br>
                <i><small>% read in the template MRI<br>
                        if isunix<br>
                          mri =
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', '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', 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 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))</small></i><br>
                <br>
                <br>
                Afair, that's all that is needed. Of course you need to
                adjust folder and file names.<br>
                <br>
                Greetings<br>
                Jörn<br>
                <br>
                On 4/9/2013 2:04 AM, Ingrid Nieuwenhuis wrote:<br>
              </div>
              <blockquote cite="mid:51635B04.7090004@berkeley.edu"
                type="cite">Hi all, <br>
                <br>
                I'd like to do source analysis (loreta and or DICS) on
                my EEG data. I don't have anatomical MRIs and I don't
                have a measurement of the scalp surface. So I'd like to
                use a template MRI or a template head model that is
                located in the FieldTrip template directory. I have EGI
                (128 channels) data and electrode positions (not subject
                specific, just the standard file also available in
                FieldTrip electrode template, GSN-HydroCel-128.sfp), but
                I'm kind of stuck how to start. I don't see any examples
                on the FieldTrip page of how to make a headmodel and
                volume conduction model giving only this limited data.
                I'd be happy to make it into a example Matlab script on
                the FieldTrip page after I got it to work. Would someone
                be able to give me some pointers, or example code? <br>
                <br>
                Thanks a lot! <br>
                Ingrid <br>
                <br>
              </blockquote>
              <br>
              <br>
              <pre class="moz-signature" cols="72">-- 
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour 
Centre for Cognitive Neuroimaging
Radboud University Nijmegen 
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:jm.horschig@donders.ru.nl">jm.horschig@donders.ru.nl</a>
Tel:    +31-(0)24-36-68493
Web: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.ru.nl/donders">http://www.ru.nl/donders</a>

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands</pre>
            </div>
            _______________________________________________<br>
            fieldtrip mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
            <a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>
        </div>
        <br>
        <div apple-content-edited="true">
          <span class="Apple-style-span" style="border-collapse:
            separate; border-spacing: 0px; "><span
              class="Apple-style-span" style="border-collapse: separate;
              color: rgb(0, 0, 0); font-family: Helvetica; font-size:
              12px; font-style: normal; font-variant: normal;
              font-weight: normal; letter-spacing: normal; line-height:
              normal; orphans: 2; 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; ">
              <div style="word-wrap: break-word; -webkit-nbsp-mode:
                space; -webkit-line-break: after-white-space; "><span
                  class="Apple-style-span" style="border-collapse:
                  separate; color: rgb(0, 0, 0); font-family: Helvetica;
                  font-size: 12px; font-style: normal; font-variant:
                  normal; font-weight: normal; letter-spacing: normal;
                  line-height: normal; orphans: 2; 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; ">
                  <div style="word-wrap: break-word; -webkit-nbsp-mode:
                    space; -webkit-line-break: after-white-space; "><span
                      class="Apple-style-span" style="border-collapse:
                      separate; color: rgb(0, 0, 0); font-family:
                      Helvetica; font-size: 12px; font-style: normal;
                      font-variant: normal; font-weight: normal;
                      letter-spacing: normal; line-height: normal;
                      orphans: 2; 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; ">
                      <div style="word-wrap: break-word;
                        -webkit-nbsp-mode: space; -webkit-line-break:
                        after-white-space; "><span
                          class="Apple-style-span"
                          style="border-collapse: separate; color:
                          rgb(0, 0, 0); font-family: Helvetica;
                          font-size: 12px; font-style: normal;
                          font-variant: normal; font-weight: normal;
                          letter-spacing: normal; line-height: normal;
                          orphans: 2; 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; ">
                          <div style="word-wrap: break-word;
                            -webkit-nbsp-mode: space;
                            -webkit-line-break: after-white-space; "><span
                              class="Apple-style-span"
                              style="border-collapse: separate;
                              -webkit-border-horizontal-spacing: 0px;
                              -webkit-border-vertical-spacing: 0px;
                              color: rgb(0, 0, 0); font-family:
                              Helvetica; font-size: 12px; font-style:
                              normal; font-variant: normal; font-weight:
                              normal; letter-spacing: normal;
                              line-height: normal;
                              -webkit-text-decorations-in-effect: none;
                              text-indent: 0px;
                              -webkit-text-size-adjust: auto;
                              text-transform: none; orphans: 2;
                              white-space: normal; widows: 2;
                              word-spacing: 0px; ">
                              <div style="word-wrap: break-word;
                                -webkit-nbsp-mode: space;
                                -webkit-line-break: after-white-space; ">
                                <div>*******************************************</div>
                                <div>Tzvetan Popov  </div>
                                <div>Clinical Psychology       </div>
                                <div>University of Konstanz</div>
                                <div>Box 23</div>
                                <div>78457 Konstanz, GERMANY</div>
                                <div>Phone: 0049-7531-883086</div>
                                <div>Fax:      0049-7531-884601</div>
                                <div>Email:  <a moz-do-not-send="true"
                                    href="mailto:tzvetan.popov@uni-konstanz.de">tzvetan.popov@uni-konstanz.de</a></div>
                              </div>
*******************************************</span></div>
                        </span><br class="Apple-interchange-newline">
                      </div>
                    </span><br class="Apple-interchange-newline">
                  </div>
                </span><br class="Apple-interchange-newline">
              </div>
            </span><br class="Apple-interchange-newline">
          </span><br class="Apple-interchange-newline">
        </div>
        <br>
      </div>
      <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>
    <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>
  </body>
</html>