Data Naming and Storing

Data Naming and Storing: MEG

Data host

The MEG data is securely stored on NYU Box; access is given by invitation only. The Data folder is structured in the standardized BIDS format. Please raise an issue on the GitHub repository if you think the structure does not conform to BIDS.

If you are unable to access the datasets, you do not have the required permission: kindly send an email to nyuad.meg@nyu.edu.

Data naming BIDS protocol

Your data should be stored in the BIDS format. A typical MEG dataset from NYUAD contains the files and folders described below, following the BIDS specification.

In the following, [SUB_ID] should be replaced with the ID of the subject.

Note

If you find a bug in the BIDS naming format, please raise an issue on GitHub or create a pull request with your proposed modifications.

Directory structuring

Your file structure should look like this:

  • a root level directory named after your project (PROJECT_NAME)

  • within the root directory, you should have:

    • README.md: general information on your project

    • dataset_description.json: a JSON object detailing the authors, project name, grants and so on

    • sub-[SUB_ID]: a folder for each subject, within which there should be:

      • optionally, a ses-[SES_ID] folder, where SES_ID is a numeric session ID, inside which you will find:

        • meg (mandatory): contains your MEG data and other metadata

        • beh (optional): behavioural data of the session

      • if there is no ses-[SES_ID] folder, the subject does not have multiple sessions; in that case meg is found directly within the sub-[SUB_ID] folder

    • sourcedata (optional): the files as they were before any conversion or renaming, such as the laser scan project, the logs of the stimulus computer and the eye-tracker files. Following BIDS, this folder sits at the root of the dataset, next to the sub-[SUB_ID] folders, and repeats the subject and session folders inside: sourcedata/sub-[SUB_ID]/[ses-[SES_ID]/]. BIDS does not prescribe the names of the files in sourcedata, and recommends following its naming where possible: start each file name with the same entities as the recording it belongs to. A README at the root of sourcedata should say what the folder holds.

Note

Datasets acquired before this rule keep a sourcedata folder inside each sub-[SUB_ID] or ses-[SES_ID] folder. The KIT pipeline does not read sourcedata, so these datasets work as they are; use the root-level folder for new datasets.

Additionally, the root directory can have:

  • events.json: metadata about the device used for presenting the stimuli

  • events.tsv: information about the types of trials, their onset and duration

  • task-[PROJECT_NAME]_meg.json: information about the MEG system used, the sampling frequency and so on

If these three files are not found at the root of your dataset, each subject or session might have a specific configuration. In that case, make sure to have these files within the subject or session folder, adding the sub/ses IDs to the name of the file. The three files can also exist both at the root of your dataset and within each session/subject, when some parameters are specified at the level of the dataset while others are specific to the session/subject.

Note

General BIDS notes:

  • If a particular file applies to all runs, it should not have the run entity in its name

  • If a particular file applies to all sessions, it should not have the ses entity in its name

Filename Entities and Ordering

The BIDS standard enforces a strict ordering of components (entities) in filenames. The following table shows the order in which entities must appear if they are present. Entities marked as Mandatory must always be included.

Entity

Status

Description

sub-<label>

Mandatory

Subject ID. Unique identifier for the subject.

ses-<label>

Optional

Session ID. Required if the subject has multiple sessions.

task-<label>

Mandatory

Task name (required for functional data).

acq-<label>

Optional

Acquisition parameter (e.g., acq-laserproject).

run-<index>

Optional

Run index. Used if multiple runs of the same task are acquired.

mod-<label>

Optional

Modality.

split-<index>

Optional

Split index. Specific to .con split files.

proc-<label>

Optional

Processing label (e.g., proc-CALMnoisereduction).

space-<label>

Optional

Coordinate space (e.g., space-ALS for marker files).

Suffix

Mandatory

The modality or file type suffix (e.g., _meg, _markers, _headshape).

Extension

Mandatory

The file extension (e.g., .con, .mrk, .fif, .json).

Warning

The order of these entities is fixed. For example, sub-001_task-rest_ses-01_meg.con is INVALID because ses must come before task. The correct name is sub-001_ses-01_task-rest_meg.con.

MEG-Laserscan files

  1. A .fsn file, named sub-[SUB_ID]_acq-laserproject_headshape.fsn: this file is obtained by saving the whole FastScan laser project (File > Save). The .fsn file is stored under sourcedata/sub-[SUB_ID]/ (sourcedata/sub-[SUB_ID]/ses-[SES_ID]/ when there are sessions), at the root of the dataset.

  2. Two .txt files holding the head surface scan and the stylus points, both stored under meg:

    • sub-001_ses-01_acq-head_headshape.txt is the head scan of the participant

    • sub-001_ses-01_acq-points_headshape.txt is the stylus points location file of the participant

MEG-KIT files

Depending on the experiment, many .con files can be produced by the KIT machine.

  1. .con files are named:

    • sub-[SUB_ID]_ses-[SES_ID]_task-[TASK_NAME]_run-[RUN_ID]_split-[SPLIT_INDEX]_meg.con

    • example: sub-001_ses-01_task-audiovisualmotor_run-03_meg.con

    • if you applied the CALM filtering or another kind of pre-processing to your .con file:

      • sub-[SUB_ID]_task-[TASK_NAME]_proc-CALMnoisereduction_meg.con, or replace the proc value with the name of your filter

      • example: sub-001_task-attention_proc-CALMnoisereduction_meg.con

    • the split entity is used when, in a single session, the scan results in multiple acquisition files; use it to indicate the order of the files

    • all .con files should be stored under meg

  2. .mrk files are named:

    • sub-[SUB_ID]_ses-[SES_ID]_task-rest_acq-[MARKER_ORDER_NUMBER]_space-ALS_markers.mrk, where:

      • [MARKER_ORDER_NUMBER] is the chronological order in which the marker was acquired in that session

      • the task should be set to rest because no stimulus events are involved (otherwise the BIDS Validator issues a warning)

      • the space refers to the coordinate system: for Yokogawa/KIT it is Anterior on the X-axis, Left on the Y-axis and Superior on the Z-axis, therefore ALS

    • all .mrk files should be stored under meg

  3. Declaring which recordings a marker measurement belongs to (scans.tsv):

    • By default the pipeline chains the markers chronologically: with n .con files (ordered by run and split) and n+1 .mrk files, recording i uses markers i (before) and i+1 (after). This needs one marker measurement between every two consecutive recordings.

    • When a measurement bounds several recordings (markers taken, two tasks recorded back to back, markers taken again), declare the pairs in the BIDS acquisition table sub-[SUB_ID]_ses-[SES_ID]_scans.tsv stored in the session folder, with two additional columns:

      filename                                      acq_time             marker_before                                              marker_after
      meg/sub-001_ses-01_task-A_run-1_meg.con       2026-10-19T09:12:00  meg/sub-001_ses-01_task-rest_acq-1_space-ALS_markers.mrk  meg/sub-001_ses-01_task-rest_acq-2_space-ALS_markers.mrk
      meg/sub-001_ses-01_task-B_run-2_meg.con       2026-10-19T09:40:00  meg/sub-001_ses-01_task-rest_acq-1_space-ALS_markers.mrk  meg/sub-001_ses-01_task-rest_acq-2_space-ALS_markers.mrk
      meg/sub-001_ses-01_task-C_run-3_meg.con       2026-10-19T10:05:00  meg/sub-001_ses-01_task-rest_acq-2_space-ALS_markers.mrk  meg/sub-001_ses-01_task-rest_acq-3_space-ALS_markers.mrk
      
    • filename and acq_time are the standard BIDS columns (one row per .con file, including proc- variants, paths relative to the session folder); marker_before and marker_after are additional columns, described in a scans.json next to the table so that the BIDS validator accepts them. Use n/a when no measurement exists on that side.

    • When the table is present every recording of the session must be listed; the KIT-to-FIF stage refuses a recording that is missing from it or that lists a file that does not exist. 2-kit_con_to_fif.py --write-scans-draft writes a draft table and its scans.json under derivatives/ from the chain rule and the recording times; correct it, then copy both files into the session folder.

    • The task-rest label of the markers is kept because a measurement between two tasks belongs to both; BIDS itself (one or two marker files per raw file, acq-pre/acq-post) has no way to share a measurement without duplicating the file.

Note

  • The ses entity is optional, but must be present if the same subject had multiple sessions

  • The run entity is optional, but must be present if, in the same session, a subject had multiple MEG acquisitions leading to multiple .con files

MEG-OPM files

The OPM (FieldLine) system writes .fif files with its own native names (for example 20240415_113034_sub-NA_file-emptyRoom-raw.fif). These must be renamed to a BIDS-valid form before storage: drop the -raw suffix and add a task label.

The .fif files are named:

  • sub-[SUB_ID]_ses-[SES_ID]_task-[TASK_NAME]_meg.fif

  • example: sub-001_ses-01_task-restingstate_meg.fif

  • all .fif files and their channels.tsv and meg.json sidecars are stored under meg

Empty-room (noise) recordings

Empty-room recordings (noise recordings) are acquired with no participant in the magnetically shielded room, to characterize system noise and to estimate noise covariance. BIDS has a dedicated convention for them, which NYUAD follows.

Store every empty-room recording under a single reserved subject sub-emptyroom, with a session label equal to the recording date (ses-YYYYMMDD) and the task noise:

sub-emptyroom/
    ses-<YYYYMMDD>/
        sub-emptyroom_ses-<YYYYMMDD>_scans.tsv
        meg/
            sub-emptyroom_ses-<YYYYMMDD>_task-noise_acq-<kit|opm>_run-<NN>_meg.<con|fif>
            sub-emptyroom_ses-<YYYYMMDD>_task-noise_acq-<kit|opm>_run-<NN>_channels.tsv
            sub-emptyroom_ses-<YYYYMMDD>_task-noise_acq-<kit|opm>_run-<NN>_meg.json

Conventions:

  1. sub-emptyroom (used literally) is the only subject for noise data. Do not assign a numeric subject ID.

  2. ses-<YYYYMMDD> is the date the empty room was recorded, for example ses-20240628.

  3. task-noise is always the task for empty-room data.

  4. acq-kit marks the KIT/Yokogawa SQUID system and acq-opm marks the FieldLine OPM system. This is how both systems coexist in one dataset, because BIDS has no dedicated system entity.

  5. run-<NN> numbers multiple recordings taken on the same day with the same system (run-01, run-02, and so on).

  6. proc-CALMnoisereduction is appended when an on-system noise-reduced copy of a run is stored next to the raw run.

  7. Conditions that must not go in the file name (for example “helium heater on”, “OPM present or removed”, or the original file name) are recorded in the comments and original_filename columns of the session scans.tsv, documented by a sub-emptyroom_scans.json data dictionary.

Examples:

sub-emptyroom_ses-20240628_task-noise_acq-kit_run-03_meg.con
sub-emptyroom_ses-20240415_task-noise_acq-opm_run-01_meg.fif
sub-emptyroom_ses-20241023_task-noise_acq-kit_run-01_proc-CALMnoisereduction_meg.con

Note

Empty-room recordings contain no participant data, so no demographic fields are required beyond the reserved sub-emptyroom entry in participants.tsv.

Note

For the KIT system the channels.tsv typing depends on the recording date: from 2018 onward the sensor mapped to MEG 092 is recorded as a reference magnetometer (a known hardware fault), giving 207 MEGMAG plus 17 MEGREFMAG; recordings before 2018 have 208 MEGMAG plus 16 MEGREFMAG.

Note

This layout is the one produced for the NYUAD empty-room dataset on NYU Box. See the BIDS empty-room specification at https://bids-specification.readthedocs.io/en/stable/modality-specific-files/magnetoencephalography.html.

Data uploading

Steps:

  1. Access the MEG data folder on NYU Box

  2. Identify the project that the data belongs to, or request a new project folder

  3. Open the folder of that project, or create it if it does not exist

  4. Follow the BIDS structure described above within each project folder

  5. Make sure that all the files have been uploaded to the folder

Data Naming and Storing: MRI

MRI data is hosted on XNAT.