maxfilter for head movement compensation only

External Email - Use Caution

Dear all,

I would like to use maxfilter for head movement compensation only and skip
the filtering bits.

There are two parts to this as I understand: head position extraction and
the actual compensation. I have several overlapping questions about both
parts.

   1. Head position extraction using Electa's MaxFilter
      1. Is this step sensitive to noisy/flat channels if I only need head
      position?
      2. Is it necessary/advised to use -cal and -ctc files for this
      purpose?
   2. Head movement compensation using mne-python's maxwell_filter
   1. Is this step sensitive to noisy/flat channels if I only do movement
      compensation?
      2. Is it necessary/advised to use the fine calibration and cross-talk
      cancellation files for this?
      3. What parameters should I supply to maxwell_filter to limit it to
      head movement compensation?

The reason I don't want the filtering done by MaxFilter/maxwell_filter is
that I would like to avoid manually selecting bad channels. Which, in turn,
I want to avoid to keep the analysis reproducible on new data. I remove bad
channels/epochs at a later stage using the autoreject package.

Thank you for any advice,
Evgenii

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#m_7451372394743761817_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190505/22ac37e9/attachment.html

External Email - Use Caution

Hi Evgenii,

you?ll find that compensating head movement will spread the noise from bad channels to other channels. Best to be bad channel rejection *before* head movement compensation.

best,
Marijn.

External Email - Use Caution

Thank you for the reply dear Marijn!

So, the compensation stage should be done after bad channels are
removed/interpolated - got it!

Do you think the bad channels would affect the position extraction though?

External Email - Use Caution

Do you think the bad channels would affect the position extraction though?

Head position is tracked through the HPI coils, not through the MEG channels, so no.

External Email - Use Caution

   1. Head position extraction using Electa's MaxFilter
      1. Is this step sensitive to noisy/flat channels if I only need
      head position?
      2. Is it necessary/advised to use -cal and -ctc files for this
      purpose?

During recordings, the HPI coils emit sinusoids, and these are picked up

by the MEG channels. From this recording, the amplitudes on each channel
are estimated. From these amplitudes, coil locations are estimated. So if
there is some channel that is bad, it could (probably only slightly) bias
the position estimation step. So better to exclude bad channels even before
head position estimation if possible.

Regarding fine calibration and cross-talk, I'm not sure if MaxFilter makes
use of them in the computed magnetic dipole forward model or not. My guess
is that it does not. (I suppose you could check to see if the positions are
numerically identical with and without fine calibration and cross-talk to
check, if you want.) Even if it does use them, the difference will probably
be minimal.

   1. Head movement compensation using mne-python's maxwell_filter
   1. Is this step sensitive to noisy/flat channels if I only do movement
      compensation?
      2. Is it necessary/advised to use the fine calibration and
      cross-talk cancellation files for this?
      3. What parameters should I supply to maxwell_filter to limit it to
      head movement compensation?

Currently there is no way to do just movement compensation without also

maxwell filtering (reducing rank / denoising). In principle it should be
possible to do this without rank reduction (see this GitHub issue
<Issues · mne-tools/mne-python · GitHub; if you want to track
our progress here) but it is not implemented yet, and there will probably
be a reduction in the resulting signal-to-noise ratio due to reconstruction
noise.

I remove bad channels/epochs at a later stage using the autoreject package.

One reproducible option would be to use autoreject or some other automated
routine to determine bad channels. MaxFilter even has an `autobad` option
you could try running before the head position estimation step to get a
list of bad channels. In principle you should be able to combine head
position estimation -headpos and automatic bad channel detection -autobad,
but in practice you can encounter bugs this way, so it's safer to separate
it into two steps.

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190506/38ea9b9c/attachment.html

External Email - Use Caution

Hello, dear Eric. Thank you for your reply! It was very helpful.

   1. Head position extraction using Electa's MaxFilter
      1. Is this step sensitive to noisy/flat channels if I only need
      head position?
      2. Is it necessary/advised to use -cal and -ctc files for this
      purpose?

During recordings, the HPI coils emit sinusoids, and these are picked up

by the MEG channels. From this recording, the amplitudes on each channel
are estimated. From these amplitudes, coil locations are estimated. So if
there is some channel that is bad, it could (probably only slightly) bias
the position estimation step. So better to exclude bad channels even before
head position estimation if possible.

Regarding fine calibration and cross-talk, I'm not sure if MaxFilter makes
use of them in the computed magnetic dipole forward model or not. My guess
is that it does not. (I suppose you could check to see if the positions are
numerically identical with and without fine calibration and cross-talk to
check, if you want.) Even if it does use them, the difference will probably
be minimal.

I'll try to run -headpos with/without supplying a list of bad channels and
with/without -cal and -ctc files and see if it leads to differences in the
head position estimation.

   1. Head movement compensation using mne-python's maxwell_filter
   1. Is this step sensitive to noisy/flat channels if I only do
      movement compensation?
      2. Is it necessary/advised to use the fine calibration and
      cross-talk cancellation files for this?
      3. What parameters should I supply to maxwell_filter to limit it
      to head movement compensation?

Currently there is no way to do just movement compensation without also

maxwell filtering (reducing rank / denoising). In principle it should be
possible to do this without rank reduction (see this GitHub issue
<Issues · mne-tools/mne-python · GitHub; if you want to
track our progress here) but it is not implemented yet, and there will
probably be a reduction in the resulting signal-to-noise ratio due to
reconstruction noise.

I will skip the head movement compensation entirely for now then and
subscribe to the issue you've mentioned.

I remove bad channels/epochs at a later stage using the autoreject package.

One reproducible option would be to use autoreject or some other automated
routine to determine bad channels. MaxFilter even has an `autobad` option
you could try running before the head position estimation step to get a
list of bad channels. In principle you should be able to combine head
position estimation -headpos and automatic bad channel detection -autobad,
but in practice you can encounter bugs this way, so it's safer to separate
it into two steps.

I did try running `autoreject` on the raw data cut into constant-width
segments. Unfortunately, it results in half-to-all the channels being
flagged as bad in most of the epochs. Also, the worst dozen or so channels
were different both from the manually selected bad channels and the
`autoreject`'s results with different settings (I've varied
pre-`autoreject` linear filtering cutoffs, decimation factor, and segment
length).

I haven't tried MaxFilter's `-autobad` yet. Every person telling me how to
use MaxFilter made sure to mention its unreliability so I've never
considered it an option :slight_smile: I'll try and see whether the results are far
from what manual inspection yields.

Again, really appreciated your answer.
Evgenii
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190507/1b26347f/attachment-0001.html

External Email - Use Caution

Hi Evgenii,

I remove bad channels/epochs at a later stage using the autoreject package.

One reproducible option would be to use autoreject or some other
automated routine to determine bad channels. MaxFilter even has an
`autobad` option you could try running before the head position estimation
step to get a list of bad channels. In principle you should be able to
combine head position estimation -headpos and automatic bad channel
detection -autobad, but in practice you can encounter bugs this way, so
it's safer to separate it into two steps.

I did try running `autoreject` on the raw data cut into constant-width
segments. Unfortunately, it results in half-to-all the channels being
flagged as bad in most of the epochs. Also, the worst dozen or so channels
were different both from the manually selected bad channels and the
`autoreject`'s results with different settings (I've varied
pre-`autoreject` linear filtering cutoffs, decimation factor, and segment
length).

Just a note, the data before MaxFilter _does_ look bad, so it's not
surprising that these are all flagged as bad. Thus, I would say it's a
little hard to decouple SSS from the bad channel selection that SSS
requires. One option that might work for you is to apply first an SSP on a
copy of the data so you mimic the situation when you select bad channels.
And then apply autoreject on the SSP-ed data.

Mainak

I haven't tried MaxFilter's `-autobad` yet. Every person telling me how to
use MaxFilter made sure to mention its unreliability so I've never
considered it an option :slight_smile: I'll try and see whether the results are far
from what manual inspection yields.

Again, really appreciated your answer.
Evgenii
_______________________________________________
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/20190507/2d4d5715/attachment.html

External Email - Use Caution

Hi, dear Mainak.

Let me make sure I understand correctly what you are proposing:

   1. Run `maxwell_filter` without setting bad channels.
   2. Run `autoreject` on the results of step 1 and identify bad channels.
   3. Run `maxwell_filter` again supplying the list of channels identified
   in step 2.

Does that make sense?

I've just realized I have two further questions:

   1. In this <https://github.com/autoreject/autoreject/issues/123>
   issue, @dengemann mentioned that `autoreject` does not identify flat
   channels. Do you think adding the following step would be appropriate?
      - 0. Run `mne.preprocessing.mark_flat` to identify flat channels.
   2. Would you add temporal filtering before `autoreject`?

Evgenii

External Email - Use Caution

Hi Evgenii,

        External Email - Use Caution

Hi, dear Mainak.

Let me make sure I understand correctly what you are proposing:

   1. Run `maxwell_filter` without setting bad channels.
   2. Run `autoreject` on the results of step 1 and identify bad channels.
   3. Run `maxwell_filter` again supplying the list of channels
   identified in step 2.

Does that make sense?

Umm ... sure you could try that but I suspect it may not work. I was
actually proposing to use SSP
<https://mne-tools.github.io/dev/auto_tutorials/preprocessing/plot_artifacts_correction_ssp.html&gt;
for step 1. It's an alternative to SSS but in this situation, I think you
can use it here to complement SSS.

I've just realized I have two further questions:

   1. In this <Issues · autoreject/autoreject · GitHub;
   issue, @dengemann mentioned that `autoreject` does not identify flat
   channels. Do you think adding the following step would be appropriate?
      - 0. Run `mne.preprocessing.mark_flat` to identify flat channels.

I've never tried this but it sounds reasonable to me.

   1. Would you add temporal filtering before `autoreject`?

You could highpass before to avoid marking too many segments as bad.

Best,
Mainak

Evgenii

        External Email - Use Caution

Hi Evgenii,

I remove bad channels/epochs at a later stage using the autoreject

package.

One reproducible option would be to use autoreject or some other
automated routine to determine bad channels. MaxFilter even has an
`autobad` option you could try running before the head position estimation
step to get a list of bad channels. In principle you should be able to
combine head position estimation -headpos and automatic bad channel
detection -autobad, but in practice you can encounter bugs this way, so
it's safer to separate it into two steps.

I did try running `autoreject` on the raw data cut into constant-width
segments. Unfortunately, it results in half-to-all the channels being
flagged as bad in most of the epochs. Also, the worst dozen or so channels
were different both from the manually selected bad channels and the
`autoreject`'s results with different settings (I've varied
pre-`autoreject` linear filtering cutoffs, decimation factor, and segment
length).

Just a note, the data before MaxFilter _does_ look bad, so it's not
surprising that these are all flagged as bad. Thus, I would say it's a
little hard to decouple SSS from the bad channel selection that SSS
requires. One option that might work for you is to apply first an SSP on a
copy of the data so you mimic the situation when you select bad channels.
And then apply autoreject on the SSP-ed data.

Mainak

I haven't tried MaxFilter's `-autobad` yet. Every person telling me how
to use MaxFilter made sure to mention its unreliability so I've never
considered it an option :slight_smile: I'll try and see whether the results are far
from what manual inspection yields.

Again, really appreciated your answer.
Evgenii
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

_______________________________________________
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/20190507/0f815b08/attachment-0001.html

External Email - Use Caution

Let me make sure I understand correctly what you are proposing:

   1. Run `maxwell_filter` without setting bad channels.
   2. Run `autoreject` on the results of step 1 and identify bad
   channels.
   3. Run `maxwell_filter` again supplying the list of channels
   identified in step 2.

Does that make sense?

Umm ... sure you could try that but I suspect it may not work. I was
actually proposing to use SSP
<https://mne-tools.github.io/dev/auto_tutorials/preprocessing/plot_artifacts_correction_ssp.html&gt;
for step 1. It's an alternative to SSS but in this situation, I think you
can use it here to complement SSS.

Thank you for the clarification! I did not notice "P" in "SSP" in your
initial reply. I'll try applying both the pre-calculated projectors alone
and complemented with the ECG-EOG-based ones.

Best,
Evgenii
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190507/524d1eba/attachment.html