Skip to content

Doppler Code from Harper et al. (2023), "Needle guidance with Doppler-tracked polarization sensitive optical coherence tomography"

Notifications You must be signed in to change notification settings

ludwig-lab/MGH_Needle_Doppler

 
 

Repository files navigation

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.

OCT Needle Probe Visualization Project

Description

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.

Workflow Overview

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.

Preprocessing with get_phase_diff

  • Purpose: Prepares phase difference data from the OCT probe.
  • Input: .mgh files containing phase data.
  • Output: Processed phase difference data used for visualization.

Visualization with doppler_needle_vis

  • 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.

Detailed Steps

1. Initialization

  • Clear the MATLAB workspace and set up file paths for scripts and data access.

2. Data Reading

  • 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.

3. Visualization Execution (doppler_needle_vis)

  • 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.

Requirements

  • MATLAB (R2023a or newer recommended)
  • Image Processing Toolbox for MATLAB

Usage

Run the scripts in the following order:

  1. get_phase_diff.m for preprocessing.
  2. doppler_needle_vis.m for visualization.
% Execute in MATLAB
run('get_phase_diff.m');
run('doppler_needle_vis.m');

OCT Phase Data Analysis: Distance Calculation Explained

Introduction

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.

Phase Data Processing

Conversion of 8-bit Phase Images

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.

Calculation of Phase Differences

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] $$

Normalization of Phase Differences

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.

Distance Calculation: Principles of Optical Interferometry in OCT

Understanding Normalized Phase Change

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.

Role of Wavelength

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.

Refractive Index Consideration

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.

Constants in the Formula

The factor of in the formula emerges from the definition of phase (with 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 Formula for Distance Calculation

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.

Conclusion

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.

About

Doppler Code from Harper et al. (2023), "Needle guidance with Doppler-tracked polarization sensitive optical coherence tomography"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • MATLAB 100.0%