This script converts data from NatMEG (MEG, EEG, OPM) to BIDS format.
- The script prompts you to select folders for MEG/EEG data (MEG data folder), OPM data (OPM data folder), and the directory to save the BIDS-formatted data (Output data folder).
- You will be prompted to select the MEG calibration and cross-talk files. If you press Cancel, the script will use the default files located at /neuro/databases/sss/ (
sss_cal.dat
) and /neuro/databases/ctc/ (ct_sparse.fif
). - The script will ask if you want to overwrite existing files. This is important if you have already run the script with some data and only want to bidsify new data. To do this, select the same output folder containing your existing BIDS folder with the bidsified data.
- The script checks for a dataset description file in the MEG folder. If not found, it will prompt you to input the necessary parameters to create one.
- The script checks for participant files in the MEG folder. If not found, it will create them with the main variables:
participant_id
,sex
,age
, andgroup
. - Converts OPM data to BIDS format if the OPM folder is provided.
- Converts MEG data from the selected MEG folder to BIDS format.
- Generates an
error_files_list.txt
file containing a list of files that encountered errors during the BIDS MNE function process or files that were not .fif (e.g., .txt used for specific annotations) and were therefore copied directly to the output folder.
- Do not use numbers in your task name when saving your raw data.
- When applying maxFilter: Do not use underscores (
_
) in your task name. If you do, parts of the task name will be incorrectly considered asproc
parameters for MaxFilter.
Ensure you have the following libraries installed in your Python environment: mne
, tkinter
, numpy
, pandas
, re
, os
, json
, shutil
, glob
.
The first line of this script sets the Python environment path with all necessary libraries at NatMEG.
/Scripts/
To run this script, follow these steps:
- Make the script executable (this step is not needed at NatMEG).
Open a terminal, navigate to the script's directory, and run:
chmod +x bidsify.py
- Run the script.
Execute the script by running:
./bidsify.py
If you need to modify this script, do not make changes directly on the main branch. Instead, create a new branch or fork the repository in your GitHub account to work on your version.