automated cell phenotyping — R package “EBImage”

[This article was first published on Tony's bubble universe » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Counting cells under microscope is always laborious and null. Those in the art would be relieved with assistance of a powerful image processing package, EBImage. Images are treated as “Image” objects, essentially multi-dimensional arrays. The class “Image” contains spatial information, pixel intensities, color channels, etc. Image objects are easily processed or modified using matrix algebraic operators. You can read the introduction document and their paper for more information.

In general, there are four steps using EBImage to automate your counting job.

  1. read the photos into R environment with readImage();
  2. extract the channel you intend to process with channel() or just subset();
  3. filter the noise, which is important to the result;
  4. get the result, e.g. the count number, labelled photo, phenotypic features.

The resulting image is shown here.

As I mention, the third step is critical, while the rest steps are straightforward. It would be easy when the background is as clean as a blue sky. But it is hard when the background gets dirty. For this particular photo, I used three steps to remove the noisy background: use thresh() to filter out noisy pixels; use opening() to enhance the morphological shapes; remove spots with less number of pixels. It turned out very well. The original code is published here at github.

The effectiveness of this filtering step is greatly dependent on the image quality. It means if the background is a mess, there is very little room for improvement. Instead of trying a bunch of filter parameters, however, there is one alternative way which requires manual curation. Use paintObjects(opac, col) to output cell-masked images, then check the cell counts. This would leave some additional work after automated processing. So rule of thumb, why just take some clean shots of your cells?

Btw, the authors locate at EMBL. No wonder the package name looks familiar.

To leave a comment for the author, please follow the link and comment on their blog: Tony's bubble universe » R. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)