Lesson 40: Practicing Image Processing

(c) 2016 Justin Bois and Griffin Chure. This work is licensed under a Creative Commons Attribution License CC-BY 4.0. All code contained herein is licensed under an MIT license.

This tutorial was generated from a Jupyter notebook. You can download the notebook here.

Practice 1: Writing your own segmentation function

As you probably noticed during the previous two lessons, there are often a lot of small operations that are sometimes necessary before you can even extract the useful data from the image! Rather than writing out each step whenever you want to process an image, you should write a boilerplate function that can be used to segment any phase contrast image of bacteria. Your function should execute the following steps.

  1. Correct for "hot" or "bad" pixels in an image.
  2. Correct for uneven illumination.
  3. Perform a thresholding operation.
  4. Remove bacteria or objects near/touching the image border.
  5. Remove objects that are too large (or too small) to be bacteria. Think carefully! For a multipurpose function, would you always want the same area cutoff?
  6. Remove improperly segmented cells.
  7. Return a labeled segmentation mask.

Run your function on both the Bacillus subtilis (Lesson 37) and the E. coli (Lesson 39) image sets. Does your function work well in both cases? In both of these images, the interpixel distance is 0.063 µm per pixel

Practice 2: Extracting fluorescence information

In the previous two lessons, we learned how to identifiy cellular objects in an image that is mostly non-cellular. However, we did not cover how you would extract information from one image (such as the fluorescence image) given a segmentation mask generated from another. Your goal for this practice session is to extract either the mean fluorescence intensity or (for bonus points) the total fluorescence intensity of each cell in our Lesson 39 E. coli image. To do this, you should.

  1. Read the documentation for skimage.measure.regionprops and see what properties you can extract given an intensity image and a segmentation mask.

  2. Using your segmentation mask generated from question 1, extract and store the mean and/or total fluorescence intensity for each cell in a single image in an array or pandas DataFrame.

  3. Generate a histogram of your extracted intensities.

Can you get a good idea of how bright a standard cell is from processing a single image?