[FieldTrip] potential bug when using ft_icabrowser - help needed

Jonathan Daume j.daume at uke.de
Mon May 21 20:36:20 CEST 2018

Hi Anne,

There seems to be a problem with ft_prepare_layout as is doesn’t construct the correct sensors layout from your data. However, you can read the layout structure simply from the provided layout file without handing over your MEG data to the function.

So just open the icabrowser ("edit ft_icabrowser.m") and change line 53 from
	lay = ft_prepare_layout(cfglay, comp);
	lay = ft_prepare_layout(cfglay);

The topotplot function should work again now. 

Nevertheless, you will still run into problems with the power spectrum (left panel in the figure) as it won’t show any data. I checked your data and saw that every ica component also contains NaNs. This means that the fft analysis will result in only NaNs as well. You may consider to just get rid of them before computing the power spectrum (which is done in lines 102-109). 

Moreover, the icabrowser was originally coded for trial-based data and only every 5th trial was considered for the power analysis. Otherwise, it just takes too long to plot every single component. However, I saw that your data only contains (continous?) data from a single trial. Computing the fft of the whole recording would take ages. So, in case your data is continuous data from resting state for example, you may also consider to divide your data into epochs and take only every 5th epoch or so for the power analysis. I have coded something in that direction for you but I am not sure what kind of data you have and if it suits your data. I just divided the data in epochs of 1s length and took every 5th epoch for the analysis. Please find the code below. You may just further adjust the code so that it better suits your data.

Change line 34 from 
	fft_data = cat(2,comp.trial{1:5:end});
	fft_data = comp.trial{1};

And lines 104 - 106 from
	Fs = comp.fsample;
	N = floor(size(fft_data,2));
	xdft = fft(fft_data(i,:));
        comp_data = fft_data(i,~isnan(fft_data(i,:))); % kick out all NaNs first
        epochJump = 5; % how many trials to jump over?
        numEpochs = size(comp_data,2)/comp.fsample;
        fft_data_i = [];
        for i_epoch = 1:epochJump:numEpochs
            epochdata = comp_data((i_epoch-1)*comp.fsample+1:i_epoch*comp.fsample);
            fft_data_i = [fft_data_i,epochdata];
        N = floor(size(fft_data_i,2));
        xdft = fft(fft_data_i);

Or you just download the edited file from here <https://wetransfer.com/downloads/291481693ee0f04e1e9335d78e71912a20180521182605/79e5bd53d8724c2a212d5d2f279fac6420180521182605/722e3c>. :)

Hope this helps! Please get in touch with me if you have any further question. 



Jonathan Daume, PhD

Dept. of Neurophysiology and Pathophysiology
University Medical Center Hamburg Eppendorf
Martinistr. 52
20246 Hamburg

Phone: +49-40-7410-55856
Email: j.daume at uke.de

> Am 17.05.2018 um 15:06 schrieb Annekathrin Weise <annekathrinweise at gmail.com>:
> Dear all,
> I am interested in using the ft_icabrowser to inpsect ICA components.
> I run into a potential bug (see my code and the related error messages in the screenshot below).
> Note that I also used the ft_databrowser to inspect the independent components what worked nicely. So, there seems to be no issue with the data "ica_components' itself.
> In case you want to have a closer look to efficiently evaluate the problem, you can find the data here. <https://oc.th-ht.de/index.php/s/6DA8eHK293ToT8S>
> I appreciate any help to find a workaround.
> Cheers,
> Anne
> <hagbbfcodljipehl.png>
> -- 
> Annekathrin Weise, Dr.
> Paris-Lodron Universität Salzburg
> Division of Physiological Psychology
> Hellbrunnerstraße 34
> 5020 Salzburg
> Austria
> e-mail: annekathrin.weise at sbg.ac.at <mailto:annekathrin.weise at sbg.ac.at>;
> annekathrinweise at gmail.com <mailto:annekathrinweise at gmail.com>
> web: 
> http://www.oboblab.at/ <http://www.oboblab.at/>
> https://sites.google.com/site/weiseannekathrin/ <https://sites.google.com/site/weiseannekathrin/> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip



Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Martina Saurin (komm.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180521/2af36de9/attachment-0002.html>

More information about the fieldtrip mailing list