A set of MATLAB scripts for quantification of microglia images acquired through brightfield microscopy.
Image processing and enhancement
Marker-controller watershed segmentation of microglia
Fractal analysis
Input images are preprocessed to enhace SNR for better cell segmentation. The current preprocessing steps are:
- Conversion to maximum intensity projection (MIP)
- Denoising with 2D Weiner filter
- Background feature removal with a top-hat filter
- FFT bandpass filter
- Image sharpening
The culmination of image processing in this order yielded the best segmentation results.
Steps in marker-controlled watershed segmentation
The processed image is subtly blurred with a Gaussian filter, using the MATLAB
function imgaussfilt
. A microglia mask (MM) is then created by thresholding
the Gaussian smoothed image, which is also subsequently used to create a soma
seed mask (SSM) by applying a higher threshold to demarcate bright regions
likely to be soma. Regions in SMM were shrunk to point-pixel and regions outside
of MM were removed to identify and index soma locations (SL). Then, a composite
image is created for marker-controlled watershed segmentation by imposing SL
onto inverted gaussian-smoothed as regional minima. The composite image
undergoes watershed segmentation to identify microglia. Microglia touching the
border or not overlapping with SL are first removed, then eroded by two pixels
to clean up watershed segmentation results. Microglia are then quantified by
metrics in the table below and any microglia with exclusion criteria are
rejected and removed.
Metrics are based on skeletonized microglia to capture their complicated network process
- 1. BranchPoints
- Total number of branch points detected in microglia.
- 2. EndPoints
- Total number of end points detected in microglia.
- 3. Branches
- Total number of branched segments in image.
- 4. MaxBranchLength
- Length of the largest branch found in microns (μm).
- 5. AverageBranchLength
- Average branch length in microns (μm).
- 6. TotalBranchLength
- Sum of all processes lengths on microglia.
A set of measures to quantify complexity of microglia structure.
- 1. Cell Area
- Area of pixels occupied by cell in microns (μm2) i.e., area of microglia. Also known as cell area (CA).
- 2. Cell Perimeter
- Distance around the boundary of microglia in microns (μm) i.e. perimeter of microglia. Also known as cell perimeter (CP).
- 3. Fractal Dimension
- Unitless measure of microglia complexity
- 4. Cell Circularity
- Roundness of microglia. A perfect circle has a value of 0, whereas an ellipsoid has a value of 1.
- 5. Span Ratio
- Ratio of convex hull ellipse’s minor length to major length, a measure of microglia elongation
- 6. Density
- Ratio of cell area (CA) to the convex hull area (CHA). This measure is an indicator of cell size. The higher the density, the smaller the microglia.
- 7. Convex Hull Area
- Convex hull is the smaller convex polygon that containing the whole microglia. All interior angles of a convex hull are smaller than 180ᵒ. The convex hull area (CHA) is the area of pixels occupied by convex hull in microns (μm).
- 8. Convex Hull Perimeter
- Distance around the boundary of convex hull in microns (μm) i.e. perimeter of convex hull.
- 9. Convex Hull Circularity
- Roundness of convex hull. A perfect circle has a value of 0, whereas an ellipsoid has a value of 1.
- 10. Roughness
- Ratio of cell perimeter (CP) to convex hull perimeter (CHP).
Change the variable pixel_micron
in L31 of ramificationStats.m to your pixel
to micron ratio. Then, call the function ramificationStats('Path to input image', 'Path to output directory')
to compute, process, and quantify an image containing microglia.
Example:
>> cell_stats = ramificationStats("D:\Datasets\Morphology\data\Benchmark\Input\w1t5m18_s20_40x_Sub2.TIF",'D:\SystemFiles\siddh\\Projects\\Mouse_Histology\Output');