Collection of Python and Matlab Scripts to run the MEG data analysis for Mars2
Pipeline requires:
- MNE Python: https://mne.tools/stable/index.html
- FieldTrip: https://www.fieldtriptoolbox.org/
- VirtualTools: https://github.com/juliankeil/VirtualTools
- Step 1: Convert Raw MEG files to BIDS format:
- Run MNE_Raw2Bids.py to read in the raw MEG data and format for the automatic processing
- Step 2: Run the automatic BIDS pipeline: Attention, need the fine MEG configuration files
- Go to the command line, go to the root folder of the BIDS data and run (watch out, this needs the fine configuration files for the MEG system!): mne_bids_pipeline --config=MNE_BIDS_config.py --steps=preprocessing
- Find Noisy or Flat Channels
- Maxwell Filter
- Bandpass and Notch Filter
- ICA
- Epoch
- Condition Selection
- Go to the command line, go to the root folder of the BIDS data and run (watch out, this needs the fine configuration files for the MEG system!): mne_bids_pipeline --config=MNE_BIDS_config.py --steps=preprocessing
- Step 3: Automatic rejection of bad channels and epochs
- Run MNE_BIDS_autoreject.py
- Step 1: Read in MNE BIDS Data
- Run CamCan_Import.m to select MEG channels and prewhiten the MEG data to have the same scale between magnetometers and gradiometers
- Step 2: Create Headmodel
- Read in the Headmodel in MRIcoGL to double check orientation
- Run CamCan_Headmodel.m to build headmodel and sourcemodel. Watch out, this requires some user input to re-orient the MRI and MEG data in space
- Compute TFR in Sensor Space
- Run CamCan_TFR.m to compute TFR
- Stats and Plotting in the same script
- Project data to virtual channels in source space
- Run CamCan_VirtChan.m for Virtual Sensor Projection
- Compute TFR in Source Space
- Run CamCan_TFR_vc.m to compute TFR
- Stats and Plotting in the same script
- Compute Connectivity in Source Space
- Run CamCan_Connectivity.m to compute Functional Connectivity
- Stats and Plotting in the same script