Today we looked at creating a smaller version of an Optical Coherence Tomography machine—a non-invasive device used to create 3D images of tissue, often used for imaging retinas. Among other things, this device requires multiple scanning patterns, all of which are used to produce slightly different images. We implemented these in Python, plotting with matplotlib, in order to verify the correctness of our code. The next step is to put it on an Arduino.
Below: the code producing a scanning pattern approximating an Archimedes spiral. The code had to evenly space dots along the spiral arc, a nontrivial task with limited computing resources—the formula for determining arc length of an Archimedes spiral based on angle is complex and includes slow operations such as the natural log. In addition, we weren’t able to find a closed-form inverse for this function, which is necessary for actually plotting the points. However, we found that a second-order Taylor series provided an surprisingly good approximation and was easily computable and invertible. The code below utilizes the Taylor series and is effectively indistinguishable from a true Archimedes spiral.
Below: Me excitedly explaining the technique.