Algorithm Optimization for Swept Source Fourier Domain Optical Coherence Tomography (OCT) with Galvo Scanner and Digital Signal Processor (DSP)
Kevin Seekell
University of Connecticut
Faculty Mentor: Professor Zhongping Chen
PhD Candidate Mentor: Jiangping Su
Biomedical Engineering Department
Abstract:
Optical Coherence Tomography (OCT) is a medical imaging system that uses the backscattering of light from a sample to create a cross-sectional image. This non-invasive procedure is quite valuable for observing delicate tissues within the body, such as the retina and vocal chords. Noninvasive techniques are crucial for working with these tissues in order to avoid irreparable damage. However, one major limitation of the OCT system is its speed of data acquisition and processing. With quicker processing speeds, it would be possible to make on-site diagnoses instead of waiting for post-processing to produce results. Also, faster data acquisition would minimize the effects of involuntary tissue movement, such as the heartbeat or eye motion, on the image. In this project, algorithms controlling the OCT were modified and optimized to improve both their speed and performance. C++ programs involving the MEMS Scanner and Digital Signal Processor were revised to accomplish this task. A program allowing the MEMS scanner to complete a two-dimensional scan with adjustable parameters was developed. Also a new algorithm designed to modify rotational images in the DSP significantly outperformed its predecessor. These improvements to the OCT system should help it become a much more accessible medical technique.
Key Terms:
Digital Signal Processor, Frame-to-Frame algorithm, Galvo Mirror, Line-to-Line algorithm, Low Coherence Interferometry, Optical Coherence Tomography, Rotational image
Introduction:
Optical Coherence Tomography (OCT) is a non-invasive medical technique that uses the optical properties of tissues to create images. Non-invasive imaging techniques are important in avoiding irreparable damage to delicate tissues (such as the retina and vocal chords) during diagnosis. OCT gathers imaging data in a method similar to ultrasound imaging, except that OCT uses light waves rather that sound waves. OCT can produce images with about ten times higher resolution than normal ultrasound systems without needing to make physical contact with the subject (Gupta et al. 3). These advantages should allow for OCT to become a widely used imaging technique.
The OCT system uses a process called low coherence interferometry to gather data. Even though OCT is a relatively new technology, the theory of low coherence interferometry has existed for centuries. First, a light source emits a low-coherence light wave. In the case of OCT, this light wave is a laser. The light wave reaches a beam splitter, or a partial mirror. This mirror splits the light wave in half. One part of the light wave travels to a reference mirror, where it reflects directly back towards the beam splitter. The second part travels to the sample tissue. Depending on the optical properties of the tissue, some amount of light may be absorbed, refracted, or reflected. The reflected (or backscattered) portion of the light travels back towards the beam splitter, where it meets with the reference light wave (Schuman et al. 93-95). The interaction between these two light waves is the basis by which OCT produces images.
When two light waves of the same wavelength and constant phase difference meet, they are combined through superposition. This is a phenomenon called interference. If the light waves are in phase, they add together in constructive interference. If they are out of phase, they cancel each other out in destructive interference (Serway and Jewett 1177). When the sample and reference light waves meet, they either intensify or diminish depending on how the sample light interacts with the tissue. A detector uses the light or dark pattern produced to create a pixel for that specific region (Puliafito et al. 6-7). After scanning a whole area, a full image of the tissue may be produced.
The major problem with OCT imaging addressed in this project is the speed of data acquisition and processing. Currently, post-processing is required to create a final image from the data gathered by the OCT system. If the speed of data processing were increased, on-site diagnosis could be possible in a timely manner. This is especially important in certain military applications, where some common retina injuries must be diagnosed and treated within 48 hours. Also, faster data acquisition will minimize the effect of involuntary movement in the sample tissue on the final image. This project focuses on modifying the computer-based algorithms controlling the OCT system to quicken the image formation process.
Algorithm optimization involves changing the method used to produce a certain result so that it is accomplished more quickly or efficiently. Two separate algorithms were modified, using the C++ programming language, for this project. The first program controls the galvo mirrors, a pair of micro-sized mirrors used to guide the scanning laser through the sample. This program uses an applied voltage from the NI PCI 6115 Data Acquisition Board to control the position of each mirror in order to scan the entire sample. The result is a three-dimensional image. The mirrors scan in two perpendicular directions while the depth the laser travels within the tissue constitutes the third dimension.
The second program converts a linear OCT image to a rotational image. For certain applications, the scanning laser moves in a circular motion rather than a linear one. However, when the image is stored, the computer treats the data as though it had been collected in a linear motion. This creates a linear (or square) image rather than the desired rotational (or circular image). A separate program must be written to convert the image to its true form. This program is executed within a Digital Signal Processor (DSP), which is a computer board designed to receive and modify signals before sending an output signal to the PC. The old algorithm, known as Frame-to-Frame, works by calculating the position on the circular image that each individual pixel on the square image should take. This requires that the entire sample be scanned before data processing begins. The new algorithm developed in this project, known as Line-to-Line, should calculate and then translate each radial line onto the rotational image. This should place each line on the rotational image directly after each individual scan. These two algorithms combined should greatly increase the speed of image formation with OCT.
Methods and Materials:
Galvo Mirrors
The pair of micro-scale galvo mirrors guides the scanning laser through the entire sample. The movements of these two mirrors must be carefully coordinated to scan the whole sample. To simplify the example, consider one Galvo mirror scanning in the x-direction as the other scans in the y-direction. The scan begins with the laser positioned at the top-left of the sample. The first Galvo mirror guides the laser from the left side to the right side of the sample, and then quickly returns to the left. Once the first mirror returns to its initial position, the second mirror moves one step downward. This process repeats itself until the scanning laser has reached the opposite corner of the sample. When the scan is complete, both mirrors return to their original positions so that a new scan can be quickly performed. Microsoft Visual C++ and the National Instruments (NI) PCI 6115 Data Acquisition (DAQ) board are used to move the galvo mirrors in this way.
The galvo mirrors’ positions are each controlled by an applied voltage. A voltage of 0V corresponds to a mirror’s neutral position. Negative and positive voltages move he mirror in opposite directions. The NI PCI 6115 DAQ generates these voltages from its two output channels. Using C++ programming, commands, called interrupts, are sent from the computer to the DAQ board, instructing it to alter the voltage at either of its output channels.
To produce the type of scan described previously, each mirror must be controlled in a unique way. Therefore, the DAQ board’s two output channels each produce different types of voltage waveforms. The first channel used in this program controls the incremental change used for scanning in the y-direction. As previously mentioned, this mirror slightly changes position each time the other mirror returns to its original position. To accomplish this task, a series of step functions are used to produce the voltage waveform for this channel. Step functions begin at one voltage, and then immediately take a new value at a certain time. The program is set so that a total of five hundred steps are made. Each step raises the voltage by 0.002V. This results in five hundred step functions raising the voltage in the first channel from –0.5 to 0.5V.
The second mirror must continuously scan from the left to the right, and then back again. Therefore, the voltage waveform applied to it must also be continuous. The second output channel uses a series of ramp functions (sloped lines) to accomplish this task. First, the voltage gradually rises from -1V to 1V. Once the voltage reaches 1V, it quickly returns to -1V. Current program settings construct a waveform with a period of 62.5 milliseconds. The first 51.5 milliseconds constitute the upward slope, while the remaining time is used to lower the voltage back to its original value. It is important to note that the program is written so that these specific settings may be easily manipulated for varying purposes.
The galvo mirrors program works by first invoking the InitializePCI6115 function. This function prepares the DAQ board to begin operation. It first clears any commands that the DAQ board may already contain. It then calculates an array of voltage values for the continuously sweeping galvo mirror. These voltage values are then converted into binary values and stored in the output channel of the DAQ board for future use. It finally sets the rate at which it updates voltage values and sets the voltage of each output channel to 0V. A second function, called OnTimer, communicates with the DAQ board. The OnTimer function repeats itself as it gives commands to the DAQ board. For each loop, it causes the waveform created in the InitializePCI6115 function to play in one output channel. It then increments the voltage in the other output channel by 0.002V. Once the function has repeated itself 500 times, it ends the activity of both output channels, sets them both to 0V, and then ends its execution. This sets both galvo mirrors back to their original positions, so that another scan may be performed.
As these functions were created and modified, both output channels of the DAQ board were attached to an oscilloscope. This device shows the behavior of the voltage waveforms as they are produced. It functions as a test to make sure the program works as intended. The voltage range, shape, and timing of both waveforms were observed using the oscilloscope, and modified accordingly. Once the functions had been properly modified, they were tested to produce a three-dimensional image.
Rotational Image Conversion
When one of the galvo mirrors moves in a circular motion rather than a linear one, a rotational image is formed. However, the computer places the radial lines of data side-by-side, rather than with an angular offset. A program must be written to convert the linear image back into a rotational one. The current method, the frame-to-frame algorithm, works with each individual pixel to produce the new image, which takes a considerable amount of time. A new algorithm, known as line-to-line, manipulates each radial line of the rotational image at once to speed up the process. To write the line-to-line algorithm, it is first necessary to understand how the frame-to-frame algorithm operates.
The frame-to-frame algorithm contains two functions. The first, known as the CreateTable function, examines each individual pixel to be used in the rotational image. For this project, all images are 1024x1024 pixel (1 MB) bitmap files. Therefore, this function looks at over one million pixels. It calculates the radius and angle of each pixel with regard to the center of the image, using these formulas:
(1)dRho = sqrt(dXLoc*dXLoc + dYLoc*dYLoc)
(2)dTheta = atan2(dXLoc,dYLoc).
Each radius value is stored in a one-dimensional array (TabRho), while each angle value is stored in a separate array of equal length (TabTheta). As this process is performed for each individual pixel, both arrays contain over one million values. Using the sqrt and atan2 functions can take up a considerable amount of time.
The second function in the frame-to-frame algorithm, called RotateImg, uses the two arrays created in the previous function. This function takes the radius and angle data from each pixel and uses them to find the pixel’s position in the linear image. The x-axis position depends only on the angle, while the y-axis position depends only on the radius. This is due to the fact that the computer initially places the radial lines from the image side by side rather than offset by their respective angles. Once this location has been determined, the values of the four surrounding pixels are recorded. Weighting factors are determined according to how close the calculated location is to each of these four pixels. The final pixel value for the location is calculated as the weighted sum of the four surrounding pixel values. This process, known as interpolation helps to fill in missing spaces in the final rotational image. Once the pixel value has been calculated, it is recorded in the proper position in the rotational image. The RotateImg function is able to place each pixel in the correct position because it works with each pixel in the same order the CreateTable function used. While the frame-to-frame method properly constructs a rotational image, it must make several million calculations, taking considerable time.
Two new algorithms were developed as alternatives to the frame-to-frame algorithm. The first is very similar to the previous algorithm, except it uses a different method of interpolation. This algorithm only uses the pixels directly to the left and right of the target pixel’s location to interpolate its value rather than using the surrounding four.
The second, and more noticeably different algorithm is the line-to-line algorithm. This algorithm uses the symmetry of a circle to simplify some of the calculations of the frame-to-frame algorithm. Each radial line in a circle has the same length, and therefore is composed of identical radial components. Furthermore, the only difference between each radial line is its angle. Therefore, instead of calculating the radius and angle of every pixel in the image, the program could instead calculate all the radial components from one line in the circle and a set of angles that spans the entire circle to describe any pixel in the image. This should cut the calculations for each array from over a million to just over one thousand.
More specifically, the CreateTable function within the line-to-line algorithm determines sets of radius and angle values without considering the exact position of each pixel. The radii values used for all lines are determined using an assumed line with an orientation at 45 using the formula:
(3)dRho=sqrt(2*dYLoc*dYLoc)
The angle values are calculated as a set of evenly spaced values ranging from - to . Using these two sets of data, any point in the rotational image can be described without needing to make a calculation for each individual pixel. Avoiding such a large amount of calculations and memory requirements should greatly speed up the data processing process.
The RotateImg function for the line-to-line function is nearly identical to that of the frame-to-frame algorithm. It determines the location for each pixel in a certain line by the same methods described for the frame-to-frame algorithm. It uses the new method to interpolate the pixel values in order to increase the speed for the function. After it has determined values for each pixel and placed each pixel from one radial line into the rotational image, it begins working with the next radial line until the circle is complete. This part of the line-to-line function must work with individual pixels because the bitmap format of the file organizes the pixels by Cartesian coordinates. Therefore, the pixels that compose a radial line are not grouped together within the bitmap file.
To test the performance of each algorithm, a new program was written to create a sample image. The CreateBMP function creates and saves a bitmap image to be modified by the other programs. This image consists of a black background with ten evenly spaced white vertical stripes and 10 white horizontal stripes. If the algorithms work properly, the vertical stripes should become radial lines while the horizontal stripes will become smaller circles within the rotational image. If one the algorithms does not produce such an image, they are modified to solve the problem.