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.
get_phase_diff
.mgh
files containing phase data.doppler_needle_vis
salmon_rr.avi
) showing the reconstructed needle movement.ii.mgh
), optical axis (OAavg_salmon.tif
), and retardation (rravg_salmon.tif
) files.totaldisr_salmon.mat
file, which contains distance data derived from Doppler measurements.doppler_needle_vis
)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:
$$ \text{phase} = \left( \text{phaseImage8bit} \times \frac{2\pi}{2^\text{{number_bits}} - 1} \right) - \pi $$
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
:
$$ \text{diff_ph1}[:, i, j] = \text{ph1}[:, i, j] - \text{ph1}[:, i + 2, j] $$
For SPARC
:
$$ \text{diff_ph1}[:, i, j] = \text{ph1}[:, i, j] - \text{ph1}[:, i + 1, j] $$
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:
$$ \text{distance} = \frac{\text{normalized_avg_a_scan} \times \text{wavelength}}{4\pi \times \text{refractive_index}} $$
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.