APP UNDER DEVELOPMENT PRIVATE APP ON BL
This app aims at computing the mean transformation matrix across all runs of a MEG session to correct the head position of all runs thanks to this matrix. This mean transformation matrix is stored in an empty .fif
file, which then can be passed as a parameter in mne.preprocessing.maxwell_filter (destination
parameter).
GitHub repository
https://github.com/AuroreBussalb/app-mean-transformation-matrix
Brainlife datatype used:
For input: neuro/meg/fif
For output: neuro/meg/fif
Discuss if these datatypes must be updated.
Datatype updated, see Datatype meeting 18.02.2021
Inputs of the App:
The runs
Files | Format | Description | Optional |
---|---|---|---|
MEG signal | .fif | first run | No |
MEG signal | .fif | second run | No |
… | … | … | Yes |
MEG signal | .fif | nth run | Yes |
At least two runs are required.
2. The MEG signal we want to preprocess
To be used in a pipeline, this App must also take the MEG signal in .fif that will be preprocessed (it must be one of the MEG files given in the first input). This is important because all the optional files will be loaded with this input and then will be used in the next Apps.
Output of the App:
Files | Format | Description |
---|---|---|
Raw file | .fif |
|
Besides, in the output directory, there are the optional files we will use in a next App and the MEG file we want to preprocess. This is mandatory, because the App that will be run after app-mean-transformation-matrix will take as input all the files in app-mean-transformation-matrix’s output directory corresponding to the datatype of the input of the next App.
Steps:
The python file mean-transformation-matrix.py
is composed of several functions:
mean_transformation_matrix()
Extract the transformation matrix from each file
Create info object of the empty .fif file
Compute the mean of all matrices across all files and add it to the info of the empty .fif file
Create fake data to put into the .fif file
Create raw object
main()
Read all the input files by parsing the
config.json
Raise a
ValueError
if only one file was givenRead the MEG data we want to preprocess later and save it
Read the optional files that will be used in the next preprocessing Apps and, if they exist, copy them in the output directory
Apply
mean_transformation_matrix()
Parameters of the App
The parameters of the App correspond to the parameters passed to the Python functions used in the App. They are listed in the config.json.example
when you test your App locally, then when you register you App on Brainlife, you enter them and a config.json
is created by Brainlife.
Here, we used the parameters set by default by mne
.
Add Comment