This code is given as an example as a supplement to the 2023 manuscript "Needle guidance with Doppler-tracked polarization-sensitive optical coherence tomography" by Danielle J. Harper, Yongjoo Kim, Alejandra Gomez-Ramirez and Benjamin J. Vakoc.
It is not actively maintained, but users are welcome to contact Danielle J. Harper (djharper@mgh.harvard.edu) should they have any questions regarding the code.
"get_phase_diff.m" allows the calculation of phase difference from raw phase information obtained from an OCT interferogram. "doppler_needle_vis.m" uses pre-stored phase differences generated by "get_phase_diff.m" and creates surface-referenced maps of intensity, phase retardation, and optic axis as the needle moves.
This project processes Optical Coherence Tomography (OCT) phase data from a needle probe to visualize the movement of the needle and create surface-referenced maps of intensity, phase retardation, and optic axis. The get_phase_diff
script prepares the data which is then visualized using the doppler_needle_vis
script.
The processing pipeline involves preprocessing the raw OCT data to calculate phase differences and then using those calculations to visualize the needle's path through tissue.
- Purpose: Prepares phase difference data from the OCT probe.
- Input:
.mgh
files containing phase data. - Output: Processed phase difference data used for visualization.
- Purpose: Creates a video visualization of needle movement and surface-referenced maps.
- Input: Processed phase difference data, averaged optical images.
- Output: A video file (
salmon_rr.avi
) showing the reconstructed needle movement.
- Clear the MATLAB workspace and set up file paths for scripts and data access.
- Load the intensity (
ii.mgh
), optical axis (OAavg_salmon.tif
), and retardation (rravg_salmon.tif
) files. - Load the
totaldisr_salmon.mat
file, which contains distance data derived from Doppler measurements.
- The script reads in the intensity image data and combines it with pre-processed distance information to construct a visualization.
- A video writer object is created to store the visualization output.
- The script iterates through the data, creating frames that are compiled into a video showing the needle's movement.
- MATLAB (R2023a or newer recommended)
- Image Processing Toolbox for MATLAB
Run the scripts in the following order:
get_phase_diff.m
for preprocessing.doppler_needle_vis.m
for visualization.
% Execute in MATLAB
run('get_phase_diff.m');
run('doppler_needle_vis.m');
Optical Coherence Tomography (OCT) employs optical interferometry to non-invasively image internal structures of biological tissues. A pivotal aspect of OCT analysis is translating phase changes in optical signals into accurate physical distances. This document details the mathematical and theoretical underpinnings of this conversion process.
OCT phase data, initially captured in an 8-bit format, undergoes a transformation to represent true phase values. The transformation formula is:
Here, number_bits
is 8, indicating the original bit depth of the image.
The next step involves computing the phase differences between subsequent A-lines. This computation varies depending on the OCT machine type:
For MGH
:
For SPARC
:
The phase differences are then averaged across each A-scan within the region of interest for each frame. Subsequently, these averages are concatenated and normalized by subtracting their mean.
In OCT, the light is divided into two paths: a reference path and a sample path. The phase change of the light, as it travels through tissue, directly correlates with the distance it travels. This phase change forms the basis for calculating the physical distance within the tissue.
The wavelength of the light source in OCT is crucial. The phase change experienced by the light is proportional to the wavelength. Thus, knowing the wavelength allows for the conversion of phase changes into actual physical distances.
The refractive index of the tissue plays a significant role in adjusting the distance calculation. This index measures the reduction in the speed of light within the tissue compared to its speed in a vacuum, affecting how the wavelength and thus the phase change should be interpreted in terms of physical distance.
The factor of 4π
in the formula emerges from the definition of phase (with 2π
radians equating to one complete cycle) and the nature of OCT, which involves round-trip travel of light, effectively doubling the observed phase changes.
The conversion of normalized phase changes to distances is articulated through the formula:
This formula is an application of the principles of optical interferometry in the context of OCT. It enables the translation of optical data (phase changes) into meaningful physical measurements, fundamental to the creation of detailed tissue images in OCT imaging.
The mathematical process of converting phase changes to physical distances in OCT is a testament to the application of optical interferometry principles in modern medical imaging technology. This process is crucial for advancements in medical diagnostics and research, offering insights into the internal structures of biological tissues with remarkable precision.