ICA Help MNE vs Fieldtrip

Hello,

I have been playing around with both mne and fieldtrip for analysing resting state continuous data. MNE is my go to, but others have recommended that fieldtrip is more appropriate for clinical data. What are peoples thoughts on this?
So far I have found that MNE is not sufficiently removing artifacts using automatic detection. However, following a nearly identical pipeline with FieldTrip, it does not seem to me that good separation has occured for the components. What could be driving this issue?

All advice and feedback much appreciated. Thanks!

Hello @hWils and welcome to the forum!

It does indeed look as if ICA decomposition didnā€™t really work.

May I ask why you switched over to FieldTrip just for visualizing the components? Iā€™m asking because MNE-Python provides similar functionality.

As for the reasons ā€“ could be that there are problematic channels that should be marked as bad, or there are some segments in the data with ā€œnon-stereotypedā€ artifacts that should be excluded. Itā€™s difficult to tell without actually looking at the data ā€¦

What can help is using the ā€œproperty plotsā€ as shown in this tutorial:
https://mne.tools/stable/auto_tutorials/intro/10_overview.html#preprocessing

The ā€œDropped segmentsā€ subplot may provide some useful information as to where problematic segments are located.

Also ā€“ youā€™re only showing 10 components. How many components were you trying to fit? 10 may be too few.

Best wishes,
Richard

Hi Richard,

Thanks so much for your response!

I switched over the FieldTrip for the whole preprocessing pipeline. This is because whereas in the past Iā€™ve always used mne for ERP data, currently Iā€™m working on clinical data, and have been recommended by colleagues that FieldTrip is more standardised and potentially more powerful in a clinical context.

I used FieldTrips visual reject option to get rid of bad segments, the individual channels seem mostly okay. As for components, I am fitting 64 (there are 64 channels), but yes only showed 10 on the visualisation.

Best Wishes,

Holly

Thanks for the explanations!

Is this full-rank data? Do the results look better if you try to fit, say, only 60 components?

Richard

Yes it was full rank data, I tried with reduced rank to 40 components, and still unmixed and weird ICA results.
I just ran more or less the same pipelien in EEGLAB (only changes was applying CleanLine and not rejecting messy segments as in ft_rejectvisual option for FieldTrip). It seems ICA output is somewhat better? Would love to hear your thoughts on this.

If so, it seems that there is a fair amount of variability in the outputs for mne vs. fieldtrip. vs eeglab!

I would think that you still have some issues in the input data. For example I assume thereā€™s an issue with a channel near the left ear

2 Likes

@hWils just looking at the ICA topographies, I have a similar impression like @richard. It seems like something is wrong with your input data i.e., the source topographies look very focal. There are various reasons that can potentially affect ICA decomposition. Did you consider using a 1hz high-pass filter to remove the slow drift noise before applying ICA pipeline?

best,
Dip

1 Like

I agree that the reason for these ā€œbadā€ ICs is probably the input data.

And to address the elephant in the room:

I donā€™t believe thatā€™s true. ā€œMore standardizedā€ and ā€œpotentially more powerfulā€ also sound very generic, and I usually hear such arguments from people who are familiar with one tool (e.g. FieldTrip) and donā€™t know a lot about the other tool (e.g. MNE). It almost sounds like ā€œMATLAB is better suited for real problems because it is developed by a companyā€.

1 Like

Im actually surprised theyā€™d recommend FT instead of EEGLAB for EEG data :sweat_smile:

2 Likes

@hWils , coming from a clinical MEG background, I agree with the rest - fieldtrip doesnā€™t seem to be any more ā€œpowerfulā€ or ā€œstandardizedā€ for clinical analysis. All of these packages have their strengths and weaknesses and special functions (I have used MNE/Brainstorm/Fieldtrip extensively + commercial software)( different MRI tools have the same tradeoffs). And if this is a Matlab v Python argument - python currently has 16 times the global usage of Matlab, so it is plenty validated (TIOBE Index - TIOBE) .

It would be good to hear the specifics on what the investigators believe are missing in the MNE suite, so that functionality could be added.

-Jeff

2 Likes

oh wow! Thanks so much for the response everyone! Really grateful for the input :slight_smile:

@dasdiptyajit yes, 1hz high pass filter was applied. Do you have any recommendations for how to best debug what is problematic in the input data? There do not seem to be so many gross muscle artifacts, and tried segmenting out data identified as bad via the ft_rejectvisual. Richard thanks for pointing out about the channel on the left side, I will experiment with removing bad channels next.

cbrnr and jstout211 the recommendation was actually made by a fellow mne user. It may be because myself and my colleague do not use fieldtrip or eeglab that we have put them on a bit of a pedestal. My other motivation for FT is that I have never seen MNE used in papers within my field, and being relatively new to this particularly research area, I wanted to keep everything as ā€˜standardā€™ as possible so I could closely follow pipelines in past research,

@jstout211, I love working with mne! The only functionality that comes to mind it being able to convert epochs back into a continuous data format. This is something FT enables

1 Like

Defaulted back to MNE (yay) - using much more stringent segment rejection - Iā€™ve got to these ICA components - to me they look far more reasonable, but would really appreciate a santiy check second glance on these at this point!!

Iā€™m still not happy with the first two components. Thereā€™s still something odd going on here. Please do check the corresponding property plots (if you pass the inst parameter to plot_components(), you can then right-click on the topographies to open the property plot)

But overall this already looks much better than before, yes!

Richard

1 Like

Thanks @richard! I had assumed the first two were eye movement related - but not so sure now after seeing the propery plots. Do you have any recommendations for resources for upping my component artifact identification skills? Would really love to improve on this

Thereā€™s something very fishy going on at around epoch number 150, according to the ā€œDropped segmentsā€ plot. Iā€™d look at those epochs again, you may find that thereā€™s a strong artifact and one or more epochs may need to be removed before running ICA.

Best wishes,
Richard

1 Like

To convert epochs back to continuous, just put the epochs back into the numpy array. Assuming that you have no gaps between epochs, the following code will give you a continuous output (even though there may be jump discontinuities in the traces due to edge effects on processing). Some additional work can help to fix the ā€œmissingā€ section below.

Also - if all you is just the ICAs on the continuous data - create the ICA solution on the epochs and apply to the raw data object.

raw = mne.io.read_raw_ctf('sub-ON28693_ses-01_task-sternberg_run-01_meg.ds', preload=True, system_clock='ignore')
#" Do Raw processing here"
raw.filter(1,None) #....

#" Do epoch stuff here "
epo = mne.make_fixed_length_epochs(raw, preload=True)


# <<Missing part - fix edge effects, set 0s/Nans/BadsLabel for rejected epo >>

# Recompose into continuous
raw._data=epo._data.transpose([1,0,2]).reshape([raw._data.shape[0],-1])

Also - the above is a quick hack to get back to continuous data (there may be some intricacies that are not accounted for that I donā€™t know about).

-Jeff

1 Like

Thereā€™s something very fishy going on at around epoch number 150, according to the ā€œDropped segmentsā€ plot.

Definitely, Iā€™m guessing you should mark as bad a segment around the end of your recording. Those 2 first components are not eye-related. Iā€™m guessing ICA006 and ICA007 are the eye-movement components.

Mathieu

2 Likes