Print

Print


Dear SP,

Just to add to Martin's answer you could use 'Re-reference EEG' in
Toolbox/MEEGtools. If you mark some channels as bad they will stay in the
dataset but will not be used for computing the reference. I think it's
better to keep them because otherwise you won't be able to combine (e.g.
merge) files with different channel sets.

Best,

Vladimir



On Mon, Apr 22, 2013 at 12:24 PM, Martin Dietz <[log in to unmask]> wrote:

>  Dear SP,
>
>  The exclusion of bad channels from the reference channels can be done as
> illustrated below. As long as a channel is marked as 'bad', it is excluded
> from further analysis which means you don't have to delete it from the
> dataset. If you intend to extract sensor time-series for analysis outside
> SPM, simply use setdiff(D.meegchannels,D.badchannels) to index clean
> MEG/EEG channels.
>
>  I hope this helps
> Martin
>
>
>   % re-reference (average)
>  % ---------------------------------------------------
>
>
>  if ~isempty(D.badchannels)
>      G = setdiff(D.meegchannels,D.badchannels);
>      R = G;
>
>
>      T = eye(numel(D.meegchannels));
>      T(G,R) = T(G,R) - 1/length(R);
>
>
>      S = [];
>      S.D = D.fname;
>      S.montage.tra = T; % mxn transformation matrix
>      S.montage.labelorg = D.chanlabels(D.meegchannels);
>      S.montage.labelnew = D.chanlabels(D.meegchannels);
>      S.keepothers = 'yes';
>      S.updatehistory = 1;
>      D = spm_eeg_montage(S);
>  end
>
>
>
>
>  On 22 Apr2013, at 12:17 PM, SP Ho wrote:
>
>  Dear experts
>
> May I ask some basic questions about spm_eeg_montage ...
>
> 1. When we create the matrix for montage, how should we handle the bad
> channels if I would like to do average referencing ?  Should I exclude the
> bad channels (so that their effect will not be spread to those good
> channels when I do the average re-referencing) ?  As each subject / session
> may have a different set of bad channels, so I should create a different
> matrix for each subject ?
>
> 2.  I would also like to exclude some EEG channels in further processing.
>  I have created a script to do this and try a few things, but not sure if
> these are the correct ways:
>   - Before montage, updated these channels as type 'Other', and put the
> flag keepothers to 'no' when running montage
>   - Keep these channel in "labelorg" but remove in 'labelnew' in the
> montage matrix (becomes MxN), and put zeros to the columns (original
> labels) for these channels
>
> And, in combining the effort to exclude both bad / other channel, I have
> generated the montage matrix so that the mean (1/N) is based on the no. of
> EEG channels that are marked as neither bad nor other ...
>
> However, question is, after I generated the montage matrix and run the
> spm_eeg_montage, I found the output file have those channels that I changed
> to "other" reverted to "EEG", and all 'other' channels are still retained
> in the montage output file.
>
> I found there are codes in spm_eeg_montage that set the channel type back
> to default.  Also, some of the channel that I set are as "other" are
> interspersed within the range of EEG channels (not only those at the very
> end), and seems the spm_eeg_montage will sort the channels and add some
> missing channels at the back (if the matrix is not MxM). So, I am worried
> that the steps I done are not correct and may have messed up the data.  How
> should I check these ?
>
> Sorry that I may have get things confused, please kindly shed some lights.
>  Thank you so much!!
>
> Best regards
> SP Ho
>
>
>