This technique describes an automated batch image processor designed to measure polysaccharide capsule and body radii. While initially designed for Cryptococcus neoformans capsule measurements the automated image processor can also be applied to other contrast based detection of circular objects.
The purpose of this technique is to provide a consistent, accurate, and manageable process for large numbers of polysaccharide capsule measurements.
First, a threshold image is generated based on intensity values uniquely calculated for each image. Then, circles are detected based on contrast between the object and background using the well-established Circle Hough Transformation (CHT) algorithm. Finally, the detected cell capsules and bodies are matched according to center coordinates and radius size, and data is exported to the user in a manageable spreadsheet.
The advantages of this technique are simple but significant. First, because these calculations are performed by an algorithm rather than a human both accuracy and reliability are increased. There is no decline in accuracy or reliability regardless of how many samples are analyzed. Second, this approach establishes a potential standard operating procedure for the Cryptococcus field instead of the current situation where capsule measurement varies by lab. Third, given that manual capsule measurements are slow and monotonous, automation allows rapid measurements on large numbers of yeast cells that in turn facilitates high throughput data analysis and increasingly powerful statistics.
The major limitations of this technique come from how the algorithm functions. First, the algorithm will only generate circles. While Cryptococcus cells and their capsules take on a circular morphology, it would be difficult to apply this technique to non-circular object detection. Second, due to how circles are detected the CHT algorithm can detect enormous pseudo-circles based on the outer edges of several clustered circles. However, any misrepresented cell bodies caught within the pseudo-circle can be easily detected and removed from the resulting data sets.
This technique is meant for measuring the circular polysaccharide capsules of Cryptococcus species based on India Ink bright field microscopy; though it could be applied to other contrast based circular object measurements.
Cryptococcus neoformans is a pathogenic yeast found ubiquitously around the globe that is associated with human disease primarily in immunosuppressed populations. C. neoformans most notably accounts for a significant cause of total annual deaths in sub-Saharan Africa due to infectious disease1. The major clinical manifestation of cryptococcal infection is meningoencephalitis, which follows invasion of the central nervous system by transport in infected macrophages (Trojan horse manner) or direct crossing of the blood-brain barrier. C. neoformans expresses several virulence factors including the ability to replicate at human body temperature, urease activity, melanization, and formation of a polysaccharide capsule2. The polysaccharide capsule is composed of repeating glucuronoxylomannan and glucoronoxylomannangalactan polymers and functions as a protective barrier against factors such as environmental stress and host immune responses2.
Although the size of the cryptococcal polysaccharide capsule size has not consistently been associated with virulence, there is evidence that it is a factor in pathogenesis2,3,4,5,6,7. Capsule size is associated with meningitis pathology6, can affect macrophage ability to control Cryptococcus infection5, and can result in loss of virulence if absent8. Hence, capsule size measurements are common in cryptococcal research, but there is no fieldwide standard for a method of capsule measurement.
Currently, C. neoformans polysaccharide capsule measurement is based on manual measurements of microscopy images, and the exact methods of both image and measurement acquisitions vary across laboratories9,10,11. An immediate concern to this method is that some studies require the acquisition of thousands of individual measurements, which makes maintaining accuracy and reliability difficult. Furthermore, even when the results are published, there is often inadequate description of the measurement method. Many publications do not explain how their measurements were obtained, what focal plane was used, how they determined the threshold for capsule identification, whether they used radius or diameter, whether they used one measurement or averaged several, or other details. Some publications only state their method as which program was used, e.g., "Adobe Photoshop CS3 was used to measure the cells"11. This lack of standardization and reporting detail can make reproducibility difficult if not impossible. Differences in human eyesight, computer brightness, microscope settings, slide lighting, and other factors can vary not only between individuals but between samples, whereas calculations based on ratios of pixel intensity values will remain constant and applicable between samples. This technique was generated in the context of providing a standardized, accurate, rapid, and simple technique to measure capsules sizes for a field in which there was none before.
As previously mentioned, the CHT algorithm is long-established, and scripts to automatically detect circles have been written before. This method improves in two areas where other scripts would fall short. First, simply detecting circles is not enough, because with cryptococcal cells two distinct circles must be detected in relation to each other. This method specifically detects cell bodies within capsules, discriminates between the two, and performs calculations only on the relevant body-capsule pairs. Second, even when following the same protocol, different investigators will end up with different acquired images. By allowing the investigator control over every algorithm parameter, this tool can be adjusted to match a broad range of acquisition methods. There is no need for a standardized scope, objective, filter, and so on.
This technique can be readily applied to any situation in which the investigator needs to detect circles within an image that contrast with their background. Both circles lighter and darker than their background can be detected, counted, and measured using this technique.
1. Preparation of India Ink Slide
- Pipette 10 µL of cryptococcal sample onto a slide. Any circular yeast strain will work but for this experiment H99 was the only strain used.
NOTE: If the sample is directly from culture media, diluting 1:2 with PBS or water can help prevent the India Ink from clumping.
- Pipette 2 µL of India Ink stain onto the sample and mix by physically pushing the pipette tip to the sample and moving in a circular motion until the India Ink appears evenly distributed.
- Place a coverslip over the sample by holding down the left edge of the coverslip against the surface of the slide, then gently and evenly lowering the opposite side of the coverslip over the sample.
- Allow the slide to air dry for 5 min.
- Gently apply a light layer of nail polish to coverslip border to form a seal and preserve the India Ink stain.
2. Imaging Slide
- Place slides in a bright field microscope with a camera attachment and known pixel-to-micron conversion. Adjust filters, objectives, and contrast so that cell capsules are clear and cell bodies are focused, dark bands.
NOTE: Various filters, objectives, and contrast settings will work but a 20x objective, Ph1 filter, and 2x2 binning is recommended.
- Ensure the field of view is dense but not overpopulated with cryptococcal cells, with clear contrast between cell capsule and background, and properly focused with the cell body visualized as a dark band.
NOTE: The exact number of cells for an optimal image will vary depending on the sample and objective being used. The important aspects are to ensure cells are not clustered or overlapping, that the cell focal planes do not vary significantly, and that there is significant India Ink stain clearly visible in the background (at least 25% of the field).
- Save images to a single directory with clear titles, as the measurement algorithm will be run on images in a single directory and the output data will be organized according to the names of the image files.
3. Algorithm Setup
- Install Python version 2.7 from
- Install additional python libraries by running the commands "pip install pillow" and "pip install openpyxl".
- Install MATLAB by following the instructions at
- Build the MATLAB python library by following the instructions provided at https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html.
- Download the three required files included in this manuscript's Supplementary Materials ("QCA.py", "Analysis2.m", and "TestRun.m").
Note: These files can be extracted to any location, but all three must be in the same directory.
4. Use of Algorithm
- Run the application by double clicking on QCA.py.
NOTE: The application may take several minutes to start. The "QCA.py" file contains the program structure that calls the ".m" files to run the actual algorithm.
- Follow the steps outlined in the program.
- Input the extension type of the image files preceded by a period and separated by semicolons (ex. ".TIF;.jpeg") then click the Enter button.
- Choose the directory in which the image files are located by clicking the Select Directory button and selecting the folder which contains the images.
- Generate the list of image files in the directory by clicking the Generate Image List button. The images will be listed in the text box to the right. Review and ensure the list is accurate and complete.
- Select a random image from the list to use as a preview by clicking the Select Random Image button.
NOTE: If the image is unable to open due to an "incorrect image mode error," the algorithm will still function properly despite not displaying the image. After step 4.2.7, the test image will still display.
- Input microscope objective and binning settings. If the default settings do not match the microscope used, select "Custom Pixel Conversion" and input the pixel-to-um conversion for the image files. Once selected, click the Calculate Conversion button and ensure the conversion is correct according to the text box on the right.
NOTE: Representative images shown in Figure 1 were calculated with 40x magnification and 2x2 binning selected.
- Input algorithm parameters for circle detection.
- Input the minimum and maximum radius detectable for the outer capsule detection as the Min and Max Capsule Radius entries. A smaller range will allow more accurate results.
- Input the minimum and maximum radius detectable for cell body detection as the Min and Max Cell Body Radius entries.
NOTE: All four of these entries should be numbers representing their respective values in pixels, according to the source images.
- Move the Capsule and Cell Body Sensitivity sliders to adjust the sensitivity threshold of the algorithm. A low sensitivity will be strict and reduce false positive circle detection, but may also detect fewer real circles. Conversely, a high sensitivity will increase the detection rate but may also result in false positive circles.
NOTE: Representative results were obtained with a minimum capsule radius of 7, maximum capsule radius of 45, minimum body radius of 4, maximum body radius of 30, capsule sensitivity of 87, and body sensitivity of 87.
- Test the parameters on the randomly selected image by clicking the Run Test button. The results will be displayed in the upper center of the program, replacing the original image. If the results look accurate, it is recommended to select an additional random image to try as well to ensure the selected parameters will fit all selected images.
- Maximize the number of bodies and capsules detected and visually inspect whether the circles appear to fit correctly. The number of bodies within capsules detected will be displayed in the text box to the right. Otherwise, manipulate the algorithm parameters until the results are accurate.
NOTE: The thick colored circles are only to help with visualization. The actual circles generated for measurement is a mathematical curve calculated by the HCT algorithm.
- Maximize the number of bodies and capsules detected and visually inspect whether the circles appear to fit correctly. The number of bodies within capsules detected will be displayed in the text box to the right. Otherwise, manipulate the algorithm parameters until the results are accurate.
- Run the detection algorithm on the entire directory of image files by clicking the Begin Analysis button. Each image will be analyzed and the program will display "finished" in the text box to the right when all images have been analyzed.
- Click the Match and Cleanup button. This will match detected cell bodies to the detected capsules they reside in, and calculate the true capsule radius by subtracting body from capsule.
NOTE: If the algorithm is being used to detect fluorescence or another situation in which only one circle is detected this step is unnecessary. Instead click the Only Pull Bodies or the Only Pull Capsules button to collect the data for only the blue or only the green circles, respectively. It is important to note that if only the capsule data is retrieved the radius will refer to the total radius of the cell as the radius of the cell body could not be subtracted.
- Locate the completed data in the "CleanedOuput.csv" file in the image directory. If only one piece of data was selected, the file will be labeled "CleanedBodies.csv" or "CleanedCapsules.csv".
Images are first obtained by microscopy of India Ink slides using a bright field microscope coupled with a camera (Figure 1A). It is important to have cells separated and in sufficiently low density not to overwhelm the field of view, as well as to use enough stain to create contrast between cells and background. As stated in the protocol, the exact number of cells for an optimal image will vary depending on the sample, microscope, and objective being used. The important aspects are to ensure cells are not clustered or overlapping, that the cell focal planes do not vary significantly, and that there is significant India Ink stain clearly visible in the background (at least 25% of the field). These directions allow the algorithm to determine a threshold unique to each image by taking the average pixel intensity value and adding the standard deviation. Any pixel with an intensity value higher than said threshold is considered white and any with an intensity value lower is considered black. The resulting image allows a clear and crisp distinction of where the capsule ends (Figure 1B). The algorithm then has a robust white-on-black contrast based circle to detect for the capsule and the original image provides a robust black-on-white circle for cell bodies. A representative visualization of the detected circles is generated as part of the program (Figure 1C). This allows the user to quickly parse through processed images and ensure the results appear accurate.
It is essential to follow the exact protocol to acquire optimal images. Sub-optimal images usually result from a lack of contrast between capsule and Ink (Figure 2A). Optimal contrast and acquisition parameters will vary based on sample, experiment, camera and microscope models, etc. An optimal image is one where yeast cells are separated if possible, where the outer edge of the capsule has clear contrast to the India Ink stain, and where the cell body is focused to appear as a dark band which contrasts sharply with its background. If too many cells are in the field of view or if the stain is too light, the pixel intensity values will cluster and the program will not be able to establish a threshold capable of elucidating capsule size (Figure 2B). When sub-optimal images are used the program can detect circles of incorrect sizes, not be able to detect any circles, or detect multiple pseudo-circles based on artifacts in the threshold image (Figure 2C).
Detecting cell bodies poses a similar problem in that the cell body must be visualized as a robust black circle on the white background of the capsule. This problem is addressed in the protocol when describing the desired focal plane for image acquisition. The best focal plane to use is one in which the cell body appears as a dark, concentrated band (Figure 3A). This focal plane is acceptable as a standard because it properly focuses the cell. This was confirmed by visualizing the cell wall with Uvitex, a chitin stain (Figure 3B). The Uvitex stain clearly shows a crisp, focused cell wall with weak signal in the center (where the top and bottom of the cell body would be stained, out of focus).
In developing this method it was also important to confirm that this algorithm could accurately determine capsule and cell body measurements. While the representative circles in the previous figures are promising, actual measurements were compared between computer and human measurements. When the protocol is followed accurately and optimal images are obtained, the algorithm is accurate and reliable (Figure 4A). However, if the protocol is followed incorrectly and suboptimal images are obtained due to poor staining, overcrowding, or other previously mentioned parameters, the algorithm loses accuracy and cannot recapitulate human measurements (Figure 4B). Since this technique was originally developed for a specific individual (first author), a different individual was asked to use it to determine if differences between staining and measurement styles would affect accuracy despite following protocol. The results showed that this technique was widely applicable as long as the protocol was followed as instructed (Figure 4C). Similarly, this technique can be used with any microscope capable of acquiring phase contrast images of the prepared India Ink slides. To ensure the algorithm remains accurate with other microscope setups this experiment was repeated by a third investigator using a different bright field microscope coupled with a camera and compared detected capsule diameters with manually measured capsule diameters. No significant difference was observed between computer and human measurements (Figure 4D).
Finally, future applications of this algorithm were explored in the context of fluorescence staining. Since fluorescence imaging is still based on signal to noise ratios of pixel intensity values the algorithm should be readily applicable to fluorescence images so long as the stain is circular in nature. This application was confirmed when the algorithm was able to successfully detect Uvitex stained cell bodies from the previously described images (Figure 5A, 5B). Users should be careful to optimize the algorithm parameters for their experiment, and standardized protocols should be developed in the future for any new applications.
Figure 1: Representative results of an optimally obtained image. A. The initial image acquired by bright field microscopy of an India Ink slide. B. The binary image created using a threshold calculated from the average pixel intensity value added to the standard deviation. All values above this threshold are considered white and all below are considered black. C. A visualization of the capsules (green) and cell bodies (blue) detected by the algorithm. All images were obtained at 40x magnification with 2x2 binning. Please click here to view a larger version of this figure.
Figure 2: Representative results of a sub-optimally obtained image. A. The initial India Ink slide acquired via bright field microscopy. Uneven and inadequate staining results in a particularly bright background with gradients of intensity. B. The resulting binary image, in which capsules cannot clearly be distinguished due to high background signal. C. Several capsules are undetectable. All images were obtained at 40x magnification with 2x2 binning. Please click here to view a larger version of this figure.
Figure 3: Detecting cell bodies. A. Bright field image of capsule centered at the preferred focal plane. B. Uvitex fluorescence image of the cell body at the preferred focal plane. Images were obtained at 100x magnification with 2x2 binning. Please click here to view a larger version of this figure.
Figure 4: Comparisons of results for algorithm (black) and human (gray) analyses. A. When slides are prepared according to protocol and optimal images are obtained there is no appreciable difference between measurements. B. If the protocol is not followed the algorithm cannot accurately identify and measure capsules. Here specifically the background was not consistent and there was not clear contrast between capsules and background. Significant variations calculated via t-test is noted as * for P values < 0.05. C. An independent investigator was asked to follow the protocol and compare their analyses with the algorithm. Reliability is maintained across observers as long as the images are properly acquired. D. A second independent investigator with a second microscope was used to confirm the algorithm retains accuracy across individuals and hardware. Please click here to view a larger version of this figure.
Figure 5: A potential alternative application of the algorithm: identification and measurement of fluorescence microscopy. Cell bodies were stained and imaged with Uvitex, then identified by algorithm. The detected circle extends past what would be labeled as the cell wall because the detection is based on the fluorescence signal. The detection algorithm can be tailored to identify specifically the brightest accumulation of signal (the cell wall) by modifying the threshold used to generate the initial binary image represented in Figures 1B and 2B. Please click here to view a larger version of this figure.
Supplemental Figure 1: A representative screenshot of the application running in a Windows environment. Please click here to view a larger version of this figure.
Supplemental Figure 2: Representations of detected budding yeast cells. Scale bar represents 10 µm. A. A parent cell and bud each counted as separate cells within their own capsule. B. A parent cell and bud each counted twice, once for their own capsule and once for the other cell capsule, resulting in four total cells detected from one parent and one bud. Please click here to view a larger version of this figure.
Supplemental Figure 3: A representation of the final data provided after cell detection and measurement. Image file refers to the name of the original image. Total radius refers to the radius of the representative green circles, capsule and cell body combined. Capsule x and Capsule y refer to the coordinates of the capsule for which this data applies to. Body radius refers to the radius of the representative blue circles. Capsule radius refers to the total radius minus the body radius, resulting in the radius of just the capsule. These values will be in microns so long as the user included a pixel-to-micron conversion ratio in step 3.2.5. Please click here to view a larger version of this figure.
The critical steps of this technique are preparing the India Ink slide and acquiring the microscope images. While the algorithm has been successfully tested with a variety of slide and image techniques the recommended protocol is described in this manuscript. The polysaccharide capsule is detected based on the exclusion of India Ink particles from the domain of the capsule as these particles are too large to penetrate the polysaccharide fibril network. India Ink exclusion results in a bright circle on top of a dark background. The algorithm detects circles based on how well they contrast with their background. Thus, a heavy India Ink stain will result in higher contrast between polysaccharide capsule and background, increasing signal to noise ratio, and improving result quality. Conversely, the cell body is detected as a dark circle on top of a bright background. The cell body will change appearance based on which focal plane the microscope is set to, appearing as a diffuse grey circle at the top or bottom of the cell and as a condensed dark band at the center. For the same reasons already discussed, the focal plane where the cell body appears as a condensed, dark band should be used for image acquisition as this will result in the most accurate circle detection.
The method reported here has progressed through several modifications and rounds of troubleshooting. The algorithm was initially coded expecting that cells would not be smaller than 4 or larger than 60 pixels based on the microscope that was used. To expand the application of this algorithm to different magnifications and cell sizes these limits were instead replaced by the user input fields described in the protocol. Users may now input parameters specific to each experiment for maximum accuracy. If this algorithm is being applied to a situation outside of Cryptococcus capsule measurement it is recommended to first set up a series of range finding conditions to determine how samples should be generated and imaged.
The most significant limitation of this technique is that it was designed with a specific application in mind, namely the measurement of cryptococcal capsule. While it can be readily modified to fit additional applications, this script is only directly applicable to the capsule measurement protocol outlined above. However, this limitation also describes the significance of this method with respect to its field and to the existing methods. Additionally, budding yeast cells can present a problem for investigators who wish to only measure parent cell sizes. This algorithm is capable of detecting buds as unique cells (Figure S2A). First, this can be a problem if the investigator in which case they would wish to remove bud measurements, or remove both cells if it cannot be determined which detected circle is the bud and which is the parent. Second, this can cause another problem if the bud is detected as a cell body still within the confines of the parental capsule (Figure S2B) in which case the algorithm will measure the bud in reference to the parental capsule. In this example each cell will be counted twice because each cell body resides within two capsules. Either of these problems can be addressed easily once the protocol is finished. The final data set will appear as a spreadsheet where each individual detected cell is labeled according to the image file it came from, and the x and y coordinates of the cell body (Figure S3). Investigators can simply find and exclude the data which matches the bud. Despite capsule size being an important and heavily studied virulence factor the Cryptococcus field has yet to establish standard protocols for capsule measurement or image acquisition. This technique was designed to fill these roles in an accurate and convenient manner freely available to laboratories with minimal prerequisites.
Future applications of this technique are largely to apply it to other experiments. Any image based detection or measurement of circular objects should be analyzable through this algorithm. Fluorescent microscopy images can be analyzed by applying the algorithm to individual laser channels. Bacterial colony counting can be achieved, and with additional modification could distinguish between galactose reporters. Yeast colony growth assays could also be evaluated using this algorithm to estimate colony area size.
The authors have no conflicts of interest to disclose.
We would like to acknowledge Anthony Bowen whose slides were used as a second human side-by-side comparison as well as Sabrina Nolan whose slides were used as a third human side-by-side and second microscope comparison.
|India Ink||Becton, Dickinson and Co.||261194|
|Fisherbrand Superfrost Microscope Slides||Fisher Scientific||12-550-143||25x75x1|
|Fisherfinest Premium Cover Glass||Fisher Scientific||12-548-B||22x22-1|
|Sally Hansen HardasNails Xtreme Wear Nail Polish||Sally Hansen||N/A||109 invisible|
|Cryptotoccus neoformans||ATCC||208821||H99 strain|
|Olympus AX70 Microscope||Olympus||AX70TRF||Discontinued ; Bright Field Microscope|
|Qimaging Retiga 1300||Qimaging||N/A||Discontinued ; Camera Microscope Attachment|
|MATLAB||MathWorks||N/A||Most recent version recommended|
|Python Programming Language||Python||N/A||Version 2 necessary ; 2.7 recommended|
|Microsoft Excel||Microsoft||N/A||Most recent version recommended|
|Phosphate Buffered Saline (PBS)||Sigma||P3813|
- Park, B. J., Wannemuehler, K. A., Marston, B. J., Govender, N., Pappas, P. G., Chiller, T. M. Estimation of the current global burden of cryptococcal meningitis among persons living with HIV/AIDS. AIDS. 23, (4), 525-530 (2009).
- Kwon-Chung, K. J., et al. Cryptococcus neoformans and Cryptococcus gattii, the etiologic agents of cryptococcosis. Cold Spring Harb Perspect Med. 4, (7), 019760 (2014).
- Granger, D. L., Perfect, J. R., Durack, D. Virulence of Cryptococcus neoformans. Regulation of capsule synthesis by carbon dioxide. J Clin Invest. 76, (2), 508 (1985).
- Rumbaugh, J., Pool, A., Gainey, L., Forrester, K., Wu, Y. The Role of Cryptococcal Capsule in Pathogenesis of Cryptococcal Meningitis. Neurology. 80, (7), Supplement (P04.007) 007 (2013).
- Bojarczuk, A., et al. Cryptococcus neoformans Intracellular Proliferation and Capsule Size Determines Early Macrophage Control of Infection. Sci Rep. 6, (2016).
- Robertson, E. J., et al. Cryptococcus neoformans Ex Vivo Capsule Size Is Associated With Intracranial Pressure and Host Immune Response in HIV-associated Cryptococcal Meningitis. J Infect Dis. 209, (1), 74-82 (2014).
- Araujo, G. deS., et al. Capsules from Pathogenic and Non-Pathogenic Cryptococcus spp. Manifest Significant Differences in Structure and Ability to Protect against Phagocytic Cells. PLoS One. 7, (1), 29561 (2012).
- García-Rivera, J., Chang, Y. C., Kwon-Chung, K. J., Casadevall, A. Cryptococcus neoformans CAP59 (or Cap59p) Is Involved in the Extracellular Trafficking of Capsular Glucuronoxylomannan. Eukaryot Cell. 3, (2), 385-392 (2004).
- Guimarães, A. J., Frases, S., Cordero, R. J. B., Nimrichter, L., Casadevall, A., Nosanchuk, J. D. Cryptococcus neoformans responds to mannitol by increasing capsule size in vitro and in vivo: Mannitol impacts the structure of C. neoformans capsule. Cell Microbiol. 12, (6), 740-753 (2010).
- Zaragoza, O., Fries, B. C., Casadevall, A. Induction of Capsule Growth in Cryptococcus neoformans by Mammalian Serum and CO2. Infect and Immun. 71, (11), 6155-6164 (2003).
- Rossi, S. A., et al. Impact of Resistance to Fluconazole on Virulence and Morphological Aspects of Cryptococcus neoformans and Cryptococcus gattii Isolates. Front Microbiol. 7, (2016).