Open Access Paper
11 March 2015 C++ software integration for a high-throughput phase imaging platform
Mikhail E. Kandel, Zelun Luo, Kevin Han, Gabriel Popescu
Author Affiliations +
Proceedings Volume 9336, Quantitative Phase Imaging; 93360Z (2015) https://doi.org/10.1117/12.2080212
Event: SPIE BiOS, 2015, San Francisco, California, United States
Abstract
The multi-shot approach in SLIM requires reliable, synchronous, and parallel operation of three independent hardware devices – not meeting these challenges results in degraded phase and slow acquisition speeds, narrowing applications to holistic statements about complex phenomena. The relative youth of quantitative imaging and the lack of ready-made commercial hardware and tools further compounds the problem as Higher level programming languages result in inflexible, experiment specific instruments limited by ill-fitting computational modules, resulting in a palpable chasm between promised and realized hardware performance. Furthermore, general unfamiliarity with intricacies such as background calibration, objective lens attenuation, along with spatial light modular alignment, makes successful measurements difficult for the inattentive or uninitiated. This poses an immediate challenge for moving our techniques beyond the lab to biologically oriented collaborators and clinical practitioners.

To meet these challenges, we present our new Quantitative Phase Imaging pipeline, with improved instrument performance, friendly user interface and robust data processing features, enabling us to acquire and catalog clinical datasets hundreds of gigapixels in size.

1.

INTRODUCTION

The quantitative phase image represents a per-pixel map of the optical path length across the specimen, providing intrinsic contrast from the structure of the object. By decoupling the image from the properties of the microscope, quantitative phase imaging techniques provide reproducible diagnostic markers well suited for clinical applications such as blood screening or cancer diagnosis [1-5].

In Spatial Light Interference Microscopy (SLIM [6]) the relative phase shift between scattered and transmitted light is manipulated by way of a spatial light modulator (SLM). In our implementation, each SLIM image is reconstructed from four ‘phase contrast’ frames acquired at 90 degree offsets between scattered and transmitted light, with the relative offset between the two components used to reconstruct a per-pixel map of the optical path across the specimen. Among the advantages of phase shifting interferometry[7, 8] is the efficient use of camera bandwidth when compared to techniques where the image is retrieved by Fourier demodulation[9], necessitating significantly more pixels to properly sample the modulated image.

The SLIM hardware sits at the output port of a conventional white light microscope with the SLM conjugate to phase ring of the objective. This design is particular well paired with fluorescence microscopy as the low intensity fluorescent signal moves through the hardware relatively unperturbed when compared to diffraction gratings[10], lenslet arrays [11], and multipath setups[12-14] that split the weak emitted light beyond the sensitivity of the camera.

2.

INSTRUMENTATION

The acquisition of a SLIM frame begins by writing a phase mask onto the SLM. Like a conventional liquid crystal display, the response time for a phase shifting SLM depends on the values written, and is on the order of 10 ms [15]. Nevertheless, to achieve this performance, in the case of a computer display connected SLM device, the pixels must actually switch on demand. In our system, we run a dedicated OpenGL render context with a condition variable releasing the buffer, effectively implementing a software trigger (Code 1). We note that by creating the context from scratch, we can disable the post-processing and motion blurring that is desirable for video games and word processing applications, but otherwise result in an increase per-frame latency in the phase modulating applications.

00021_psisdg9336_93360Z_page_2_1.jpg

By default, there is a few millisecond latency between notifying a condition variable and returning control to the associated thread (Code 2). On a Windows platform, Multimedia Timers provide a workaround to achieve response times on the order of Windows NT thread quanta, achieving near optimal response time, reducing jitter due to multithreading to under a millisecond[16] :

00021_psisdg9336_93360Z_page_2_2.jpg

Although hardware camera triggering can be used for time critical acquisitions, instead we opt to use software based camera triggering as it enables us to implicitly adjust for variable image processing time, in particular for in the live acquisition mode. We perform the software triggering and datacopy operations on separate threads, enabling the camera API to respond as data becomes available. Moreover, by decoupling triggering from datacopy we can reduce camera aperture jitter, as triggering is usually immediate while waiting for the data to arrive is subject to other factors such as the computational load.

Writing data to a hard disk at our acquisition speeds is challenging because, even with the fastest solid state drives, the archived speed can vary as a function of capacity, leading to the so-called “SSD write cliff"[17]. Our implementation addresses this problem by performing file writing asynchronously reserving a memory buffer corresponding to the computer’s storage capacity letting us briefly exceed hard disk capacity. Further performance increases come from writing the files as binary data and avoiding the operating systems internal file buffering (Code 3).

00021_psisdg9336_93360Z_page_3_1.jpg

As the mechanical motion of the microscope takes a variable amount of time to complete, tasks such as opening a shutter or moving the stage require synchronous operation where control returns to the program upon completion. Nevertheless, it is desirable to do such tasks in parallel, for example modulating the SLM while moving to a new position or switch to a reflectorendering the live image in fluorescence filter cube while turning off the transmitted illumination. We group such task blocks by launching them asynchronously waiting for their completion through the `std::future` framework. Further, the destruction of purpose built objects ensures a minimal execution time effectively converting portions of the code from asynchronous to synchronous ensuring predictable computation times(Code 4). With these two techniques, the total time becomes the maximum of each step rather than sum of each step - i.e., max(slm,microscope) rather than slm+microscope - and is enforced implicitly without any a-priori knowledge of the execution time of the constituent elements.

00021_psisdg9336_93360Z_page_3_2.jpg
00021_psisdg9336_93360Z_page_4_2.jpg

3.

USER INTERFACE

To present the SLIM image as a unified contrast setting, in the same way as Bright Field or Phase Contrast, we use CUDA and OpenGL to perform real-time rendering on a separate drawing thread. Passive mechanisms, such as write-combined memory were considered, but not used due conflicts with OEM camera hardware. Instead, we perform the data transfer on a second thread achieving a similar effect, where the next frame loads while the current one is processed. In total, the live mode runs three threads: one for triggering and data upload, one for waiting on new data, and one for rendering the live image (Figure 1).

00021_psisdg9336_93360Z_page_4_1.jpg

The acquisition process reads a list of acquisition events, with each event indexing the corresponding channel information. Information stored in each channel includes items such as exposure time, along with QPI specific parameters like the background illumination (Figure.2). To maximize code reusability, OEM SDK are hidden in a particular implementarendering the live imagetion of generic devices - i.e. OspreyCamera implements Camera. The acquisition list enables us to decouple the graphical user interface (Figure 3) from the acquisition process, greatly improving code reusability, as only the list generation function needs to be changed when modifying the user interface or adding features to the acquisition process. The principle downside of such a structure being the need to use synchronization primitives when changing the list during acquisition, although the persistence of well-defined acquisition events facilitates an error correction procedure where a failed event can be easily re-attempted.

00021_psisdg9336_93360Z_page_5_1.jpg
00021_psisdg9336_93360Z_page_5_2.jpg

Understanding that a clinical slide scanner designed for use by medical professionals must digitize samples whose `surface of best focus` is non-uniform, we incorporate a mechanism to set focus points across the surface of the sample (figure 4). To handle arbitrary locations we generate a Delaunay triangulation and sample it when generating our acquisition list[18]. A slide scan, as would be used to digitize a peripheral blood smear or frozen biopsy section, can use this surface `as is` or take it as a hint for the automated focus system as is addressed in our separate work [19].

00021_psisdg9336_93360Z_page_6_1.jpg

4.

ARCHIVAL STORAGE

A typical acquisition results in tens of thousands of images, and presents a computational challenge to existing image assembly tools. These tools are often designed for general image alignment tasks such as merging tilings with arbitrary positions or compensating for image warping resulting in producer-consumer schemes with hard to predict threading. For example, some stitching programs are able to align a tile with a variable number of neighbors, leading to parallelism schemes where too few or too many threads are invoked. Instead, we optimize our code for regularly spaced mosaic tiles and rigid transformations[20] facilitating predictable overlap between disk reading and computation, resulting in a code that aligns images comparable to hard disk read speeds. The resulting list is converted into a format compatible with tile based online image viewers, ready for inspection by a medical professional [21, 22].

The intrinsic contrast and quantitative nature of QPI techniques make them well posited for archival storage, because phase, unlike intensity, does not depend on the properties of the instrument but rather only on the actual specimen. To this end, we demonstrate a computational workflow designed to scan a large number slides, processing them in batch and storing them for easy online access. Specifically, a k-means clustering on a down-sampled version identifies the pixels as belonging to a cores and then a second k-means clustering is used to assign the labels (Figure 5) [23].

00021_psisdg9336_93360Z_page_7_1.jpg

5.

SUMMARY

Our design presents spatial light interference microscopy in a user-friendly manner, unifying a multistep interferometric contrast technique into an image well suited for use by biologists and clinical practitioners. In addition to providing a real time image, our pipeline represents a realization of cloud pathology, with images moving directly from the scanner to a web based image viewer.

REFERENCES

[1] 

T. Kim, S. Sridharan, A. Kajdacsy-Balla, “Gradient field microscopy for label-free diagnosis of human biopsies,,” Appl. Optv, 52 (1), A92 –A96 (2013). https://doi.org/10.1364/AO.52.000A92 Google Scholar

[2] 

Z. Wang, G. Popescu, K. V. Tangella, “Tissue refractive index as marker of disease (Journal Paper),,” Journal of Biomedical Optics,, 16 (11), 116017 (2011). https://doi.org/10.1117/1.3656732 Google Scholar

[3] 

M. Hunter, V. Backman, G. Popescu, “Tissue self-affinity and polarized light scattering in the born approximation: a new model for precancer detection,,” Physical review letters,, 97 (13), 138102 (2006). https://doi.org/10.1103/PhysRevLett.97.138102 Google Scholar

[4] 

M. Mir, K. Tangella, and G. Popescu,, “Blood testing at the single cell level using quantitative phase and amplitude microscopy,,” Biomedical Optics Express,, 2 (12), 3259 –3266 (2011). https://doi.org/10.1364/BOE.2.003259 Google Scholar

[5] 

H. Pham, B. Bhaduri, K. Tangela, “Real time blood testing using quantitative phase imaging,,” PLoS ONE, 8 (2), e55676 (2013). https://doi.org/10.1371/journal.pone.0055676 Google Scholar

[6] 

Z. Wang, L. Millet, M. Mir, “Spatial light interference microscopy (SLIM),,” Optics Express,, 19 (2), 1016 –1026 (2011). https://doi.org/10.1364/OE.19.001016 Google Scholar

[7] 

H. Kadono, M. Ogusu, and S. Toyooka,, “Phase shifting common path interferometer using a liquid-crystal phase modulator,,” Optics Communications, 110 (3-4), 391 –400 (1994). https://doi.org/10.1016/0030-4018(94)90443-X Google Scholar

[8] 

W. S. Rockward, A. L. Thomas, B. Zhao, “Quantitative phase measurements using optical quadrature microscopy,,” Applied Optics,, 47 (10), 1684 –1696 (2008). https://doi.org/10.1364/AO.47.001684 Google Scholar

[9] 

M. Takeda, H. Ina, and S. Kobayashi,, “Fourier-transform method of fringe-pattern analysis for computer-based topography and interferometry,,” Journal of the Optical Society of America,, 72 (1), 156 –160 (1982). https://doi.org/10.1364/JOSA.72.000156 Google Scholar

[10] 

G. Popescu, T. Ikeda, R. R. Dasari, “Diffraction phase microscopy for quantifying cell structure and dynamics,,” Optics letters,, 31 (6), 775 –777 (2006). https://doi.org/10.1364/OL.31.000775 Google Scholar

[11] 

P. Bon, G. Maucort, B. Wattellier, “Quadriwave lateral shearing interferometry for quantitative phase microscopy of living cells,,” Optics Express,, 17 (15), 13080 –13094 (2009). https://doi.org/10.1364/OE.17.013080 Google Scholar

[12] 

P. Kolman, and R. Chmelík,, “Coherence-controlled holographic microscope,,” Optics Express,, 18 (21), 21990 –22003 (2010). https://doi.org/10.1364/OE.18.021990 Google Scholar

[13] 

E. Cuche, P. Marquet, and C. Depeursinge,, “Simultaneous amplitude-contrast and quantitative phase-contrast microscopy by numerical reconstruction of Fresnel off-axis holograms,,” Applied Optics,, 38 (34), 6994 –7001 (1999). https://doi.org/10.1364/AO.38.006994 Google Scholar

[14] 

G. Popescu, T. Ikeda, C. A. Best, “Erythrocyte structure and dynamics quantified by Hilbert phase microscopy,,” Journal of biomedical optics,, 10 060503 (2005). https://doi.org/10.1117/1.2149847 Google Scholar

[15] 

G. Thalhammer, R. W. Bowman, G. D. Love, “Speeding up liquid crystal SLMs using overdrive with phase change reduction,,” Optics Express, 21 (2), 1779 –1797 (2013). https://doi.org/10.1364/OE.21.001779 Google Scholar

[16] 

Microsoft, [Multimedia Timers], Google Scholar

[17] 

C. Mellor,, [HP and Violin build Oracle Exadata killer] The Register, (2011). Google Scholar

[18] 

“Computational Geometry Algorithms Library,” Google Scholar

[19] 

B. B. Mikhail E. Kandel, Gabriel Popescu,, “An efficient autofocusing scheme for quantitative phase imaging,” Quantitative Phase Imaging, Google Scholar

[20] 

E. De Castro, and C. Morandi,, “Registration of Translated and Rotated Images Using Finite Fourier Transforms,,” Pattern Analysis and Machine Intelligence, IEEE Transactions on, PAMI-, 9 (5), 700 –703 (1987). https://doi.org/10.1109/TPAMI.1987.4767966 Google Scholar

[21] 

I. Zoomify,, [Zoomify], Google Scholar

[22] 

S. Saalfeld, A. Cardona, V. Hartenstein, “CATMAID: collaborative annotation toolkit for massive amounts of image data,,” Bioinformatics,, 25 (15), 1984 –1986 (2009). https://doi.org/10.1093/bioinformatics/btp266 Google Scholar

[23] 

OpenCV, [Clustering], Google Scholar
© (2015) COPYRIGHT Society of Photo-Optical Instrumentation Engineers (SPIE). Downloading of the abstract is permitted for personal use only.
Mikhail E. Kandel, Zelun Luo, Kevin Han, and Gabriel Popescu "C++ software integration for a high-throughput phase imaging platform", Proc. SPIE 9336, Quantitative Phase Imaging, 93360Z (11 March 2015); https://doi.org/10.1117/12.2080212
Lens.org Logo
CITATIONS
Cited by 2 scholarly publications.
Advertisement
Advertisement
RIGHTS & PERMISSIONS
Get copyright permission  Get copyright permission on Copyright Marketplace
KEYWORDS
Cameras

Spatial light modulators

Phase imaging

Biomedical optics

Human-machine interfaces

Microscopes

Microscopy

Back to Top