BIOPAC fNIRS to Homer2 file conversion scripts

Dear All

I have briefly worked with Homer2 and the BIOPAC fNIRS device (fNIRS 100) and have created the following scripts to convert a COBI studio file to the .nirs files used by Homer2.

I am not a Matlab expert and the scripts may therefore not be perfect, please feel free to modify them as you see fit; I will therefore not take any responsibility for any work resulting from the use of these scripts.

How to use the scripts:

Download the zip folder, see below, and add it to your Matlab pathway. Open the <test_all.m> file.  This is the file that converts your data. You don’t need to open any of the other files, but they have to be in the same folder as the <test_all.m> file.

If you don’t know anything about Matlab I suggest that you just run the script with the test data. It uses the <TEST_homer_test> files as an example if you just open it and run it as-is. That way you can have a look in the Workspace, and see what the end result should look like. Each variable tells you different things about your data.

d = data; t = trigger; s = time and SD has your settings for the user GUY in it. After running the script you will also see that a new variable has been created with the same file name (here TEST_homer_test_07011313) and the ending .nirs; this is the file that Homer2 will use.

Once you’ve had a look at it you can just change TEST_homer_test_07011313 to your variable name and run the script again (you will have to do this 3 times, in line 6, 7 and 16. Make sure that the endings .nir, .mrk and .nirs stay as they are now).

A note on the markers: I have used only two markers (1 and 4 using the parallel port) in my experiments. The Matlab script for the triggers is set out to take only take these two into consideration, you will have to modify the script (gettriggers.m) if you have used different markers. The <test_all.m> script might not work if the markers are not set right.

To open the file in Homer2 go to the directory  for the .nirs file you have just created. Homer2 will automatically identify your file and try to open it. It will also open a box titled ‘Load Process Options File’;  click “cancel” on the box unless you have previously created a process file. Homer2 will proceed to open your file and you can start working with it.

Good luck


Click to download zip file – Convert BIOPAC to Homer2 

3 thoughts on “BIOPAC fNIRS to Homer2 file conversion scripts

  1. Raul

    Hi, I am running Homer2 with Matlab runtime, is it possible to convert the file like that? or do I need to install full Matlab?
    Is there any other way I can use the file from BIOPAC COBI with Homer2?

    Any help will be very welcome (It is first time dealing with these two pieces of software)

    Man thanks,

      1. Raul

        Hi Kiel,
        Thanks for letting me know.
        I did send an email but I’m afraid she doesn’t seem available at the moment.

Comments are closed.