Forum

converting mat. or ...
 
Notifications
Clear all

converting mat. or csv. files into snirf.

3 Posts
3 Users
0 Reactions
4,619 Views
Posts: 1
Topic starter
(@erialc)
New Member
Joined: 5 years ago
[#309]

Hello, I am an undergraduate student working on a project to build a pre-processing code sets for a fNIRS instrument NIRSIT. 

They provide file formats in csv. and mat., and I want to convert them into nirs. or snirf. format to utilize various codes shared online for fnirs data analysis. 

Does anyone know how to change mat. files into snirf. format? 

Thanks,


2 Replies
Posts: 52
(@sstucker)
Joined: 6 years ago

Hi Nahyun,

 

.mat nor .csv files are directly convertible to SNIRF format, unless the .mat file happens to follow the .nirs convention, in which case Homer3 can convert it:

snirf = SnirfClass(NirsClass(<path to .mat /.nirs file>))

 

But depending on where the source data is coming from, I doubt the above code will work. Please see the SNIRF file specification document for information about how to write SNIRF files: https://github.com/fNIRS/snirf/blob/master/snirf_specification.md

 

There is example code in the repository which demonstrates how to write SNIRF file fields in MATLAB and Python.

 

If you are building an app in Python 3 or wish to validate the SNIRF files you are generating, see the Python package pysnirf2: https://github.com/sstucker/pysnirf2


Reply
1 Reply
(@yixi)
Joined: 2 years ago

Active Member
Posts: 10

@sstucker
Hello Tucker,

I'd like to know if I can convert the preprocessed .mat file to snirf using any function in the Homer 3 package? I found quite some conversion scripts under Homer3-1.87.0\DataTree\AcquiredData\DataFiles but wasn't able to locate the script that can convert .matlab to .snirf.

I’m asking because I ran into errors when exporting the preprocessed .snirf file from the Homer 3 GUI. Specifically, the data field under /nirs{i}/data is empty if I run my preprocessing pipeline up to OD2Conc. If I add the block averaging in addition to the pipeline, the concentration data appear as expected.

I'd like to load this preprocessed snirf file to mne-nirs for GLM analysis, so I can't just use the data after running the block average. 

Thank you so much and I'd be very much appreciated if anyone has any advice or idea on how to solve this!

 

Best,

Yixi


Reply
Share:
en_USEnglish