Open access peer-reviewed chapter

Low Cost Open-Source OCT Using Undergraduate Lab Components

Written By

Hari Nandakumar and Shailesh Srivastava

Submitted: January 29th, 2019 Reviewed: June 13th, 2019 Published: May 27th, 2020

DOI: 10.5772/intechopen.88031

Chapter metrics overview

812 Chapter Downloads

View Full Metrics


Instrument cost is one of the factors limiting the adoption of optical coherence tomography (OCT) from a wider range of applications. We present a couple of OCT devices using optical components which are commonly found in undergraduate-level optics laboratories. These low-cost devices have lower signal-to-noise ratios (SNR) than top-of-the-line commercial offerings, yet can serve most of the needs of academic laboratories. A time-domain full-field (TD-FF-) OCT device has been assembled with Arduino control, which yields sub-4-μm axial and lateral resolutions. This device is useful where quick sample acquisition is not critical, but high resolution is paramount, for example with samples from material-science, or ex-vivo stabilized biological samples. Next, we discuss a spectral-domain (SD-) OCT device which delivers real-time video rate B-scans. This device is useful where real-time signal acquisition is desirable, for example with in-vivo biological samples. Cross-platform open-source software control for both these devices is also made available.


  • full-field optical coherence tomography
  • spectral-domain OCT
  • low-cost
  • open-source
  • CMOS camera

1. Introduction

Non-clinical uses of optical coherence tomography (OCT) has mainly been in industrial scale non-destructive materials testing, and for the study of invaluable historical artifacts [1]. Purchase costs of commonly available commercial OCT devices remained above five figures in US dollars till recently [2]. The lowest priced OCT device available for purchase is, as of 2019, the OQ Labscope from Lumedica, at US$9995 [3, 4]. The cost of the instrument makes it inaccessible to undergraduate students, especially in developing countries. In this chapter, we present a couple of schemes developed in our lab, utilizing commonly available optics lab components to construct capable OCT instruments—in time-domain (TD-OCT) and spectral-domain (SD-OCT) configurations. Such instruments could then be used to study a wide variety of biological and inorganic samples, by choosing an illumination wavelength in which the sample is relatively transparent or translucent.


2. Full-field TD-OCT

2.1 Motivation

Full-field optical coherence tomography (FF-OCT) or optical coherence microscopy (OCM) is commonly constructed in a Linnik or Michelson interferometer configuration—that is, with or without microscope objectives—as shown in Figure 1. FF-OCT employs a 2-D image sensor like a CCD or CMOS camera as the detector, and en-face images of the sample are acquired at different depths by coherence gating. High axial and lateral resolutions are possible with FF-OCT. High-speed cameras also allow FF-OCT to be employed with swept-sources. But FF-OCT can also be implemented [5] using existing lab components with a minimum of parts being purchased. This approach assumes static samples, since the acquisition time for an OCT volume can take a few minutes.

Figure 1.

(a) Schematic of an FF-OCT system with microscope objectives and (b) image of our set-up without microscope objectives. Labeled components are: 1, LED; 2, sample; 3, lens; 4, aperture; 5, cube beam splitter; 6, front surface of a prism as reference mirror; 7, lens; 8, translation stage actuated by stepper motor; 9, camera.

The use of FF-OCT in the time-domain configuration avoids specialized and potentially expensive components such as galvanometer or MEMS micromirror scanners, swept-sources and even superluminescent diode (SLED) or halogen or supercontinuum sources. Simple LEDs provide sufficient illumination for sub-10-μm imaging. Such a system has the potential to create high resolution 3D tomograms at very low cost. The system schematic and an illustrative photograph are shown in Figure 1.

2.2 Choosing the right components

2.2.1 Source and detector

The axial resolution of the FF-OCT device directly depends on the choice of light source used, since axial resolution [1] is given by


where λ is the center wavelength of the source and Δλ is the full width at half maximum (FWHM) bandwidth of the source spectrum. Additionally, the detector or camera sensor should also have adequate sensitivity over the source spectrum. If the source spectrum is broader than the camera’s sensitive region, only the part of the source spectrum convolved with the camera’s spectral sensitivity would be the relevant source bandwidth in the Eq. 1 for axial resolution. Thus, if a standard RGB CMOS or CCD camera is used, only the individual red, green or blue sensor bandwidth would be relevant. Hence, it is advisable to use a monochrome camera if sub-micron axial resolutions are desired. Additionally, consumer-grade cameras almost invariably have IR filters attached to their sensors. These filters will severely limit the use of such cameras with near-IR sources.

Now for some real-world numbers relating to center wavelengths, spectral bandwidths and achievable axial resolutions. The source spectrum of a white LED is shown in Figure 2. Though this spectrum is far from the Gaussian spectral shape assumed in Eq. 1, we can assume a spectrum of 200 nm bandwidth centered at 540 nm based on the full-width at half-maximum (FWHM) from the weighted center of the spectrum. With such a source, Eq. 1 would let us have a best-case axial resolution of 0.64 μm if a monochrome camera is used. A digital SLR camera, Canon 1100D, used as the detector for a white LED source resulted [5] in sub-4 μm axial resolutions, due to the convolution of the source spectrum with the RGB sensors’ sensitivity discussed above. In this case, the R data alone was used, thus filtering out the G and B parts of the spectrum and reducing the available source bandwidth. Dispersion compensation is also critically important when broad spectrum sources are used. We discuss dispersion compensation in more detail in Section 2.3. The spectrum of a red LED is shown in Figure 2. Using its FWHM of 20 nm and center wavelength of 670 nm, Eq. 1 yields an axial resolution of 9.90 μm. This is quite adequate for many purposes. A camera without an IR filter, like the monochrome CMOS planetary imager (QHY5L-II M) shown in Figure 3, enables the use of near-IR sources. Longer wavelengths like near-IR have greater penetration depths in biological samples which exhibit strong Rayleigh scattering. IR LEDs are commonly available with center wavelengths of 850 nm and FWHM of 25 nm, which can give us an axial resolution of 12.8 μm.

Figure 2.

Source spectra of LEDs obtained using an Ocean Optics USB 4000 spectrometer: white LED in blue, red LED in red.

Figure 3.

An example of a low-cost monochrome CMOS camera: QHY5L-II M.

2.2.2 Optical components

Uncoated components can be used in the experimental setup for lowering cost. Optical losses due to component reflections would need to be compensated by increasing exposure time at the camera. A cube beam splitter is used in order to avoid dispersion mismatch between the interferometer arms. In case a plate beam splitter is used, dispersion compensation should be done by the insertion of a glass plate of similar thickness in the shorter arm as explained in Section 2.3. The lateral resolution of the system directly depends on the quality of the lenses used. The expression for the lateral resolution of an OCT system [1] is similar to that of a microscope,


where f and D are the focal length and aperture size of the objective lens. Commonly available microscope objective lenses are listed in terms of magnification available for a standard length microscope, like 10×. A typical 10× objective like the Newport M-10× [6] has a focal length of 16.5 mm and a clear aperture of 7.5 mm. Theoretically, this should yield an axial resolution of 1.56 μm. Experimentally, imaging with uncoated lab lenses uncorrected for aberrations, resolution below 4 μm [5] was obtained.

2.2.3 Automated signal acquisition and processing

Standard single axis translation stages like the TS-35 from Holmarc can be converted to micro-stepping operation using 3D-printed stepper motor coupling shafts which are commonly available online. Driving stepper motors with microstepping drivers like the Bholanath BH MSD 2A enable sub-micron translations. The microstepping driver just needs a TTL signal to initiate the microstep. This can be automated using microcontroller platforms like Arduino. TTL outputs can also be generated by PCs using serial or parallel ports. The sample is attached to the translation stage and moved axially through the microscope objective’s focus which should coincide with the zero-path-difference point. Simple automation scripts can then be written to acquire images and translate the sample in the axial direction. We have open-sourced Arduino and OpenCV-based code [7] to acquire and process FF-OCT volumes using the camera SDK from QHYCCD. This code can be easily modified to work with SDKs and cameras from other manufacturers, or even with simple webcams. A screenshot of this software is shown in Figure 4.

Figure 4.

Screenshot of open-source software for acquiring FF-OCT images.

2.3 Experimental method

The first hurdle in assembling a low-coherence interferometer is accurate estimation of the zero-path-difference point in the two interferometer arms. Our method to do this was as follows. We first verify interferometer alignment by observing coarse interference fringes using visible laser illumination, making sure the fringes remain similar in shape when the moving arm is translated. Next, we translate the moving arm 10 μm at a time under narrow-spectrum LED illumination, monitoring the camera output continuously until interference fringes are visible. Once the zero-path-difference point is identified, the illumination can be changed to wide-spectrum white LEDs or halogen if desired. If the sample is being imaged through a medium, for example if the sample is being used with an oil-immersion objective lens, high axial resolutions with broad-spectrum sources are possible only with dispersion correction. This can be done experimentally by introducing glass plates or cover slips of varying thickness to minimize the axial displacement over which fringes appear for a particular reflective layer.

Many inexpensive camera sensors including mobile phone cameras now allow saving of images in RAW format. Saving in RAW format allows the export of images with a gamma of 1.0, i.e., having a linear detector response to incident optical power. Software like DCRAW can then be used to convert the RAW images to linear TIFF [8, 9] or other image formats. Acquisition of RAW images is not mandatory. If a simple webcam is used as the detector, its output may not be linear with optical power, but interference fringes would still be visible. Such images also could be used to create tomograms, with the rider that the intensities of the reflectors may not be accurately portrayed. Qualitative imaging can still be done, and feature positions would not be affected by the nonlinear camera response.

Post-processing of the images involves subtracting the background DC and taking the Hilbert transform [1] of the images (perpendicular to the fringe lines). The resulting en-face tomographic images can either be volume rendered using free software like Blender [10, 11] or Octave [12], or displayed as single slices in movies and so on. Some examples of tomograms rendered with Blender and Octave are shown in Figure 5. Lateral calibration, pixels per micron, can be done by imaging known samples like USAF targets. Axial calibration directly results from the known motion of the micro-stepping translation stage. The distances we measure with OCT are optical path lengths—actual distances inside samples would be the optical path length divided by the sample refractive index.

Figure 5.

Tomograms: (a) microchannels in PDMS rendered in blender. (b) Profile of numeral 2 on a coin, plotted in octave.


3. Parallel SD-OCT

3.1 Motivation

Signal-to-noise ratio (SNR) of Fourier-domain optical coherence tomography (FD-OCT) can be higher by several orders of magnitude compared to time-domain optical coherence tomography (TD-OCT) [13]. This motivates us to devise a way to use the components we have used for FF-OCT in an FD-OCT configuration. FD-OCT can be implemented either with swept-sources (SS-OCT) or using spectrometers as spectral-domain OCT (SD-OCT). Swept-sources are expensive, so we do not attempt to assemble a Swept-Source OCT (SS-OCT) device. Instead, we explore a way to use the two-dimensional camera sensor in a parallel spectrometer design. The schematic of a parallel FD-OCT [14, 15] setup, also known as line-field OCT [16, 17] is shown in Figure 6. Such a configuration captures data for a complete B-scan in a single frame captured by the camera. Even a low-cost CMOS camera which can do 200 fps for 320 × 240 frames would then enable an FD-OCT system with a respectable 48,000 A-scans per second.

Figure 6.

(a) Schematic of a parallel FD-OCT system (b) our set-up. Labeled components are: 1, collimated SLED source; 2, steering mirror; 3, cylindrical lens; 4, cube beam splitter; 5, plane surface of NDF as sample; 6, reference mirror; 7, collimating lens; 8, steering mirror; 9, grating; 10, imaging lens; 11, camera.

3.2 Specialized components needed

The parallel OCT configuration manages to avoid scanning mirrors, but an SLED source would be needed to focus the line illumination on the sample below a thickness of 100 μm. The extended nature of common LED sources prevent them from being tightly focused in this manner. The $300 SLED (Superlum SLD-340-MP-TO56) and a short focal length aspheric lens for collimation are hence necessary purchases. Care needs to be taken to avoid back-reflections, which can cause damage to SLEDs. The collimating lens should therefore have an anti-reflection coating at the SLED’s wavelength range. A diffraction grating or other dispersive element would also be needed.

Here, we would like to point out that SLEDs need greater care in handling than LEDs. Not only are they static-sensitive, they also degrade if overheated or overdriven. Many varieties of free-space SLEDs are also highly sensitive to back-reflections, which can even cause irreversible damage when operated at high powers. Common laboratory power supplies tend to produce large spikes when they are powered on or off, and if an SLED is being driven by such a power supply, it will undergo irreversible damage, reducing its power output. Dedicated driver modules, or laser diode drivers, are the preferred sources to drive SLEDs. The minimum precautions needed would be to employ good heat-sinking, drive at only 50% of rated power, and isolate the SLEDs from power supply spikes using extra switches.

Unlike the TD-OCT case, linear detector response is important for FD-OCT. The noise-floor of the final B-scan also depends on the SNR of the camera. Hence, the camera needs to be chosen with some care, and needs to have gamma, gain and exposure-time controls at the very minimum. We have shown [18] that with simple observations, we can estimate the noise level CMOS cameras. Sensors exhibiting low-noise characteristics along with a high dynamic range are preferable, but useful work can still be done if the camera’s SNR is only 40 dB, as with 8-bit cameras which have a dynamic range of only 48 dB. Averaging helps to reduce noise, with the statistical noise reduction of N for N averages.

3.3 Experimental method

3.3.1 General setup

The cylindrical lens used in the parallel FD-OCT system illuminates a line on the sample (and the reference arm). The spectrum of this line is dispersed by the grating onto the 2D camera sensor. In our implementation, the line is along the vertical axis of the sensor, and the spectrum is thus obtained along each horizontal line of pixels of the camera. Though the post-processing of the captured data is more involved, the practical setting up the FD-OCT assembly is much easier than in the TD-OCT case, since finding the zero-path-difference point is not critically important. Focused width of the line illumination can be measured by imaging the line on the camera. The grating equation points to the angle at which the imaging lens and camera assembly needs to be set up. Once the spectrum is obtained on the camera, the standard FD-OCT post-processing yields a B-scan from each frame.

3.3.2 Spectrometer calibration

In Section 3.4, we discuss the details of the data processing needed to create B-scans from the interograms obtained with the FD-OCT assembly. The required input for the data processing is the calibrated spectrogram, i.e., intensity as a function of wavelength or wavenumber. For this, we need to calibrate the spectrometer consisting of the dispersive element (grating), focusing optics and camera. Since our grating produces a spectrum which is linear in wavelength, we just need to find the bandwidth of the spectrometer for its calibration. This is because we align the camera to have the spectrum centered around the known center wavelength of the source. We used a simple iterative calibration procedure which was easy to use because our software permitted configuration via a text file of parameters. Our calibration procedure was:

  1. Enter the source’s FWHM bandwidth as an initial estimate of our spectrometer measurement bandwidth, as the min/max wavelengths in our software’s ini file.

  2. With these settings, use a single surface reflector as the sample in the FD-OCT device. By moving the reflector using a calibrated micrometer translation stage, note the number of B-scan pixels corresponding to a known distance, say 1 mm, of translation. From the known total number of pixels in the B-scan, compute the measurement depth of our OCT device.

  3. From FD-OCT theory, the measurement depth of an FD-OCT device, if not corrected for the complex conjugate, [1] is


where λ0 is the source center wavelength and Δλ is the full width at half maximum (FWHM) bandwidth. If the spectrometer measures a smaller bandwidth than the source bandwidth, the Δλ would become the spectrometer bandwidth. We use the known value of λ from the source datasheet. Our measured zmax, then gives us the required Δλ. We thus calibrate our spectrometer as having a minimum wavelength λ0Δλ/2 and a maximum wavelength λ0+Δλ/2 and enter these parameters in our software’s parameter ini file.

3.3.3 Measurable depth and axial resolution

We note that there could be a trade-off between measurable depth and axial resolution, when the number of spectrometer pixels is limited. For example, if a sensor with resolution 1280×960 is used with 2×2 binning, the number of usable spectral points, without interpolation, is just 640. Eliminating the complex conjugate half of the Fourier transform, the resulting B-scan would have only 320 points. If a measurement depth of 6.4 mm is obtained with such a sensor configuration, the number of pixels would limit the axial resolution to 20 μm even if the source characteristics can provide a higher resolution using Eq. 1. We note that the spectrometer resolution can easily be varied by changing the relative powers of the collimating lens and imaging lens in the spectrometer section of the FD-OCT setup. In our setup as seen in Figure 6, we have used,

  1. cylindrical lens with f=15cm

  2. cube beamsplitter with NR coating 700-1100 nm

  3. reflection grating with 1200lines/mm (Richardson gratings 360R25x50x6 from Newport)

  4. output collimating lens with f=24cm

  5. imaging lens with f=10cm

and obtained a measurement depth of 6.6 mm with an axial resolution of 20.7 μm, with 2×2 binning on 1280×960 frames.

3.4 Data processing

In our parallel FD-OCT configuration, each horizontal line on the acquired image corresponds to the spectrum obtained from a single point on the sample. According to the theoretical background [19] of FD-OCT, this spectrum corresponds to an A-scan at that sample point as defined by the following relations. Representing the spectrum as a function of wavenumber k,


where Sk is the source’s power spectral density, rR is the reference arm’s amplitude reflectivity, rsls is the sample arm point’s amplitude reflectivity density of a discrete reflector located at a path length ls inside the sample and ns is the sample’s refractive index. The first term in the right-hand side of Eq. 4 is the reference intensity term. Subtracting DC from the Ik gets rid of this term. The second term in Eq. 4 is the desirable one in FD-OCT, and is used to extract rsls using the inverse Fourier transform. The third term is the self-interference or autocorrelation term. Autocorrelation causes artifacts in FD-OCT. If sample reflectivity is significantly weaker than the reference arm reflectivity, the autocorrelation term can be safely ignored. Thus, data processing for FD-OCT involves DC subtraction and an inverse Fourier transform on the spectral interferogram represented as a function of wavenumber k.

The captured spectrum obtained by dispersion from a grating is equispaced in wavelength, that is, the raw data we obtain is Iλ. This needs to be interpolated to a function Ik equispaced in k. Basic image processing steps like binning and moving average improve the quality of the image. Further, addition of a larger number of FFT points by interpolation improves final B-scan SNR. Thus, a typical pipeline for data processing FD-OCT data would be:

  1. Acquire frames—either of source spectrum or of sample interferogram.

  2. Process the frames, optionally, with image processing steps like

    1. binning

    2. averaging

    3. moving average filter

    4. median filter

    5. increasing number of points by zero padding in Fourier domain.

  3. Save a frame with the source spectrum alone.

  4. Acquire sample interferogram.

  5. Divide the sample interferogram by the source spectrum to obtain the apodized interferogram.

  6. Optionally increase the number of points in the interferogram by performing a Fourier transform, zero-padding in the Fourier domain, and then performing an inverse Fourier transform.

  7. Resample the interferogram using interpolation to make it equispaced in k rather than equispaced in λ.

  8. Perform inverse Fourier transform on the apodized interferogram to obtain the B-scan.

  9. Optionally average the B-scan, mask out the DC component, display on screen, save data to disk storage.

We have written real-time code to capture and display B-scans using such a parallel FD-OCT setup. This cross-platform open-source software [20] has been implemented in C++ using the OpenCV [21] framework. Even without using GPU processing, this software can process and display B-scans at 148 frames per second (fps) for low resolution 320 point FFTs, and at 48 fps for 1280 point FFTs, on an i7 MacBook Pro. A screenshot of this software in action is presented in Figure 7.

Figure 7.

Screenshot of our open-source software which displays B-scans in realtime.


4. Conclusions

In this chapter, we discussed the possibility of assembling capable OCT devices using common laboratory components. Such devices can be put together at low cost, or at no cost if the items are already available, in just a few hours. Such devices would encourage the use of OCT in University optics laboratories, where they could be utilized in inter-disciplinary studies along with Material Science, Chemistry or Biology departments. The microscopic tomograms produced with OCT avoid the expense and preparation required for electron microscope imaging, and also have the advantage of being non-destructive. Tomographic reconstructions of crystals which can show up micron-level imperfections, measurements of biofilm thickness, sample optical dispersion measurements, volume renderings of micro-machined or laser etched parts, or measurements of thick-film deposition are just a few of the myriad applications which can result from the ready availability of OCT in an academic setting. Lowering the cost barrier to entry for OCT imaging is likely to stimulate innovative investigations.



This work was not funded by any grant from any funding agency.


Conflict of interest

The authors declare that they have no conflict of interest to report.


Notes/thanks/other declarations

We thank Bhagawan Sri Sathya Sai Baba, the founder Chancellor of our University, for help and guidance during the low-cost OCT development work.


Appendices and Nomenclature

OCToptical coherence tomography
FF-OCTfull-field optical coherence tomography
FD-OCTFourier-domain optical coherence tomography
SD-OCTspectral-domain optical coherence tomography
TD-OCTtime-domain optical coherence tomography


  1. 1. Drexler W, Fujimoto JG. Optical Coherence Tomography: Technology and Applications. 2nd ed. Switzerland: Springer International Publishing; 2015
  2. 2. Fujimoto J, Swanson E. The development, commercialization, and impact of optical coherence tomography. Investigative Ophthalmology & Visual Science. 2016;57(9):OCT1-OCT13. Available from:
  3. 3. OQ LABSCOPE: Lumedica. Lumedia Inc; 2018. Available from:
  4. 4. Kim S, Crose M, Eldridge WJ, Cox B, Brown WJ, Wax A. Design and implementation of a low-cost, portable OCT system. Biomedical Optics Express. 2018;9(3):1232-1243. Available from:
  5. 5. Nandakumar H, Subramania AK, Srivastava S. Sub-4-micron full-field optical coherence tomography on a budget. Sādhanā. 2018;43(6):97. Available from:
  6. 6. Newport: M-10X. Newport Inc; 2019.
  7. 7. Nandakumar H. ASKlive. GitHub; 2018.
  8. 8. Johnson MK. Capturing linear images. MIT; 2009.˜kimo/blog/linear.html
  9. 9. Coffin D. Decoding raw digital photos in Linux. 1997–2018.
  10. 10. Foundation B. Blender v2.79b; 1998–2018.
  11. 11. Kent BR. 3D Scientific Visualization with Blender. USA: Morgan & Claypool Publishers; 2015
  12. 12. John WE, David Bateman SH, Wehbring R. GNU Octave version 4.0.0 manual: A high-level interactive language for numericalcomputations; 2015. Available from:
  13. 13. De Boer JF, Cense B, Park BH, Pierce MC, Tearney GJ, Bouma BE. Improved signal-to-noise ratio in spectral-domain compared with time-domain optical coherence tomography. Optics Letters. 2003;28(21):2067-2069 Available from:
  14. 14. Grajciar B, Pircher M, Fercher AF, Leitgeb RA. Parallel Fourier domain optical coherence tomography for in vivo measurement of the human eye. Optics Express. 2005;13(4):1131-1137. Available from:
  15. 15. Nandakumar H, Parameshwaran S, Gamini R, Srivastava S. Artifact-free robust single-shot background subtraction for optical coherence tomography. OSA Continuum. 2019;2(5):1556-1564. Available from:
  16. 16. Lawman S, Dong Y, Williams BM, Romano V, Kaye S, Harding SP, et al. High resolution corneal and single pulse imaging with line field spectral domain optical coherence tomography. Optics Express. 2016;24(11):12395-12405. Available from:
  17. 17. Kazaili A, Lawman S, Geraghty B, Eliasy A, Zheng Y, Shen Y, et al. Line-field optical coherence tomography as a tool for in vitro characterization of corneal biomechanics under physiological pressures. Scientific Reports. 2019;9(1):6321. Available from:
  18. 18. Nandakumar H, Srivastava S. Data and code for analyzing performance of QHY CMOS cameras. 2018. Available from:
  19. 19. Wang LV, Hi W. Biomedical Optics: Principles and Imaging. USA: John Wiley & Sons; 2012
  20. 20. Nandakumar H. FDOCT. GitHub; 2019. Available from:
  21. 21. Bradski G, Kaehler A. OpenCV. Dr. Dobbs Journal of Software Tools. 2000;25:120-125

Written By

Hari Nandakumar and Shailesh Srivastava

Submitted: January 29th, 2019 Reviewed: June 13th, 2019 Published: May 27th, 2020