Basic fNIRS Data Analysis with Homer€¦ · Basic fNIRS Data Analysis with Homer Neurophotonics...
Transcript of Basic fNIRS Data Analysis with Homer€¦ · Basic fNIRS Data Analysis with Homer Neurophotonics...
Basic fNIRS Data Analysis
with Homer
Neurophotonics Center, Boston University fNIRS Workshop, November 7-9, 2018
Prepared by Juliette Selb
Outline
◊ More advanced processing
◊ Basic processing :
◊ Homer file formats
◊ Other useful Homer functions◊ Exporting results
◊ Plot probe◊ Group analysis
◊ Intensity to hemoglobin concentrations◊ Filtering◊ Block-averaging
File formats
Probe source-detector geometry : .sd files
fNIRS experimental data : .nirs files
Data processing stream : .cfg files
Processed data files : groupResults.mat
.SD file format
Lambda Wavelengths used for data acquisition 1 × nWavelengths [690 830]
nSrcs Number of sources 1 × 1 1
nDets Number of detectors 1 × 1 2
SrcPos Array of source coordinates nSrcs × 3 [ 0 0 0]
DetPos Array of detector coordinates nDets × 3 [30 0 0;0 30 0]
MeasList List of measurement channels nChannels × 4 [1 1 1 1;1 2 1 1;1 1 1 2;1 2 1 2]
Note: The SD structure is also incorporated in the .nirs file format we will see in a few slides
Describes the 2D source/detector geometry
Field Definition Size Example
column 1 column 2 column 3 column 4 source idx detector idx unused wavelength idx
Matlab .sd file containing the structured variable SD with the following fields:
.SD file format: the SDgui
Sub-GUI of AtlasViewer
Enables you to create your own .sd files
6
Start AtlasViewer
Go to Tools > Make Probe → it starts the SDgui
.SD file format: the SDgui
7
.SD file format: the SDgui
We will go over this in
detail on Day 3.
.NIRS file format
Structured variable
NTime_points × 1
NTime_points × NChannels
NTime_points × NConditions
NTime_points × NAux channels
Contains an fNIRS dataset
Field Definition Size
Matlab .nirs file containing the following variables:
SD Probe geometry, same as .sd files
t Array of data time points
d Array of raw intensity time course
s Array of stimulus onsets. Different conditions are a way to separate stimuli into different groups
aux Array of auxiliary signals
Note 1: In addition to the above parameters, additional parameters can appear in the .nirs file as a result of processing the data set in Homer2.
Note 2: Conversion scripts are available for some other data formats (Hitachi, NIRx, Shimadzu, …), see http://homer-fnirs.org/faq/
.CFG file format
Note: in options, you can
hover over each function to get
help on the function and the
parameters
A .cfg file describes the steps of data analysis, a sequence of Homer2 functions
Intensity to ΔOD
ΔOD to Concentration
Block- average
ΔOD
Concentration
Hemodynamic response function
(HRF)
Intensity
Band-pass filter
Identify MAs
Prune data
Remove / Correct MAs
Regress short SD
GLM
Ignore segments
Simplest processing stream: Multiple more advanced functions we can incorporate in the stream:
Let’s create a processing stream.
• Launch HOMER2
• Option 1: Executable version: Run HOMER2.exe
• Option 2: MATLAB version: Run MATLAB, run “setpaths”
function and then call EasyNIRS (or Homer_UI) from
command window.
• Hit cancel when it asks you to load process options
file
• Go to File
• Change Directory to following folder:
\fNIRS_COURSE_2018\EXERCISES\Ex1_Basic_data_analysis\1-basic-steps
.CFG file format: the Process Stream GUI
The Process Stream GUI enables you to create your own .cfg files
Go to Tools > Process Stream GUI → it starts procStreamGUI
.CFG file format
The list of functions to choose from
InputsOutputs Function Name
The processing stream you’re creating
InputsOutputs Function Name
The help information for the
selected function
Add, remove, and move functions in the stream
.CFG file format
1 2
Intensity to ΔOD
ΔOD
Intensity
.CFG file format
Add:• hmrIntensity2OD• hmrBandpassFilt• hmrOD2Conc• hmrBlockAvg
Intensity to ΔOD
ΔOD to Concentration
Block-average
ΔOD
Concentration
Hemodynamic response
function (HRF)
Intensity
Band-pass filter
ΔOD, filtered
.CFG file format
1
2
.CFG file format
Give a name to your new processing stream
and save
.CFG file format
You can change your current processing stream in Homer2File > Load Process Options (*.cfg)
.CFG file format
1
2
.CFG file format
Click on ‘Options’
This will open the ProcessOptwindow, where you can modify the parameters of each function
Let’s analyze some fNIRS data: Homer2_UI
When opening Homer2, you need to select:• The dataset(s): a folder containing at least one .nirs file• The data processing stream: a .cfg file. If you hit ‘Cancel’, a default process stream will load.
• Start Homer2• When prompted to select a .nirs folder, navigate to and select folder
• When prompted to select a .cfg file, select my_simple_processing.cfg file we just created.
Note: If you’re already in Homer2 and need to change the .nirs directory or the .cfg file:• Go to File > Change Directory, and select your nirs folder• Go to File > Load Process Options (*.cfg) and select your .cfg file
\fNIRS_COURSE_2018\EXERCISES\Ex1_Basic_data_analysis\1-basic-steps
\fNIRS_COURSE_2018\EXERCISES\Ex1_Basic_data_analysis\1-basic-steps\my_simple_processing.cfg
Homer2_UI
Source / detector geometry
Data time series
.nirs files in your folder
Modify options and run processing stream
Display options
What data type to display
Displaying the raw fNIRS data
Click next to the source
Displaying the raw fNIRS data
Right click on a channel will remove it from the display.
Displaying the raw fNIRS data
Left click on a channel will remove it from the analysis.
Click again to return back.
Displaying the raw fNIRS data
Select wavelength to display
Zooming in
Zoom in
Zooming in
Modifying the processing stream options
1 - Open the processing options
2 - Set hpf (high-pass filter) and lpf (low-pass filter) to 0, i.e. no filtering
Running the processing stream
hpf and lpfare set to 0
Select Run
Zoom reset
Intensity to ΔOD
Select OD
ΔOD to Hb concentrations
Select Conc
ΔOD to Hb concentrations
Choose HbO/HbR/HbT to display.Use Control or Shift to show more than one.
Band-pass filtering
Showing HbO
x-range fixed
Band-pass filtering
hpf = 0.00lpf = 0.5
Select Run
Band-pass filtering
hpf = 0.00lpf = 0.5
unchecked
Band-pass filtering
hpf = 0.01lpf = 0.5
Select Run
Band-pass filtering
hpf = 0.1lpf = 0.5
Select Run
Go back to hpf = 0.01 and re-run
hpf = 0.01lpf = 0.5
Select Run
This dataset doesn’t have stimulus onsets, we will enter them manually.
Go to Tools > StimGUI
StimGUI
You can add one or multiple stimulus marks.
StimGUI
StimGUI
StimGUI: delete the stim mark
(1) Select stim mark by mouse.
(2) Delete
StimGUI
You can create stim marks using the auxiliary signals
StimGUI
(1) 22:25:347(stim marks every 25 seconds starting at t = 22s)
(3) Save
(2) Select 1
Stimulus onsets
Back to the Homer2_UI main window, the stim marks are visible.
Stimulus onsets: rejecting stim marks
(2) Select ‘Stim Reject’
(3) Drag a box around the stim mark to edit
(1) Go back to raw data
Stimulus onsets: rejecting stim marks
Stimulus onsets: rejecting stim marks
Stim mark now appears as dotted line (toggled off)
Stimulus onsets: rejecting stim marks
Let’s say we want to remove these two stimulus onsets from the block-average
Displaying the HRF
(2) Show Run HRF
(1) Run
Displaying the HRF (shift + left click)
Display both HbO and HbR
Exporting results
(2) Right-click on a time trace.
(1) Should be unchecked.
Display options: waterfall
Waterfall display of channels
Visualize all HRFs: the Plot Probe feature
(2) Check ‘Plot Probe’
(1) Back to zero
Visualize all HRFs: the Plot Probe feature
Show time markers
Other useful Homer processing functions
See ‘Motion artifacts’ lecture
See ‘GLM and short separation regression’ lecture
Group average: data structure
SubjectName1_run01.nirs SubjectName1_run02.nirs . . . . . . . . . . . . . SubjectName1_runn1.nirs
SubjectName2_run01.nirs SubjectName2_run02.nirs . . . . . . . . . . . . . SubjectName2_runn2.nirs
. . . . . . . . . . . . .
SubjectNamem_run01.nirs SubjectNamem_run02.nirs . . . . . . . . . . . . . SubjectNamem_runnm.nirs
Any directory that contains one or more files with the .nirs extension is considered by Homer2_UI to be a group, organized into sub-groups called sessions (or subjects).
You can compute the HRF:
• at the run level
• at the session (or subject) level
• at the group level
Data processed in Homer2_UI is saved automatically to disk: • Run data is saved in the corresponding .nirs file• Subject and group processing results are saved to
groupResults.mat
To go back to the state before any processing was done to the dataset, go to File > Reset File
Group average: exampleFile > Change directory to:
\fNIRS_COURSE_2018\EXERCISES\Ex1_Basic_data_analysis\2-group-averaging
Group average: exampleFile > Load Process Options (*.cfg)
Choose your processing stream *.cfg
Group average: example
Folder structure
Group average: example
(3) You can run the analysis at the run level, session level, or group level
(1) Choose a specific run
(2) Click on the display to visualize signal
Group average: example
Compute Run HRF
Group average: example
Compute Session (Subject) HRF
Group average: example
Compute Group HRF
Group average: example
Note: All subjects can also be in the same folder, provided they have the proper name nomenclature
Group average: example
We will get back to this dataset tomorrow and perform more advanced data analysis.