Drop epochs if > N electrodes are bad

External Email - Use Caution

Hi all,

I was wondering if there was a way to do epoch rejection using the drop_bad
method of an Epochs object, but in a way that specifies that I only want to
drop epochs if a certain amount don't pass the threshold. My data is quite
noisy and I lose an awful lot of channels where only one electrode failed
the peak-to-peak threshold test and my analyses would be robust enough to
withstand these. However, if, say, over 5-6 electrodes were bad then I
would want to drop them.

To give an example, I would like to be able to apply a procedure that
ignores these cases:

Rejecting epoch based on EEG : ['CP3']
Rejecting epoch based on EEG : ['CP3']
Rejecting epoch based on EEG : ['CP3']
Rejecting epoch based on EEG : ['T8']
Rejecting epoch based on EEG : ['PO9']
Rejecting epoch based on EEG : ['PO9']
Rejecting epoch based on EEG : ['PO9']
Rejecting epoch based on EEG : ['F2']
Rejecting epoch based on EEG : ['T7']

While not ignoring these cases:

Rejecting epoch based on EEG : ['F3', 'Fz', 'F4', 'FC1', 'FC2',
'FC6', 'Cz', 'C4', 'T8', 'TP9', 'CP6', 'P7', 'P3', 'Pz', 'P4',
'P8'...]
Rejecting epoch based on EEG : ['F3', 'Fz', 'F4', 'FC1', 'FC2',
'FC6', 'C3', 'Cz', 'C4', 'T8', 'TP9', 'CP6', 'P7', 'P3', 'Pz', 'P4',
'P8'...]
Rejecting epoch based on EEG : ['F3', 'Fz', 'F4', 'FC1', 'FC2',
'FC6', 'C3', 'Cz', 'C4', 'T8', 'TP9', 'CP6', 'P7', 'P3', 'Pz', 'P4',
'P8'...]
Rejecting epoch based on EEG : ['F3', 'Fz', 'F4', 'F8', 'FC1', 'FC2',
'FC6', 'C3', 'Cz', 'C4', 'T8', 'TP9', 'CP5', 'CP6', 'P7', 'P3', 'Pz',
'P4', 'P8'...]
Rejecting epoch based on EEG : ['F3', 'Fz', 'F4', 'F8', 'FC1', 'FC2',
'FC6', 'Cz', 'C4', 'T8', 'CP5', 'P7', 'P3', 'Pz', 'P4', 'PO9'...]
Rejecting epoch based on EEG : ['F3', 'T8', 'CP5', 'TP10', 'P7',
'P3', 'P8', 'PO9', 'O1'...]
Rejecting epoch based on EEG : ['F3', 'P8', 'PO9', 'O1', 'Oz',
'PO10', 'AF4', 'PO7', 'PO3', 'POz']

Does anyone have an idea how this could be implemented in a way that
doesn't require a lot of hacky solutions?

Thanks
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190109/f8fad01c/attachment.html

External Email - Use Caution

hi Alex,

you have the option to mark some channels as bad to avoid loosing a
lot of epochs due to one very noisy channel.

you might also consider using autoreject: https://autoreject.github.io/
that can detect and clean locally bad channels.

HTH
Alex

Hi MNE Folks,

I am trying to identify the MNI coordinates from a SourceSpaces object from a specific individual (i.e. not fsaverage).

If src is the result from mne.set_volume_source_space():
I found that I can identify the indices of the relevant vertices from: src[0][?vertno?]
I can then use vertex_to_mni for the vertex; however, I cannot figure out how to identify which hemisphere a vertex belongs to, and vertex_to_mni requires a selection.
My source space has coordinate_frame=MRI (surface RAS).

Does anyone know how to extract the MNI coordinates for the sources in a volume source space?

Thanks for any help,
Josh

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1521 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190109/4f88d367/attachment.bin
-------------- next part --------------
        External Email - Use Caution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190109/4f88d367/attachment.html

External Email - Use Caution

vertex_to_mni is only really designed to work for surface-based source
estimates. So in this case you can instead look at
`src[0]['rr'][src[0]['vertno'][whichever]]` and this will give you an array
of shape (N, 3) corresponding to the points in the subject's MRI coordinate
frame.

For now you can use `mne.source_space._read_talxfm` to get the affine
transformation matrix that will convert these points to MNI space:

https://github.com/mne-tools/mne-python/blob/master/mne/source_space.py#L1286

But it's private so the API can change at any time. Then you can use
`mne.transformns.apply_trans` to apply it to your points.

Feel free to open an MNE issue about making this function public, it's
probably worthwhile for applications like these. Also we should update the
`vertex_to_mni` doc to mention that it's only designed to work with surface
source spaces.

Eric

Hi Eric,

Thank you for these details! I had to shift focus for a minute but will get back to this shortly. I?ll open an MNE issue after I?ve had a chance to work it out.

I also want to comment on how awesome the MNE team is for all of the timely support and thoughtful responses, not to mention the software itself!

Josh

        External Email - Use Caution

vertex_to_mni is only really designed to work for surface-based source estimates. So in this case you can instead look at `src[0]['rr'][src[0]['vertno'][whichever]]` and this will give you an array of shape (N, 3) corresponding to the points in the subject's MRI coordinate frame.

For now you can use `mne.source_space._read_talxfm` to get the affine transformation matrix that will convert these points to MNI space:

https://github.com/mne-tools/mne-python/blob/master/mne/source_space.py#L1286

But it's private so the API can change at any time. Then you can use `mne.transformns.apply_trans` to apply it to your points.

Feel free to open an MNE issue about making this function public, it's probably worthwhile for applications like these. Also we should update the `vertex_to_mni` doc to mention that it's only designed to work with surface source spaces.

Eric

Hi MNE Folks,

I am trying to identify the MNI coordinates from a SourceSpaces object from a specific individual (i.e. not fsaverage).

If src is the result from mne.set_volume_source_space():
I found that I can identify the indices of the relevant vertices from: src[0][?vertno?]
I can then use vertex_to_mni for the vertex; however, I cannot figure out how to identify which hemisphere a vertex belongs to, and vertex_to_mni requires a selection.
My source space has coordinate_frame=MRI (surface RAS).

Does anyone know how to extract the MNI coordinates for the sources in a volume source space?

Thanks for any help,
Josh

        External Email - Use Caution

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu <mailto:Mne_analysis at nmr.mgh.harvard.edu>
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190117/fd56dc06/attachment-0002.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1521 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190117/fd56dc06/attachment-0001.bin
-------------- next part --------------
        External Email - Use Caution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190117/fd56dc06/attachment-0003.html