The particle detection is currently requiring an image acquired in darkfield-mode (bright particles on dark background). The image segmentation is based on a watershed algorithm and is realized mainly using openCV functions and can be controlled using a number of parameters that are exposed to the user interface. Processing a very large image (e.g. 17000 x 17000 px) can take a few minutes, which makes interactive adjustment of the parameters difficult. Therefore, the particle detection window (shown below) displays a small region (1000 x 1000 px) on which the image segmentation takes usually less than a second. After having determined a useful set of parameters interactively, the parameter set can be applied to the entire fullimage by clicking on "detect all". Left-clicking anywhere in the main Window (fullimage) makes the preview window jump to that location. Alternatively, by right-clicking and dragging the mouse in the preview window allows to scroll over the full sample. The image below displays the general structure of the detection window: On the left the individual steps of the image segmentation algorithm is depicted (read from top to bottom). Each step can be previewed by pressing the corresponding preview button. When pressed, an overlay shows the state of the image segmentation until the selected step. With the transparency slider below the transparency of the overlay is controlled.
The following section explains the individual steps in detail.
1.) Contrast adjustment: After having done a grayscale adjustment, the contrast of the image is adjusted, if the corresponding checkbox is checked. For the adjustment, the curve in the histogram is applied, which can be modified by clicking and dragging the two control markers. The aim is to maximize the contrast between particles (bright) and background (dark).
3.) Thresholding: Next a threshold is applied at the given level. In the example, the threshold at 0.08 means, that every pixel that is >= 8 % of complete white will be considered as a particle. Thus, a binary image (black = background, white = particle) is obtained.
5.) Erode convexity defects: This is a function, which in most cases does affect the final segmentation and probably will be discarded in newer versions of GEPARD. It essentially looks for convexity defects (i.e., concave areas) and erodes the particles there. This could in some cases guide the watershed algorithm to split particles.
6.) Filter particles by size: The particles to detect can be filtered by their size for excluding too small particles. The function "measure fraction of particles" is currently still included for testing or demonstration purposes only. When set to any value smaller than 1.0, only a random fraction of the particles will be considered, according to the value (e.g. 0.3 means that 30 % of the particles is used). Important Note: The algorithm does not exactly give 30 % when set to 0.3, but approaches the value if the number of particles is sufficiently high. Do not take it for aliquotation of the sample. If you absolutely have to, run the particle detection once with fraction set to 1.0, note the total particle number and then run again with a lower fraction value. Note the new number and calculate the exact measured fraction!
7.) Show sure foreground: This preview shows how the "sure foreground", which is the starting point for the actual watershed algorithm, looks like. Everything in green will be definitely a particle, whereas each yellow spot depicts the center of each individual particle.
8.) Watershed compactness, Show watershed markers: Starting from the previously shown yellow dots the watershed algorithm tries to find particle borders. This can be controlled to some extent using the "compactness", a float value ranging from 0 to 1. It effects how "straight" the borders will be. The below image shows the two extremes of 0 (curvy boundaries) to 1 (perfectly straight boundaries). In most cases, values between 0 and 0.1 are useful. Clicking on "show matershed markers" displays the currently produced boarders.
9.) Detect, Detect all, Clear detection: Clicking on "detect" applies the parameters to the current preview, showing the final particle boarders and the measurement spots (refer to first overview image). Clicking on "detect all" applies the parameter to the entire fullimage, which can take a few minutes. "Clear detection" obviously deletes the currently detected particles.
10.) Manually editing the particles: The algorithm is likely to fail at several cases in the fullimage, which makes it adequate to manually edit the detected particles. This can be done at any time by drawing in the preview window (holding left mouse button) and pressing one of the following key combinations:
- a) Add "seed points": Ctrl
- b) Add "remove points": Ctrl+Shift
- c) Remove manually set points: Ctrl+Alt
The "show manual seed points" shows or hides the manually drawn points. Each drawn point will be inserted with the currently set "Seed radius", which can be edited using the corresponding spinbox or by spinning the mouse wheel up (size increase) or down (size decrease).