Hydrogel Microstructure Measurement

Date: 2025

In the lab, researchers typically use software like ImageJ/Fiji to manually measure the porosity and size of hydrogels. However, this process is time-consuming and makes it difficult to process large datasets

In this project, an algorithm was developed to replace the manual software analysis, automating the image processing and feature extraction with the objective of guiding the next generation design of hydrogels for tissue engineering applications.

Computer Vision

Using OpenCV and scikit-image, a computer vision algorithm capable of detecting pores (non-perfect circles) from hydrogel microscope images. The algorithm converts images to grayscale and applies adaptive thresholding to create binary images. Then, it uses morphological operations to remove noise and separate touching pores, and detects individual pores using contour detection.

For each pore detected, the algorithm extracts 7 morphological features: area, perimeter, equivalent diameter, circularity (where 1 equals a perfect circle), aspect ratio, eccentricity, and solidity.

n = 1000

Figure 1. Size vs Circularity

Machine learning

After extracting features from the pores, two different machine learning models were applied to analyze and classify the microstructure:

K-Means Clustering and Random Forest

Using scikit-learn, K-Means clustering classified pores into 4 types (large circular, medium semi-circular, large irregular), while Random Forest predicted pore quality with 98.3% accuracy based on morphological characteristics. For this demonstration, synthetic quality labels were used, but the model can be trained with real laboratory measurements for improved accuracy.

n = 400

Figure 3. Medium environment, n = 400.

n = 1000

Figure 1. Size vs Circularity

n = 400

Figure 3. Medium environment, n = 400.

n = 1000

Figure 1. Size vs Circularity