CellCounter


CellCounter

Introduction

This application contains functions to automatically count cells from pictures taken. The intention behind the application is to analyze pictures of cells taken under a microscope from a Neubauer counting chamber to quickly calculate cell numbers for the colonies in question. While it is intended for pictures of a counting chamber, it can also be used to count colonies inside a petri dish, but this use needs more user input and calibration and results vary depending on the quality of the image taken.

The idea for this counter is to apply a Marr wavelet, the 2D version of the Mexican hat wavelet, to the part of the image which should be analyzed. The effect of the wavelet is, that it enhances the parts of the picture which fit the shape of the wavelet, making it easier to distinguish those parts from the rest of the image. Because of its circular shape, it fits the form of cells really well, making it a good candidate for this application. For more informations about wavelets and their function, i can recommend this Tutorial.

Example

This is an example of how to analyze a picture. Filter.squareCalculator can be used to calculate the dimensions of the square to be counted in pixels using the specifications of the microscope and camera. Pipeline.processImage is then used to analyze the picture from the given path. The output is a tuple with the number of counted cells at the first position and a chart at the second position. The chart is a visualization of the image processing. The first image is the thresholded and transformed picture. The second image is the transformed image and the third one is the original imagepart which was analyzed with the recognized cells overlaid. The images are shown as heatmaps.

1: 
2: 
3: 
4: 
5: 
6: 
7: 
open CounterFunctions
open FSharp.Plotly

let dimension = Filter.squareCalculator 6.45 2. 20. 2.

let processedImage = Pipeline.processImage @"...\CellCounter\docsrc\files\img\4.tif"
                        dimension dimension 20. 0.2

A more thorough view of the project can be found here with a practical demonstration. For more explanations of the functions you can go there.

Samples & documentation

The library comes with comprehensible documentation. It can include tutorials automatically generated from *.fsx files in the content folder. The API reference is automatically generated from Markdown comments in the library implementation.

  • Tutorial contains a further explanation of this sample library.

  • API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding a new public API, please also consider adding samples that can be turned into a documentation. You might also want to read the library design notes to understand how it works.

The library is available under Public Domain license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.

namespace CounterFunctions
Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
namespace FSharp.Plotly
val dimension : int
module Filter

from CounterFunctions
val squareCalculator : cameraPixelSize:float -> binning:float -> magnification:float -> cameraMount:float -> int
val processedImage : int * GenericChart.GenericChart
module Pipeline

from CounterFunctions
val processImage : filePath:string -> height:int -> width:int -> radius:float -> multiplier:float -> int * GenericChart.GenericChart
Fork me on GitHub