[FieldTrip] source pos dimensions ft_sourcestatistics

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Mon Jun 26 14:57:22 CEST 2017


Senor Schoffelen,

C'est vrai! But what to do? I've been trying ft_source2full, but that
doesn't do the trick. In other words, I'm back to where I started when I
cried my first cry for help (to the FT mailinglist, not birth).

Should I try to reshape the data to a regular grid? But can't FT do that
somewhere brilliantly without my interference?

Merci,
Stephen

On 26 June 2017 at 14:45, Schoffelen, J.M. (Jan Mathijs) <
jan.schoffelen at donders.ru.nl> wrote:

> Monsieur Stephen!
>
> I would expect that prod(stat.dim), which is on the order of 5780 is equal
> to the number of positions. This is clearly not the case. It could be that
> this confuses ft_sourceinterpolate.
> Best,
> JM
>
>
> On 26 Jun 2017, at 13:42, Stephen Whitmarsh <stephen.whitmarsh at gmail.com>
> wrote:
>
> Hi again Mathijs :-)
>
> The problem seems to be shifted toward the next step: I now want to
> visualize the stats on an anatomical image (the same template on which the
> subject inverse headmodels were based). For this I need to interpolate, but
> that breals. The following datasets go into ft_sourceinterpolate:
>
> stat =
>
>   struct with fields:
>
>                    prob: [2982×1 double]
>             posclusters: [1×3 struct]
>     posclusterslabelmat: [2982×1 double]
>         posdistribution: [1×1000 double]
>             negclusters: [1×4 struct]
>     negclusterslabelmat: [2982×1 double]
>         negdistribution: [1×1000 double]
>                 cirange: [2982×1 double]
>                    mask: [2982×1 logical]
>                    stat: [2982×1 double]
>                     ref: [2982×1 double]
>                  dimord: 'pos'
>                     dim: [17 20 17]
>                    freq: 10.5000
>                     pos: [2982×3 double]
>                     cfg: [1×1 struct]
>
> and:
>
>
> template_mri =
>
>   struct with fields:
>
>           dim: [91 109 91]
>       anatomy: [91×109×91 double]
>           hdr: [1×1 struct]
>     transform: [4×4 double]
>          unit: 'mm'
>      coordsys: 'spm'
>        inside: [91×109×91 logical]
>
> Now, if I run the following:
>
> cfg            = [];
> cfg.parameter  = 'stat';
> stat_int       = ft_sourceinterpolate(cfg, stat, template_mri);
>
> I get the following error:
>
> Warning: could not reshape stat to the expected dimensions
> > In ft_datatype_volume (line 136)
>   In ft_checkdata (line 351)
>   In ft_sourceinterpolate (line 170)
> selecting subvolume of 0.0%
> reslicing and interpolating stat
> interpolating
> Error using interpn (line 153)
> Wrong number of input arguments.
>
> Error in ft_sourceinterpolate>my_interpn (line 693)
>   av(sel) = interpn(fv, ax(sel), ay(sel), az(sel), interpmethod);
>
> Error in ft_sourceinterpolate (line 595)
>           av( sel) = my_interpn(fv, ax(sel), ay(sel), az(sel),
> cfg.interpmethod, cfg.feedback);
>
> 153         error(message('MATLAB:interpn:nargin'));
>
> Now, I did try to add a .statdimord field, but that didn't make a
> difference.
> Any idea?
>
> Thanks,
> Stephen
>
>
> On 26 June 2017 at 13:09, Stephen Whitmarsh <stephen.whitmarsh at gmail.com>
> wrote:
>
>> Hi Jan-Mathijs,
>>
>> Indeed, adding a .dim field did it!
>>
>> Thanks again,
>> Stephen
>>
>> On 24 June 2017 at 09:30, Schoffelen, J.M. (Jan Mathijs) <
>> jan.schoffelen at donders.ru.nl> wrote:
>>
>>> Hi Stephen,
>>>
>>> The error suggests that Fieldtrip does not manage to guess whether the
>>> set of dipole positions are defined on a regular grid, or whether it’s on a
>>> 2D mesh. Your source structure either needs a ‘dim’ field (if indeed the
>>> positions describe a full 3D grid in an ordered way), or it needs a ‘tri’,
>>> defining the edges between the nodes.
>>>
>>> Best,
>>> JM
>>>
>>>
>>> J.M.Schoffelen, MD PhD
>>> Senior Researcher, VIDI-fellow - PI, language in interaction
>>> Telephone: +31-24-3614793 <+31%2024%20361%204793>
>>> Physical location: room 00.028
>>> Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands
>>>
>>> On 23 Jun 2017, at 16:28, Stephen Whitmarsh <stephen.whitmarsh at gmail.com>
>>> wrote:
>>>
>>> Dear Jan-Mathijs,
>>>
>>> Thanks, I've been away but back on it now.
>>> I've been going over it again, and while plotting works fine (after
>>> sourceinterpolate), sourcestatistics still throws the same error. Just to
>>> be clear - i am using/creating current source-level datastructures and
>>> without complicating things, I end up with the following data structures
>>> that go into sourceanalysis.
>>>
>>>          pos: [2982×3 double]
>>>         freq: 10.5000
>>>          cfg: [1×1 struct]
>>>           MI: [2982×1 double]
>>>       inside: [2982×1 logical]
>>>     MIdimord: 'pos'
>>>
>>> The error I keep getting is:
>>>
>>> Error using spm_bwlabel
>>> spm_bwlabel: CONN must be 6, 18 or 26
>>>
>>> Error in clusterstat (line 222)
>>>       [negclusobs, negnum] = spm_bwlabel(tmp, 2*numdims);
>>>
>>> Error in ft_statistics_montecarlo (line 347)
>>>   [stat, cfg] = clusterstat(cfg, statrand, statobs);
>>>
>>> Error in ft_sourcestatistics (line 205)
>>>   [stat, cfg] = statmethod(cfg, dat, design);
>>>
>>> It's a mystery what might be wrong. Would you have any further leads?
>>>
>>> Thanks again,
>>> Stephen
>>>
>>> On 18 May 2017 at 21:35, Schoffelen, J.M. (Jan Mathijs) <
>>> jan.schoffelen at donders.ru.nl> wrote:
>>>
>>>> Hi Stephen,
>>>>
>>>> source2full and source2sparse are probably quite outdated, and do not
>>>> seem to work well anymore with the latest type of source-level data
>>>> structures. Most relevantly, the inside field these days is by default a
>>>> boolean vector of size nposx1, whereas once upon a time the inside and
>>>> outside fields together contained the indices of the dipole positions,
>>>> indicating which positions are on the in-/outside.
>>>>
>>>> Do you need the source2sparse step to begin with?
>>>>
>>>> Best,
>>>> JM
>>>>
>>>>
>>>>
>>>> On 17 May 2017, at 16:46, Stephen Whitmarsh <
>>>> stephen.whitmarsh at gmail.com> wrote:
>>>>
>>>> Hi there,
>>>>
>>>>
>>>> After beamformer sourceanalysis I end up with datastructures looking
>>>> like:
>>>>
>>>>   struct with fields:
>>>>
>>>>          freq: 10.5000
>>>>           cfg: [1×1 struct]
>>>>           pos: [2982×3 double]
>>>>           pow: [2982×1 double]
>>>>        inside: [2982×1 logical]
>>>>     powdimord: 'pos'
>>>>
>>>> The .inside field is created by ft_selectdata used to average across
>>>> frequencies, and contains all 1s. Running sourceanalysis with this data
>>>> trows the following error:
>>>>
>>>>
>>>> Error using spm_bwlabel
>>>> spm_bwlabel: CONN must be 6, 18 or 26
>>>>
>>>> Error in clusterstat (line 222)
>>>>       [negclusobs, negnum] = spm_bwlabel(tmp, 2*numdims);
>>>>
>>>> Error in ft_statistics_montecarlo (line 347)
>>>>   [stat, cfg] = clusterstat(cfg, statrand, statobs);
>>>>
>>>> Error in ft_sourcestatistics (line 205)
>>>>   [stat, cfg] = statmethod(cfg, dat, design);
>>>>
>>>> *222 *      [negclusobs, negnum] = spm_bwlabel(tmp, 2*numdims);
>>>>
>>>>
>>>> I think this results because of a wrong estimate of the dimensionality,
>>>> resulting from the fact that the data is represented in an array rather
>>>> than a 3-dimensional matrix, which it seems to expect.
>>>>
>>>> I think therefor that I might need to convert my data back into a 3-d
>>>> representation, i..e not a sparse but full representation. I have tried
>>>> using ft_source2full, but that is not straightforward as I only have inside
>>>> voxels/positions. In other words, I would need to do exactly the same as
>>>> ft_source_statistics seems to want to do with spm_bwlabel.
>>>>
>>>> So I guess I might just have put FieldTrip on the wrong leg, to use a
>>>> Dutch expression.
>>>>
>>>> Any suggestions?
>>>>
>>>> Best,
>>>> Stephen
>>>>
>>>>
>>>> _______________________________________________
>>>> fieldtrip mailing list
>>>> fieldtrip at donders.ru.nl
>>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> fieldtrip mailing list
>>>> fieldtrip at donders.ru.nl
>>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>>
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>
>>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170626/40caa210/attachment-0002.html>


More information about the fieldtrip mailing list