fNIRS/snirf

Easy way to convert an fNIRS dataset to SNIRF format from another format (like CSV)?

michaelchughes opened this issue · 1 comments

Hi SNIRF community,

I'm part of a team at Tufts that has released a new open-access fNIRS dataset [see links 1,2 below]

We hope this data could be of broad interest to the BCI/fNIRS community, especially those that want to build and evaluate machine learning classifiers of a user's mental workload intensity level given short windows (say 30 seconds) of multivariate fNIRS recordings.

So far, we've been releasing data in plain-text CSV format. We became aware of SNIRF due to some helpful reviewer comments, but we haven't used it ourselves before. We are hoping you can help us figure out if SNIRF might be a good fit for our work.

My questions are:

  1. do you know of tools that would let us adapt our data from a CSV file (or some other format) to SNIRF format?
  2. are there tools available for reading SNIRF data into machine learning pipelines? (we work in Python, so I'm especially curious if there are tools for helping SNIRF play well with sklearn or pytorch).

Helpful details about our data: for each subject we have a CSV file with a row for every timestep (we recorded measurements every 5.2 Hz). The columns would tell you the estimated oxy/deoxy hemoglobin concentrations at that instant across several channels. You can see a screenshot of the data format here: https://tufts-hci-lab.github.io/code_and_datasets/fNIRS2MW.html#sliding-window-fnirs-data-for-classifiers (I'm sure we have other more "raw" fNIRS measurements too, but this preprocessed format is what seems most helpful to release to encourage ML folks to work on this problem).

Other open-access datasets for fNIRS and mental workload also seem to be available in other formats (e.g. the dataset by Shin et al [3] recorded at TU-Berlin), so a general guide/outline of how to "convert" data to SNIRF I think would be broadly helpful in moving more of the community to use SNIRF and benefit from open standards.

Best,
Mike Hughes

[1] Paper: https://openreview.net/pdf?id=QzNHE7QHhut
[2] Project Website: https://tufts-hci-lab.github.io/code_and_datasets/fNIRS2MW.html
[3] Shin et al dataset link: http://doc.ml.tu-berlin.de/simultaneous_EEG_NIRS/

Hi @michaelchughes,

do you know of tools that would let us adapt our data from a CSV file (or some other format) to SNIRF format?

Converting CSV data to SNIRF is possible, and just takes a little extra work as you will need to manually specify the required meta data (sample rate, sensor locations, etc).

You mention you use Python, in which case you can use MNE-Python with the MNE-NIRS extension to achieve this. You can read the data using this example (you will need to modify the example to read hbo and hbr, or you can change the types after using set_channel_type. To write the file use write_raw_snirf (see example which converts vendor format to SNIRF). If you hit any roadblocks please just ask us at https://mne.discourse.group

Alternatively you can use the MATLAB toolbox Homer3.

are there tools available for reading SNIRF data into machine learning pipelines? (we work in Python, so I'm especially curious if there are tools for helping SNIRF play well with sklearn or pytorch).

You can use MNE-Python for this. It is tightly integrated with sklearn (many of the same authors), for example, see the decoding docs https://mne.tools/stable/decoding.html . I dont have experience using pytorch with fNIRS data.