A PyQt Matplotlib python application to detect automatically peaks from multiple profile segments drawn on high resolutuon microscopic images, edit by suppressing or adding extracted peaks, count stripes and measure their widths.
We developed this software to address a specific need that existing market solutions either do not meet or are not well-suited for. The chosen strategy was to create an ad-hoc software tailored precisely to these requirements. The approach is relatively straightforward, featuring two main stages. The first stage involves peaks detection, where the software identifies peaks based on an image intensity profile selected by the user, with various customizable criteria such as smoothing kernel or integration width along the profile. The second stage is an editing phase, allowing users to add or delete these automatically positioned peaks from the previous step, providing maximum flexibility and precision. The application has been designed to work seamlessly with high resolution images (25000x25000) recorded from microscopes using progressive subsampling technology.
The application has a very specific scope of use. It does not offer complex image processing algorithms, only basic adjustments such as contrast, brightness, and inversion. For more advanced processing, you will need to use dedicated image processing software in a preliminary phase. Similarly, once the peaks are edited and validated by the user, their positions, scales, and distances between each peak can be saved in a spreadsheet file (CSV format), ready to be processed in a subsequent phase.
The application is available from a GitHub repository and consists of a python Matplotlib-based application with a PyQt interface. It is designed to run in a Conda environment, with the installation process facilitated by a requirements.txt file to ease the creation of a dedicated environment. The necessary packages to be installed include PyQt5, scikit-image, opencv-python, opencv-contrib-python, opencv-python-headless, shapely, pycairo, matplotlib, peakutils, and pandas. See instructions bellow for details.
Here are the different steps :
git clone https://github.com/PBrockmann/StripesCounter
cd StripesCounter
conda create --name env_for_StripesCounter
conda env list
conda activate env_for_StripesCounter
conda install python
pip install -r requirements.txt
python test_imports.py
python detect_scale.py BEL17-2-2_1.35x_haut0001.png
python StripesCounter_v11.py
https://docs.opencv.org/4.5.4/d3/dc1/tutorial_basic_linear_transform.html
https://peakutils.readthedocs.io/en/latest/reference.html#module-peakutils.peak
thres (float between [0., 1.])
– Normalized threshold. Only the peaks with amplitude higher than the threshold will be detected.min_dist (int)
– Minimum distance between each detected peak. The peak with the highest amplitude is preferred to satisfy this constraint.thres_abs (boolean)
– If True, the thres value will be interpreted as an absolute value, instead of a normalized threshold.