Using homer functions offline - BUNPC/Homer3 GitHub Wiki

This page provides examples of how to use Homer's functions without the Homer3 GUI. Codes and data files on this page could be found from \Homer3\UnitTests\Example_RunFuncOffline under your Homer3 root folder.

Note: Before running these codes, first add the Homer3 folder into the Matlab path. To do this, change the current folder to the Homer3 root folder and type setpaths in the Matlab command window.

Example1: Raw_to_DeltaConc_Example.m

This example script can be used to convert raw data to delta concentration and plot it. The input variables of this script are filename, hbType and channels. So you need to provide the name of the snirf file and indicate the hbType(HbO/HbR/HbT) and the index of the channel.

For example, you can plot channels 1 and 2 delta HbR concentration, derived from acquisition file test.snirf by typing:

cd '<root folder>\Homer3\UnitTests\Example_RunFuncOffline'
Raw_to_DeltaConc_Example('./test.snirf', ‘2’, ‘[1,2]’);

If the hbType and channel index are not provided, the delta HbO concentration of channel 1 will be plotted by default:

cd '<root folder>\Homer3\UnitTests\Example_RunFuncOffline'
Raw_to_DeltaConc_Example('./test.snirf');

Example02: Raw_to_HRF_Example.m

This example script is used to convert raw data to HRF and plot it. To run the script, the input variables filename, hbType and channels index should be provided as well.

For example, to plot the HbT HRF of channels 1 and 2, type the following codes in the Matlab command window:

cd '<root folder>\Homer3\UnitTests\Example_RunFuncOffline'
Raw_to_HRF_Example ('./test.snirf', ‘3’, ‘[1,2]’);

To plot the HbO and HbR HRF of channel 2, type:

cd '<root folder>\Homer3\UnitTests\Example_RunFuncOffline'
Raw_to_HRF_Example ('./test.snirf', ‘[1,2]’, ‘2’);

If the hbType and channel index are not provided like this:

Raw_to_HRF_Example ('./test.snirf');

the HbO HRF of channel 1 will be plotted.

Note: For the Raw_to_HRF_Example.m, you need to have stim marks before executing the script. Otherwise, no HRF will be generated.