Microscopists like to say that seeing is believing. The so-called belief in this context is a product of highly experienced imagination, which raises a concern about the objectivity. To remain objective, we try to use analytical approaches to quantify images and turn phenotypes into numbers.
Many image analysis approaches exist nowadays, from simple manual measurements to more advanced machine learning models. In this article, I’ll give you an introduction to unbiased bio-image analysis and show you some tools that will help you quantify images.
Three Steps to Quantify Images
The analytical pipeline of phenotype quantification is actually quite complex, but can be separated into three main parts:
- Image segmentation,
- Analysis of segmented objects, and
- Data analysis.
I’ll demonstrate these parts in a few examples.
Figure 1 shows an image of a cell, which has fluorescently labeled punctate structures. They are probably some vesicles that transport material from one compartment to the other. For this analysis, we will count how many of these punctates are in a cell, and we will do it in a completely automated/unbiased fashion.
The above task can be done with the help of ImageJ, which is an open-source image analysis software. I would recommend that you install Fiji, which is an enhanced distribution of ImageJ and includes multiple image converters and analytical plugins. Fiji can be downloaded from fiji.sc free of charge and is available for Windows, Mac, and Linux.
Image Segmentation of Whole Cells
Image segmentation is probably the most important part of the analysis pipeline and the step in which most of the things can go wrong. Segmentation includes steps to identify the objects in the image and draw their boundaries. Several image segmentation competitions exist, which demonstrates the complexity and demands of this field. But in our case we will stick to the basics. We’ll first segment the cells in Figure 1 to demonstrate how it works. At the end of this part we’ll have new image with black and white regions—white representing cells and black representing the background. This will be used to tell the computer where the cells are in the image.
For segmentation, you could simply segment the cell out of the background by drawing a polygon or freehand shape selection around it. However, a more unbiased approach is to use a method called thresholding. Because the cells are on a dark background, you could tell Fiji to simply remove everything that is dark. While this works fine if the cell is very bright, it does not work well in our case where we have small bright spots. Try it yourself by opening the above image and selecting Image->Adjust->Threshold, and then play around with different methods for automatic thresholding.
Image Segmentation Refined
The solution is to first blur the image by applying a Gaussian filter with high sigma—values between 10 and 30 pixels usually work fine. Try the steps below and you’ll quickly see how blurring helps with the segmentation.
First, open the image in Fiji by dragging it into the main window. Make a duplicate of the image by right-clicking on the image, select Duplicate and OK. Apply the Gaussian blur from the menu by selecting Process->Filters. Choose 20 px as sigma.
You can then segment by thresholding the image. Play with different automated thresholding techniques and see which most closely matches the actual cell area—in our case this is the Mean method. Don’t forget to tick the Dark background option and then click Auto and Apply. The result is a binary image with one big object representing multiple cells. To separate these cells into individual objects use the Watershed algorithm by selecting Process->Binary->Watershed. In the end you should get an image similar to Figure 2.
Preparation of Segmented Objects for Analysis
Next, save individual cells as Region of Interests (ROI). Use the Wand tool and click on the binary mask of the first cell – you should see a yellow border appearing around it. Then press T on your keyboard—a ROI manager window will appear and the first entry in the list will be your first cell. Repeat this process for each cell—they will show up in the list in the ROI manager.
Now we’ll check how good the segmentation was. In ROI manager, select Show all (bottom right) to see the boundaries of the cells.
Congratulations, you segmented the cells in an unbiased way! If you are not satisfied with the results play around with different thresholding and blurring settings. You can also get some more tips from the ImageJ website.
Now let’s take some measurements.
Segmentation and Measurement of Spots
Segment and Threshold the Spots
We defined the cell boundaries in the previous part, now let’s move on to find the punctates and count them in each individual cell. To get started, we’ll need to segment the spots in the image. Start by duplicating the image and thresholding it, but this time use Local threshold. This is similar to the thresholding we used for cell segmentation except that it works on small segments of the image. This method works well if the intensity of the background changes throughout the image.
Identify the best method for thresholding. Select Image->Adjust->Auto local threshold and click OK. You’ll get a montage of all methods that can be used (you can zoom in to individual pictures to get the name of the method). In the example, the best methods are Bernsen and MidGrey—we’ll continue with Bernsen. Again open the Local thresholding dialog and select Bernsen method. This will produce a nice binary image of our spots (Figure 3).
Analyze the Spots
In this part we’ll return to the ROI manager where the information about the cell boundaries are stored. First, focus on the binary image of spots we made in the part above (Figure 3) and then select the first cell in the ROI manager. This will draw a yellow boundary around the area of the first cell (Figure 4). Then you can easily count the number of spots within the cell (marked with the yellow boundary) by selecting Analyze->Analyze particles. There are several options available. For example, you can limit the analysis to a certain subset of spots based on size and shape. We’ll just stick to the defaults here.
To get detailed information for each individual spot, select Display results – you would need this if you want to draw a histogram of the size distribution of the spots. But let’s keep to the total counts per cell only, by selecting Summarize and unchecking all other options. A table with results will open – don’t close it, as the results for other cells will add to it. Now repeat this for all other cells: select the next cell in the ROI manager and then Analyze Particles. Export the table of results to xls file and open it in your favorite spreadsheet software.
In this article, we got a primer on an unbiased approach to quantify images in microscopy. The above steps can be fully automated by building image analysis pipelines in some other software, such as CellProfiler.