Processing Phase (FD) data and Extracting data throughout proc stream
I have two questions which I thought I would put into one topic.
1. Firstly, does Homer3 process phase data collected from a frequency domain NIRS device? (In this case it is the ISS Imagent). I have seen that you can allocate the the phase datatype to
but was not sure if this variable was a dummy. If Homer3 doesn't, how does one programme function for Homer3. Is this something I would need to speak to Jay about?
2. Secondly, is it possible to extract the data out from Homer3 after each step in the processing stream. I.e Extract raw data after pre processing, then extract OD, then extract Concentration, then extract HRF.
If I understand correctly, the delta OD and delta concentration can be extracted POST processing via the groupResults.mat, but was wondering if you could edit anything to access the data during the processing stream.
The SNIRF file format does support phase data. But Homer does not have functions that operate on the phase data. You could easily enough add functions into Homer3 to process the phase data.
What type of analysis do you want to do on the phase data? I guess you just want to block average it or run it through the GLM the same way you would act on HbO and HbR? Let us know and we can point you to instructions on how to write your own functions. We haven't put these instructions on the wiki yet, but should get them there soon. There are instructions on the wiki for how to use the Homer3 functions in your own scripts that will give you an idea of how to write your own Homer3 functions. See the wiki page here.
Your second question is very much related to your first question. First, you have access to all of the intermediate output variables from each function in the groupResults.mat file. Just load groupResults.mat into matlab and look at the data structure. You can probably figure it out. But the wiki also provides guidance here. Further, if you write your own functions for Homer3, then you can pass these intermediate values to your functions to do processing on them. Just follow the examples of, for instance, hmrR_ODtoConc.m or any of the other hmrR functions that use outputs from earlier functions.
There is a README found at Homer3\FuncRegistry\UserFunctions that describes how to format the help text for a user function-- this will be helpful should you decide to write your own function.
Yes I would basically just want to do a standard processing pipeline with phase data in the same way I would for intensity data. So something similar to,
1. Prune channels
3. Bandpass filter OD
5. Block avg on CONC
With the current measurement set up, I don't think I have any channels short enough to perform a reasonable GLM SS regression for example.
Thank you for that David and Stephen.
I think I will have a go at making my own function, but firstly I will see if I can just output data from various functions so I can see how the data is handled at each step. Will keep you posted.
One QUESTION - are the functions written , assuming they are in a certain order in the processing stream. E.g Is it expected that the input to say OD2Conc will be OD data, or does the function literally process the numbers and doesn't care if the numbers make physical sense? And are the functions just called one at a time as defined in the processing stream?
This is the way I think about the processing stream:
The processing stream functions are called in order... the functions have input arguments and returned outputs which live in the MATLAB workspace as variables while the processing stream is executed.
These variables have canonical names and formats-- creating a table of these is an important piece of documentation we should have that I'm working on. Critically, these variables names are what ensure they are passed around correctly: dod for optical density, data for SNIRF data structure as specified here, mlActAuto and mlActMan to specify included channels, etc.
For instance, a function which takes dc as an argument will take the dc from the processing stream workspace... if there is no OD2Conc function in the stream before it, it will likely fail.
When processing is complete all these end up in groupResults.mat in the input and output of the procStream. Custom inputs and outputs will end up under "misc."