Multi-session BIDS-compatible MEG data set -- anatomical scan

Dear all,

I am currently in the middle of recording a multi-session MEG data set and want to store the data in a BIDS compatible way. So far, I used mne_bids for the BIDS-conversion and things work quite nicely. However, now I also want to add the anatomical scan per subject to the data set I and I am not sure I understand the procedure to do it. Specifically, I wonder on which level would I include the anatomical scan? As there is only a single scan per subject, it doesn’t really make sense to put it on the modality level within every session, right? Would it be more appropriate to have a separate session, alike to the procedure with empty rooms?

In the BIDS-specs, I found following passage describing how to link anatomical scan to corresponding sessions in the json file, but can’t really wrap my head around what that implies for folder organization

Path or list of path relative to the subject subfolder pointing to the structural MRI, possibly of different types if a list is specified, to be used with the MEG recording. The path(s) need(s) to use forward slashes instead of backward slashes (for example, ses-/anat/sub-01_T1w.nii.gz ).

Is there maybe an example data set online anywhere that I could use as template/inspiration. This one here comes close, but doesn’t really answer my questions.

Apart from that, I am also not certain on how to use mne-bids to add anatomical scans to the directory. If I am not mistaken, niftis (let alone dicoms) won’t do, I first need to myself get the surfaces from freesurfer, which can then be read out by mne_bids to produce all necessary files, including the transforms? Or do I need to compute the transforms and do the co-registration myself before invoking mne_bids? Only these files will then be included in the data set and not the “raw” nifti?

I appreciate any pointers/resources.

Thanks!

Eduard

1 Like

I think what you suggest would already work well, something like:

(this is a rough draft, I didn’t check too deeply)

├── dataset_description.json
├── participants.json
├── participants.tsv
├── README
└── sub-01
    ├── ses-meg1
    │   ├── meg
    │   │   ├── sub-01_ses-meg1_coordsystem.json
    │   │   ├── sub-01_ses-meg1_task-test_channels.tsv
    │   │   ├── sub-01_ses-meg1_task-test_meg.fif
    │   │   └── sub-01_ses-meg1_task-test_meg.json
    │   └── sub-01_ses-meg1_scans.tsv
    ├── ses-meg2
    │   ├── meg
    │   │   ├── sub-01_ses-meg2_coordsystem.json
    │   │   ├── sub-01_ses-meg2_task-test_channels.tsv
    │   │   ├── sub-01_ses-meg2_task-test_meg.fif
    │   │   └── sub-01_ses-meg2_task-test_meg.json
    │   └── sub-01_ses-meg2_scans.tsv
    └── ses-mri
        ├── anat
        │   ├── sub-01_ses-mri_T1w.json
        │   └── sub-01_ses-mri_T1w.nii.gz
        └── sub-01_ses-mri_scans.tsv

regarding the “linking” from MEG to corresponding T1w image, you found the correct documentation already: You use the IntendedFor field. I also think that the documentation on that needs some work, as I mentioned here: WIP: Overhaul CoordinateSystem details for MRI, MEG, EEG, iEEG by sappelhoff · Pull Request #700 · bids-standard/bids-specification · GitHub … see also discussion here: Specification of relative or absolute path in IntendedFor and SpatialReference is not consistent · Issue #471 · bids-standard/bids-specification · GitHub

basically, according to the current specification you would supply an IntendedFor field with a path as a value, perhaps something like this: ../../ses-mri/anat/sub-01_ses-mri_T1w.nii.gz

But I never did something like this myself, so I don’t know whether this is optimal.

Apart from that, I am also not certain on how to use mne-bids to add anatomical scans to the directory.

Have you taken a look at 07. Save and load T1-weighted MRI scan along with anatomical landmarks in BIDS — MNE-BIDS 0.14 documentation ?

It could well be that some features for T1 image-handling are still lacking in mne-bids … would be cool to use your current experience as a test case of what we have and what we need.

@hoechenberger may know more.

1 Like

(this is a rough draft, I didn’t check too deeply)

Yes, that’s what I had in mind. Looks good to me. So then, I would only need to specify the intendedFor field in each session’s *_cordsystem.json to point to the T1w scan, e.g. update_sidecar_json?

Have you taken a look at 07. Save and load T1-weighted MRI scan along with anatomical landmarks in BIDS — mne_bids 0.6 documentation ?

I had done it, but somehow I completely skipped the Writing T1 image part. Sorry! Indeed, writing_anat is pretty much what I was looking for. There are still a few problems though. For one, mb.write_anat(mri_path, t1w_bids_path,raw=raw, verbose=True) does not produce any sidecars. Perhaps this is because I am still using version 0.5 of mne-bids?

What is also not quite optimal is that I first need to do a dicom2nifti conversion before I can use mne-bids. That is, loading dicoms is not supported (as nibabel does not use nib.load, but a special procedure to read them). Therefore, there is an extra preprocessing step necessary. With heudiconv I could produce the niftis quite painlessly, and merging the existing MEG dataset with the MRI file tree shouldn’t be too much work either. Still, this extra step makes everything a little more awkward and susceptible to errors. Not sure, whether adding dicom support to mne-bids would be worth the effort?

It could well be that some features for T1 image-handling are still lacking in mne-bids … would be cool to use your current experience as a test case of what we have and what we need.

I would gladly help, but so far, there is not much expertise here. This is my first MEG/MRI dataset. I have worked with pure bids-organized mri before, but the combination is also new territory for me.

Thanks a lot!
Eduard

if mne-bids does not write sidecars, we could probably start doing that - can you verify and potentially open an issue on the mne-bids GitHub page?

Not sure, whether adding dicom support to mne-bids would be worth the effort?

I wouldn’t know where to start … but if there is an external python package that we could just “plug in” and require as an optional dependency during an mne-bids install, that’d be a great feature.

Perhaps also a good “feature request” issue on the mne-bids page?

I would gladly help, but so far, there is not much expertise here. This is my first MEG/MRI dataset. I have worked with pure bids-organized mri before, but the combination is also new territory for me.

user testing is very helpful to us :slight_smile: just be sure to report all issues, problems, and potential points of improvement (like you are already doing), thanks a lot!

Thanks for your input!

I opened two (somewhat lengthy) issues on github:

For now, I guess I need to explore a little more what needs to be done to properly merge anatomical scans with the meg data set

1 Like