-
Notifications
You must be signed in to change notification settings - Fork 55
Output Files
After processing fNIRS datasets with Homer3, a "derivatives" folder will be generated automatically. The subfolder "homer" under the "derivatives" folder contains a groupResults.mat file and a .mat file for each subject, session and run. The subject, session and run files are under the dedicated subject folders. Subject level analysis is the average of runs for that subject.
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.
See this page for detailed descriptions of Homer3's output variables.
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).sess(1).runs(2).Load
group(1).subjs(3).sess(1).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).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: LoadDerivedData() and LoadAcquiredData() 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).sess(1).runs(2).Load();
d = group.subjs(3).sess(1).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).sess(1).runs(2).Load();
dc = group.subjs(3).sess(1).runs(2).procStream.output.dc.GetDataTimeSeries('reshape');
t = group.subjs(3).sess(1).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).sess(1).runs(2).Load();
dcAvg = group.subjs(3).sess(1).runs(2). procStream.output.dcAvg.GetDataTimeSeries('reshape');
tHRF = group.subjs(3).sess(1).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();
**Example 1.
group.subjs(1).runs(1).sess(1).Load();
group.subjs(1).runs(1).sess(1).procStream.output.misc;
struct with fields:
mlActAuto: {[112×1 double]}
dcNew: [1×1 DataClass]
dcResid: [1×1 DataClass]
beta: {[21×2×56 double]}
R: {[56×3 double]}
hmrstats: [1×1 struct]
ADDITIONAL NOTE: 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.
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