[FieldTrip] ICA/PCA EOG artifact removal

Herring, J.D. (Jim) j.herring at fcdonders.ru.nl
Thu Oct 10 17:35:25 CEST 2013


Dear Raquel,

What you could do, for example, is:



% Save your data to disk
Save('data','data','-v7.3'); % Saves the variable data to the file
data.mat. The '-v7.3' switch allows the file to be larger than 4gb, if
necessary. 

% Resample your data
cfg = [];
cfg.resamplefs = 250; % Or less

data_resampled = ft_resampledata(cfg, data);

% Clear original data from memory
Clear data


% Perform ICA on resampled data
cfg = [];
cfg.method = 'runica'; % or 'fastica', for example.

comp = ft_componentanalysis(cfg, data_resampled);

% clear resampled data
Clear data_resampled

% load original data
Load('data.mat');

% Use previously calculated unmixing matrix on original data
cfg = [];
cfg.unmixing = comp.unmixing; % copy unmixing matrix to new configuration
structure
cfg.topolabel = comp.topolabel; % copy channel labels to new config
structure.

comp = ft_componentanalysis(cfg, data);



All the saving and clearing in between might not be necessary depending on
how much RAM you have and on the size of your data.

Best,

Jim




-----Original Message-----
From: fieldtrip-bounces at science.ru.nl
[mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Raquel Bibi
Sent: donderdag 10 oktober 2013 15:36
To: FieldTrip discussion list
Cc: FieldTrip discussion list; CR
Subject: Re: [FieldTrip] ICA/PCA EOG artifact removal

Dear Robert,
Over a year ago I tried to use the suggested method of the lower sample
rate and project onto my original data. I had problems. Can you provide a
little snippet of the projection?

Best,

Raquel
Sent from my iPhone

> On Oct 10, 2013, at 4:43 AM, Robert Oostenveld
<r.oostenveld at donders.ru.nl> wrote:
> 
> Hi Craig,
> 
> Let me forward this to the email discussion list.
> 
> 
>> On 9 Oct 2013, at 23:27, CR wrote:
>> 
>> Hi Robert,
>> I wanted to see what your thoughts were on the merits of 2 different
methods of removing blinks.  I have a 12 minute resting state segment of
data, so it has required me to do some things a little differently.
>> 
>> Method 1:  ICA
>> 
>> I break the 12 minute segment into 2 second intervals, since doing ICA
on the whole segment gave a poor result.  
> 
> why does it give you a poor result? Has the subject been moving? Is
there something else that makes the data not compatible with the
stationary mixing assumption? 
> 
> Or is it the difference in the preprocessing? 12 minutes of data
represented in one segment can have drift, whereas 12 minutes of data
represented in 2 second snippets will not have the drift  (assuming you
use the default cfg.demean=yes). Doing a low-pass filter on the continuous
data would have a similar effect as segmenting it and demeaning the 2 sec
snippets.
> 
>> I apply the resulting unmixing matrix to the 12 minute segment and
correlate each component with the EOG to find the most relevant
components, and reject these based on a threshold.
> 
> so a bit like
>
http://fieldtrip.fcdonders.nl/example/use_independent_component_analysis_i
ca_to_remove_eog_artifacts
> with the correlation method of
>
http://fieldtrip.fcdonders.nl/example/use_independent_component_analysis_i
ca_to_remove_ecg_artifacts
> 
> 
>> Method 2: PCA
>> 
>> I do a timelock analysis based on the blink onset point returned by the
eyelink system.  I then PCA the resulting blink ERF.  I then reject the
component(s) that account for say 98% of the total variance.
>> 
>> Obviously option 2 is much faster.  What do you see as the relative
merits/problems with the techniques?  Technique 1 is largely what the FT
tutorials suggest, so what about method 2?
> 
> Option 2 makes the large variance component orthogonal to the remainder
of the components, whereas in option 1 the eye component and frontal brain
components are both estimated, not orthogonal, and removing of the eye
component does not remove the frontal brain component.
> 
> Option 1 is better, as it is less aggressive in removing brain
components.
> 
> If speed is a concern, you could do
> - ft_resampledata to e.g. 250 Hz or even less, estimate the components
based on that and project them out of the original high Fsample data.
> - do ft_componentanalysis on a subset of the data (say every 4th data
segment after cutting it in pieces), and project them out of the original
segmented data
> - a combination of the two
> - try out anothe rica algorithm (fastica versus runica)
> - try out with the options of the ica algorithm, esp the stopping
options
> - get a faster computer
> 
> best regards
> Robert
> 
> 
> 
> 
> 
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip



More information about the fieldtrip mailing list