From roycox.roycox at gmail.com  Thu Jun  1 00:30:30 2017
From: roycox.roycox at gmail.com (Roy Cox)
Date: Wed, 31 May 2017 18:30:30 -0400
Subject: [FieldTrip] cluster statistics on subset of channels
In-Reply-To: <CAFiryVtKnOmc+VY2y1qG6ZL+Q=VsyVRCbBudNaeeFEqXBbguiA@mail.gmail.com>
References: <CABafTZfrtOH3h+qyUNMvLBweSbRtvwEDS2TGMfyFhsdc7J1sqg@mail.gmail.com>
 <CAFiryVtKnOmc+VY2y1qG6ZL+Q=VsyVRCbBudNaeeFEqXBbguiA@mail.gmail.com>
Message-ID: <CABafTZeAh82kJ4h-Y9iju=ja-c7E3Nve+NN3dQ2=xeKqPV1mNQ@mail.gmail.com>

That simple!

Thank you Elmeri, works like a charm.

On Wed, May 31, 2017 at 3:24 PM, Elmeri Syrjänen <elmeri.syrjanen at gmail.com>
wrote:

> Hi Roy,
>
> I have pasted the relevant section from http://www.fieldtriptoolbox.org/
> reference/ft_freqstatistics the lines that would be applicable in your
> situation.
>
>
> The configuration can contain the following options for data selection
>     *cfg.channel     = Nx1 cell-array with selection of channels (default = 'all'),
>                       see FT_CHANNELSELECTION <http://www.fieldtriptoolbox.org/reference/ft_channelselection> for details*
>     *cfg.avgoverchan = 'yes'* or 'no'                   (default = 'no')
>
>
> /elmeri
>
> On Wed, May 31, 2017 at 8:57 PM, Roy Cox <roycox.roycox at gmail.com> wrote:
>
>> hello,
>>
>> Does anyone know if it's possible to run ft_freqstatistics on only a
>> subset of channels?
>>
>> Per my hypothesis, I'm only interested in the posterior half of the scalp.
>>
>> I know I could remove the channels entirely from the data, but for
>> plotting purposes I'd like to retain the full set of data, and it would be
>> cumbersome to stitch data and clusters back together. Alternatively, I
>> could change the channel neighborhood structure for the frontal channels
>> such that they don't enter the cluster formation procedure at all, but I'm
>> not sure if this is valid.
>>
>> Maybe ft_freqstatistics already supports channel selection? Can't seem to
>> find it in the documentation or tutorials, though.
>>
>> Thanks for any insights,
>>
>> Roy
>>
>> _______________________________________________
>> 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/20170531/8cd6a09f/attachment.htm>

From kash.kgp at gmail.com  Thu Jun  1 08:27:48 2017
From: kash.kgp at gmail.com (Kasturi Barik)
Date: Thu, 1 Jun 2017 11:57:48 +0530
Subject: [FieldTrip] Fwd: Source Analysis from EEG data
In-Reply-To: <CADW7XCBjUFt8Le-74ZBEyDehZ4NL6ftgOBpfJNNmENGE+H-APw@mail.gmail.com>
References: <CAD2_9NRxH9+oiftn0tFFPp21OOQ3mim1yH+4KHYhW6CsCU5aGA@mail.gmail.com>
 <CAD2_9NTz1iH0Dvtwj+Turqn0vu-8MM=DosHBcO3Qsq0PL7eRxw@mail.gmail.com>
 <CADW7XCBjUFt8Le-74ZBEyDehZ4NL6ftgOBpfJNNmENGE+H-APw@mail.gmail.com>
Message-ID: <CAD2_9NQhPewUZ4iC03Lip7zop=xQ1_7FvoKty0SQrqmHw+Ny=w@mail.gmail.com>

Dear all,

As per last suggestion, I again focus on constructing head-model to generate
a proper forward model for localization purposes.

*CODE:*

%% 1. read the anatomical data with ft_read_mri;
load('standard_mri.mat');
disp(mri)
save mri mri

%% Align the coordinate system
cfg = [];
cfg.method = 'interactive';
cfg.coordsys = 'spm';
cfg.snapshot     = 'yes';
[mri_aligned] = ft_volumerealign(cfg,mri);
save mri_aligned mri_aligned

%% 2. SEGMENTATION
% set path of means go to :
D:\MATLAB\toolbox\fieldtrip-20140401\external\spm8
cfg           = [];
cfg.output    = {'brain','skull','scalp'};
segmentedmri  = ft_volumesegment(cfg, mri_aligned);
save segmentedmri segmentedmri

%% 3. triangulate the surfaces with ft_prepare_mesh;
cfg             = [];
cfg.tissue      = {'brain','skull','scalp'};
cfg.numvertices = [3000 2000 1000];
bnd             = ft_prepare_mesh(cfg,segmentedmri);
save bnd bnd

%% 4. Create headmodel
cfg        = [];
cfg.method = 'bemcp'; % You can also specify 'openmeeg', 'bemcp', or
another method.
% cfg.conductivity = [0.3300 0.0041 0.3300];
vol1        = ft_prepare_headmodel(cfg, bnd);

*When running these settings **I am getting the following error message:*

Error using surface_nesting (line 26)
the compartment nesting cannot be determined

Error in ft_headmodel_bemcp (line 66)
order = surface_nesting(vol.bnd, 'insidefirst');

Error in ft_prepare_headmodel (line 257)
      vol = ft_headmodel_bemcp(geometry, 'conductivity',
      cfg.conductivity);

 I am not able to detect, where is the problem. I would be very thankful if
you can help me in this regard.

On Wed, May 31, 2017 at 5:19 PM, Cristiano Micheli <michelic72 at gmail.com>
wrote:

> Dear Kastouri,
>
> My hunch is that either ft_prepare_headmodel or ft_prepare_leadfield fail
> in generating a proper forward model for localization purposes.
> I would check that ft_prepare_headmodel's vol structure contains sensible
> data by plotting both the 'bnd' triangulated surface and the EEG electrodes
> together (you should be able to find instructions on the wiki) in the same
> image. Sometimes units (mm,cm) or coregistration (left/right swap) might
> influence a good outcome.
> Accordingly the grid.leadfield structure will not make sense because it
> uses the incorrect outcome of the vol structure.
>
> So if you manage to solve the 1st problem you'll kill two bird with a stone
> Good luck!
> Cris
>
>
>
>
>
> On Wed, May 31, 2017 at 12:50 PM, Kasturi Barik <kash.kgp at gmail.com>
> wrote:
>
>> *Dear all,
>> **I am trying to perform source localization in the frequency domain *
>>
>> *from EEG data using 'DICS' . As I have no mri data of the participants, *
>>
>> *I am using **'Subject01.mri' to read the anatomical data with ft_read_mri. *
>>
>> *The **head model created with 'bemcp'.*
>>
>> *Code:*
>>
>> *%% **Read the anatomical data*
>>
>> *mri = ft_read_mri('Subject01.mri');*
>>
>> *%% **Segment the anatomical information & triangulate the surfaces*
>>
>> *load segmentedmri                                   % load from *ftp
>> server
>> <ftp://ftp.fieldtriptoolbox.org/pub/fieldtrip/tutorial/headmodel_eeg/segmentedmri.mat>
>>  (segmentedmri.mat).
>> *load bnd*
>>
>> *%% **Create the headmodel*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *cfg        = [];cfg.method = 'bemcp'; vol        =
>> ft_prepare_headmodel(cfg, bnd);%% Position of the
>> electrodesload('Face_sub.mat');                                   % data of
>> participants' electrode positions electrodes = Face_sub.elec;%% Interactive
>> alignmentcfg           = [];cfg.method    = 'interactive';cfg.elec      =
>> electrodes;cfg.headshape = vol.bnd(3);                          %
>> scalpelec_aligned  = ft_electroderealign(cfg);%% Compute leadfield:cfg
>>             = [];cfg.elec            = elec_aligned;cfg.vol             =
>> vol;cfg.channel         = {'EEG'};[grid] = ft_prepare_leadfield(cfg);%%
>> Source Analysiscfg              = []; cfg.method       =
>> 'dics';cfg.frequency    = 10; cfg.grid         = grid;cfg.vol          =
>> vol;cfg.dics.projectnoise = 'yes';cfg.dics.lambda       = 0;sourceFace =
>> ft_sourceanalysis(cfg, face_data);   % face_data is obtained from the
>> FT_FREQANALYSIS %   [%%  time frequency analysis
>>     ||    cfg = [];
>>    ||     cfg.channel    = 'EEG';                                     ||
>>  cfg.method     = 'mtmfft';                                   ||
>>  cfg.output     = 'powandcsd';                              ||
>>  cfg.tapsmofrq  = 4;                                           ||
>>  cfg.foi        =  1:1:40;                                        ||
>>  face_data = ft_freqanalysis(cfg, Face_sub);       ]*
>>
>> *When running DICS with these settings **I am getting the following error message:*
>>
>>
>> *Error using svd
>> Input to SVD must not contain NaN or Inf.
>>
>> Error in beamformer_dics>pinv (line 650)
>>   [U,S,V] = svd(A,0);
>>
>> Error in beamformer_dics (line 339)
>>         filt = pinv(lf' * invCf * lf) * lf' * invCf;
>>         % Gross eqn. 3, use PINV/SVD to cover rank
>>         deficient leadfield
>>
>> Error in ft_sourceanalysis (line 568)
>>       dip(i) = beamformer_dics(grid, sens, vol, [],
>>       squeeze(Cf(i,:,:)), optarg{:});
>>
>> Error in SourceAnalysis (line 133)
>> sourceFace = ft_sourceanalysis(cfg, face_data);*
>>
>>
>> * I am not able to detect, where is the problem. Another issue I have found that 'vol.mat' or 'grid.leadfield' are all NaN value. I cannot understand how to solve it. I would be very thankful if you can help me in this regard.  *
>>
>>
>>
>>
>>
>> --
>> Thanks & Regards
>>
>> *Kasturi Barik*
>>
>> MS Research Scholar
>> Audio and Bio-signal Processing Lab
>> Department of Electronics and Electrical Engineering
>> Indian Institute of Technology Kharagpur
>> Mob: +91-8902400644 <+91%2089024%2000644>
>>
>> _______________________________________________
>> 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
>



-- 
Thanks & Regards

*Kasturi Barik*

MS Research Scholar
Audio and Bio-signal Processing Lab
Department of Electronics and Electrical Engineering
Indian Institute of Technology Kharagpur
Mob: +91-8902400644
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170601/96d64962/attachment.htm>

From michelic72 at gmail.com  Thu Jun  1 09:20:30 2017
From: michelic72 at gmail.com (Cristiano Micheli)
Date: Thu, 1 Jun 2017 09:20:30 +0200
Subject: [FieldTrip] Fwd: Source Analysis from EEG data
In-Reply-To: <CAD2_9NQhPewUZ4iC03Lip7zop=xQ1_7FvoKty0SQrqmHw+Ny=w@mail.gmail.com>
References: <CAD2_9NRxH9+oiftn0tFFPp21OOQ3mim1yH+4KHYhW6CsCU5aGA@mail.gmail.com>
 <CAD2_9NTz1iH0Dvtwj+Turqn0vu-8MM=DosHBcO3Qsq0PL7eRxw@mail.gmail.com>
 <CADW7XCBjUFt8Le-74ZBEyDehZ4NL6ftgOBpfJNNmENGE+H-APw@mail.gmail.com>
 <CAD2_9NQhPewUZ4iC03Lip7zop=xQ1_7FvoKty0SQrqmHw+Ny=w@mail.gmail.com>
Message-ID: <CADW7XCAxEhNituH2ibCaZ3ZcZTw4HqGqxt_B+iuWNmncNWeezw@mail.gmail.com>

Dear Kastouri,

the error might come from an incorrect realignment of the segmented volumes
or from a failure to segment the mri into the wished compartments. You
could check the mri images by browsing through the slices with
ft_sourcplot([],mri).
If the mri images are of low quality or contain artefacts, due to set-up
devices such as scaffoldings, or ROI boxed images (limiting the volume of
acquisition) you are in trouble.
If you pass the previous check, try again to plot the tessellated surfaces
in the same image. Have you done that yet?

Best
Cris

On Thu, Jun 1, 2017 at 8:27 AM, Kasturi Barik <kash.kgp at gmail.com> wrote:

> Dear all,
>
> As per last suggestion, I again focus on constructing head-model to generate
> a proper forward model for localization purposes.
>
> *CODE:*
>
> %% 1. read the anatomical data with ft_read_mri;
> load('standard_mri.mat');
> disp(mri)
> save mri mri
>
> %% Align the coordinate system
> cfg = [];
> cfg.method = 'interactive';
> cfg.coordsys = 'spm';
> cfg.snapshot     = 'yes';
> [mri_aligned] = ft_volumerealign(cfg,mri);
> save mri_aligned mri_aligned
>
> %% 2. SEGMENTATION
> % set path of means go to : D:\MATLAB\toolbox\fieldtrip-
> 20140401\external\spm8
> cfg           = [];
> cfg.output    = {'brain','skull','scalp'};
> segmentedmri  = ft_volumesegment(cfg, mri_aligned);
> save segmentedmri segmentedmri
>
> %% 3. triangulate the surfaces with ft_prepare_mesh;
> cfg             = [];
> cfg.tissue      = {'brain','skull','scalp'};
> cfg.numvertices = [3000 2000 1000];
> bnd             = ft_prepare_mesh(cfg,segmentedmri);
> save bnd bnd
>
> %% 4. Create headmodel
> cfg        = [];
> cfg.method = 'bemcp'; % You can also specify 'openmeeg', 'bemcp', or
> another method.
> % cfg.conductivity = [0.3300 0.0041 0.3300];
> vol1        = ft_prepare_headmodel(cfg, bnd);
>
> *When running these settings **I am getting the following error message:*
>
> Error using surface_nesting (line 26)
> the compartment nesting cannot be determined
>
> Error in ft_headmodel_bemcp (line 66)
> order = surface_nesting(vol.bnd, 'insidefirst');
>
> Error in ft_prepare_headmodel (line 257)
>       vol = ft_headmodel_bemcp(geometry, 'conductivity',
>       cfg.conductivity);
>
>  I am not able to detect, where is the problem. I would be very thankful
> if you can help me in this regard.
>
> On Wed, May 31, 2017 at 5:19 PM, Cristiano Micheli <michelic72 at gmail.com>
> wrote:
>
>> Dear Kastouri,
>>
>> My hunch is that either ft_prepare_headmodel or ft_prepare_leadfield fail
>> in generating a proper forward model for localization purposes.
>> I would check that ft_prepare_headmodel's vol structure contains sensible
>> data by plotting both the 'bnd' triangulated surface and the EEG electrodes
>> together (you should be able to find instructions on the wiki) in the same
>> image. Sometimes units (mm,cm) or coregistration (left/right swap) might
>> influence a good outcome.
>> Accordingly the grid.leadfield structure will not make sense because it
>> uses the incorrect outcome of the vol structure.
>>
>> So if you manage to solve the 1st problem you'll kill two bird with a
>> stone
>> Good luck!
>> Cris
>>
>>
>>
>>
>>
>> On Wed, May 31, 2017 at 12:50 PM, Kasturi Barik <kash.kgp at gmail.com>
>> wrote:
>>
>>> *Dear all,
>>> **I am trying to perform source localization in the frequency domain *
>>>
>>> *from EEG data using 'DICS' . As I have no mri data of the participants, *
>>>
>>> *I am using **'Subject01.mri' to read the anatomical data with ft_read_mri. *
>>>
>>> *The **head model created with 'bemcp'.*
>>>
>>> *Code:*
>>>
>>> *%% **Read the anatomical data*
>>>
>>> *mri = ft_read_mri('Subject01.mri');*
>>>
>>> *%% **Segment the anatomical information & triangulate the surfaces*
>>>
>>> *load segmentedmri                                   % load from *ftp
>>> server
>>> <ftp://ftp.fieldtriptoolbox.org/pub/fieldtrip/tutorial/headmodel_eeg/segmentedmri.mat>
>>>  (segmentedmri.mat).
>>> *load bnd*
>>>
>>> *%% **Create the headmodel*
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *cfg        = [];cfg.method = 'bemcp'; vol        =
>>> ft_prepare_headmodel(cfg, bnd);%% Position of the
>>> electrodesload('Face_sub.mat');                                   % data of
>>> participants' electrode positions electrodes = Face_sub.elec;%% Interactive
>>> alignmentcfg           = [];cfg.method    = 'interactive';cfg.elec      =
>>> electrodes;cfg.headshape = vol.bnd(3);                          %
>>> scalpelec_aligned  = ft_electroderealign(cfg);%% Compute leadfield:cfg
>>>             = [];cfg.elec            = elec_aligned;cfg.vol             =
>>> vol;cfg.channel         = {'EEG'};[grid] = ft_prepare_leadfield(cfg);%%
>>> Source Analysiscfg              = []; cfg.method       =
>>> 'dics';cfg.frequency    = 10; cfg.grid         = grid;cfg.vol          =
>>> vol;cfg.dics.projectnoise = 'yes';cfg.dics.lambda       = 0;sourceFace =
>>> ft_sourceanalysis(cfg, face_data);   % face_data is obtained from the
>>> FT_FREQANALYSIS %   [%%  time frequency analysis
>>>     ||    cfg = [];
>>>    ||     cfg.channel    = 'EEG';                                     ||
>>>  cfg.method     = 'mtmfft';                                   ||
>>>  cfg.output     = 'powandcsd';                              ||
>>>  cfg.tapsmofrq  = 4;                                           ||
>>>  cfg.foi        =  1:1:40;                                        ||
>>>  face_data = ft_freqanalysis(cfg, Face_sub);       ]*
>>>
>>> *When running DICS with these settings **I am getting the following error message:*
>>>
>>>
>>> *Error using svd
>>> Input to SVD must not contain NaN or Inf.
>>>
>>> Error in beamformer_dics>pinv (line 650)
>>>   [U,S,V] = svd(A,0);
>>>
>>> Error in beamformer_dics (line 339)
>>>         filt = pinv(lf' * invCf * lf) * lf' * invCf;
>>>         % Gross eqn. 3, use PINV/SVD to cover rank
>>>         deficient leadfield
>>>
>>> Error in ft_sourceanalysis (line 568)
>>>       dip(i) = beamformer_dics(grid, sens, vol, [],
>>>       squeeze(Cf(i,:,:)), optarg{:});
>>>
>>> Error in SourceAnalysis (line 133)
>>> sourceFace = ft_sourceanalysis(cfg, face_data);*
>>>
>>>
>>> * I am not able to detect, where is the problem. Another issue I have found that 'vol.mat' or 'grid.leadfield' are all NaN value. I cannot understand how to solve it. I would be very thankful if you can help me in this regard.  *
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Thanks & Regards
>>>
>>> *Kasturi Barik*
>>>
>>> MS Research Scholar
>>> Audio and Bio-signal Processing Lab
>>> Department of Electronics and Electrical Engineering
>>> Indian Institute of Technology Kharagpur
>>> Mob: +91-8902400644 <+91%2089024%2000644>
>>>
>>> _______________________________________________
>>> 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
>>
>
>
>
> --
> Thanks & Regards
>
> *Kasturi Barik*
>
> MS Research Scholar
> Audio and Bio-signal Processing Lab
> Department of Electronics and Electrical Engineering
> Indian Institute of Technology Kharagpur
> Mob: +91-8902400644 <+91%2089024%2000644>
>
> _______________________________________________
> 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/20170601/00feb1e8/attachment.htm>

From timeehan at gmail.com  Thu Jun  1 21:02:13 2017
From: timeehan at gmail.com (Tim Meehan)
Date: Thu, 1 Jun 2017 15:02:13 -0400
Subject: [FieldTrip] ft_singleplotTFR with trial-varying baseline interval?
Message-ID: <CAOpyOFWrAVpf5aVwdXbUHtkJk3QnXFMqBVDzQDYyN0Rd7cMyUg@mail.gmail.com>

Hello all,

I would like to plot TFRs for single channels centered on the event of
movement onset, which varies in time across trials. I would also like to
use baseline normalization, using as a baseline period the ITI. This means
that the baseline period varies in time with respect to t-zero across
trials.

>From what I can tell, in ft_singleplotTFR one can specify one baseline
interval, so I'm not sure how to account for the fact that my baseline
interval needs to vary across trials. Does anyone have some advice on how
to handle this?

Thanks,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170601/42bb3b7f/attachment.htm>

From emilia.flo.rama at gmail.com  Thu Jun  1 21:41:32 2017
From: emilia.flo.rama at gmail.com (=?UTF-8?Q?Emilia_Fl=C3=B3?=)
Date: Thu, 1 Jun 2017 16:41:32 -0300
Subject: [FieldTrip] Issue with downloading datasets
Message-ID: <CADP59ZiOkdE9b8E=btttkYqYdm8o+PaRNUrpcVsqAhB11mjRHA@mail.gmail.com>

Hey ! I'm not able to download the Subject01.zip dataset for the
MEG-language experiment that's used in the Cluster-based permutation tests
tutorial

Can anyone check if there is an issue with the link? or If anyone has the
dataset on their computer send it to me maybe via wetransfer?

I would be extremely grateful!


Emilia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170601/bb85b483/attachment.htm>

From ecaspar at ulb.ac.be  Mon Jun  5 10:46:57 2017
From: ecaspar at ulb.ac.be (Emilie Caspar)
Date: Mon, 5 Jun 2017 10:46:57 +0200
Subject: [FieldTrip] Bipolar visualisation on continuous data
Message-ID: <030655B7-5CC9-4823-80EB-5609C6264614@ulb.ac.be>

Dear community, 

My name is Emilie Caspar and I am currently a postdoctoral researcher. In my study, I have to check that my participants did not move their fingers during the task. To do so, I used two external electrodes (namely, EX3 and EX4) to record muscular activity. I would need to inspect my data visually on continuous data after a bipolar montage between these two electrodes.

I first tried to use appenddata but it is not convenient for what I am looking. Then, I tried to use ft_lateralized but, if I am right, it’s for averaged data, which is not my case since I need to check continuous data. I finally tried cfg.operation but I am not sure if why I am doing is correct for the purpose I have. In addition, I have an error indicating that This function requires unknown data as input.

cfg         = [];
cfg.dataset = 'P4_IB_2.bdf';
cfg.preproc.hpfilter        = 'yes';
cfg.preproc.hpfreq          = 10;
cfg.channel                 = {'EX3', 'EX4'};
E1 = 'EX3'
E2 = 'EX4'
cfg.operation = 'E1-E2';
data = ft_math(cfg, E1, E2);
cfg.ylim                    = [-150 150];
cfg.blocksize               = 5;
cfg.viewmode                = 'butterfly';
ft_databrowser(cfg, data);

I would strongly appreciate if some of you had some recommandations about what is the best method that I could use or, if using cfg.operation is the best method, how I could solve the error message.

Thank you in a dance for your time!

Best, 

Emilie



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170605/2aa2a55c/attachment.htm>

From Miguel.Granjaespiritosanto at nottingham.ac.uk  Tue Jun  6 13:36:35 2017
From: Miguel.Granjaespiritosanto at nottingham.ac.uk (Miguel Granja Espirito Santo)
Date: Tue, 6 Jun 2017 11:36:35 +0000
Subject: [FieldTrip] Tranform MNE to dSPM
In-Reply-To: <AM2PR06MB0866EFC0712F798B8F284F6483CB0@AM2PR06MB0866.eurprd06.prod.outlook.com>
References: <AM2PR06MB0866EFC0712F798B8F284F6483CB0@AM2PR06MB0866.eurprd06.prod.outlook.com>
Message-ID: <AM2PR06MB0866FD479E0E0DD4470A33EA83CB0@AM2PR06MB0866.eurprd06.prod.outlook.com>

Hello all,

I am currently trying to transform my source-localized MNE individual data into dSPM before conducting group stats. However, I am stuck in the last step. Unfortunately, I am not very good with maths, so I can't replicated Dale et al. (2000) formulas. I had look through previous posts (namely, https://mailman.science.ru.nl/pipermail/fieldtrip/2012-May/005170.html) , and information is a bit vague on how to replicate this process. Does anyone have any information about how to proceed from MNE to dSPM. I currently have the code below ( as per the MNE tutorial) and would appreciate any advice on what to do next:

 %% prepare leadfield

cfg = [];

cfg.grid.unit = 'mm';

cfg.vol  = vol;

cfg.grad = grad;

cgf.reducerank = 2;

cfg.normalize = 'yes';

cfg.grid = sourcespace;

leadfield = ft_prepare_leadfield(cfg);

%% Inverse Solution

 cfg        = [];

cfg.method = 'mne';

cfg.grid   = leadfield;

cfg.vol    = vol;

cfg.mne.normalize = 'yes';

cfg.mne.prewhiten = 'yes';

cfg.mne.keepfilter= 'yes';

cfg.mne.lambda    = 3;

cfg.mne.scalesourcecov = 'yes';

cfg.mne.projectnoise = 'yes';

cfg.mne.keepfilter = 'yes';

mne_hands_Distorted  = ft_sourceanalysis(cfg,tl_DistHands);

mne_hands_Standard  = ft_sourceanalysis(cfg,tl_StdHands);

  %% Plot Results

bnd.pnt = sourcespace.pos;

bnd.tri = sourcespace.tri;

cfg = [];

cfg.projectmom = 'yes';

shDist = ft_sourcedescriptives(cfg,mne_hands_Distorted);

m=shDist.avg.pow(:,700); % Plotting around 170ms

ft_plot_mesh(bnd,'edgecolor', 'k', 'vertexcolor', m);


Thanks for your help.
Best,
Miguel
PhD Student
School of Psychology
University of Nottingham





This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 

Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170606/d45bffdc/attachment.htm>

From martabortoletto at yahoo.it  Tue Jun  6 14:55:43 2017
From: martabortoletto at yahoo.it (Marta Bortoletto)
Date: Tue, 6 Jun 2017 12:55:43 +0000 (UTC)
Subject: [FieldTrip] Post-doc position at CIMeC
References: <44874734.5186487.1496753743191.ref@mail.yahoo.com>
Message-ID: <44874734.5186487.1496753743191@mail.yahoo.com>


Dear all,Please see the following announcement for a post-doc position at the CIMeC.

Job description: The Transcranical Brain Stimulation Laboratory (http://www.cimec.unitn.it/en/180/transcranial-brain-stimulation-lab-tbs-lab) led by Prof. Carlo Miniussi(http://www5.unitn.it/People/en/Web/Persona/PER0053912#INFO) at the Center for Mind/Brain Sciences CIMeC University of Trento (Mattarello) Rovereto (http://www.cimec.unitn.it/en) is recruiting a post-doctoral 
research fellow to work on a project on Cognitive plasticity: modulation and monitoring through a neurophysiological approach, funded by BIAL foundation.
The aims are: to establish a tES protocol to improve plasticity and behavioral performance in a memory task; and evaluate a causal-effect relation between memory formation and neurophysiological changes, measured as changes in functional connectivity by means of TMS-EEG coregistration.
The position is available from September 1st 2017 and is funded for 18 months.
Key Requirements:
·      We are seeking for aspiring individuals with experience in transcranical electrical stimulation (tES), transcranial magnetic 
stimulation and electroencephalography (TMS-EEG) coregistration, EEG research and computational abilities.
·      The applicants should also be interested in studying cortical networks.
·      Successful candidates should have a background and PhD degree in a neuroscience-related field, broadly specified, and skills for working with complex empirical data and human subjects.
·      Applicants should have experience with conducting experimental research, hands-on knowledge in tES, TMS and EEG methods, and skills in at least one programming language (preferably Matlab).
·      Eventually experience with advanced EEG signal processing, EEG source localization, connectivity analyses and a strong publication record are an advantage.
If you are interested please send a CV to carlo.minussi at unitn.it
 Marta Bortoletto, PhD 
Cognitive Neuroscience Section,
 IRCCS Centro San Giovanni di Dio Fatebenefratelli 
Via Pilastroni 4, 25125 Brescia, Italy 
Phone number: (+39) 0303501594 
E-mail: marta.bortoletto at cognitiveneuroscience.it
 web: http://www.cognitiveneuroscience.it/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170606/00090e90/attachment.htm>

From icon2017 at icon2017.org  Wed Jun  7 14:50:54 2017
From: icon2017 at icon2017.org (ICON 2017)
Date: Wed, 7 Jun 2017 14:50:54 +0200
Subject: [FieldTrip] Conference announcement: ICON 2017 in Amsterdam (5-8
	August)
Message-ID: <CAM6CJQhx8m9tR-e7yx6zO7ep4-MCvXqpkXQrtPcvx-pC2W+LaQ@mail.gmail.com>

The ICON XIII conference will take place on 5-8 August 2017 in Amsterdam
(the Netherlands). Amsterdam is an easily-accessible and progressive city.
The venue is the Beurs van Berlage, located in downtown Amsterdam and one
of the most beautiful conference venues in Europe!

Visit the website: http://www.icon2017.org

There is an exciting line-up of keynote speakers and symposia, and there
are new presentation formats including "ask-the-experts" panels and
hackathons. Check out the online program: icon2017.org/program.html

**NOTE**
We are still accepting late poster submissions! Contact us (
icon2017 at icon2017.org) for details.

FOLLOW US ON TWITTER
For up-to-date announcements before and during the ICON meeting, follow
@icon2017 and use #iconNL (see also "Media" tab on the website).

QUESTIONS ABOUT THE MEETING OR SPONSORSHIP?
email icon2017 at icon2017.org

http://www.icon2017.org

We look forward to seeing you in beautiful Amsterdam!

Mike X Cohen and Birte Forstmann

<https://www.facebook.com/profile.php?id=100009436610953>
<https://twitter.com/ICON2017>

*http://www.icon2017.org/ <http://www.icon2017.org/>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170607/3b9e0a9f/attachment.htm>

From katrinheimann at gmail.com  Wed Jun  7 23:41:30 2017
From: katrinheimann at gmail.com (KatrinH Heimann)
Date: Wed, 7 Jun 2017 23:41:30 +0200
Subject: [FieldTrip] ft_multiplotER frozen
Message-ID: <CACnHcBcT93VGgnOhnC0eDpowEkB7GmRBN18DNw0RreBxuooBOw@mail.gmail.com>

Dear all, me and my colleagues are experiencing problems with
ft_multiplotER in the interactive design. We just can´t zoom in or do
anything else with the graph (that is far too small to see)... Anybody else
experiencing this problem? Best, Kat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170607/8b829ff8/attachment.htm>

From davide.tabarelli at unitn.it  Thu Jun  8 14:40:45 2017
From: davide.tabarelli at unitn.it (Davide Tabarelli)
Date: Thu, 8 Jun 2017 13:40:45 +0100
Subject: [FieldTrip] Problem in calculating connectivity from PCC beamformed
	data
Message-ID: <CAMUmKUhL_-wUdh07Qfr5TEE=X6W7MmrMOFq_n_WN1NbcUu7ZsA@mail.gmail.com>

Dear all,

I'm currently trying to calculate various spectral based connectivity
metrics starting from the results of a partial canonical coherence
beamfomer as in this tutorial:

http://www.fieldtriptoolbox.org/tutorial/chieti/wholebrain?s[]=connectivity

but I'm facing with the following problems:

1) Despite I specify a seed location in cfg.refindx,
ft_connectivityanalysis is calculating the coherence spectrum for all the
possible grid point combinations (24024 x 24024 values)
2) I cannot calculate WPLI (seems this method is not supported for source
data).

Below the code I'm using. Fieldtrip version is 20170522.

Any help will be appreciated ! Thank you !


% Here I compute full Fourier spectrum from "data"
cfg = [];
cfg.keeptrials = 'yes';
cfg.channel = '{ft_channelselection({'MEGGRAD'}, data);
cfg.method='mtmfft';
cfg.output = 'fourier';
cfg.pad = 'nextpow2';
cfg.foi = 5.5;
cfg.taper='dpss';
cfg.tapsmofrq = 1.5;
frc = ft_freqanalysis(cfg, data);

% Compute the PCC beamformer
cfg = [];
cfg.method = 'pcc';
cfg.headmodel = vol;
cfg.grad = grad;
cfg.grid = sourcemodel;
cfg.frequency = 5.5;
cfg.pcc.lambda = lambda;
cfg.pcc.fixedori = 'yes';
cfg.pcc.feedback = 'no';
cfg.pcc.normalize = 'yes';
cfg.pcc.keepfilter = 'yes';
cfg.channel = ft_channelselection({'MEGGRAD'}, data);
source = ft_sourceanalysis(cfg, frc);

% Compute connectivity
cfg = [];
cfg.refindx = seedIndex;
% cfg.method = 'wpli_debiased";  % Not supported?
cfg.method = 'coh';
cfg.complex = 'imag';
conn = ft_connectivityanalysis(cfg, source);


D.

-- 
Davide Tabarelli, Ph.D.
Center for Mind Brain Sciences (CIMeC)
University of Trento,
Via delle Regole, 101
38123 Mattarello (TN)
Italy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170608/2ae7fefb/attachment.htm>

From r.oostenveld at donders.ru.nl  Tue Jun 13 07:26:16 2017
From: r.oostenveld at donders.ru.nl (Robert Oostenveld)
Date: Tue, 13 Jun 2017 07:26:16 +0200
Subject: [FieldTrip] PhD Scholarship in Deep Learning with GAN
References: <F5A8A39B-B8E3-4506-938D-51662FA6E0C8@kent.ac.uk>
Message-ID: <45C7A849-048B-4404-8A98-ECEF25AC4BA0@donders.ru.nl>

> Begin forwarded message:


===================================
PhD Scholarship in Deep Learning
http://www.jobs.ac.uk/job/AYN907/funded-phd-in-deep-learning/ <http://www.jobs.ac.uk/job/AYN907/funded-phd-in-deep-learning/>

Three-year PhD scholarship is available to UK, EU and overseas students and will cover home tuition fees (£4,179 for 2017/18) plus a maintenance grant equivalent to the full UK Research Council rate (£14,553 for 2017/18). The amount of scholarship is £18,732 for 2017/18. The scholarship for year 2,3 should foresee a similar amount with slightly yearly increase. Tuition fees at the home/EU rate will be paid by the School of Computing on behalf of the student. Students from overseas will receive the same contribution to their fees (£4,179 in 2017/18) but will need to demonstrate that they can fund the difference between overseas and home fees <http://www.kent.ac.uk/finance-student/fees/tuition/index.html#!pg> (Oversea fee is currently £16,480).

Research Theme: This project aims to explore how deep learning can be used to deal with multiscale multidimensional biomedical signals, and to evaluate the effectiveness of different learning algorithms in recognizing the signal patterns. It will examine this problem by comparing with traditional algorithms and propose novel deep learning architectures with adversarial network (i.e. GAN) to explore discriminative power in a particular domain of biomedical signals (i.e. EMG, ECG, EEG).

Location          : University of Kent at Medway, UK (40-50 mins from London by train)
Supervisors     : Dr. Caroline Ling Li, Prof. Philippe De Wilde, Dr. Palaniappan Ramaswamy
Key words       : Machine learning, Deep learning, Biomedical signal analysis, EMG

Criteria 
Candidates must hold a good Honours degree (First or 2:1) or a Master's degree at merit or distinction in a relevant subject or equivalent. Applicants whose first language is not English must hold IELTS (or equivalent) at 6.5 with no element less than 6.0. Strong programming or/and math skill is preferred. Previous research experience leading to publications would be an advantage.

How to apply 
Deadline: Friday 30 June 2017
Expected start date: Autumn 2017 （Other scholarship available for starting on September 2018）
For further detail: https://www.cs.kent.ac.uk/people/staff/cl339/doc/2017PhdAdv.pdf <https://www.cs.kent.ac.uk/people/staff/cl339/doc/2017PhdAdv.pdf>

Please send a covering letter and CV to c.li at kent.ac.uk <mailto:c.li at kent.ac.uk>, including contact detail, research interest and your suitability for this award. Please also include experience, if any, of academic or professional research; experience, if any, of teaching or mentoring.

The successful candidate will be based at the Medway Campus. Information about the Medway Campus can be found here: http://www.kent.ac.uk/locations/medway/campus/index.html <http://www.kent.ac.uk/locations/medway/campus/index.html>


For questions about applications, please contact c.li at kent.ac.uk <mailto:c.li at kent.ac.uk>
http://www.jobs.ac.uk/job/AYN907/funded-phd-in-deep-learning/ <http://www.jobs.ac.uk/job/AYN907/funded-phd-in-deep-learning/>

Caroline Li | Director of Internationalisation |School of Computing | University of Kent 
M3-34, Medway Building, University of Kent, Chatham Maritime, Kent, ME4 4AG 7NZ, UK
T: +44 (0) 1634 202987 | E: c.li at kent.ac.uk <mailto:r.j.batchelor at kent.ac.uk>  
www.kent.ac.uk <http://www.kent.ac.uk/> | Facebook <https://www.facebook.com/UniversityofKent> | Twitter <https://twitter.com/unikent> | YouTube <https://www.youtube.com/user/UniversityofKent> | Flickr <https://www.flickr.com/photos/universityofkent/> | Weibo Account (英国肯特大学微博)| WeChat (UK-Kent) 

The UK’s European university
Locations in Canterbury, Medway, Athens, Brussels, Paris and Rome
In the top 10% of the world’s leading universities for international outlook
Times Higher Education World University Rankings 2015
4th highest score in the UK for overall student satisfaction
National Student Survey (NSS) 2016
Ranked 20th in the Times Higher Education (THE) ‘Table of Tables’ 2016





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170613/cc3efdd0/attachment.htm>

From susmitasen.ece at gmail.com  Fri Jun 16 11:48:45 2017
From: susmitasen.ece at gmail.com (Susmita Sen)
Date: Fri, 16 Jun 2017 15:18:45 +0530
Subject: [FieldTrip] How to convert coordinate system
Message-ID: <CAOD6VW_ZbzUV_7fSB0mp+9QRqWn6y_D8eOBqt=cfNqcw5aWkXw@mail.gmail.com>

Dear Community,

I need to convert coordinate system of the gradiometer array definition
from 'yokogawa' to 'spm'. I found *ft_convert_coordsys *function but it do
not work for gradiometer definition. Any help regarding this problem highly
appreciable.

Thanks and Regards,
Susmita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170616/b0b7a5ee/attachment.htm>

From jan.schoffelen at donders.ru.nl  Sat Jun 17 06:44:32 2017
From: jan.schoffelen at donders.ru.nl (Schoffelen, J.M. (Jan Mathijs))
Date: Sat, 17 Jun 2017 04:44:32 +0000
Subject: [FieldTrip] Fwd: A Simple question about the template of brain
 anatomy Used in Field Trip
References: <CAAxPzera++q4itAs6nw3SLi3dGm5MNvinJ8dmoFt5QbCSA_ZUQ@mail.gmail.com>
Message-ID: <A0B9B231-BA63-42B5-9697-709501A82D30@donders.ru.nl>

Dear GuangYe Li,

Please use the fieldtrip discussion list for this type of questions in the future.

I cannot reproduce your problem. Please check whether you are using a sufficiently up-to-date version of FieldTrip. In the past (but that is already a while ago) there was an issue with the alignment, which has long since been fixed.

Best wishes,

Jan-Mathijs


J.M.Schoffelen, MD PhD
Senior Researcher, VIDI-fellow - PI, language in interaction
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands




Begin forwarded message:

From: GuangYe LI <liguangye.hust at gmail.com<mailto:liguangye.hust at gmail.com>>
Subject: A Simple question about the template of brain anatomy Used in Field Trip
Date: 16 June 2017 at 23:11:31 GMT+3
To: <robert.oostenveld at donders.ru.nl<mailto:robert.oostenveld at donders.ru.nl>>, <jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>>

Hi Robert & Jan:

Hope you everything goes well and sorry for any inconvenience, I am writing this mail to ask you a question about the brain model template you provided in FieldTrip.
Because I go to the template/anatomy/ folder of fieldtrip, and generate a brain model using the image file (single_subj_T1_1mm.nii) you provide in that folder in Freesurfer, and then compare the brain model provided in the same folder: surface_pial_both.mat .  What I found is that these two brain model is not in the same coordinate origins (Please see the attachment for details).  I think these two models shall be in the same coordinate, so that the people can project the electrodes correctly.
So if you don't mind, could you please help to tell me that which software you use and which file you use to generate the surface_pial_both.mat ?  so that I can re-run the segmentation.
It will be highly appreciated if you can give me a  reply.


Thanks & Regards
GuangYe Li
Email: liguangye.hust at gmail.com<mailto:liguangye.hust at gmail.com>
Institute of Robotics
Shanghai Jiao Tong University | Shanghai | China




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170617/4959ac0d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Surface_pial_Both and single_subj_T1_1mm.pdf
Type: application/pdf
Size: 201612 bytes
Desc: Surface_pial_Both and single_subj_T1_1mm.pdf
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170617/4959ac0d/attachment.pdf>

From Ramirez_U at ukw.de  Mon Jun 19 12:11:36 2017
From: Ramirez_U at ukw.de (Ramirez Pasos,)
Date: Mon, 19 Jun 2017 10:11:36 +0000
Subject: [FieldTrip] mri.coordsys
Message-ID: <2ffdc6d2d94d4a7d9d08f2677ea62981@ukw.de>

Dear Fieldtrippers,


I would like to perform source reconstruction based on EEG recordings. What is the best approach when I have the mir dicom files, but no fiducials? When I call ft_read_mri, the mri struct lacks the field coordsys. How do I go about generating this field without fiducials? Is this field important for source reconstruction? Or should the struct yielded by ft_electroderealign after interactive aligning suffice?


Would very much appreciate any advice!


Uri Ramirez

University of Würzburg



From nikulin at cbs.mpg.de  Mon Jun 19 12:44:38 2017
From: nikulin at cbs.mpg.de (Vadim Nikulin)
Date: Mon, 19 Jun 2017 12:44:38 +0200 (CEST)
Subject: [FieldTrip] PhD student position
Message-ID: <1974131474.69999.1497869078418.JavaMail.zimbra@cbs.mpg.de>

Dear Colleagues,

Please forward the ad below to anyone who might be interested 
and post in your departmental lists. Thank you.

Best regards,

Vadim


===============================


The Department of Neurology at the Max Planck Institute for Human Cognitive and Brain Sciences (MPI CBS), Leipzig, Germany is offering 

PhD Student Position
for a research project on functional significance of neuronal oscillations in the human brain

The project focuses on the mechanisms through which neuronal oscillations affect task performance and brain responses in perceptual and cognitive paradigms. We will study pre-stimulus effects of neuronal oscillations as well as an impact of resting state neuronal dynamics on the task performance. EEG, MEG and a combination of TMS with EEG will be used to quantify temporal dynamics and spatial connectivity. We plan to utilize machine learning approaches for the recovery of complex relationship between ongoing oscillatory patterns and task-related activity.  

Eligible candidates should have a Master’s degree (or equivalent) in a relevant discipline, including neuroscience, physiology, medicine, psychology, physics or computer science. Previous experience with neuroimaging methods (e.g. EEG or MEG) is essential. Knowledge of Matlab for data analysis is required. Proficiency in spoken and written English is necessary. 

The research is conducted at MPI CBS in Leipzig, Germany, an internationally leading centre for cognitive and imaging neuroscience equipped with a 7.0 T MRI scanner, several 3.0 T MRI scanners, a 306-channels MEG system, TMS, tDCS, and several EEG systems. All facilities and data analysis are supported by experienced IT and physics staff. 

The position is for three years. The preferred starting date is August/September 2017, and the position will remain open until filled. Remuneration depends on your experience and is based on funding guidelines of the Max Planck Society. The Max Planck Society is committed to increasing the number of individuals with disabilities in its workforce and therefore encourages applications from such qualified individuals.

Please submit your application via our online system at http://www.cbs.mpg.de/vacancies (the subject heading is “PHD 12/17”) and include the following documents:

•        Cover letter (max 2 pages) describing personal qualifications and research interests
•        Curriculum vitae
•        Contact details of two referees
For further details please contact: Dr. Vadim Nikulin, Email: nikulin at cbs.mpg.de

Website: https://www.cbs.mpg.de/departments/neurology/neural-interactions-and-dynamics
Max Planck Institute for Human Cognitive and Brain Sciences 
Stephanstraße 1A, 04103 Leipzig



From russgport at gmail.com  Tue Jun 20 03:54:07 2017
From: russgport at gmail.com (russ port)
Date: Mon, 19 Jun 2017 21:54:07 -0400
Subject: [FieldTrip] possible bug when using old neuromas data with newer
 fieldtrip version
Message-ID: <3B7F9C1A-46C4-4A4A-8FF2-9D974809F5B7@gmail.com>

Hi All,

Sorry to bother you all, but I was wondering if I may have found a possible bug. If so, I’ll submit a request to the bugzilla subsection. I am not completely sure the issue is not my own incompetence though. The error occurs when using a neuromag dataset that was read in with an old fieldtrip version (i.e. from 2015), and having it undergo ft_artifact_zvalue from a newer version of fieldtrip. 

In short, I use the following code:
 	
	load('MEGGRAD_Visual_clean_combinedscripts')
        
        datanoline=[]
        datanoline=data_clean

	load('/MEGGRADfinal_cleaned_jumpartifact_outputcfg_redone_Visual.mat') 
            

        cfgaj                    = [];

        % channel selection, cutoff and padding
        cfgaj.artfctdef.zvalue.channel    = allchanell;
        cfgaj.artfctdef.zvalue.cutoff     =   cfgajout.artfctdef.zvalue.cutoff
        cfgaj.artfctdef.zvalue.trlpadding = 0;
        cfgaj.artfctdef.zvalue.artpadding = 0;
        cfgaj.artfctdef.zvalue.fltpadding = 0.0;

        % algorithmic parameters
        cfgaj.artfctdef.zvalue.cumulative    = 'yes'; 
        cfgaj.artfctdef.zvalue.medianfilter  = 'yes';
        cfgaj.artfctdef.zvalue.medianfiltord = 9;
        cfgaj.artfctdef.zvalue.absdiff       = 'yes';
    	% cfgaj.artfctdef.zvalue.interactive = 'yes';

        [cfgajout, artifact_jump] = ft_artifact_zvalue(cfgaj,datanoline);

When I run this code in a 2015 version of fieldtrip, it works fine (without any error). On the other hand, in the 2016 version of fieldtrip I have (as well as in the latest version which  I downloaded this weekend), I get the following error:

Error using ft_datatype_sens (line 278)
unexpected number of coils (408)
contributing to channel MEG0113 (1)

Error in ft_datatype_raw (line 141)
      data.grad =
      ft_datatype_sens(data.grad);

Error in ft_checkdata (line 236)
  data = ft_datatype_raw(data,
  'hassampleinfo', hassampleinfo);

Error in ft_artifact_zvalue (line 215)
  data = ft_checkdata(data, 'datatype',
  'raw', 'hassampleinfo', 'yes’);


The dataset datanoline (as well as cfgaj) are linked to below (sorry it’s dropbox, but I’m not quite sure how to do it otherwise).

https://www.dropbox.com/s/86t5agwv2vanrh3/MEGGRAD_Visual_clean_combinedscripts.mat?dl=0 <https://www.dropbox.com/s/86t5agwv2vanrh3/MEGGRAD_Visual_clean_combinedscripts.mat?dl=0>

https://www.dropbox.com/s/rw8e7mof8plss72/MEGGRADfinal_cleaned_jumpartifact_outputcfg_redone_Visual.mat?dl=0 <https://www.dropbox.com/s/rw8e7mof8plss72/MEGGRADfinal_cleaned_jumpartifact_outputcfg_redone_Visual.mat?dl=0>

Sorry for the bother,
Russ



   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170619/73e4bf13/attachment.htm>

From aborna at sandia.gov  Tue Jun 20 19:48:16 2017
From: aborna at sandia.gov (Borna, Amir)
Date: Tue, 20 Jun 2017 17:48:16 +0000
Subject: [FieldTrip] Coregistering the MRI data
Message-ID: <3cbf1af8f7c24683b971d9f710cb1a46@ES06AMSNLNT.srn.sandia.gov>

Dear Fieldtrip community,
I have a question regarding coregistering the MRI data. After using "ft_volumerealign" to align the MRI data with the digitized Polhemus data, the translation of the MRI voxels is saved in the "transform" field of the structure returned by the "ft_volumerealign". However after using "ft_volumereslice" this matrix (transform) is lost and the coordinate system of the transformed MRI volume does not match the coordinate system of the original MRI data. Is there any way to extract the  output of the "ft_volumerealign" function so I can rotate and translate my Polhemus data while having the MRI voxels fixed in space? Thank you for your time.

Best,
Amir Borna.
Sandia National Lab.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170620/c7b33e38/attachment.htm>

From cornelia.quaedflieg at uni-hamburg.de  Wed Jun 21 10:10:00 2017
From: cornelia.quaedflieg at uni-hamburg.de (Conny Quaedflieg)
Date: Wed, 21 Jun 2017 10:10:00 +0200
Subject: [FieldTrip] headmovement - circumcenter function
Message-ID: <004001d2ea65$c7936d90$56ba48b0$@uni-hamburg.de>

Dear Fieldtrip users, 

 

I would like to add / regress out headmovement in my MEG data. 

I found the nice wiki tutorial from fieldtrip: 

http://www.fieldtriptoolbox.org/example/how_to_incorporate_head_movements_in
_meg_analysis 

 

However, when running the code I get the following error message: 

Undefined function 'circumcenter' for input arguments of type 'double'.

 

I checked my paths and circumcenter is in it. Though if I open it, I see the
following code. 

%circumcenter  Circumcenter of triangle or tetrahedron

% CC = circumcenter(TR, TI) returns the coordinates of the circumcenter

%     of each triangle or tetrahedron in TI.

%     TI is a column vector of triangle or tetrahedron IDs corresponding to

%     the row numbers of the triangulation connectivity matrix
TR.ConnectivityList.

%     CC is an m-by-n matrix, where m is of length(TI), the number of
specified

%     triangles/tetrahedra, and n is the spatial dimension 2 <= n <= 3.

%     Each row CC(i,:) represents the coordinates of the circumcenter

%     of TI(i). If TI is not specified the circumcenter information for

%     the entire triangulation is returned, where the circumcenter
associated

%     with triangle/tetrahedron i is the i'th row of CC.

%

%     [CC RCC] = circumcenter(TR, TI) returns in addition, the corresponding

%     radius of the circumscribed circle/sphere. RCC is a vector of length

%     length(TI), the number of specified triangles/tetrahedra.

%

%   Example 1: Load a 2D triangulation and use the triangulation to compute
the

%              circumcenters.

%       load trimesh2d

%       % This loads triangulation tri and vertex coordinates  x, y

%       trep = triangulation(tri, x,y)

%       cc = circumcenter(trep);

%       triplot(trep);

%       axis([-50 350 -50 350]);

%       axis equal;

%       hold on; plot(cc(:,1),cc(:,2),'*r'); hold off;

%       % The circumcenters represent points on the medial axis of the
polygon.

%

%   Example 2: Direct query of a 3D triangulation created using
delaunayTriangulation

%              Compute the circumcenters of the first five tetrahedra.

%       X = rand(10,3);

%       dt = delaunayTriangulation(X);

%       [cc rcc] = circumcenter(dt, [1:5]')

%

%   See also triangulation, triangulation.incenter, delaunayTriangulation.

%   Copyright 2008-2012 The MathWorks, Inc.

%   Built-in function.

 

It seems to me that the real function is missing. Is this normal? Could this
be the problem? 

I googled circumcenter and found the function, though I am not sure whether
this is doing what it should do. Besides it also doesnt run when including
the 3 coil variables (error messages: Error using circumcenter2 Too many
input arguments.)

Help is really appreciated :) 

Best 

Dr. C. Quaedflieg, Hamburg University 

 

 

The code that I Found for circumcenter

 

function [ pc, r ] = circumcenter ( p, t )

 

%***************************************************************************
**80

%

%% CIRCUMCENTER computes the circumcenters of a set of triangles.

%

%  Discussion:

%

%    The circumcenter of a triangle is the circle which passes through

%    all three vertices of the triangle.

%

%  Licensing:

%

%    (C) 2004 Per-Olof Persson. 

%    See COPYRIGHT.TXT for details.

%

%  Reference:

%

%    Per-Olof Persson and Gilbert Strang,

%    A Simple Mesh Generator in MATLAB,

%    SIAM Review,

%    Volume 46, Number 2, June 2004, pages 329-345.

%

%  Modified:

%

%    11 June 2004

%

%  Parameters:

%

%    Input, real P(NP,2), the coordinates of a set of nodes.

%

%    Input, integer T(NT,1:3), a list of the nodes which make up each
triangle

%    of a triangulation of the nodes in P.

%

%    Output, real PC(NT,2), the centers of the circumcircles.

%

%    Output, real R(NT,1), the radii of the circumcircles.

%

  nt = size ( t, 1 );

 

  pc = zeros ( nt, 2 );

  r  = zeros ( nt, 1 );

 

  for it = 1 : nt

 

    ct = t(it,:);

    dp1 = p(ct(2),:) - p(ct(1),:);

    dp2 = p(ct(3),:) - p(ct(1),:);

  

    mid1 = ( p(ct(2),:) + p(ct(1),:) ) / 2;

    mid2 = ( p(ct(3),:) + p(ct(1),:) ) / 2;

  

    s = [ -dp1(2), dp2(2); dp1(1), -dp2(1) ] \ [ -mid1 + mid2 ]';

  

    cpc = mid1 + s(1) * [ -dp1(2), dp1(1) ];

    cr = norm ( p(ct(1),:) - cpc );

  

    pc(it,:) = cpc;

    r(it,1) = cr;

    

  end

 

  return 

end

 

 

Mit freundlichen Grüßen,

 

 



E-Mail:  <mailto:cornelia.quaedflieg at uni-hamburg.de>
cornelia.quaedflieg at uni-hamburg.de 

Tel.:  <tel:+49%2040%2042838-5448> +49 40 42838-5448   Website:
<https://www.psy.uni-hamburg.de/arbeitsbereiche/kognitionspsychologie/person
en/quaedflieg-conny.html> Hyperlink

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170621/1fb414da/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 5394 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170621/1fb414da/attachment.jpg>

From efrain.torres at marquette.edu  Wed Jun 21 12:55:21 2017
From: efrain.torres at marquette.edu (Torres, Efrain)
Date: Wed, 21 Jun 2017 10:55:21 +0000
Subject: [FieldTrip] Beamformer
Message-ID: <CY1PR0101MB0761F9D030E7CA889438D900EEDA0@CY1PR0101MB0761.prod.exchangelabs.com>

Dear all,

I was able to write a code for LCMV beamforming for the global neural activity index, but was unsure how to calculate the time dependent neural activity index. I was wondering if anyone knew how?

Sincerely,
Efrain Torres
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170621/9b3b9000/attachment.htm>

From sarang at cfin.au.dk  Wed Jun 21 13:01:27 2017
From: sarang at cfin.au.dk (Sarang S. Dalal)
Date: Wed, 21 Jun 2017 11:01:27 +0000
Subject: [FieldTrip] Beamformer
In-Reply-To: <CY1PR0101MB0761F9D030E7CA889438D900EEDA0@CY1PR0101MB0761.prod.exchangelabs.com>
References: <CY1PR0101MB0761F9D030E7CA889438D900EEDA0@CY1PR0101MB0761.prod.exchangelabs.com>
Message-ID: <1498042887.28769.11.camel@cfin.au.dk>

Hi Efrain,

In your cfg options for ft_sourceanalysis, just add:
cfg.lcmv.weightnorm = 'nai';
cfg.lcmv.fixedori = 'yes'; % the 'fixedori' case is typically used and fully tested

I don't remember if it's still necessary, but you may also need
cfg.lcmv.projectnoise = 'yes';

Cheers,
Sarang


On Wed, 2017-06-21 at 10:55 +0000, Torres, Efrain wrote:
Dear all,

I was able to write a code for LCMV beamforming for the global neural activity index, but was unsure how to calculate the time dependent neural activity index. I was wondering if anyone knew how?

Sincerely,
Efrain Torres

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto: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/20170621/a9451a63/attachment.htm>

From a.stolk8 at gmail.com  Wed Jun 21 18:01:20 2017
From: a.stolk8 at gmail.com (Arjen Stolk)
Date: Wed, 21 Jun 2017 09:01:20 -0700
Subject: [FieldTrip] headmovement - circumcenter function
In-Reply-To: <004001d2ea65$c7936d90$56ba48b0$@uni-hamburg.de>
References: <004001d2ea65$c7936d90$56ba48b0$@uni-hamburg.de>
Message-ID: <CAAiwptS-2drH1fG91NjQV_uzeUri2LaRvtXvyCQL6u3J7yk6hQ@mail.gmail.com>

Hi Conny,

You're right in that the circumcenter function is missing from the
fieldtrip suite itself, but fortunately it's there at the bottom of the
same wiki page. ;) Just copy it into your editor and save it out to a
preferred matlab path (so it gets prioritized over any version of
cicumcenter that may be in matlab).

Best,
Arjen

On Wed, Jun 21, 2017 at 1:10 AM, Conny Quaedflieg <
cornelia.quaedflieg at uni-hamburg.de> wrote:

> Dear Fieldtrip users,
>
>
>
> I would like to add / regress out headmovement in my MEG data.
>
> I found the nice wiki tutorial from fieldtrip:
>
> http://www.fieldtriptoolbox.org/example/how_to_
> incorporate_head_movements_in_meg_analysis
>
>
>
> However, when running the code I get the following error message:
>
> Undefined function 'circumcenter' for input arguments of type 'double'.
>
>
>
> I checked my paths and circumcenter is in it. Though if I open it, I see
> the following code.
>
> %circumcenter  Circumcenter of triangle or tetrahedron
>
> % CC = circumcenter(TR, TI) returns the coordinates of the circumcenter
>
> %     of each triangle or tetrahedron in TI.
>
> %     TI is a column vector of triangle or tetrahedron IDs corresponding to
>
> %     the row numbers of the triangulation connectivity matrix
> TR.ConnectivityList.
>
> %     CC is an m-by-n matrix, where m is of length(TI), the number of
> specified
>
> %     triangles/tetrahedra, and n is the spatial dimension 2 <= n <= 3.
>
> %     Each row CC(i,:) represents the coordinates of the circumcenter
>
> %     of TI(i). If TI is not specified the circumcenter information for
>
> %     the entire triangulation is returned, where the circumcenter
> associated
>
> %     with triangle/tetrahedron i is the i'th row of CC.
>
> %
>
> %     [CC RCC] = circumcenter(TR, TI) returns in addition, the
> corresponding
>
> %     radius of the circumscribed circle/sphere. RCC is a vector of length
>
> %     length(TI), the number of specified triangles/tetrahedra.
>
> %
>
> %   Example 1: Load a 2D triangulation and use the triangulation to
> compute the
>
> %              circumcenters.
>
> %       load trimesh2d
>
> %       % This loads triangulation tri and vertex coordinates  x, y
>
> %       trep = triangulation(tri, x,y)
>
> %       cc = circumcenter(trep);
>
> %       triplot(trep);
>
> %       axis([-50 350 -50 350]);
>
> %       axis equal;
>
> %       hold on; plot(cc(:,1),cc(:,2),'*r'); hold off;
>
> %       % The circumcenters represent points on the medial axis of the
> polygon.
>
> %
>
> %   Example 2: Direct query of a 3D triangulation created using
> delaunayTriangulation
>
> %              Compute the circumcenters of the first five tetrahedra.
>
> %       X = rand(10,3);
>
> %       dt = delaunayTriangulation(X);
>
> %       [cc rcc] = circumcenter(dt, [1:5]')
>
> %
>
> %   See also triangulation, triangulation.incenter, delaunayTriangulation.
>
> %   Copyright 2008-2012 The MathWorks, Inc.
>
> %   Built-in function.
>
>
>
> It seems to me that the real function is missing. Is this normal? Could
> this be the problem?
>
> I googled circumcenter and found the function, though I am not sure
> whether this is doing what it should do. Besides it also doesn’t run when
> including the 3 coil variables (error messages: Error using circumcenter2
> Too many input arguments.)
>
> Help is really appreciated J
>
> Best
>
> Dr. C. Quaedflieg, Hamburg University
>
>
>
>
>
> The code that I Found for circumcenter
>
>
>
> function [ pc, r ] = circumcenter ( p, t )
>
>
>
> %***********************************************************
> ******************80
>
> %
>
> %% CIRCUMCENTER computes the circumcenters of a set of triangles.
>
> %
>
> %  Discussion:
>
> %
>
> %    The circumcenter of a triangle is the circle which passes through
>
> %    all three vertices of the triangle.
>
> %
>
> %  Licensing:
>
> %
>
> %    (C) 2004 Per-Olof Persson.
>
> %    See COPYRIGHT.TXT for details.
>
> %
>
> %  Reference:
>
> %
>
> %    Per-Olof Persson and Gilbert Strang,
>
> %    A Simple Mesh Generator in MATLAB,
>
> %    SIAM Review,
>
> %    Volume 46, Number 2, June 2004, pages 329-345.
>
> %
>
> %  Modified:
>
> %
>
> %    11 June 2004
>
> %
>
> %  Parameters:
>
> %
>
> %    Input, real P(NP,2), the coordinates of a set of nodes.
>
> %
>
> %    Input, integer T(NT,1:3), a list of the nodes which make up each
> triangle
>
> %    of a triangulation of the nodes in P.
>
> %
>
> %    Output, real PC(NT,2), the centers of the circumcircles.
>
> %
>
> %    Output, real R(NT,1), the radii of the circumcircles.
>
> %
>
>   nt = size ( t, 1 );
>
>
>
>   pc = zeros ( nt, 2 );
>
>   r  = zeros ( nt, 1 );
>
>
>
>   for it = 1 : nt
>
>
>
>     ct = t(it,:);
>
>     dp1 = p(ct(2),:) - p(ct(1),:);
>
>     dp2 = p(ct(3),:) - p(ct(1),:);
>
>
>
>     mid1 = ( p(ct(2),:) + p(ct(1),:) ) / 2;
>
>     mid2 = ( p(ct(3),:) + p(ct(1),:) ) / 2;
>
>
>
>     s = [ -dp1(2), dp2(2); dp1(1), -dp2(1) ] \ [ -mid1 + mid2 ]';
>
>
>
>     cpc = mid1 + s(1) * [ -dp1(2), dp1(1) ];
>
>     cr = norm ( p(ct(1),:) - cpc );
>
>
>
>     pc(it,:) = cpc;
>
>     r(it,1) = cr;
>
>
>
>   end
>
>
>
>   return
>
> end
>
>
>
>
>
> Mit freundlichen Grüßen,
>
>
>
>
>
> [image: Unbenannt-1]
>
> *E-Mail*: cornelia.quaedflieg at uni-hamburg.de
>
> *Tel.*: +49 40 42838-5448 <+49%2040%2042838-5448>   *Website*: Hyperlink
> <https://www.psy.uni-hamburg.de/arbeitsbereiche/kognitionspsychologie/personen/quaedflieg-conny.html>
>
>
>
> _______________________________________________
> 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/20170621/2d23da2b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 5394 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170621/2d23da2b/attachment.jpg>

From a.kochari at uva.nl  Thu Jun 22 12:45:43 2017
From: a.kochari at uva.nl (Arnold Kochari)
Date: Thu, 22 Jun 2017 15:45:43 +0500
Subject: [FieldTrip] error with automatic artefact rejection using
	ft_artifact_threshold
Message-ID: <CAO0EGE=unhBTM25ikLzWPH9f523fhH+ycUv8+GM-ZUbBXXmg7g@mail.gmail.com>

Dear FieldTrip community,



I am new to FieldTrip and got stuck while trying to exactly replicate an
analysis reported in a paper. I would be very grateful for any tips.
Specifically, I cannot manage to automatically reject trials with certain
min/max uV (question 1) and cannot find any way to automatically detect
linear drift (question 2).

*1.* After segmenting and baseline correcting using *demean*, I am trying
to use the following code for rejection of trials with extreme values using
*ft_artifact_threshold*, but I seem to have made a mistake somewhere:

    cfg = [];

    cfg.trl = 'baselined.sampleinfo';

    cfg.continuous = 'no';

    cfg.artfctdef.threshold.min = -75;

    cfg.artfctdef.threshold.max = 75;



    [cfg, artifact] = ft_artifact_threshold(cfg, baselined);


I am getting to following error:

Error using butter (line 79)
butter: first band edge must be smaller than second

Error in ft_preproc_bandpassfilter (line 153)
[B, A] = butter(N, [min(Fbp)/Fn max(Fbp)/Fn]);

Error in preproc (line 327)
if strcmp(cfg.bpfilter, 'yes'), dat = ft_preproc_bandpassfilter(dat,
fsample, cfg.bpfreq, cfg.bpfiltord, cfg.bpfilttype,
cfg.bpfiltdir, cfg.bpinstabilityfix, cfg.bpfiltdf, cfg.bpfiltwintype,
cfg.bpfiltdev, cfg.plotfiltresp, cfg.usefftfilt); end

Error in ft_artifact_threshold (line 164)
dat = preproc(dat, channel, offset2time(cfg.trl(trlop,3), hdr.Fs,
size(dat,2)), artfctdef);

*2. *I am also trying to detect a linear drift of more than +/- 50 uV
beginning before the onset of the stimulus (so before 0). With this one, I
am not sure where to begin. I would be grateful for tips about what
functions I can use to do this.


Kind regards,
Arnold Kochari
PhD candidate, Institute for Logic, Language and Computation, University of
Amsterdam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170622/4eab3810/attachment.htm>

From orekhova.elena.v at gmail.com  Thu Jun 22 17:43:48 2017
From: orekhova.elena.v at gmail.com (Elena Orekhova)
Date: Thu, 22 Jun 2017 17:43:48 +0200
Subject: [FieldTrip] surface plot with atlas limited template_grid.inside
Message-ID: <CAGuwe0LYqoumYtRJKvY99LFCdjU6WWHuHG5oT87+Kw+fy-CzDg@mail.gmail.com>

Dear FT experts,

I just recently started to use Fieldtrip for my MEG data source
reconstruction.


I would like to use an atlas with my source reconstruction. I limited
template_grid.inside to the atlas, as advised in the tutorial (
http://www.fieldtriptoolbox.org/tutorial/salzburg)



%% Create template grid based on the standard head model

load(strcat(fieldtripfolder, '/template/headmodel/standard_singleshell'));

step=0.7;

cfg = [];

cfg.grid.xgrid  = -20:step:20;

cfg.grid.ygrid  = -20:step:20;

cfg.grid.zgrid  = -20:step:20;

cfg.grid.unit   = 'cm';

cfg.grid.tight  = 'yes';

cfg.inwardshift = -1;

cfg.headmodel        = vol;

template_grid  = ft_prepare_sourcemodel(cfg);



%% Load atlas and create a binary mask

atlas = ft_read_atlas(strcat(fieldtripfolder,
'/template/atlas/aal/ROI_MNI_V4.nii') );

atlas = ft_convert_units(atlas,'cm');% assure that atlas and template_grid
are expressed in the %same units



cfg = []

cfg.atlas = atlas;

cfg.roi = atlas.tissuelabel; % here you can also specify a single label,
i.e. single ROI

cfg.inputcoord = 'mni';

mask = ft_volumelookup(cfg,template_grid);



% create temporary mask according to the atlas entries

tmp                  = repmat(template_grid.inside,1,1);

tmp(tmp==1)          = 0;

tmp(mask)            = 1;

% define inside locations according to the atlas based mask

template_grid.inside = tmp;

%%


Then I performed the  source reconstruction using this template_grid and
plotted the result (induced visual gamma power) on the standard brain
surface.



The resulting surface image has ‘holes’ and it does not look correct to me.

When I do not limit the template_grid.inside to the atlas it looks much
better.

(figures are attached)



What am I doing wrong?



Best regards,

Elena
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170622/2b26f9b2/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Example_to templatenomask.jpg
Type: image/jpeg
Size: 15192 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170622/2b26f9b2/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Example_to atlas.jpg
Type: image/jpeg
Size: 16680 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170622/2b26f9b2/attachment-0001.jpg>

From maria.hakonen at gmail.com  Fri Jun 23 11:23:32 2017
From: maria.hakonen at gmail.com (Maria Hakonen)
Date: Fri, 23 Jun 2017 12:23:32 +0300
Subject: [FieldTrip] Estimate coherence between conditions?
Message-ID: <CADF3goMth8S5N496=uDbMyJ_jsiyy+dGDhsq++Sfvbax4JyS-g@mail.gmail.com>

Dear FieldTrip experts,

I have just started to use Fieldtrip and would like to estimate coherence
between MEG responses measured in two different conditions from the same
cortical areas. The example in Appendix 1 is close to what I would like to
do:
http://www.fieldtriptoolbox.org/tutorial/coherence

However, in the example, coherence is calculated between the reference
signal (EMG) and all MEG channels. Could it be possible to calculate
coherence between each MEG channel in one condition and the same MEG
channels in the other condition, that is:
ch1 in cond1 vs. ch1 in cond2, ch2 in cond1 vs. ch2 in cond2, ...

As far as I understand, the example in Appendix 1 would do this:
ch1 in cond1 vs. all channels in cond2, ch2 in cond ch1 all channels in
cond2, ...

Best,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170623/9f8be2d3/attachment.htm>

From maity_winky at yahoo.es  Fri Jun 23 16:07:39 2017
From: maity_winky at yahoo.es (=?UTF-8?Q?Mait=C3=A9_Crespo_Garc=C3=ADa?=)
Date: Fri, 23 Jun 2017 14:07:39 +0000 (UTC)
Subject: [FieldTrip] Estimate coherence between conditions?
In-Reply-To: <CADF3goMth8S5N496=uDbMyJ_jsiyy+dGDhsq++Sfvbax4JyS-g@mail.gmail.com>
References: <CADF3goMth8S5N496=uDbMyJ_jsiyy+dGDhsq++Sfvbax4JyS-g@mail.gmail.com>
Message-ID: <1150996732.820503.1498226859679@mail.yahoo.com>

Hi Maria,
Here it is a possible solution. First, rename channels from one of both conditions: for example, for condition 2, {'ch01cond2', 'ch02cond2', ...}. Then, append the data from both conditions. In ft_freqanalysis introduce all the channels combinations you want: 

cfg.channel    = {'MEG' 'ch01cond2' 'ch02cond2' ...};
cfg.channelcmb = {'ch01' 'ch01cond2'; 'ch02' 'ch02cond2'};
As I understand, you could use the same channelcmb later on in ft_connectivityanalysis.
I hope it helps.
Best wishes,Maité

. 
 

    El Viernes 23 de junio de 2017 11:43, Maria Hakonen <maria.hakonen at gmail.com> escribió:
 

 Dear FieldTrip experts,

I have just started to use Fieldtrip and would like to estimate coherence between MEG responses measured in two different conditions from the same cortical areas. The example in Appendix 1 is close to what I would like to do:
http://www.fieldtriptoolbox.org/tutorial/coherence

However, in the example, coherence is calculated between the reference signal (EMG) and all MEG channels. Could it be possible to calculate coherence between each MEG channel in one condition and the same MEG channels in the other condition, that is: 
ch1 in cond1 vs. ch1 in cond2, ch2 in cond1 vs. ch2 in cond2, ... 

As far as I understand, the example in Appendix 1 would do this: 
ch1 in cond1 vs. all channels in cond2, ch2 in cond ch1 all channels in cond2, ...

Best,
Maria
_______________________________________________
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/20170623/7dfbd1ed/attachment.htm>

From stephen.whitmarsh at gmail.com  Fri Jun 23 16:28:01 2017
From: stephen.whitmarsh at gmail.com (Stephen Whitmarsh)
Date: Fri, 23 Jun 2017 16:28:01 +0200
Subject: [FieldTrip] source pos dimensions ft_sourcestatistics
In-Reply-To: <4EF37F95-710B-4EAC-8FE5-786964346094@donders.ru.nl>
References: <CAFrxm=zDPvMrD8rpfWo5Yu_BsH_0ztjf4NA4ZQRjr3gTRiB9qg@mail.gmail.com>
 <4EF37F95-710B-4EAC-8FE5-786964346094@donders.ru.nl>
Message-ID: <CAFrxm=xRaN3T-hcN_gy-oMW6tLXj1G02G56k0oHPdsEN1+gSKQ@mail.gmail.com>

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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170623/9a35b009/attachment.htm>

From jan.schoffelen at donders.ru.nl  Sat Jun 24 09:30:27 2017
From: jan.schoffelen at donders.ru.nl (Schoffelen, J.M. (Jan Mathijs))
Date: Sat, 24 Jun 2017 07:30:27 +0000
Subject: [FieldTrip] source pos dimensions ft_sourcestatistics
In-Reply-To: <CAFrxm=xRaN3T-hcN_gy-oMW6tLXj1G02G56k0oHPdsEN1+gSKQ@mail.gmail.com>
References: <CAFrxm=zDPvMrD8rpfWo5Yu_BsH_0ztjf4NA4ZQRjr3gTRiB9qg@mail.gmail.com>
 <4EF37F95-710B-4EAC-8FE5-786964346094@donders.ru.nl>
 <CAFrxm=xRaN3T-hcN_gy-oMW6tLXj1G02G56k0oHPdsEN1+gSKQ@mail.gmail.com>
Message-ID: <5C6A6EB1-B4DD-4770-938A-A53E61A5E489@donders.ru.nl>

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
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<mailto: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<mailto: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<mailto: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<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip


_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto: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/20170624/8f0e509b/attachment.htm>

From maria.hakonen at gmail.com  Sun Jun 25 12:53:15 2017
From: maria.hakonen at gmail.com (Maria Hakonen)
Date: Sun, 25 Jun 2017 13:53:15 +0300
Subject: [FieldTrip] Estimate coherence between conditions?
In-Reply-To: <CADF3goMth8S5N496=uDbMyJ_jsiyy+dGDhsq++Sfvbax4JyS-g@mail.gmail.com>
References: <CADF3goMth8S5N496=uDbMyJ_jsiyy+dGDhsq++Sfvbax4JyS-g@mail.gmail.com>
Message-ID: <CADF3goPiG=UOutDDjHA5jm3UgLTpX_hzEv-AUZeCfzdNGH1MGQ@mail.gmail.com>

Hi Maité,

Thank you for your answer!

I have managed to calculate the coherence between two conditions in
the sensor space in the way you suggested. However, I haven't managed
to calculate the coherence between conditions in the source space
(i.e. Appendix 1 in
http://www.fieldtriptoolbox.org/tutorial/coherence). ft_sourceanalysis
doesn't have channelcmb. I wonder if anyone has any solutions for
this?

BTW. I didn't get the answer to my question in my email but found it
from Fieldtrip archive. However, I have also got some other emails
from fieldtrip discussion forum.

Best,

Maria


Hi Maria,
Here it is a possible solution. First, rename channels from one of
both conditions: for example, for condition 2, {'ch01cond2',
'ch02cond2', ...}. Then, append the data from both conditions. In
ft_freqanalysis introduce all the channels combinations you want:

cfg.channel    = {'MEG' 'ch01cond2' 'ch02cond2' ...};
cfg.channelcmb = {'ch01' 'ch01cond2'; 'ch02' 'ch02cond2'};
As I understand, you could use the same channelcmb later on in
ft_connectivityanalysis.
I hope it helps.
Best wishes,Maité



Dear FieldTrip experts,

I have just started to use Fieldtrip and would like to estimate coherence
between MEG responses measured in two different conditions from the same
cortical areas. The example in Appendix 1 is close to what I would like to
do:
http://www.fieldtriptoolbox.org/tutorial/coherence

However, in the example, coherence is calculated between the reference
signal (EMG) and all MEG channels. Could it be possible to calculate
coherence between each MEG channel in one condition and the same MEG
channels in the other condition, that is:
ch1 in cond1 vs. ch1 in cond2, ch2 in cond1 vs. ch2 in cond2, ...

As far as I understand, the example in Appendix 1 would do this:
ch1 in cond1 vs. all channels in cond2, ch2 in cond ch1 all channels in
cond2, ...

Best,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170625/37cdbbce/attachment.htm>

From maity_winky at yahoo.es  Mon Jun 26 08:42:11 2017
From: maity_winky at yahoo.es (=?UTF-8?Q?Mait=C3=A9_Crespo_Garc=C3=ADa?=)
Date: Mon, 26 Jun 2017 06:42:11 +0000 (UTC)
Subject: [FieldTrip] Estimate coherence between conditions?
In-Reply-To: <CADF3goPiG=UOutDDjHA5jm3UgLTpX_hzEv-AUZeCfzdNGH1MGQ@mail.gmail.com>
References: <CADF3goMth8S5N496=uDbMyJ_jsiyy+dGDhsq++Sfvbax4JyS-g@mail.gmail.com>
 <CADF3goPiG=UOutDDjHA5jm3UgLTpX_hzEv-AUZeCfzdNGH1MGQ@mail.gmail.com>
Message-ID: <1122498006.3141711.1498459331272@mail.yahoo.com>

Hi Maria,
maybe in this case it is better that you export the sources timecourses, build a data matrix with them and treat them in the same way as you did with the channels. 

Best,Maité 

    El Domingo 25 de junio de 2017 13:11, Maria Hakonen <maria.hakonen at gmail.com> escribió:
 

 Hi Maité,Thank you for your answer!I have managed to calculate the coherence between two conditions in the sensor space in the way you suggested. However, I haven't managed to calculate the coherence between conditions in the source space (i.e. Appendix 1 in http://www.fieldtriptoolbox.org/tutorial/coherence). ft_sourceanalysis doesn't have channelcmb. I wonder if anyone has any solutions for this?BTW. I didn't get the answer to my question in my email but found it from Fieldtrip archive. However, I have also got some other emails from fieldtrip discussion forum.Best,Maria
Hi Maria,
Here it is a possible solution. First, rename channels from one of both conditions: for example, for condition 2, {'ch01cond2', 'ch02cond2', ...}. Then, append the data from both conditions. In ft_freqanalysis introduce all the channels combinations you want: 

cfg.channel    = {'MEG' 'ch01cond2' 'ch02cond2' ...};
cfg.channelcmb = {'ch01' 'ch01cond2'; 'ch02' 'ch02cond2'};
As I understand, you could use the same channelcmb later on in ft_connectivityanalysis.
I hope it helps.
Best wishes,Maité

Dear FieldTrip experts,

I have just started to use Fieldtrip and would like to estimate coherence between MEG responses measured in two different conditions from the same cortical areas. The example in Appendix 1 is close to what I would like to do:
http://www.fieldtriptoolbox.or g/tutorial/coherence

However, in the example, coherence is calculated between the reference signal (EMG) and all MEG channels. Could it be possible to calculate coherence between each MEG channel in one condition and the same MEG channels in the other condition, that is: 
ch1 in cond1 vs. ch1 in cond2, ch2 in cond1 vs. ch2 in cond2, ... 

As far as I understand, the example in Appendix 1 would do this: 
ch1 in cond1 vs. all channels in cond2, ch2 in cond ch1 all channels in cond2, ...

Best,
Maria

_______________________________________________
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/9d38ad0e/attachment.htm>

From jonas at obleser.de  Mon Jun 26 09:55:23 2017
From: jonas at obleser.de (Jonas Obleser)
Date: Mon, 26 Jun 2017 07:55:23 +0000
Subject: [FieldTrip] =?iso-8859-1?q?Call_for_a_professorship_position_at_t?=
 =?iso-8859-1?q?he_University_of_L=FCbeck=2C_Germany?=
Message-ID: <474f0f4506ac4d9385e84e356d620e82@EXPRD01.hosting.ru.nl>

Dear colleagues,
Excuse the spam/cross-posting:

We are currently advertising a Tenure-track Professor position (W2) in Differential Psychology (Interindividual differences) and Diagnostics
at the University of Lübeck, Germany. Deadline is July 13.

Thanks for alerting potentially interested candidates to this!
PM or call me for details.

https://www.dropbox.com/s/vddqzetsd4etyd9/Call%20Differential%20Psychology%20Luebeck%20EN.pdf?dl=1

Best wishes, Jonas





Jonas Obleser
Professor

Universität zu Lübeck
Department of Psychology
MFC 8, Maria-Goeppert-Straße 9a
23562 Lübeck, Germany

Phone +49 (0)451 3101 3620
Mobile +49 (0)171 6993337
jonas.obleser at uni-luebeck.de<mailto:jonas.obleser at uni-luebeck.de>
http://jonasobleser.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170626/1dfda784/attachment.htm>

From maria.hakonen at gmail.com  Mon Jun 26 11:45:06 2017
From: maria.hakonen at gmail.com (Maria Hakonen)
Date: Mon, 26 Jun 2017 12:45:06 +0300
Subject: [FieldTrip] Estimate coherence between conditions?
In-Reply-To: <CADF3goPiG=UOutDDjHA5jm3UgLTpX_hzEv-AUZeCfzdNGH1MGQ@mail.gmail.com>
References: <CADF3goMth8S5N496=uDbMyJ_jsiyy+dGDhsq++Sfvbax4JyS-g@mail.gmail.com>
 <CADF3goPiG=UOutDDjHA5jm3UgLTpX_hzEv-AUZeCfzdNGH1MGQ@mail.gmail.com>
Message-ID: <CADF3goPdSLOnyLZWKPWSQXF+hEwAVor9r_iEzmVuQ-ckkQ==FQ@mail.gmail.com>

Hi Maria,
maybe in this case it is better that you export the sources
timecourses, build a data matrix with them and treat them in the same
way as you did with the channels.

Best,Maité


Hi Maité,

Could you please yet let me know how to get the sources timecources? source
= ft_sourceanalysis(cfg, freq); only gives
source =

         freq: 18
    cumtapcnt: [180x1 double]
          dim: [19 15 15]
       inside: [4275x1 logical]
          pos: [4275x3 double]
       method: 'average'
          avg: [1x1 struct]
          cfg: [1x1 struct]

Best,
Maria

2017-06-25 13:53 GMT+03:00 Maria Hakonen <maria.hakonen at gmail.com>:

> Hi Maité,
>
> Thank you for your answer!
>
> I have managed to calculate the coherence between two conditions in the sensor space in the way you suggested. However, I haven't managed to calculate the coherence between conditions in the source space (i.e. Appendix 1 in http://www.fieldtriptoolbox.org/tutorial/coherence). ft_sourceanalysis doesn't have channelcmb. I wonder if anyone has any solutions for this?
>
> BTW. I didn't get the answer to my question in my email but found it from Fieldtrip archive. However, I have also got some other emails from fieldtrip discussion forum.
>
> Best,
>
> Maria
>
>
> Hi Maria,
> Here it is a possible solution. First, rename channels from one of both conditions: for example, for condition 2, {'ch01cond2', 'ch02cond2', ...}. Then, append the data from both conditions. In ft_freqanalysis introduce all the channels combinations you want:
>
> cfg.channel    = {'MEG' 'ch01cond2' 'ch02cond2' ...};
> cfg.channelcmb = {'ch01' 'ch01cond2'; 'ch02' 'ch02cond2'};
> As I understand, you could use the same channelcmb later on in ft_connectivityanalysis.
> I hope it helps.
> Best wishes,Maité
>
>
>
> Dear FieldTrip experts,
>
> I have just started to use Fieldtrip and would like to estimate coherence
> between MEG responses measured in two different conditions from the same
> cortical areas. The example in Appendix 1 is close to what I would like to
> do:
> http://www.fieldtriptoolbox.org/tutorial/coherence
>
> However, in the example, coherence is calculated between the reference
> signal (EMG) and all MEG channels. Could it be possible to calculate
> coherence between each MEG channel in one condition and the same MEG
> channels in the other condition, that is:
> ch1 in cond1 vs. ch1 in cond2, ch2 in cond1 vs. ch2 in cond2, ...
>
> As far as I understand, the example in Appendix 1 would do this:
> ch1 in cond1 vs. all channels in cond2, ch2 in cond ch1 all channels in
> cond2, ...
>
> Best,
> Maria
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170626/38ae2fa4/attachment.htm>

From maity_winky at yahoo.es  Mon Jun 26 12:58:40 2017
From: maity_winky at yahoo.es (=?UTF-8?Q?Mait=C3=A9_Crespo_Garc=C3=ADa?=)
Date: Mon, 26 Jun 2017 10:58:40 +0000 (UTC)
Subject: [FieldTrip] Estimate coherence between conditions?
In-Reply-To: <CADF3goPdSLOnyLZWKPWSQXF+hEwAVor9r_iEzmVuQ-ckkQ==FQ@mail.gmail.com>
References: <CADF3goMth8S5N496=uDbMyJ_jsiyy+dGDhsq++Sfvbax4JyS-g@mail.gmail.com>
 <CADF3goPiG=UOutDDjHA5jm3UgLTpX_hzEv-AUZeCfzdNGH1MGQ@mail.gmail.com>
 <CADF3goPdSLOnyLZWKPWSQXF+hEwAVor9r_iEzmVuQ-ckkQ==FQ@mail.gmail.com>
Message-ID: <169939442.3510085.1498474720044@mail.yahoo.com>

Hi Maria,
for obtaining the sources timecourses (aka virtual channels) you can follow the tutorials pasted below. 

Best,Maité

http://www.fieldtriptoolbox.org/tutorial/connectivity#extract_the_virtual_channel_time-series

http://www.fieldtriptoolbox.org/tutorial/shared/virtual_sensors#extract_the_virtual_channel_time-series


 

    El Lunes 26 de junio de 2017 12:02, Maria Hakonen <maria.hakonen at gmail.com> escribió:
 

 Hi Maria,
maybe in this case it is better that you export the sources timecourses, build a data matrix with them and treat them in the same way as you did with the channels. 

Best,Maité 

Hi Maité,
Could you please yet let me know how to get the sources timecources? source = ft_sourceanalysis(cfg, freq); only gives  source = 
         freq: 18    cumtapcnt: [180x1 double]          dim: [19 15 15]       inside: [4275x1 logical]          pos: [4275x3 double]       method: 'average'          avg: [1x1 struct]          cfg: [1x1 struct]
Best,Maria
2017-06-25 13:53 GMT+03:00 Maria Hakonen <maria.hakonen at gmail.com>:

Hi Maité,Thank you for your answer!I have managed to calculate the coherence between two conditions in the sensor space in the way you suggested. However, I haven't managed to calculate the coherence between conditions in the source space (i.e. Appendix 1 in http://www.fieldtriptoolbox. org/tutorial/coherence). ft_sourceanalysis doesn't have channelcmb. I wonder if anyone has any solutions for this?BTW. I didn't get the answer to my question in my email but found it from Fieldtrip archive. However, I have also got some other emails from fieldtrip discussion forum.Best,Maria
Hi Maria,
Here it is a possible solution. First, rename channels from one of both conditions: for example, for condition 2, {'ch01cond2', 'ch02cond2', ...}. Then, append the data from both conditions. In ft_freqanalysis introduce all the channels combinations you want: 

cfg.channel    = {'MEG' 'ch01cond2' 'ch02cond2' ...};
cfg.channelcmb = {'ch01' 'ch01cond2'; 'ch02' 'ch02cond2'};
As I understand, you could use the same channelcmb later on in ft_connectivityanalysis.
I hope it helps.
Best wishes,Maité

Dear FieldTrip experts,

I have just started to use Fieldtrip and would like to estimate coherence between MEG responses measured in two different conditions from the same cortical areas. The example in Appendix 1 is close to what I would like to do:
http://www.fieldtriptoolbox.or g/tutorial/coherence

However, in the example, coherence is calculated between the reference signal (EMG) and all MEG channels. Could it be possible to calculate coherence between each MEG channel in one condition and the same MEG channels in the other condition, that is: 
ch1 in cond1 vs. ch1 in cond2, ch2 in cond1 vs. ch2 in cond2, ... 

As far as I understand, the example in Appendix 1 would do this: 
ch1 in cond1 vs. all channels in cond2, ch2 in cond ch1 all channels in cond2, ...

Best,
Maria



_______________________________________________
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/3503eeb4/attachment.htm>

From stephen.whitmarsh at gmail.com  Mon Jun 26 13:09:28 2017
From: stephen.whitmarsh at gmail.com (Stephen Whitmarsh)
Date: Mon, 26 Jun 2017 13:09:28 +0200
Subject: [FieldTrip] source pos dimensions ft_sourcestatistics
In-Reply-To: <5C6A6EB1-B4DD-4770-938A-A53E61A5E489@donders.ru.nl>
References: <CAFrxm=zDPvMrD8rpfWo5Yu_BsH_0ztjf4NA4ZQRjr3gTRiB9qg@mail.gmail.com>
 <4EF37F95-710B-4EAC-8FE5-786964346094@donders.ru.nl>
 <CAFrxm=xRaN3T-hcN_gy-oMW6tLXj1G02G56k0oHPdsEN1+gSKQ@mail.gmail.com>
 <5C6A6EB1-B4DD-4770-938A-A53E61A5E489@donders.ru.nl>
Message-ID: <CAFrxm=xVMzjMsj8ftesO8BPYymv5a5TszjmXDoLjoi5zNRnVYQ@mail.gmail.com>

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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170626/2883fef6/attachment.htm>

From stephen.whitmarsh at gmail.com  Mon Jun 26 13:42:58 2017
From: stephen.whitmarsh at gmail.com (Stephen Whitmarsh)
Date: Mon, 26 Jun 2017 13:42:58 +0200
Subject: [FieldTrip] source pos dimensions ft_sourcestatistics
In-Reply-To: <CAFrxm=xVMzjMsj8ftesO8BPYymv5a5TszjmXDoLjoi5zNRnVYQ@mail.gmail.com>
References: <CAFrxm=zDPvMrD8rpfWo5Yu_BsH_0ztjf4NA4ZQRjr3gTRiB9qg@mail.gmail.com>
 <4EF37F95-710B-4EAC-8FE5-786964346094@donders.ru.nl>
 <CAFrxm=xRaN3T-hcN_gy-oMW6tLXj1G02G56k0oHPdsEN1+gSKQ@mail.gmail.com>
 <5C6A6EB1-B4DD-4770-938A-A53E61A5E489@donders.ru.nl>
 <CAFrxm=xVMzjMsj8ftesO8BPYymv5a5TszjmXDoLjoi5zNRnVYQ@mail.gmail.com>
Message-ID: <CAFrxm=w8NRvRzYeyy1o_EjtTgkTtoahOU1f+tkoQ7P0k_3viww@mail.gmail.com>

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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170626/76719ede/attachment.htm>

From jan.schoffelen at donders.ru.nl  Mon Jun 26 14:45:40 2017
From: jan.schoffelen at donders.ru.nl (Schoffelen, J.M. (Jan Mathijs))
Date: Mon, 26 Jun 2017 12:45:40 +0000
Subject: [FieldTrip] source pos dimensions ft_sourcestatistics
In-Reply-To: <CAFrxm=w8NRvRzYeyy1o_EjtTgkTtoahOU1f+tkoQ7P0k_3viww@mail.gmail.com>
References: <CAFrxm=zDPvMrD8rpfWo5Yu_BsH_0ztjf4NA4ZQRjr3gTRiB9qg@mail.gmail.com>
 <4EF37F95-710B-4EAC-8FE5-786964346094@donders.ru.nl>
 <CAFrxm=xRaN3T-hcN_gy-oMW6tLXj1G02G56k0oHPdsEN1+gSKQ@mail.gmail.com>
 <5C6A6EB1-B4DD-4770-938A-A53E61A5E489@donders.ru.nl>
 <CAFrxm=xVMzjMsj8ftesO8BPYymv5a5TszjmXDoLjoi5zNRnVYQ@mail.gmail.com>
 <CAFrxm=w8NRvRzYeyy1o_EjtTgkTtoahOU1f+tkoQ7P0k_3viww@mail.gmail.com>
Message-ID: <CF4095FC-2A08-40CB-9982-2E753E7D3BCF@donders.ru.nl>

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<mailto: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<mailto: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<mailto: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<tel:+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<mailto: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<mailto: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<mailto: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<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip


_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip






_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip


_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto: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/8417a639/attachment.htm>

From stephen.whitmarsh at gmail.com  Mon Jun 26 14:57:22 2017
From: stephen.whitmarsh at gmail.com (Stephen Whitmarsh)
Date: Mon, 26 Jun 2017 14:57:22 +0200
Subject: [FieldTrip] source pos dimensions ft_sourcestatistics
In-Reply-To: <CF4095FC-2A08-40CB-9982-2E753E7D3BCF@donders.ru.nl>
References: <CAFrxm=zDPvMrD8rpfWo5Yu_BsH_0ztjf4NA4ZQRjr3gTRiB9qg@mail.gmail.com>
 <4EF37F95-710B-4EAC-8FE5-786964346094@donders.ru.nl>
 <CAFrxm=xRaN3T-hcN_gy-oMW6tLXj1G02G56k0oHPdsEN1+gSKQ@mail.gmail.com>
 <5C6A6EB1-B4DD-4770-938A-A53E61A5E489@donders.ru.nl>
 <CAFrxm=xVMzjMsj8ftesO8BPYymv5a5TszjmXDoLjoi5zNRnVYQ@mail.gmail.com>
 <CAFrxm=w8NRvRzYeyy1o_EjtTgkTtoahOU1f+tkoQ7P0k_3viww@mail.gmail.com>
 <CF4095FC-2A08-40CB-9982-2E753E7D3BCF@donders.ru.nl>
Message-ID: <CAFrxm=xOqUSJFAKesEYpam=awPba1FwjgwC5O+4-2TvNFDPBJA@mail.gmail.com>

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.htm>

From jan.schoffelen at donders.ru.nl  Mon Jun 26 15:23:44 2017
From: jan.schoffelen at donders.ru.nl (Schoffelen, J.M. (Jan Mathijs))
Date: Mon, 26 Jun 2017 13:23:44 +0000
Subject: [FieldTrip] source pos dimensions ft_sourcestatistics
In-Reply-To: <CAFrxm=xOqUSJFAKesEYpam=awPba1FwjgwC5O+4-2TvNFDPBJA@mail.gmail.com>
References: <CAFrxm=zDPvMrD8rpfWo5Yu_BsH_0ztjf4NA4ZQRjr3gTRiB9qg@mail.gmail.com>
 <4EF37F95-710B-4EAC-8FE5-786964346094@donders.ru.nl>
 <CAFrxm=xRaN3T-hcN_gy-oMW6tLXj1G02G56k0oHPdsEN1+gSKQ@mail.gmail.com>
 <5C6A6EB1-B4DD-4770-938A-A53E61A5E489@donders.ru.nl>
 <CAFrxm=xVMzjMsj8ftesO8BPYymv5a5TszjmXDoLjoi5zNRnVYQ@mail.gmail.com>
 <CAFrxm=w8NRvRzYeyy1o_EjtTgkTtoahOU1f+tkoQ7P0k_3viww@mail.gmail.com>
 <CF4095FC-2A08-40CB-9982-2E753E7D3BCF@donders.ru.nl>
 <CAFrxm=xOqUSJFAKesEYpam=awPba1FwjgwC5O+4-2TvNFDPBJA@mail.gmail.com>
Message-ID: <A08D8D4E-F750-4E1E-BE24-C35B7F711EE3@donders.ru.nl>

Hi Stephen,
As indicated earlier, it could be that the old functionality of source2full/source2sparse is broken (i.e. not backward compatible). The easiest solution would be to re-run your pipeline, omitting the step of source2sparse.

Alternatively, you may try and handcraft your way into making the stat-structure ‘full’ again. This latter only works if you have a well-defined set of 3D positions of the template grid you used (which I assume you have somewhere), as well as the indices of the ‘inside’ dipole positions

In pseudocode:

fn = fieldnames(stat);
for k = 1:numel(fn)
if numel(stat.(fn{k})==2982),
tmp=zeros(prod(stat.dim),1);
tmp(inside) = stat.(fn{k});
end
end

stat.pos = the-set-of-template-positions (prod(stat.dim)x3)
stat.inside = a boolean vector indexing the inside dipole positions


Best,
JM


On 26 Jun 2017, at 14:57, Stephen Whitmarsh <stephen.whitmarsh at gmail.com<mailto:stephen.whitmarsh at gmail.com>> wrote:

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<mailto: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<mailto: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<mailto: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<mailto: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<tel:+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<mailto: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<mailto: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<mailto: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<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip


_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip






_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip


_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip


_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto: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/b3f6f37c/attachment.htm>

From stephen.whitmarsh at gmail.com  Mon Jun 26 15:34:23 2017
From: stephen.whitmarsh at gmail.com (Stephen Whitmarsh)
Date: Mon, 26 Jun 2017 15:34:23 +0200
Subject: [FieldTrip] source pos dimensions ft_sourcestatistics
In-Reply-To: <A08D8D4E-F750-4E1E-BE24-C35B7F711EE3@donders.ru.nl>
References: <CAFrxm=zDPvMrD8rpfWo5Yu_BsH_0ztjf4NA4ZQRjr3gTRiB9qg@mail.gmail.com>
 <4EF37F95-710B-4EAC-8FE5-786964346094@donders.ru.nl>
 <CAFrxm=xRaN3T-hcN_gy-oMW6tLXj1G02G56k0oHPdsEN1+gSKQ@mail.gmail.com>
 <5C6A6EB1-B4DD-4770-938A-A53E61A5E489@donders.ru.nl>
 <CAFrxm=xVMzjMsj8ftesO8BPYymv5a5TszjmXDoLjoi5zNRnVYQ@mail.gmail.com>
 <CAFrxm=w8NRvRzYeyy1o_EjtTgkTtoahOU1f+tkoQ7P0k_3viww@mail.gmail.com>
 <CF4095FC-2A08-40CB-9982-2E753E7D3BCF@donders.ru.nl>
 <CAFrxm=xOqUSJFAKesEYpam=awPba1FwjgwC5O+4-2TvNFDPBJA@mail.gmail.com>
 <A08D8D4E-F750-4E1E-BE24-C35B7F711EE3@donders.ru.nl>
Message-ID: <CAFrxm=yBeM=fEy5iS+qai2bikwawT7s+s9i83YKN=Oysw9yRgQ@mail.gmail.com>

Salut Jan-Mathijs,

As indicated earlier - I have been running the pipeline with recent
versions of FT, and nowhere use source2sparse, but yeah, there is plenty of
custom code, so somewhere along the lines it went to sparse.

In any case, for the sake of our (well, your) progeny and anyone else
listening, I finally solved it like this, using the dimensionality of the
template grid to which I reverse-warped my subjects.

% prepare datastruct
stat_full            = keepfields(stat,{'label','stat'});
stat_full.statdimord = 'pos';
stat_full.dimord     = 'pos';
stat_full.dim        = template_grid.dim;

% from sparse to full
stat_full.stat                       = zeros(prod(stat_full.dim),1);
stat_full.stat(template_grid.inside) = stat.stat;
stat_full.pos                        = template_grid.pos;

% and now this works:
stat_int        = ft_sourceinterpolate(cfg, stat_full, template_mri);
stat_int.inside = template_mri.inside;

Like always, thanks for you help and patience!

A bientot,
Stephen


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

> Hi Stephen,
> As indicated earlier, it could be that the old functionality of
> source2full/source2sparse is broken (i.e. not backward compatible). The
> easiest solution would be to re-run your pipeline, omitting the step of
> source2sparse.
>
> Alternatively, you may try and handcraft your way into making the
> stat-structure ‘full’ again. This latter only works if you have a
> well-defined set of 3D positions of the template grid you used (which I
> assume you have somewhere), as well as the indices of the ‘inside’ dipole
> positions
>
> In pseudocode:
>
> fn = fieldnames(stat);
> for k = 1:numel(fn)
> if numel(stat.(fn{k})==2982),
> tmp=zeros(prod(stat.dim),1);
> tmp(inside) = stat.(fn{k});
> end
> end
>
> stat.pos = the-set-of-template-positions (prod(stat.dim)x3)
> stat.inside = a boolean vector indexing the inside dipole positions
>
>
> Best,
> JM
>
>
> On 26 Jun 2017, at 14:57, Stephen Whitmarsh <stephen.whitmarsh at gmail.com>
> wrote:
>
> 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
>>
>
> _______________________________________________
> 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/910ab5fd/attachment.htm>

From da401 at kent.ac.uk  Mon Jun 26 15:56:13 2017
From: da401 at kent.ac.uk (D.Abdallah)
Date: Mon, 26 Jun 2017 13:56:13 +0000
Subject: [FieldTrip] Sending message to Fieldtrip mailing list subscribers
Message-ID: <1498485373154.82608@kent.ac.uk>

Dear All,



My name is Diane Abdallah. I am a PhD student at the University of Kent. My focus is analyzing EEG data collected on Perceptual Illusions and analyzing that data using MVPA. And this is my first time using the FieldTrip discussion list.



I have completed the MEG MVPA (Multivariate Pattern Analysis) tutorial on the FieldTrip website: http://www.fieldtriptoolbox.org/tutorial/multivariateanalysis
However, I am unable to understand the Brain Heat Map that at the end. Where is the x-axis? Where is the y-axis? What is the legend of the map? What does it represent?



Thank you so much for your help! It is very much appreciated :)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170626/07caccc5/attachment.htm>

From jan.schoffelen at donders.ru.nl  Mon Jun 26 16:31:17 2017
From: jan.schoffelen at donders.ru.nl (Schoffelen, J.M. (Jan Mathijs))
Date: Mon, 26 Jun 2017 14:31:17 +0000
Subject: [FieldTrip] Sending message to Fieldtrip mailing list
 subscribers
In-Reply-To: <1498485373154.82608@kent.ac.uk>
References: <1498485373154.82608@kent.ac.uk>
Message-ID: <71C62F04-7664-4358-B06A-75FE4FB3EFAE@donders.ru.nl>

Dear Diane,

Well, that makes two of us :). That is: I can tell you what is depicted in these, what you call, 'brain heat maps’, but I don’t understand the purpose. It’s a masked topographical display, where the color values reflect the (spatially interpolated)  sensor-specific weights that the classifier ‘learnt’ to be able to do an optimal classification. Typically this is not the most useful depiction, but the people who designed this particular tutorial probably have different ideas about this.

Stefan Haufe has written a nice paper about the interpretation of the outcome of multivariate classification algorithms (http://www.sciencedirect.com/science/article/pii/S1053811913010914) and makes a case for looking at the encoding or forward model, rather than at the decoding/inverse model parameters, as depicted in the tutorial. Some of the implemented methods in the ‘dmlt’ toolbox (which is the lower-level code that FieldTrip uses for the classification) generate output, typically called ‘weights’, that in a current version of FieldTrip is converted into a ‘weightsinv’ field, which reflect the ‘encoding parameters’ mentioned above.

Best wishes,
Jan-Mathijs



On 26 Jun 2017, at 15:56, D.Abdallah <da401 at kent.ac.uk<mailto:da401 at kent.ac.uk>> wrote:

Dear All,



My name is Diane Abdallah. I am a PhD student at the University of Kent. My focus is analyzing EEG data collected on Perceptual Illusions and analyzing that data using MVPA. And this is my first time using the FieldTrip discussion list.



I have completed the MEG MVPA (Multivariate Pattern Analysis) tutorial on the FieldTrip website:http://www.fieldtriptoolbox.org/tutorial/multivariateanalysis
However, I am unable to understand the Brain Heat Map that at the end. Where is the x-axis? Where is the y-axis? What is the legend of the map? What does it represent?



Thank you so much for your help! It is very much appreciated :)



_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto: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/01f2b604/attachment.htm>

From jan.schoffelen at donders.ru.nl  Mon Jun 26 21:10:59 2017
From: jan.schoffelen at donders.ru.nl (Schoffelen, J.M. (Jan Mathijs))
Date: Mon, 26 Jun 2017 19:10:59 +0000
Subject: [FieldTrip] possible bug when using old neuromas data with
 newer fieldtrip version
In-Reply-To: <CAHEWi10Mm=2wn7vu4nPF2q=Ufff9XTdj06u0ZkSusaUETumvNQ@mail.gmail.com>
References: <3B7F9C1A-46C4-4A4A-8FF2-9D974809F5B7@gmail.com>
 <CAHEWi10Mm=2wn7vu4nPF2q=Ufff9XTdj06u0ZkSusaUETumvNQ@mail.gmail.com>
Message-ID: <D776BE4D-9D9F-4EAD-9977-FAFD7361216E@donders.ru.nl>

Hey Russ,
I saw your message come by on the discussion list. Apparently, nobody felt inclined yet to respond :(.
Is there a reason why you read in the data with an old version of fieldtrip? I think there’s a backward compatibility clash, which is most likely due to the more fancy way in which sensors are defined these days. It could be that things are resolved if you upgrade your full analysis pipeline to a recent FT-version. Yet, I suspect an ‘adder under the grass’, as the Dutch saying goes…

Best,
JM

PS: please do keep sending off questions to the list. The fact that nobody responds is usually not due to any lack of competence on your side, but is probably mainly due to everybody to be too busy with their own chores.


On 26 Jun 2017, at 20:32, Russell G Port <russgport at gmail.com<mailto:russgport at gmail.com>> wrote:

Dear Dr. Schoffelen,


I was hoping to inquire about the email I sent last monday (see below). I have not seen it appear on the fieldtrip mailing list, and I am wondering if there was a problem with the email. I fully understand that if due to my past emails on the discussion list (and their lack of competence), my questions are no longer sent out. Alternatively, I was wondering if I should have sent this email to the bug tracker (though again I am not sure if it is actually a bug, or again my incompetence). I would really appreciate a confirmation, as I'm am currently held at my current step.

Best,
Russ Port

---------- Forwarded message ----------
From: russ port <russgport at gmail.com<mailto:russgport at gmail.com>>
Date: Mon, Jun 19, 2017 at 9:54 PM
Subject: possible bug when using old neuromas data with newer fieldtrip version
To: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>


Hi All,

Sorry to bother you all, but I was wondering if I may have found a possible bug. If so, I’ll submit a request to the bugzilla subsection. I am not completely sure the issue is not my own incompetence though. The error occurs when using a neuromag dataset that was read in with an old fieldtrip version (i.e. from 2015), and having it undergo ft_artifact_zvalue from a newer version of fieldtrip.

In short, I use the following code:

load('MEGGRAD_Visual_clean_combinedscripts')

        datanoline=[]
        datanoline=data_clean

load('/MEGGRADfinal_cleaned_jumpartifact_outputcfg_redone_Visual.mat')


        cfgaj                    = [];

        % channel selection, cutoff and padding
        cfgaj.artfctdef.zvalue.channel    = allchanell;
        cfgaj.artfctdef.zvalue.cutoff     =   cfgajout.artfctdef.zvalue.cutoff
        cfgaj.artfctdef.zvalue.trlpadding = 0;
        cfgaj.artfctdef.zvalue.artpadding = 0;
        cfgaj.artfctdef.zvalue.fltpadding = 0.0;

        % algorithmic parameters
        cfgaj.artfctdef.zvalue.cumulative    = 'yes';
        cfgaj.artfctdef.zvalue.medianfilter  = 'yes';
        cfgaj.artfctdef.zvalue.medianfiltord = 9;
        cfgaj.artfctdef.zvalue.absdiff       = 'yes';
    % cfgaj.artfctdef.zvalue.interactive = 'yes';

        [cfgajout, artifact_jump] = ft_artifact_zvalue(cfgaj,datanoline);

When I run this code in a 2015 version of fieldtrip, it works fine (without any error). On the other hand, in the 2016 version of fieldtrip I have (as well as in the latest version which  I downloaded this weekend), I get the following error:

Error using ft_datatype_sens (line 278)
unexpected number of coils (408)
contributing to channel MEG0113 (1)

Error in ft_datatype_raw (line 141)
      data.grad =
      ft_datatype_sens(data.grad);

Error in ft_checkdata (line 236)
  data = ft_datatype_raw(data,
  'hassampleinfo', hassampleinfo);

Error in ft_artifact_zvalue (line 215)
  data = ft_checkdata(data, 'datatype',
  'raw', 'hassampleinfo', 'yes’);


The dataset datanoline (as well as cfgaj) are linked to below (sorry it’s dropbox, but I’m not quite sure how to do it otherwise).

https://www.dropbox.com/s/86t5agwv2vanrh3/MEGGRAD_Visual_clean_combinedscripts.mat?dl=0

https://www.dropbox.com/s/rw8e7mof8plss72/MEGGRADfinal_cleaned_jumpartifact_outputcfg_redone_Visual.mat?dl=0

Sorry for the bother,
Russ






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170626/d4e6be57/attachment.htm>

From da401 at kent.ac.uk  Mon Jun 26 21:30:48 2017
From: da401 at kent.ac.uk (D.Abdallah)
Date: Mon, 26 Jun 2017 19:30:48 +0000
Subject: [FieldTrip] Question about ft_topoplotER
Message-ID: <1498505448904.50219@kent.ac.uk>

Dear All,



My name is Diane Abdallah. I am a PhD student at the University of Kent. My focus is analyzing EEG data collected on Perceptual Illusions and analyzing that data using MVPA. And this is my first time using the FieldTrip discussion list.



I have completed the MEG MVPA (Multivariate Pattern Analysis) tutorial on the FieldTrip website: http://www.fieldtriptoolbox.org/tutorial/multivariateanalysis
However, I am unable to understand the Brain Heat Map that at the end. Where is the x-axis? Where is the y-axis? What is the legend of the map? What does it represent?



I understand that it plots the mean over channels. But the mean of what exactly?



Thank you so much for your help! :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170626/dd0ea577/attachment.htm>

From bioeng.yoosofzadeh at gmail.com  Tue Jun 27 18:08:42 2017
From: bioeng.yoosofzadeh at gmail.com (Vahab Yousofzadeh)
Date: Tue, 27 Jun 2017 12:08:42 -0400
Subject: [FieldTrip] PCC vs DICS
Message-ID: <CAL5FLd+s=qnx2-S5pGVJDeKMh8iTR+kYUeBMvcR_B4qO6rWNhw@mail.gmail.com>

​​Dear all,

What is the main difference between DICS and PCC beamformer methods? It
seems that the PCC is more friendly than the DICS for the network analysis.
Is there any paper to cite for the PCC?

Thank you,
Vahab
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170627/0747206b/attachment.htm>

From russgport at gmail.com  Tue Jun 27 20:40:02 2017
From: russgport at gmail.com (russ port)
Date: Tue, 27 Jun 2017 14:40:02 -0400
Subject: [FieldTrip] possible bug when using old neuromas data with
 newer fieldtrip version
In-Reply-To: <D776BE4D-9D9F-4EAD-9977-FAFD7361216E@donders.ru.nl>
References: <3B7F9C1A-46C4-4A4A-8FF2-9D974809F5B7@gmail.com>
 <CAHEWi10Mm=2wn7vu4nPF2q=Ufff9XTdj06u0ZkSusaUETumvNQ@mail.gmail.com>
 <D776BE4D-9D9F-4EAD-9977-FAFD7361216E@donders.ru.nl>
Message-ID: <DC487556-964A-442F-99B2-6240AC44DDF7@gmail.com>

Hi JM and fieldtriplist in general,

Sorry to bother you all again, but I think JM was correct; there is an ‘adder under the grass’. 

Since the last email, I have re-read in my data using the newer version of fieldtrip. 

Now the script no longer fails during artifact rejection! The issue now appears during ft_plot_sens. It is the same issue as last time, where due to the sens.tra code (ft_plot_sens -> lines 336,337):

	poscoil = find(sens.tra(i,:)>0);
        negcoil = find(sens.tra(i,:)<0);

returning more than one element for both poscoil and negcoil, fieldtrip then produces an error. I believe this failure is occurring because this neuromag data was collected with active shielding. As a result I had to put the data through MaxFilter before reading it into fieldtrip (as the built in fiedltrip warning suggests). Is this correct? Below is a link to the sens array

https://www.dropbox.com/s/y2n0iq5ew2g42f0/sens_tra_russ.mat?dl=0 <https://www.dropbox.com/s/y2n0iq5ew2g42f0/sens_tra_russ.mat?dl=0>

Does anyone have suggestions on how to proceed with a sens.tra that returns multiple positive and negative coils?

Best,
Russ


> On Jun 26, 2017, at 3:10 PM, Schoffelen, J.M. (Jan Mathijs) <jan.schoffelen at donders.ru.nl> wrote:
> 
> Hey Russ,
> I saw your message come by on the discussion list. Apparently, nobody felt inclined yet to respond :(. 
> Is there a reason why you read in the data with an old version of fieldtrip? I think there’s a backward compatibility clash, which is most likely due to the more fancy way in which sensors are defined these days. It could be that things are resolved if you upgrade your full analysis pipeline to a recent FT-version. Yet, I suspect an ‘adder under the grass’, as the Dutch saying goes…
> 
> Best,
> JM
> 
> PS: please do keep sending off questions to the list. The fact that nobody responds is usually not due to any lack of competence on your side, but is probably mainly due to everybody to be too busy with their own chores.
> 
> 
>> On 26 Jun 2017, at 20:32, Russell G Port <russgport at gmail.com <mailto:russgport at gmail.com>> wrote:
>> 
>> Dear Dr. Schoffelen, 
>> 
>> 
>> I was hoping to inquire about the email I sent last monday (see below). I have not seen it appear on the fieldtrip mailing list, and I am wondering if there was a problem with the email. I fully understand that if due to my past emails on the discussion list (and their lack of competence), my questions are no longer sent out. Alternatively, I was wondering if I should have sent this email to the bug tracker (though again I am not sure if it is actually a bug, or again my incompetence). I would really appreciate a confirmation, as I'm am currently held at my current step.
>> 
>> Best,
>> Russ Port 
>> 
>> ---------- Forwarded message ----------
>> From: russ port <russgport at gmail.com <mailto:russgport at gmail.com>>
>> Date: Mon, Jun 19, 2017 at 9:54 PM
>> Subject: possible bug when using old neuromas data with newer fieldtrip version
>> To: FieldTrip discussion list <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>>
>> 
>> 
>> Hi All,
>> 
>> Sorry to bother you all, but I was wondering if I may have found a possible bug. If so, I’ll submit a request to the bugzilla subsection. I am not completely sure the issue is not my own incompetence though. The error occurs when using a neuromag dataset that was read in with an old fieldtrip version (i.e. from 2015), and having it undergo ft_artifact_zvalue from a newer version of fieldtrip. 
>> 
>> In short, I use the following code:
>>  
>> load('MEGGRAD_Visual_clean_combinedscripts')
>>         
>>         datanoline=[]
>>         datanoline=data_clean
>> 
>> load('/MEGGRADfinal_cleaned_jumpartifact_outputcfg_redone_Visual.mat') 
>>             
>> 
>>         cfgaj                    = [];
>> 
>>         % channel selection, cutoff and padding
>>         cfgaj.artfctdef.zvalue.channel    = allchanell;
>>         cfgaj.artfctdef.zvalue.cutoff     =   cfgajout.artfctdef.zvalue.cutoff
>>         cfgaj.artfctdef.zvalue.trlpadding = 0;
>>         cfgaj.artfctdef.zvalue.artpadding = 0;
>>         cfgaj.artfctdef.zvalue.fltpadding = 0.0;
>> 
>>         % algorithmic parameters
>>         cfgaj.artfctdef.zvalue.cumulative    = 'yes'; 
>>         cfgaj.artfctdef.zvalue.medianfilter  = 'yes';
>>         cfgaj.artfctdef.zvalue.medianfiltord = 9;
>>         cfgaj.artfctdef.zvalue.absdiff       = 'yes';
>>     
>> % cfgaj.artfctdef.zvalue.interactive = 'yes';
>> 
>>         [cfgajout, artifact_jump] = ft_artifact_zvalue(cfgaj,datanoline);
>> 
>> When I run this code in a 2015 version of fieldtrip, it works fine (without any error). On the other hand, in the 2016 version of fieldtrip I have (as well as in the latest version which  I downloaded this weekend), I get the following error:
>> 
>> Error using ft_datatype_sens (line 278)
>> unexpected number of coils (408)
>> contributing to channel MEG0113 (1)
>> 
>> Error in ft_datatype_raw (line 141)
>>       data.grad =
>>       ft_datatype_sens(data.grad);
>> 
>> Error in ft_checkdata (line 236)
>>   data = ft_datatype_raw(data,
>>   'hassampleinfo', hassampleinfo);
>> 
>> Error in ft_artifact_zvalue (line 215)
>>   data = ft_checkdata(data, 'datatype',
>>   'raw', 'hassampleinfo', 'yes’);
>> 
>> 
>> The dataset datanoline (as well as cfgaj) are linked to below (sorry it’s dropbox, but I’m not quite sure how to do it otherwise).
>> 
>> https://www.dropbox.com/s/86t5agwv2vanrh3/MEGGRAD_Visual_clean_combinedscripts.mat?dl=0 <https://www.dropbox.com/s/86t5agwv2vanrh3/MEGGRAD_Visual_clean_combinedscripts.mat?dl=0>
>> 
>> https://www.dropbox.com/s/rw8e7mof8plss72/MEGGRADfinal_cleaned_jumpartifact_outputcfg_redone_Visual.mat?dl=0 <https://www.dropbox.com/s/rw8e7mof8plss72/MEGGRADfinal_cleaned_jumpartifact_outputcfg_redone_Visual.mat?dl=0>
>> 
>> Sorry for the bother,
>> Russ
>> 
>> 
>> 
>>    
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170627/f8fdadce/attachment.htm>

From xmq1990 at gmail.com  Tue Jun 27 21:09:04 2017
From: xmq1990 at gmail.com (Mengqi Xing)
Date: Tue, 27 Jun 2017 19:09:04 +0000
Subject: [FieldTrip] Reading .csv file and Emotiv compatibility
Message-ID: <f283637e8ae9452482c689ec02c587a3@EXPRD01.hosting.ru.nl>

Dear all,

My name is Mengqi Xing. I am a PhD student from University of Illinois at Chicago. I've been trying to use the FT toolbox to analyze the output data from the Emotiv EEG recording system. The output data is the the .csv format, and it seems like the toolbox is unable to read such format. It doesn't work well if I load the .csv and save it as .mat either. I was wondering if anyone worked with this format before and how to get around with it? Also, for those who had experience in connecting FT with Emotiv (or any other BCI recording system) to load and analyze data before, is there a way to directly load the recording from the device to the Matlab?

Thank you very much for your help!

Best,
Mengqi


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170627/7f803644/attachment.htm>

From r.oostenveld at donders.ru.nl  Tue Jun 27 21:16:08 2017
From: r.oostenveld at donders.ru.nl (Robert Oostenveld)
Date: Tue, 27 Jun 2017 21:16:08 +0200
Subject: [FieldTrip] Reading .csv file and Emotiv compatibility
In-Reply-To: <f283637e8ae9452482c689ec02c587a3@EXPRD01.hosting.ru.nl>
References: <f283637e8ae9452482c689ec02c587a3@EXPRD01.hosting.ru.nl>
Message-ID: <4A1EC1DB-BB51-49AA-818C-3DF63D67DEFA@donders.ru.nl>

Hi Mengzi

The csv file does not contain all details that are needed by FieldTrip. E.g. sampling frequency and channel names are likely to be missing. But see here <http://www.fieldtriptoolbox.org/faq/how_can_i_import_my_own_dataformat#circumvent_the_fieldtrip_reading_functions> for a solution that should work in combination with csvread <https://nl.mathworks.com/help/matlab/ref/csvread.html>. 

best
Robert



> On 27 Jun 2017, at 21:09, Mengqi Xing <xmq1990 at gmail.com> wrote:
> 
> Dear all,
> 
> My name is Mengqi Xing. I am a PhD student from University of Illinois at Chicago. I've been trying to use the FT toolbox to analyze the output data from the Emotiv EEG recording system. The output data is the the .csv format, and it seems like the toolbox is unable to read such format. It doesn't work well if I load the .csv and save it as .mat either. I was wondering if anyone worked with this format before and how to get around with it? Also, for those who had experience in connecting FT with Emotiv (or any other BCI recording system) to load and analyze data before, is there a way to directly load the recording from the device to the Matlab? 
> 
> Thank you very much for your help!
> 
> Best,
> Mengqi
> 
> 
> _______________________________________________
> 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/20170627/c63cab47/attachment.htm>

From hamedtaheri at yahoo.com  Tue Jun 27 23:16:59 2017
From: hamedtaheri at yahoo.com (Hamed Taheri)
Date: Tue, 27 Jun 2017 21:16:59 +0000 (UTC)
Subject: [FieldTrip] Brain Connectivity
References: <938014516.3569136.1498598219917.ref@mail.yahoo.com>
Message-ID: <938014516.3569136.1498598219917@mail.yahoo.com>

Dear all,
My name is Hamed a PhD student in Neuroscience. 
I'm working on a project about EEG analyzing. 
My EEG signal recorded by BrainVision Recorder (64 channels and 250 sampling rate)I selected a simple task for starting analyzing which it was eyes open and closed task. Now I want to do several steps 
1- reading  .eeg file 
2- artifact rejection3- extracting 8-13 Hz4- Finding which electrodes have more connectivity to each other during this task and which brain regions are connected during this task correspond to the electrodes. 
I have no problem with steps 1 to 3. 
For step 4 I read this tutorial http://www.fieldtriptoolbox.org/tutorial/networkanalysis
but I don't have MRI images from my participants and I don't have the head model.Would you please let me know what should I do for doing the main part ( part 4) of my analysis?
Best RegardsHamed


 Hamed Taheri Gorji
PhD Candidate 
Brain Imaging Laboratory 

DEPARTMENT OF PSYCHOLOGY
FACULTY OF MEDICINE AND PSYCHOLOGY
SAPIENZA
University of Rome

Santa Lucia Foundation, ViaArdeatina 306, 00179 Rome
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170627/6f05f8fb/attachment.htm>

From mona at sdsc.edu  Wed Jun 28 19:04:31 2017
From: mona at sdsc.edu (Wong-Barnum, Mona)
Date: Wed, 28 Jun 2017 17:04:31 +0000
Subject: [FieldTrip] RMS calculation
Message-ID: <11F1BA88-2519-4EC1-8B67-7A554FFBDDCB@mail.ucsd.edu>


Hello fellow FieldTrip users:

We would like to do RMS calculations for our MEG & EEG data.  My PI explains the calculation we need as follows:

This is a very simple calculation. What it does is it takes an amplitude, meaning a sine wave like signal, that goes above and below the midline, and thus also has negative and positive values and converts them all to positive values and then exhibits what is called “power.” All of the original values are squared and that leaves us with power which is essentially the “energy” of the signal. And of course instead of 603.1072 measures per second, we end up with only one measure per second to help simply the overall signal.

I don’t see a RMS calculation in the FieldTrip software but there appears to be a Matlab rms function (http://www.mathworks.com/help/signal/ref/rms.html).

I’m hoping someone more knowledgeable than I can either point to an appropriate function in the FieldTrip software or confirm that the Matlab rms function will do what we are looking for?

Mona

*********************************************
    Mona Wong
    Web & Mobile Application Developer
    San Diego Supercomputer Center

    "Whether you think you can or you
    you can't, you're right."
                                --- Henry Ford
*********************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170628/d3e6ddb6/attachment.htm>

From CXK699 at student.bham.ac.uk  Wed Jun 28 20:36:38 2017
From: CXK699 at student.bham.ac.uk (Casper Kerren)
Date: Wed, 28 Jun 2017 18:36:38 +0000
Subject: [FieldTrip] RMS calculation
In-Reply-To: <11F1BA88-2519-4EC1-8B67-7A554FFBDDCB@mail.ucsd.edu>
References: <11F1BA88-2519-4EC1-8B67-7A554FFBDDCB@mail.ucsd.edu>
Message-ID: <817B246999EC6E49AFEEDFCEC604EED83C5149F4@EX11.adf.bham.ac.uk>

Hi Mona,

I guess you want to measure the fluctuation in the data.
If for example you have your data in a channel-time-trial structure, you can get the RMS over electrodes by using the following:
AvgChan = squeeze(sqrt(mean(data.^2, 1)));   (Just change the dimension you want to calculate it over).
You will then get a measure per time-trial point.
If you check that against the rms(data,1) you see that you get the same answer.

I don’t know about a rms function in fieldtrip, but detrended fluctuation analysis involves RMS, so maybe you can start looking there.

I hope this helped you a bit.

Kind regards,

Casper

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Wong-Barnum, Mona
Sent: 28 June 2017 18:05
To: FieldTrip discussion list
Subject: [FieldTrip] RMS calculation


Hello fellow FieldTrip users:

We would like to do RMS calculations for our MEG & EEG data.  My PI explains the calculation we need as follows:

This is a very simple calculation. What it does is it takes an amplitude, meaning a sine wave like signal, that goes above and below the midline, and thus also has negative and positive values and converts them all to positive values and then exhibits what is called “power.” All of the original values are squared and that leaves us with power which is essentially the “energy” of the signal. And of course instead of 603.1072 measures per second, we end up with only one measure per second to help simply the overall signal.

I don’t see a RMS calculation in the FieldTrip software but there appears to be a Matlab rms function (http://www.mathworks.com/help/signal/ref/rms.html).

I’m hoping someone more knowledgeable than I can either point to an appropriate function in the FieldTrip software or confirm that the Matlab rms function will do what we are looking for?

Mona

*********************************************
    Mona Wong
    Web & Mobile Application Developer
    San Diego Supercomputer Center

    "Whether you think you can or you
    you can't, you're right."
                                --- Henry Ford
*********************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170628/51548050/attachment.htm>

From maria.hakonen at gmail.com  Thu Jun 29 11:57:16 2017
From: maria.hakonen at gmail.com (Maria Hakonen)
Date: Thu, 29 Jun 2017 12:57:16 +0300
Subject: [FieldTrip] Estimate coherence between conditions?
In-Reply-To: <CADF3goPdSLOnyLZWKPWSQXF+hEwAVor9r_iEzmVuQ-ckkQ==FQ@mail.gmail.com>
References: <CADF3goMth8S5N496=uDbMyJ_jsiyy+dGDhsq++Sfvbax4JyS-g@mail.gmail.com>
 <CADF3goPiG=UOutDDjHA5jm3UgLTpX_hzEv-AUZeCfzdNGH1MGQ@mail.gmail.com>
 <CADF3goPdSLOnyLZWKPWSQXF+hEwAVor9r_iEzmVuQ-ckkQ==FQ@mail.gmail.com>
Message-ID: <CADF3goP9XBxqJ3h7KmuxdV6ozguyor-8p3mhxYGGXjzom06rzw@mail.gmail.com>

Hi Maria,
for obtaining the sources timecourses (aka virtual channels) you can
follow the tutorials pasted below.

Best,Maité
http://www.fieldtriptoolbox.org/tutorial/connectivity#extract_the_virtual_channel_time-series
http://www.fieldtriptoolbox.org/tutorial/shared/virtual_sensors#extract_the_virtual_channel_time-series

Hi Maité,

Thank for your answer again!

However, I would need to calculate coherence within certain frequency
bands and, therefore, I would like to use dics. The examples in the
links seem to use lcmv. Could you please let me know how I can get
coherence between conditions using dics?

Best,

Maria


2017-06-26 12:45 GMT+03:00 Maria Hakonen <maria.hakonen at gmail.com>:

> Hi Maria,
> maybe in this case it is better that you export the sources timecourses, build a data matrix with them and treat them in the same way as you did with the channels.
>
> Best,Maité
>
>
> Hi Maité,
>
> Could you please yet let me know how to get the sources timecources?
> source = ft_sourceanalysis(cfg, freq); only gives
> source =
>
>          freq: 18
>     cumtapcnt: [180x1 double]
>           dim: [19 15 15]
>        inside: [4275x1 logical]
>           pos: [4275x3 double]
>        method: 'average'
>           avg: [1x1 struct]
>           cfg: [1x1 struct]
>
> Best,
> Maria
>
> 2017-06-25 13:53 GMT+03:00 Maria Hakonen <maria.hakonen at gmail.com>:
>
>> Hi Maité,
>>
>> Thank you for your answer!
>>
>> I have managed to calculate the coherence between two conditions in the sensor space in the way you suggested. However, I haven't managed to calculate the coherence between conditions in the source space (i.e. Appendix 1 in http://www.fieldtriptoolbox.org/tutorial/coherence). ft_sourceanalysis doesn't have channelcmb. I wonder if anyone has any solutions for this?
>>
>> BTW. I didn't get the answer to my question in my email but found it from Fieldtrip archive. However, I have also got some other emails from fieldtrip discussion forum.
>>
>> Best,
>>
>> Maria
>>
>>
>> Hi Maria,
>> Here it is a possible solution. First, rename channels from one of both conditions: for example, for condition 2, {'ch01cond2', 'ch02cond2', ...}. Then, append the data from both conditions. In ft_freqanalysis introduce all the channels combinations you want:
>>
>> cfg.channel    = {'MEG' 'ch01cond2' 'ch02cond2' ...};
>> cfg.channelcmb = {'ch01' 'ch01cond2'; 'ch02' 'ch02cond2'};
>> As I understand, you could use the same channelcmb later on in ft_connectivityanalysis.
>> I hope it helps.
>> Best wishes,Maité
>>
>>
>>
>> Dear FieldTrip experts,
>>
>> I have just started to use Fieldtrip and would like to estimate coherence
>> between MEG responses measured in two different conditions from the same
>> cortical areas. The example in Appendix 1 is close to what I would like to
>> do:
>> http://www.fieldtriptoolbox.org/tutorial/coherence
>>
>> However, in the example, coherence is calculated between the reference
>> signal (EMG) and all MEG channels. Could it be possible to calculate
>> coherence between each MEG channel in one condition and the same MEG
>> channels in the other condition, that is:
>> ch1 in cond1 vs. ch1 in cond2, ch2 in cond1 vs. ch2 in cond2, ...
>>
>> As far as I understand, the example in Appendix 1 would do this:
>> ch1 in cond1 vs. all channels in cond2, ch2 in cond ch1 all channels in
>> cond2, ...
>>
>> Best,
>> Maria
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170629/b28a4680/attachment.htm>

From mona at sdsc.edu  Thu Jun 29 18:08:33 2017
From: mona at sdsc.edu (Wong-Barnum, Mona)
Date: Thu, 29 Jun 2017 16:08:33 +0000
Subject: [FieldTrip] RMS calculation
In-Reply-To: <817B246999EC6E49AFEEDFCEC604EED83C5149F4@EX11.adf.bham.ac.uk>
References: <11F1BA88-2519-4EC1-8B67-7A554FFBDDCB@mail.ucsd.edu>
 <817B246999EC6E49AFEEDFCEC604EED83C5149F4@EX11.adf.bham.ac.uk>
Message-ID: <E89FC2D0-3103-4473-ACF1-5803C6CAD64A@mail.ucsd.edu>


Yes, thank you very much Casper!

cheers,
Mona


On Jun 28, 2017, at 11:36 AM, Casper Kerren <CXK699 at student.bham.ac.uk<mailto:CXK699 at student.bham.ac.uk>> wrote:

Hi Mona,

I guess you want to measure the fluctuation in the data.
If for example you have your data in a channel-time-trial structure, you can get the RMS over electrodes by using the following:
AvgChan = squeeze(sqrt(mean(data.^2, 1)));   (Just change the dimension you want to calculate it over).
You will then get a measure per time-trial point.
If you check that against the rms(data,1) you see that you get the same answer.

I don’t know about a rms function in fieldtrip, but detrended fluctuation analysis involves RMS, so maybe you can start looking there.

I hope this helped you a bit.

Kind regards,

Casper

************************************************************
    Mona Wong
    Web & Mobile Application Developer
    San Diego Supercomputer Center

    "When your thoughts are too expensive,
     to ever want to keep."

-- U2's When I Look At The World
************************************************************





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170629/c635d062/attachment.htm>

From a.kochari at uva.nl  Thu Jun 29 18:27:00 2017
From: a.kochari at uva.nl (Arnold Kochari)
Date: Thu, 29 Jun 2017 21:27:00 +0500
Subject: [FieldTrip] error with automatic artefact rejection using
	ft_artifact_threshold
In-Reply-To: <CAO0EGE=unhBTM25ikLzWPH9f523fhH+ycUv8+GM-ZUbBXXmg7g@mail.gmail.com>
References: <CAO0EGE=unhBTM25ikLzWPH9f523fhH+ycUv8+GM-ZUbBXXmg7g@mail.gmail.com>
Message-ID: <CAO0EGEnu+Mz=j+ARAzGE_SMWsvxRgWdeSo_87DOx4KQVpRh+GA@mail.gmail.com>

I am still struggling with automatic detection of linear drif. I solved the
1st issue with ft_artifact_threshold by writing my own simple function to
do what I needed to achieve.

As I mentioned, my starting point is data segmented into trials. I look
into every trial and add it to an array if there are no values higher or
lower than +/-75. I then select only those trials that were added to this
array.

    cfg=[];

    cfg.trials=[];

    for tr = 1:length(baselined.trial)

        if length(find(baselined.trial{1, tr} > 75 | baselined.trial{1, tr}
< -75)) == 0

            cfg.trials=[cfg.trials, tr];

        end

    end

    filtered = ft_selectdata(cfg, baselined);


I hope this is useful to someone.


Arnold



On Thu, Jun 22, 2017 at 3:45 PM, Arnold Kochari <a.kochari at uva.nl> wrote:

> Dear FieldTrip community,
>
>
>
> I am new to FieldTrip and got stuck while trying to exactly replicate an
> analysis reported in a paper. I would be very grateful for any tips.
> Specifically, I cannot manage to automatically reject trials with certain
> min/max uV (question 1) and cannot find any way to automatically detect
> linear drift (question 2).
>
> *1.* After segmenting and baseline correcting using *demean*, I am trying
> to use the following code for rejection of trials with extreme values using
> *ft_artifact_threshold*, but I seem to have made a mistake somewhere:
>
>     cfg = [];
>
>     cfg.trl = 'baselined.sampleinfo';
>
>     cfg.continuous = 'no';
>
>     cfg.artfctdef.threshold.min = -75;
>
>     cfg.artfctdef.threshold.max = 75;
>
>
>
>     [cfg, artifact] = ft_artifact_threshold(cfg, baselined);
>
>
> I am getting to following error:
>
> Error using butter (line 79)
> butter: first band edge must be smaller than second
>
> Error in ft_preproc_bandpassfilter (line 153)
> [B, A] = butter(N, [min(Fbp)/Fn max(Fbp)/Fn]);
>
> Error in preproc (line 327)
> if strcmp(cfg.bpfilter, 'yes'), dat = ft_preproc_bandpassfilter(dat,
> fsample, cfg.bpfreq, cfg.bpfiltord, cfg.bpfilttype,
> cfg.bpfiltdir, cfg.bpinstabilityfix, cfg.bpfiltdf, cfg.bpfiltwintype,
> cfg.bpfiltdev, cfg.plotfiltresp, cfg.usefftfilt); end
>
> Error in ft_artifact_threshold (line 164)
> dat = preproc(dat, channel, offset2time(cfg.trl(trlop,3), hdr.Fs,
> size(dat,2)), artfctdef);
>
> *2. *I am also trying to detect a linear drift of more than +/- 50 uV
> beginning before the onset of the stimulus (so before 0). With this one, I
> am not sure where to begin. I would be grateful for tips about what
> functions I can use to do this.
>
>
> Kind regards,
> Arnold Kochari
> PhD candidate, Institute for Logic, Language and Computation, University
> of Amsterdam
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170629/8b410a5c/attachment.htm>

From krugliakova.es at gmail.com  Fri Jun 30 14:42:31 2017
From: krugliakova.es at gmail.com (Elena Krugliakova)
Date: Fri, 30 Jun 2017 14:42:31 +0200
Subject: [FieldTrip] design for ft_freqstatistics
Message-ID: <CACnpnhTQQCBUrk16dZ31yQDpRLX_8VdM6OrJFK1nZ4WQ=sv4_g@mail.gmail.com>

Dear Fieldtrippers,

I have a question about design for ft_freqstatistics.
I have only 4 subjects with 2 conditions*300 observations.
So far I did a single - subject statistics, but I would like to estimate
the effect on the group level by pulling subjects together without
averaging across trials. In this case I need to control for the fact that 4
subsets of my data are coming from different subjects.
I assume that design matrix should look like this (2 conditions, 4
subjects, 3observation(as an example)):

[image: Inline images 1]
*(I hope you can see the picture...)

cfg.ivar  = 1;  % 2 conditions
cfg.cvar  = 2; % I assume "subject" can be treated as a control variable
cfg.uvar  = 3; % observations

Do you think the control variable is a proper way to control for "subject"
effect?

Kind Regards,
Elena
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170630/b5513e4a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 4011 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170630/b5513e4a/attachment.png>

