mne-bids-pipeline icon indicating copy to clipboard operation
mne-bids-pipeline copied to clipboard

Making epochs optional

Open MerlinDumeur opened this issue 3 years ago • 12 comments

Hi,

Right now the way the pipeline is set-up, epoching is necessary.

I would however need to apply the ica on the raw recording instead of the epoched data. Is it planned for this pipeline to be able to do that? I will need to do it anyway, and I'll be happy to have my version of the code which does that, but it might be interesting to add this feature as a PR here.

Please let me know what you think

MerlinDumeur avatar Apr 15 '21 10:04 MerlinDumeur

one issue with ICA on raw data is that it makes it harder to remove bad data segments that can seriously alter the results on non-Gaussian ICA (such as fastica or picard or infomax). Also for non-Gaussian ICA time structure does not matter. It takes time samples as independent observations.

note also that you can compute ICA on epochs an apply it on raw

agramfort avatar Apr 15 '21 10:04 agramfort

one issue with ICA on raw data is that it makes it harder to remove bad data segments

You mean because if there's a bad segment, we get edge artifacts, whereas with epochs, we would drop the entire epoch?

hoechenberger avatar Apr 15 '21 10:04 hoechenberger

one issue with ICA on raw data is that it makes it harder to remove bad data segments

You mean because if there's a bad segment, we get edge artifacts, whereas with epochs, we would drop the entire epoch?

you would need annotations to have ICA ignore crap segments with raw. There is no edge artifact issue for temporal ICA like we use here.

agramfort avatar Apr 15 '21 10:04 agramfort

Ok so if I understand correctly the options are:

  • Annotate bad segments in the raw data, then compute ICA on the raw data, ignoring bad segments.
  • Compute the ICA on epoched data, and apply it on the raw data.

It seems to me that the second option would be easiest, but maybe not optimal, and I will likely need to annotate bad segments anyway. Would it be possible to arbitrarily segment the data into small epochs, and apply the rejection method from mne? Otherwise, would it be feasible to use SSP instead?

MerlinDumeur avatar Apr 15 '21 11:04 MerlinDumeur

It seems to me that the second option would be easiest, but maybe not optimal, and I will likely need to annotate bad segments anyway. Would it be possible to arbitrarily segment the data into small epochs, and apply the rejection method from mne?

you mean use https://mne.tools/dev/generated/mne.make_fixed_length_epochs.html#mne.make_fixed_length_epochs

that's what is currently planned for rest data

agramfort avatar Apr 15 '21 11:04 agramfort

yes that's what I meant.

If there's any way I can help with adding this to the pipeline, I'd be happy to because I will need it.

MerlinDumeur avatar Apr 15 '21 12:04 MerlinDumeur

I would then suggest you take what you need in https://github.com/mne-tools/mne-bids-pipeline/pull/276/files and start a fresh PR. We'll rebase and clean https://github.com/mne-tools/mne-bids-pipeline/pull/276/files later once we have your improvements.

agramfort avatar Apr 15 '21 12:04 agramfort

I'll get on it then

MerlinDumeur avatar Apr 15 '21 12:04 MerlinDumeur

great !

agramfort avatar Apr 15 '21 12:04 agramfort

Amazing!

hoechenberger avatar Apr 15 '21 12:04 hoechenberger

I'll get on it then

I guess it will take some more time? :)

moritz-gerster avatar Nov 24 '21 11:11 moritz-gerster

@moritz-gerster see WIP #296 and discussion there

drammock avatar Nov 24 '21 15:11 drammock