AnalyzingData/MNE_BaselineCorrectSTC - Meg Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
WHat wOrd is made by the captiaL lettErs?

location: AnalyzingData / MNE_BaselineCorrectSTC

Baseline Correction for Source Estimates

Baseline-correcting MEG or EEG data does not imply that average baseline activity for source estimates is zero as well. For example, if intensitities are computed (i.e. the option --signed was NOT used), baseline activity will always be above zero. This may affect statistical tests, if conditions with different baseline levels are compared, e.g. due to different numbers of trials. It may therefore make sense to correct the baselines for the source estimates.

function corr_base_STC(filein, fileout, interval);

% subtract baseline at each vertex in MNE STC file
% filein: input STC file
% fileout: output STC file
% interval: baseline interval in milliseconds
% OH 18.1.2010

interval = interval/1000;   % now in s for MNE

datain = mne_read_stc_file(filein);

[nvert, ntime] = size(datain.data);

lats = datain.tmin:datain.tstep:datain.tmin+(ntime-1)*datain.tstep;

[tmp base1] = min( abs( lats-interval(1) ) );
[tmp base2] = min( abs( lats-interval(2) ) );
fprintf(1, 'Correcting from %f (%d) to %f (%d)\n', interval(1), base1, interval(2), base2);

meanbase = mean( datain.data(:,base1:base2), 2 );
meanbasemat = repmat(meanbase, 1, ntime);

dataout = datain;

dataout.data = datain.data - meanbasemat;

mne_write_stc_file( fileout, dataout );