<div dir="ltr"><div>Dear Fieldtrip community,</div><div><br></div><div>In ft_prepare_sourcemodel there is an option the meaning of which is not clear to me.<br></div><div><br></div><div>From ft_prepare_sourcemodel reference documentation:</div><div>%cfg.inwardshift  = number, how much should the innermost surface be moved inward to constrain<br></div><div><div>%                      sources to be considered inside the source compartment (default = 0)</div><div class="gmail_extra"><br></div><div class="gmail_extra">In a fieldtrip tutorial this value is set to cfg.inwardshift = -1.5, but it does not expain why..</div><div class="gmail_extra"><a href="http://www.fieldtriptoolbox.org/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space">http://www.fieldtriptoolbox.org/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Can someone explain what the practical purpose of this option is, i.e., what problem does it address? Naively speaking, I would not have this option at all and always have the value at zero - why should the surface be shifted at all? Inside is inside, and outside is outside, right? Clearly I am missing something here...</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks in advance,</div><div class="gmail_extra">Maris</div><div class="gmail_extra"><br></div><div class="gmail_extra"> </div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 15, 2015 at 12:00 PM,  <span dir="ltr"><<a href="mailto:fieldtrip-request@science.ru.nl" target="_blank">fieldtrip-request@science.ru.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Send fieldtrip mailing list submissions to<br>
        <a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:fieldtrip-request@science.ru.nl">fieldtrip-request@science.ru.nl</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:fieldtrip-owner@science.ru.nl">fieldtrip-owner@science.ru.nl</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of fieldtrip digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: Problem with ft_megrealign (Daria Laptinskaya)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 15 Sep 2015 11:36:15 +0200<br>
From: Daria Laptinskaya <<a href="mailto:daria.laptinskaya@googlemail.com">daria.laptinskaya@googlemail.com</a>><br>
To: FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>><br>
Subject: Re: [FieldTrip] Problem with ft_megrealign<br>
Message-ID:<br>
        <<a href="mailto:CADcxnnNDRP_DYQGq%2BuEeqKJVvVd%2BAEzXNszbPwc1LWC13wqJjw@mail.gmail.com">CADcxnnNDRP_DYQGq+uEeqKJVvVd+AEzXNszbPwc1LWC13wqJjw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Dear J?rn,<br>
<br>
<br>
thank you very much for your helpful answer! I did not want to answer<br>
before running the function. First I got an error message with the notice<br>
that separate structures of the cfg.template could not be translated into a<br>
variable of the type double (template variable).  Hence I defined the<br>
template variable as a cell-array:<br>
<br>
Ntemplate = length(cfg.template);<br>
<br>
template = cell(Ntemplate, 1);<br>
<br>
<br>
<br>
and at the end did this:<br>
<br>
j = 1;<br>
<br>
<br>
<br>
for i=1:length(template)<br>
<br>
<br>
<br>
    eval(['tp', num2str(j), ' = template{1};'])<br>
<br>
<br>
<br>
    j = j+1;<br>
<br>
end<br>
<br>
<br>
<br>
template_new = ([tp1, tp2]);<br>
<br>
<br>
<br>
grad = ft_average_sens(template_new);<br>
<br>
<br>
<br>
Now it works fine, then I leave out the cfg.headshape = ?hs_file?.  Using<br>
this command is leading to the following error message: Reference to<br>
non-existent field 'xgrid'. I understand the message, but could not fix the<br>
problem till now. I could swear, it worked some time ago :).<br>
<br>
I?m sorry to bother you with this, but I would appreciate, if you or<br>
someone else could give me a further tip, how to solve the problem.<br>
<br>
Many thank in advance!<br>
<br>
<br>
Best,<br>
<br>
Daria<br>
<br>
2015-09-10 10:52 GMT+02:00 J?rn M. Horschig <<a href="mailto:jorn@artinis.com">jorn@artinis.com</a>>:<br>
<br>
> Dear Daria,<br>
><br>
><br>
><br>
> try initializing tp_avg just before the for-loop, e.g. by set tp_avg = []<br>
><br>
><br>
><br>
> The error message you got means that you have a function called template<br>
> somewhere in your path. In the command line, you can type<br>
><br>
> >> which template<br>
><br>
> to find out where function is located. Afaik it?s not a FieldTrip<br>
> function.  Anyway, to fix this, the template variable should have been<br>
> initialized in the same vein as I described above. I?ll quickly fix this so<br>
> that this does not happen anymore in the new version (from tomorrow<br>
> onwards).<br>
><br>
> This means, also for you the fix would have been just to initialize the<br>
> template variable rather than renaming the variable, but your solution also<br>
> works fine after initializing the variable ;)<br>
><br>
><br>
><br>
> Best,<br>
><br>
> J?rn<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> *--*<br>
><br>
><br>
><br>
> *J?rn M. Horschig, PhD*, Software Engineer<br>
><br>
> Artinis Medical Systems <<a href="http://www.artinis.com/" rel="noreferrer" target="_blank">http://www.artinis.com/</a>>  |  <a href="tel:%2B31%20481%20350%20980" value="+31481350980">+31 481 350 980</a><br>
><br>
><br>
><br>
> *From:* <a href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a> [mailto:<br>
> <a href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a>] *On Behalf Of *Daria Laptinskaya<br>
> *Sent:* Thursday, September 10, 2015 10:39 AM<br>
> *To:* FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>><br>
> *Subject:* [FieldTrip] Problem with ft_megrealign<br>
><br>
><br>
><br>
> Dear all,<br>
><br>
> I would like to apply the ft_megrealign function to MEG data.<br>
><br>
> First I tried this:<br>
><br>
>     cfg             = [];<br>
><br>
>     cfg.vol.r       = 12;<br>
><br>
>     cfg.vol.o       = [0, 0, 4];<br>
><br>
>     cfg.template    = allsens;<br>
><br>
>     cfg.channel     = {'MEG'};<br>
><br>
>     cfg.inwardshift =  1;<br>
><br>
>     cfg.headshape   = 'hs_file';<br>
><br>
><br>
><br>
> new_data = ft_megrealign(cfg, old_data);<br>
><br>
><br>
><br>
> Then I got the following error message:<br>
><br>
> At compilation, "template" was determined to be a variable and this<br>
> variable is<br>
> uninitialized. "template" is also a function name and previous versions of<br>
> MATLAB would<br>
> have called the function. However, MATLAB 7 forbids the use of the same<br>
> name in the same<br>
> context as both a function and a variable.<br>
><br>
><br>
><br>
> I thought that renaming the variable ?template? would solve the problem<br>
> and did the following within the original function (replaced the<br>
> template-variable with the Ntp_avg variable):<br>
><br>
><br>
><br>
> Ntp_avg = length(cfg.template);<br>
><br>
> for i=1:Ntp_avg<br>
><br>
>   if ischar(cfg.template{i}),<br>
><br>
>     fprintf('reading template sensor position from %s\n',<br>
> cfg.template{i});<br>
><br>
>     tp_avg(i) = ft_read_sens(cfg.template{i});<br>
><br>
>   elseif isstruct(cfg.template{i}) && isfield(cfg.template{i}, 'coilpos')<br>
> && isfield(cfg.template{i}, 'coilori') && isfield(cfg.template{i}, 'tra'),<br>
><br>
>     tp_avg(i) = cfg.template{i};<br>
><br>
>   end<br>
><br>
> end<br>
><br>
><br>
><br>
> No I get an error message, that ?the variable tp_avg is not defined?.<br>
><br>
> Do I forget something? Or do anyone have an other solution for the problem?<br>
><br>
><br>
><br>
> I would appreciate any help / ideas!<br>
><br>
><br>
><br>
> Thanks in advance!<br>
><br>
><br>
><br>
> Best,<br>
><br>
> Daria<br>
><br>
> _______________________________________________<br>
> fieldtrip mailing list<br>
> <a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150915/923298df/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150915/923298df/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<br>
End of fieldtrip Digest, Vol 58, Issue 14<br>
*****************************************<br>
</blockquote></div><br></div></div></div>