-
Notifications
You must be signed in to change notification settings - Fork 55
Output Files
After processing fNIRS datasets with Homer3, several .mat files containing all acquired data and derived data will be generated.
Here is an example based on the group file structure below which shows where to find these .mat files.
In this instruction, .nirs files are stored in the Group01 folder and organized in this way:
(NOTE that more details about directory structure and data file organization can be found from here)
After loading and processing these datasets with Homer3, .mat files for
- each run (subj01_run01.mat, subj01_run02.mat, subj01_run03.mat, subj02_run01.mat…);
- each subject (subj01.mat, subj02.mat, subj03.mat, subj04.mat, subj05.mat);
- group (Group01.mat);
- and groupResults.mat file
would be generated and stored under the Group01 folder:
All data for each run is stored in the corresponding run-level .mat file; data for each subject is stored in the corresponding subject-level .mat file; and the group-level data is stored in the Group01.mat.
groupResults.mat contains the entire data tree, an array of group objects (and their subject and run objects), BUT with empty procStream.output. In the groupResults.mat file, the run elements in the data tree have empty acquired data fields, in addition to the procStream.output. When the current element in Homer3 MainGUI is a run, procStream.output is loaded from the corresponding .mat file AND acquired data is loaded from the corresponding acquisition file.
If you wish to work with groupResults.mat file standalone (outside of Homer3), an easy way to load the data is to use the Load() method belonging to all the data tree classes. NOTE that you only need to use this method to access data when the storage scheme in groupResults.mat is distributed - this is the default in Homer3 as set in the AppConfig.cfg file.
Here are two examples of how data is accessed in groupResults.mat:
Example 1. To access run-level data
After loading groupResults.mat in Matlab command window, if you want to look at the data in the run02 of subject03, you would access the derived data this way:
load groupResults.mat
group(1).subjs(3).runs(2).Load
group(1).subjs(3).runs(2).procStream.output
You could also access the acquired data this way:
load groupResults.mat
group(1).subjs(3).runs(2).Load
group(1).subjs(3).runs(2).procStream.acquired
Example 2. To access subject-level data
After loading the groupResults.mat in Matlab command window, you could look at the derived data in subject #3 by typing this:
group(1).subjs(3).Load
group(1).subjs(3).procStream.output
If you want to extract HRF results from the groupResults.mat file, you could convert dcAvg data to the multi-dimensional array by using the GetDataTimeSeries() method belonging to DataClass (the class that implements the SNIRF field/nirs/data).
Alternatively, if all you want to look at is the procStream.output for a specific run, subject or group, you can simply load the .mat file that corresponds to the processing element of interest.
Here are five more examples based on the group file structure above which show how to use both methods to extract HRF results:
NOTE: the Load() function used in method 1 of each example, itself calls two more class functions: LoadDerived() and LoadAcquired() loading both acquired and derived data automatically. In each example, Load() could be replaced by one of those other two functions depending on which of the data you are interested in. To make it simple, the following examples load both acquired and derived data with the more general Load().
Example 1. To view d (raw data) of a specific run (run #2 of Subject #3)
- Method 1:
load groupResults.mat
group.subjs(3).runs(2).Load();
d = group.subjs(3).runs(2).acquired.data.GetDataTimeSeries();
- Method 2:
snirf = SnirfClass('subj03_run02.snirf');
d = snirf.data.GetDataTimeSeries();
Example 2. To view dc (delta concentration) and t (time points) of a specific run (run #2 of Subject #3)
- Method 1:
load groupResults.mat
group.subjs(3).runs(2).Load();
dc = group.subjs(3).runs(2).procStream.output.dc.GetDataTimeSeries('reshape');
t = group.subjs(3).runs(2).procStream.output.dc.GetTime();
- Method 2:
load subj03_run02.mat
dc = output.dc.GetDataTimeSeries('reshape');
t = output.dc.GetTime();
Example 3. To view HRF (dcAvg) and tHRF of a specific run (run #2 of Subject #3)
- Method 1:
load groupResults.mat
group.subjs(3).runs(2).Load();
dcAvg = group.subjs(3).runs(2). procStream.output.dcAvg.GetDataTimeSeries('reshape');
tHRF = group.subjs(3).runs(2). procStream.output.dcAvg.GetTime();
- Method 2:
load subj03_run02.mat
dcAvg = output.dcAvg.GetDataTimeSeries('reshape');
tHRF = output.dcAvg.GetTime();
Example 4. To view HRF (dcAvg) and tHRF of a specific subject (Subj02)
- Method 1:
load groupResults.mat
group.subjs(2).Load();
dcAvg = group.subjs(2).procStream.output.dcAvg.GetDataTimeSeries('reshape');
tHRF = group.subjs(2).procStream.output.dcAvg.GetTime();
- Method 2:
load subj02.mat
dcAvg = output.dcAvg.GetDataTimeSeries('reshape');
tHRF = output.dcAvg.GetTime();
Example 5. To view HRF (dcAvg) and tHRF of group
- Method 1:
load groupResults.mat
group.Load();
dcAvg = group.procStream.output.dcAvg.GetDataTimeSeries('reshape');
tHRF = group.procStream.output.dcAvg.GetTime();
- Method 2:
load Group01.mat
dcAvg = output.dcAvg.GetDataTimeSeries('reshape');
tHRF = output.dcAvg.GetTime();
Join the Homer3 community on openfnirs.org!
- Homer3 Overview
- Download and Installation
- Homer3 Graphical User Interfaces
- Input and Output Definitions
- Processing Data
- Viewing Processed Data via GUI
- Exporting Processed Data into a Text File
- Exporting Processed Data into MATLAB WorkSpace
- Working with Datasets using DataTree Library
- Working with SNIRF files standalone
- Custom User Functions