<p dir="ltr">Hi Casper,</p>
<p dir="ltr">The cfg.anaparameter should then be 'anatomy'.  It refers to the field (in data) in which the anatomy can be found, in your case: data.anatomy.</p>
<p dir="ltr">Hope this helps,</p>
<p dir="ltr">Hanneke</p>
<div class="gmail_quote">Op 23 jan. 2013 10:57 schreef "Casper van Heck" <<a href="mailto:caspervanheck@gmail.com">caspervanheck@gmail.com</a>> het volgende:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Dear Jan-Mathijs,<div><br></div><div>Since ft_sourceplot complained about not having anatomy (or functional) parameter, and it seems to default to a field named '<i>data.anatomy'</i>, I assumed adding <i>mri.anatomy</i> in <i>data.anatomy</i> would suffice.</div>


<div><br></div><div>But, without this, ft_sourceplot would again require an anatomy parameter, so that would mean that I need to ut '<i>cfg.anaparameter = mri</i>' in the cfg I feed to ft_sourceplot, where 'mri' is the result from ft_volumereslice.</div>


<div>However, ft_sourceplot then says "<i>do not understand cfg.anaparameter</i>", and thus it is not plotting "<i>anatomy</i>". After looking back to the plotting tutorial where I read "The anatomy can be read with ft_read_mri", I'm not quite sure what's going wrong.</div>


<div><br></div><div>Sincerely,</div><div><br></div><div>Casper</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 22, 2013 at 9:49 AM, jan-mathijs schoffelen <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi intersect(everyone, casper)<div><div><br></div><div><blockquote type="cite">

<div dir="ltr"><div><div><div>Everyone,</div><div><br></div>While the whole script is way too convoluted to put up here, but luckily the relevant steps are quite simple<div>Input is simply raw data, read with ft_preprocessing, which is passed through functions as shown in my previous email.</div>


<div><br></div><div>After passing the data to ft_sourcegrandaverage (only using cfg.outputfile), where the data is fed as a cell array (which seems to work properly), I go over to a source-comparison script. This script works as follows:</div>


<div><div>First I create a pre-post contrast as shown in the beamformer tutorial.</div><div><br></div><div>Next, I read some MRI-data using ft_read_mri from a standard folder, and reslice this data:</div><div><div><i>mri = ft_read_mri(strcat(h.subject,'Subject01.mri'));  <br>


</i></div><div><i>mri = ft_volumereslice([], mri);</i></div><div><br></div></div></div></div></div></div></blockquote></div></div><div><div><div><blockquote type="cite"><div dir="ltr"><div><div><div>Then:</div>

<div><div><i>[data] = ft_sourceinterpolate(cfg, data, mri);<br>

</i></div><div>where cfg contains:</div><div><div><div><i>cfg.parameter: 'avg.pow'</i></div><div><i>cfg.downsample: 4</i></div></div><div><br></div></div><div>and I add the anatomy:</div></div><div>

<i>data.anatomy = mri.anatomy; clear mri</i></div></div></div></div></blockquote><div><br></div></div><div><div>Putting mri.anatomy into data.anatomy is probably not what you want to do: the whole point about ft_sourceinterpolate is to get the functional and anatomical data in the same 'pixel-space'; this is the only way that ft_sourceplot (as of yet) can deal with it. The reason is that now the functional data is sampled once every 4 voxels, relative to the anatomy. I guess that this causes your problem in ft_sourceplot.</div>


<div><blockquote type="cite"><div dir="ltr"><div><div><div></div></div></div></div></blockquote></div></div><div><br></div><div><br></div><div>Best wishes,</div><div><br></div><div>Jan-Mathijs</div><div><div><div>

<br></div><div><br></div><br><blockquote type="cite"><div dir="ltr"><div><div><div>And finally, I call ft_sourceplot using these options:</div></div></div></div></blockquote><blockquote type="cite"><div dir="ltr"><div><div>


<div>cfg.<i>parameter: 'avg.pow';</i></div></div></div></div></blockquote><blockquote type="cite"><div dir="ltr"><div><div><div><i>cfg.downsample: 4</i></div></div></div></div></blockquote><div><div><i><br></i></div>


</div></div></div></div><div><div><div><blockquote type="cite"><div dir="ltr"><div><div><div><div>with one of these three methods:</div><div>1) <i>cfg.method = 'surface';</i></div><div><i>    cfg.surffile = 'surface_l4_both.mat';</i></div>


<div><i>    cfg.surfdownsample = 4;</i></div>

<div><i>    cfg.projmethod = 'nearest';</i></div></div><div>2) <i>cfg.method = 'ortho';</i></div><div>3) <i>cfg.method = 'slice';</i></div><div><i>    cfg.nslices = 20;</i></div><div>Which leads to the errors shown earlier. At this point, disp(data) yields:</div>




<div><div><i>K>> disp(data)</i></div><div><i>         avg: [1x1 struct]</i></div><div><i>         pos: [16777216x3 double]</i></div><div><i>         dim: [256 256 256]</i></div><div><i>      inside: [1x16777216 double]</i></div>




<div><i>     outside: [1x0 double]</i></div><div><i>    coordsys: 'ctf'</i></div><div><i>        unit: 'mm'</i></div><div><i>         cfg: [1x1 struct]</i></div><div><i>     anatomy: [256x256x256 double]</i></div>




<div><i><br></i></div><div>I'm guessing it has something to do with the 'inside' and 'outside' elements, so my 'standard head model'. I think I made this using the following code:</div><div>

<div><i>mri = ft_read_mri(strcat(h.subject,'Subject01.mri')); % load 'standard' anatomical model<br></i></div><div><i><br></i></div><div><i>% segment the template brain and construct a volume conduction model (i.e. head model)</i></div>




<div><i>cfg             = [];</i></div><div><i>cfg.output      = {'brain' 'scalp' 'skull'};</i></div><div><i>cfg.downsample  = 2;</i></div><div><i>t_seg    = ft_volumesegment(cfg, mri);</i></div><div>




<i> </i></div><div><i>% create head model</i></div><div><i>cfg          = [];</i></div><div><i>cfg.method   = 'singlesphere';</i></div><div><i>cfg.hdmfile  = strcat(h.subject,'Subject01.hdm');</i></div><div>




<i>cfg.elec     = ft_read_sens('standard_1020.elc');</i></div><div><i>t_vol = ft_prepare_headmodel(cfg, t_seg);</i></div><div><i>clear template_seg</i></div><div><i><br></i></div><div><i>% construct the dipole grid in the template brain coordinates</i></div>




<div><i>cfg = [];</i></div><div><i>cfg.normalize = 'no'; % no normalization, since we're comparing two conditions THAT'S RIGHT I DID PAY ATTENTION</i></div><div><i>cfg.vol        = t_vol;</i></div><div><i>t_grid  = ft_prepare_sourcemodel(cfg);</i></div>




<div><i><br></i></div><div>After which I use this on all subjects, using this (note that I store all data in a single massive structure, to make saving to disk and selecting data etc. easier):</div><div><i>source{subj}.(datasets{d}) = sourceanalysis(data, t_vol, t_grid);</i></div>




<div><i><br></i></div><div>Anyone seeing anything obviously stupid?</div><div><br></div><div>Sincerely,</div><div><br></div><div>Casper</div></div></div><div></div></div></div></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Fri, Jan 18, 2013 at 4:43 PM,  <span dir="ltr"><<a href="mailto:Lilla.Magyari@mpi.nl" target="_blank">Lilla.Magyari@mpi.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




Hi Casper,<br>
<br>
I think it is really difficult to figure only from the error message what<br>
the problem is. I think it would be also useful to see the inputs (cfg,<br>
and your data) of ft_sourceplot. Could you just send me how your cfg and<br>
your data-structure looks like? (I mean that you do not need to send the<br>
actual data, just the screen output of disp(data) and disp(cfg)).<br>
<br>
Best,<br>
Lilla<br>
<div><br>
<br>
> Dear Fieldtrippers,<br>
><br>
> I've asked this question earlier, but either it got lost due to technical<br>
> reasons, or the people who actually understand what's happening here were<br>
> on vacation, so here it is again:<br>
><br>
> I've been trying to do a source analysis on a dataset with two conditions,<br>
> mostly following the tutorials and examples from the Fieldtrip site, and<br>
> come upon a problem; it won't plot. While the source analysis is not an<br>
> essential component of the analysis of this dataset (it's more along the<br>
> lines of "let's see if I can do this"), and I don't expect any result<br>
> other<br>
> than something like "there might be a source in the left hemisphere", I'd<br>
> still would like to found out why it's not working.<br>
><br>
> Essentially, I create a standard headmodel cause I don't have individual<br>
> MRI's from the "Subject1.mri"-example, using ft_volumesegment,<br>
> ft_prepare_headmodel and ft_prepare_sourcemodel, and try to get Fieldtrip<br>
> to find sources based on individual EEG-datasets using ft_freqanalysis<br>
> (with cfg.method = 'mtmfft') and ft_sourceanalysis.<br>
> After that, I use ft_sourcegrandaverage to produce, well, a grand average<br>
> source, and feed this via ft_sourceinterpolate to ft_sourceplot.<br>
><br>
> Now, ft_sourceplot has three plotting possibilities: slice, ortho, and<br>
> surface. Initially I tried to get the ortho-option to work, but this gave<br>
> the following error:<br>
</div>> *Attempted to access dim(3); index out of bounds because numel(dim)=2.*<br>
> *Error in ==> cornerpoints at 11<br>
> *<br>
> *Error in ==> ft_plot_slice at 157<br>
<div>> *<br>
><br>
> So, I tried the surf-option, which gave me this:<br>
</div>> *Undefined function or variable "val".*<br>
> *Error in ==> ft_sourceplot at 1174<br>
<div>> *<br>
><br>
> And finally, I tried the slice-option, which gave one of two errors (which<br>
> seems to be based on how many slices I requested):<br>
</div>> *Out of memory*<br>
<div>> Which is pretty damn impressive since I've got 8GB of RAM and a pagefile<br>
> topping of at 40GB<br>
> Or, the mildly disconcerting:<br>
</div>> *Matlab has encountered an internal error and has to close*<br>
> Which seems to have been caused by a so-called *"Segmentation violation"<br>
> *<br>
<div><div>><br>
> Can anyone offer any insight in these errors? I think I'm doing something<br>
> wrong pretty early on, but have no idea what it is.<br>
><br>
> Sincerely,<br>
><br>
> Casper van Heck<br>
><br>
><br>
> On Fri, Dec 21, 2012 at 1:43 PM, Casper van Heck<br>
> <<a href="mailto:caspervanheck@gmail.com" target="_blank">caspervanheck@gmail.com</a>>wrote:<br>
><br>
>> Dear Fieldtrippers,<br>
>><br>
>> I've been trying to do a source analysis on a dataset with two<br>
>> conditions,<br>
>> mostly following the tutorials and examples from the Fieldtrip site, and<br>
>> come upon a problem; it won't plot. While the source analysis is not an<br>
>> essential component of the analysis of this dataset (it's more along the<br>
>> lines of "let's see if I can do this"), and I don't expect any result<br>
>> other<br>
>> than something like "there might be a source in the left hemisphere",<br>
>> I'd<br>
>> still would like to found out why it's not working.<br>
>><br>
>> Essentially, I create a standard headmodel cause I don't have individual<br>
>> MRI's from the "Subject1.mri"-example, using ft_volumesegment,<br>
>> ft_prepare_headmodel and ft_prepare_sourcemodel, and try to get<br>
>> Fieldtrip<br>
>> to find sources based on individual EEG-datasets using ft_freqanalysis<br>
>> (with cfg.method = 'mtmfft') and ft_sourceanalysis.<br>
>> After that, I use ft_sourcegrandaverage to produce, well, a grand<br>
>> average<br>
>> source, and feed this via ft_sourceinterpolate to ft_sourceplot.<br>
>><br>
>> Now, ft_sourceplot has three plotting possibilities: slice, ortho, and<br>
>> surface. Initially I tried to get the ortho-option to work, but this<br>
>> gave<br>
>> the following error:<br>
</div></div>>> *Attempted to access dim(3); index out of bounds because numel(dim)=2.*<br>
>> *Error in ==> cornerpoints at 11<br>
>> *<br>
>> *Error in ==> ft_plot_slice at 157<br>
<div>>> *<br>
>><br>
>> So, I tried the surf-option, which gave me this:<br>
</div>>> *Undefined function or variable "val".*<br>
>> *Error in ==> ft_sourceplot at 1174<br>
<div>>> *<br>
>><br>
>> And finally, I tried the slice-option, which gave one of two errors<br>
>> (which<br>
>> seems to be based on how many slices I requested):<br>
</div>>> *Out of memory*<br>
<div>>> Which is pretty damn impressive since I've got 8GB of RAM and a pagefile<br>
>> topping of at 40GB<br>
>> Or, the mildly disconcerting:<br>
</div>>> *Matlab has encountered an internal error and has to close*<br>
>> Which seems to have been caused by a so-called *"Segmentation violation"<br>
>> *<br>
<div>>><br>
>> Can anyone offer any insight in these errors? I think I'm doing<br>
>> something<br>
>> wrong pretty early on, but have no idea what it is.<br>
>><br>
>> Sincerely,<br>
>><br>
>> Casper van Heck<br>
>><br>
</div><div><div>> _______________________________________________<br>
> fieldtrip mailing list<br>
> <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</div></div></blockquote></div><br></div>
_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>


</div><br></div></div><div><div>
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">


<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">


<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">


<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">


<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">


<div>Jan-Mathijs Schoffelen, MD PhD </div><div><br></div><div>Donders Institute for Brain, Cognition and Behaviour, <br>Centre for Cognitive Neuroimaging,<br>Radboud University Nijmegen, The Netherlands</div><div><br></div>


<div>Max Planck Institute for Psycholinguistics,</div><div>Nijmegen, The Netherlands</div><div><br></div><div><a href="mailto:J.Schoffelen@donders.ru.nl" target="_blank">J.Schoffelen@donders.ru.nl</a></div><div>Telephone: <a href="tel:%2B31-24-3614793" value="+31243614793" target="_blank">+31-24-3614793</a></div>


</div></span></div></span></div></span></div></span></div></span></span>
</div>
<br></div></div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>
<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" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div>