Introduction to fNIRS From Raw Intensity to Hemoglobin
Introduction to fNIRS
0% Completed

From Raw Intensity to Hemoglobin: The Essential Transformations

When an fNIRS recording ends, what you have is a set of light intensities: one time series for every channel and every wavelength, together with the times of the events in your task. Everything you will eventually report, from a hemoglobin time course to a group map of brain activation, is the result of a sequence of transformations applied to these intensities. Each transformation exists for a reason, each one rests on assumptions, and each one can change the data in ways that are not always obvious. Unit 5 is about understanding these steps: why they exist, what they can do to the data, and, just as importantly, what they cannot do.

There is no single correct way to process fNIRS data, and this unit will not teach you to use any particular software; a dedicated course on fNIRS processing will follow. Instead, we want you to be able to read a methods section, or design your own pipeline, and recognize what each choice implies. We start in this lesson with a map of a typical pipeline and with the transformations that every CW fNIRS analysis must perform: converting intensities to optical density and then to hemoglobin concentration changes. Much of the physics was covered in Unit 2, so here we focus on the decisions these steps involve and on the errors they can introduce.

1. A Map of the Processing Pipeline

Most fNIRS analyses, whatever software they use, combine a similar set of stages. The table lists them in the order in which they are commonly applied, together with the lesson in which we discuss each one. The details, and sometimes the order, vary between laboratories, and not every study uses every stage.

Stage What it does Usually applied to Lesson
Inspect and assess signal quality Identifies channels, periods, or participants with poor data Raw intensity 5.2
Convert to optical density Turns intensities into changes in attenuation relative to a reference Raw intensity 5.1
Detect and correct motion artifacts Finds and repairs (or removes) segments corrupted by movement Optical density 5.2
Filter Attenuates slow drifts and fast physiological oscillations Optical density or hemoglobin 5.3
Convert to hemoglobin Applies the modified Beer-Lambert law to obtain ΔHbO₂ and ΔHbR Optical density 5.1
Estimate the response Estimates the task response with a statistical model, such as the general linear model, that accounts for systemic physiology (short channels, auxiliary signals); block averages are used to inspect the data Hemoglobin 5.3
Group statistics Tests hypotheses across participants and corrects for multiple comparisons Individual response estimates 5.3
Image reconstruction Combines overlapping channels into images of the brain (high-density arrays) Optical density, hemoglobin, or response estimates 5.4
Connectivity and synchrony Relationships between regions, or between people, rather than responses to events Hemoglobin 5.5
Report and share Documents every choice and makes data and code available Everything above 5.6

Flowchart of a typical fNIRS processing pipeline, from raw intensity to group statistics, with image reconstruction and connectivity as alternative analyses and reporting spanning all steps

Figure 1. A typical fNIRS processing pipeline. Stages are colored by the lesson of this unit that discusses them. Diamonds mark nonlinear steps or decisions, whose order relative to other steps changes the result. Image reconstruction and connectivity analyses start from the same data as the task analysis, and reporting spans every step.

Two features of this map are worth noticing before we go further. The first is that the order of the lessons is not the order of the pipeline. We discuss the conversion to hemoglobin first because every analysis needs it and because it closes the loop with Unit 2, but in practice signal quality checks and motion correction usually come before the conversion, working on raw intensities or on optical density. One reason is that these steps benefit from having the two wavelengths separately, in the units the instrument actually measured, before any assumption about pathlength or extinction coefficients is made.

The second is that the order of the stages matters for some steps and not for others, and the distinction is mathematical. The conversion from optical density to hemoglobin is a linear operation (a fixed matrix multiplication for each channel), and so is a standard temporal filter. Linear operations can be swapped without changing the result: filtering the optical density and then converting gives exactly the same hemoglobin signals as converting and then filtering, provided the same filter is applied to both wavelengths. Other steps are nonlinear: the logarithm that produces optical density, decisions based on thresholds (removing a channel or a trial, flagging a motion artifact), and corrections whose behavior depends on the signal itself. For these, the order changes the result, and it should be chosen deliberately and reported.

2. Step One: From Intensity to Optical Density

The first transformation expresses each intensity time series as a change in optical density relative to a reference intensity, \(I_0\):

💡 The Conversion Chain

$$\Delta OD(\lambda, t) = -\log_{10}\left(\frac{I(\lambda, t)}{I_0(\lambda)}\right)$$

$$\begin{pmatrix} \Delta HbO_2(t) \\ \Delta HbR(t) \end{pmatrix} = \frac{1}{d} \begin{pmatrix} \epsilon_{HbO_2}(\lambda_1)\,DPF(\lambda_1) & \epsilon_{HbR}(\lambda_1)\,DPF(\lambda_1) \\ \epsilon_{HbO_2}(\lambda_2)\,DPF(\lambda_2) & \epsilon_{HbR}(\lambda_2)\,DPF(\lambda_2) \end{pmatrix}^{-1} \begin{pmatrix} \Delta OD(\lambda_1, t) \\ \Delta OD(\lambda_2, t) \end{pmatrix}$$

The first step needs only a choice of reference intensity \(I_0\). The second needs the source-detector distance \(d\), the extinction coefficients \(\epsilon\) at the wavelengths actually used, and a pathlength factor for each wavelength. These are the inputs this lesson is about.

The logarithm is what makes the rest of the analysis possible. As we saw in Lesson 2.2, the detected intensity is the product of many factors, including the source power, the coupling of each optode to the skin, the scattering of the tissue, and the absorption we care about. The logarithm turns these products into sums, so that the factors that do not change during the recording become constant offsets that disappear when we look at changes relative to \(I_0\). This is why CW fNIRS can measure changes in absorption without knowing the coupling losses or the scattering of each channel.

The choice of \(I_0\) is the first decision of the pipeline. The most common choice is the mean intensity of the whole recording; another is the mean of a resting baseline at the start of the session or before each trial. For changes during a task, the choice matters less than it may seem, because it only shifts the zero of the optical density, and any later baseline correction or statistical model with a constant term removes such offsets. It matters more when the signal drifts strongly over the session, or when a large motion artifact changes the coupling of an optode: in those cases, the mean of the recording is no longer a good description of any part of it, which is one reason why motion correction usually works on optical density segment by segment (Lesson 5.2).

The logarithm also exposes problems in the raw data. An intensity that is zero, negative (which can happen after subtraction of the background light), or saturated at the maximum of the detector has no meaningful logarithm, and software will either fail or produce extreme values. These are not numerical curiosities to be patched; they are signs of a channel with no usable light or with too much of it, and they belong to the quality checks of Lesson 5.2.

3. Step Two: Choosing the Pathlength

To convert optical density into concentration, the modified Beer-Lambert law needs the distance the light actually traveled through the tissue, written as the source-detector distance \(d\) multiplied by the differential pathlength factor (DPF). As we saw in Lesson 2.2, the DPF of the human head typically lies between 4 and 8, depending on wavelength, tissue, and age, and a CW instrument cannot measure it. Every CW analysis therefore has to make a choice, and the options differ in what they assume and in what they allow you to conclude.

Choice What it assumes What to keep in mind
A fixed DPF (for example, 6) for all wavelengths and participants That the pathlength is the same for everyone and at every wavelength Simple and common; ignores the wavelength dependence, which affects crosstalk, and the age dependence, which affects group comparisons
A DPF that depends on wavelength and age That your participants resemble the population in which the values were measured (often the forehead of healthy participants) Usually better than a fixed value (Duncan et al., 1996; Scholkmann & Wolf, 2013); still an estimate for each individual and head region
A DPF measured in each participant Access to an FD or TD measurement (Lesson 4.3) The most accurate option for the whole tissue; it still does not tell you how much of the path lies in the brain
No pathlength correction (DPF set to 1) Nothing about the pathlength Results are in units of concentration times length (for example, µM·cm); honest about what is unknown, but harder to compare with studies that used a DPF
A partial pathlength factor (PPF) An estimate, usually from simulations, of the part of the path that lies in the brain Gives larger, brain-specific changes (Lesson 2.5); values depend strongly on the model and are not comparable with DPF-based results

The consequences of this choice are easy to work out, because the estimated concentration change is inversely proportional to the assumed pathlength. If you assume a DPF of 6 and the true value is 5, every concentration change is underestimated by about 17%; if the true value is 7, it is overestimated by about 17%. When the same error applies to every channel and every participant, it changes the units of your results but not the pattern of activation or the statistics of a within-subject comparison. It becomes a real problem in two situations. The first is a comparison between groups whose DPF differs, such as children and adults, where a single assumed value can create, hide, or reverse a group difference in amplitude. The second is an error that differs between the two wavelengths, which, as we saw in Lesson 2.3, leaks part of the change in one chromophore into the other (crosstalk).

No choice of DPF solves the deeper limitation discussed in Lessons 2.2 and 2.5: the modified Beer-Lambert law spreads a focal change in the cortex over the whole volume sampled by the light, most of which is not activated, so the concentration changes it reports are diluted by the partial volume effect. A correct DPF gives you the correct average change along the path, not the change in the active cortex. For this reason, the amplitudes of fNIRS responses are best compared within a study, under the same assumptions, rather than taken as absolute physiological quantities.

💭 Pause and Think

A study compares the prefrontal response of 7-year-old children with that of adults during the same task, using a DPF of 6 for everyone. The children show smaller ΔHbO₂ responses. Could the choice of DPF contribute to this difference, and in which direction?

Recall how the DPF changes with age (Lesson 2.2) and how the estimated change depends on the assumed DPF. Then think about the other age-related factors from Lesson 4.2, such as the distance from the scalp to the brain, and about what you would report to let readers judge the comparison.

4. Step Three: Extinction Coefficients, Wavelengths, and Distances

The other inputs of the conversion look like fixed constants, but each of them hides a decision. The extinction coefficients of HbO₂ and HbR come from tables measured in the laboratory, most often the compilation by Prahl (1999) that we used in Unit 2. Software packages include these tables, sometimes in slightly different versions, and look up the values at the wavelengths you specify. The values must correspond to the wavelengths your instrument actually emits, which are not always the nominal ones printed in its documentation, and for LED sources the appropriate value is an average weighted by the emission spectrum (Lesson 4.1). Because the HbR spectrum is steep below 800 nm, a difference of a few nanometers can change the coefficients appreciably and, through the inversion, mix the two chromophores. When an instrument reports its actual wavelengths for each source, use them.

The source-detector distance \(d\) enters the conversion directly, so an error in it scales the result just like an error in the DPF. Most analyses use the nominal distance of the probe design, but on a curved head, with flexible caps, the real distance can differ from the nominal one by several millimeters. A channel designed for 3 cm that ends up at 2.6 cm will have its concentration changes underestimated by about 13% if the nominal value is used. When optode positions are digitized (Lesson 4.2), the measured distances can and should be used. Short-separation channels are especially sensitive to this, since an error of 2 mm is a quarter of an 8 mm distance.

Systems with more than two wavelengths solve the same equations by least squares, which averages out some of the noise and makes the result less sensitive to an error at any single wavelength (Lesson 2.3). Once ΔHbO₂ and ΔHbR are available, other quantities follow by simple arithmetic, most commonly the change in total hemoglobin, ΔHbT = ΔHbO₂ + ΔHbR. With a single distance and a CW instrument, however, no transformation can produce absolute concentrations or tissue oxygen saturation; those require the additional information discussed in Lesson 4.3.

⚠ A Common Mistake to Avoid

The conversion combines quantities from different sources, and their conventions must match. Optical density can be computed with the base-10 or the natural logarithm, and extinction coefficients are tabulated for one or the other (Lesson 2.2): mixing them changes every result by a factor of 2.303. Extinction coefficients may be given per centimeter or per millimeter, and concentrations in molar, millimolar, or micromolar units, so a mismatch can introduce factors of 10 or 1,000.

None of these errors produces an error message. The data look perfectly reasonable, only scaled. Check the conventions of your software once, check that the wavelengths and distances it uses are those of your instrument and probe, and report all of them.

5. Housekeeping: Timing, Trimming, and Resampling

A few less glamorous steps happen at the start of almost every pipeline, and they deserve as much care as the conversion itself. The first is checking the event markers. Every later estimate of the response is computed relative to the times at which stimuli were presented, so markers that are missing, duplicated, or shifted by a constant delay propagate into every result. A delay of half a second is invisible in a raw recording but biases the estimated timing of the response, and it can differ between systems and between wired and wireless setups (Lesson 4.1). Comparing the number and spacing of the markers with the design of the task, and measuring the delay of the marking system once, are simple safeguards.

The second is trimming the recording: removing periods before the task started or after it ended, or the first minutes in which the instrument and the participant were still settling (Lesson 4.1). Trimming is harmless when it removes data that were never part of the analysis, but it changes the mean intensity of the recording, and therefore the reference \(I_0\), so it should be done before the conversion to optical density and applied in the same way to every participant.

The third is resampling. Data recorded at high sampling rates are sometimes reduced to a lower rate to save memory and computing time, which is reasonable because the hemodynamic response is slow. But reducing the sampling rate is subject to the same rule we met in Lesson 4.1: any oscillation faster than half the new sampling rate will fold into lower frequencies. Downsampling must therefore be preceded by a low-pass filter that removes those oscillations, a step that good software performs automatically and that simply keeping every n-th sample does not.

💭 Pause and Think

To make files smaller, a colleague reduces recordings from 25 Hz to 2 Hz by keeping every twelfth or thirteenth sample, arguing that the hemodynamic response is far slower than 1 Hz anyway. The participants are adults with heart rates around 1.2 Hz. What will happen to the cardiac oscillation, and where might it appear in the downsampled data?

Use the aliasing rule from Lesson 4.1: with a sampling rate of 2 Hz, frequencies above 1 Hz fold back below it. Then think about how the folded oscillation could interact with the frequencies of the task and of Mayer waves (Lesson 4.2).

6. What These Steps Can and Cannot Do

It helps to be clear about what the transformations in this lesson achieve. They put the data into physically meaningful units, remove the unknown but constant factors that make raw intensities impossible to compare, and separate the contributions of the two chromophores. They do not remove noise, motion artifacts, or systemic physiology: a heartbeat, a Mayer wave, or a movement in the raw intensity will still be present, now expressed as a change in hemoglobin. Those are the subjects of the next two lessons.

The errors these steps can introduce are also of a particular kind. An incorrect DPF, a wrong wavelength, or a mismatched unit does not add random noise that averages out over trials or participants; it adds a systematic error that is the same every time. Collecting more data does not reduce it, and when it differs between groups or conditions, it can create effects that look real. The protection is not statistical but procedural: make the choices deliberately, apply them consistently, keep the raw data so that the analysis can be repeated with different choices, and report them in enough detail for others to understand and reproduce what you did (Lesson 5.6).

🔬 Going Deeper: Why Not Analyze Optical Density Directly?

Since the conversion to hemoglobin is linear, any linear analysis, such as a general linear model, gives equivalent results whether it is applied to optical density or to hemoglobin, as long as the conversion is carried along consistently. Some pipelines therefore keep the data in optical density for as long as possible, or even estimate the response at each wavelength and convert only the final estimates. The physiological interpretation, however, is in terms of HbO₂ and HbR (Unit 3), and the two chromophores respond differently to brain activity and to systemic physiology (Lesson 3.5). Converting before interpreting is therefore essential, even when the computation itself could stay in optical density.


📌 Key Takeaways

  • A typical pipeline goes from raw intensity to quality checks, optical density, motion correction, filtering, hemoglobin, response estimation, and group statistics. The order of the lessons is not the order of the pipeline.
  • Linear steps (the conversion to hemoglobin, standard filters) can be swapped without changing the result; nonlinear steps (the logarithm, thresholds, signal-dependent corrections) cannot, so their order must be chosen and reported.
  • The logarithm turns constant multiplicative factors, such as optode coupling, into offsets that cancel in changes. Zero, negative, or saturated intensities signal bad channels, not numerical problems.
  • The pathlength must be assumed in CW analysis. Concentration changes scale inversely with the assumed DPF; errors matter most when they differ between groups or between wavelengths. No DPF removes the partial volume effect.
  • Use the actual wavelengths and distances of your instrument and probe, and check that logarithm conventions and units match. Such errors are silent.
  • Check event markers, trim consistently, and low-pass filter before downsampling. These transformations set units and scale; they do not remove noise, and their errors are systematic, so they do not average out.

📚 Further Reading & Key References

  1. Delpy, D.T., Cope, M., van der Zee, P., Arridge, S., Wray, S. & Wyatt, J. (1988). “Estimation of optical pathlength through tissue from direct time of flight measurement.” Physics in Medicine and Biology, 33(12), 1433–1442. [doi] — The origin of the differential pathlength factor used in every CW conversion.
  2. Duncan, A., Meek, J.H., Clemence, M., Elwell, C.E., Fallon, P., Tyszczuk, L., Cope, M. & Delpy, D.T. (1996). “Measurement of cranial optical path length as a function of age using phase resolved near infrared spectroscopy.” Pediatric Research, 39(5), 889–894. [doi] — Age-dependent DPF values measured in 283 participants.
  3. Scholkmann, F. & Wolf, M. (2013). “General equation for the differential pathlength factor of the frontal human head depending on wavelength and age.” Journal of Biomedical Optics, 18(10), 105004. [doi] — A formula for the DPF as a function of wavelength and age.
  4. Prahl, S.A. (1999). Tabulated molar extinction coefficients for hemoglobin in water. Oregon Medical Laser Center. [omlc.org/spectra/hemoglobin] — The extinction coefficients used by most fNIRS software; check which version and units your software uses.

Society for Functional Near-Infrared Spectroscopy.
Content is for educational purposes.