br Pre segmentation of test cells
3.3. Pre-segmentation of test cells
A test cell was defined as a cell for which we wished to check the possible reconstruction of its expected shape. Moreover, we wanted to assess the quality of the reconstruction and parameters characterizing the overlapped area of the deformed cells.
The first pre-processing work included preliminary segmenta-tion of the cells. The aim was to identify the approximate bound-ary of all 87414-49-1 in the analyzed field of view. This could be achieved using any method belonging to traditional image thresholding techniques; for example, an algorithm based on watershed trans-formation (Xing & Yang, 2016). The result of this operation was the mask, representing the positions and edges of all detected cells. A natural side effect of this transformation was deformation of the cell shapes, resulting from the nonlinear distribution of the pixel brightness or the overlapping problem. Cell reconstruction would allow restoring the original shape of the cells. The final step of the test cell preparation was similar to that of the cell patterns, as de-scribed in the previous step. In this stage, the image of each test cell was cut to a size of ρ = max (α, β ) + 30 pixels and stored as a separate unit. The set of test cells represented the candidates for reconstruction.
3.4. Similarity and sensitivity measures for two images
The measures of the sensitivity and similarity of patterns play important roles in speeding up the final reconstruction procedure.
The similarity of two RGB images is assessed based on the distance between these images. The Euclidean measure of distance between the pixel brightness values of two RGB images, with T representing the tested cell and P representing the pattern cell, was applied. This measure is defined as follows:
where T(i) and P(i) represent the brightness values of the ith pixel in the test and pattern images, respectively, while the indices R, G, and B denote the red, green, and blue channels, respectively. Based on this distance, the similarity measure of the test and pattern im-ages is defined as follows:
A smaller distance d results in greater similarity between the test and pattern cells.
The sensitivity is another measure that allows for calculating the differences between the corresponding pixel locations in the images representing the tested and pattern cells. This measure is based on the standard definition of sensitivity:
TP + FN
where TP is a true positive result and FN is a false negative re-sult. In the experiment, the tested cell mask (MT) and pattern mask (MP) were used to calculate TP and FN. The MT was superimposed onto the MP, and then, for all pixels within these masks, the fol-lowing conditions were verified:
TP is the sum of the pixels meeting condition A, while FN is the sum of the pixels meeting condition B. The similarity and sensi-tivity tests are very fast and could aid in reducing the number of analyzed reconstructions.
3.5. Final reconstruction of cells using PatchMatch
The final step of the cell reconstruction was based on the gen-eralized correspondence algorithm known as PatchMatch (Barnes et al., 2011). The algorithm divides the image into many small, overlapping rectangles of a fixed size, known as patches, and then analyzes the image based on its patches. The idea of the Patch-Match approach involves finding the most similar patch in image P for each patch of tested image T, representing the pattern. The searching takes place over all possible patch coordinates in image P. The similarity of the patches was measured by using definition (3). For a strong match, we propagated the patch to adjacent points P((x-1,y), (x,y-1)) on the image. The effect was that, if (x,y) repre-sented correct mapping and was in the coherent region R, all of this region below and to the right thereof would be filled with the correct mapping. This stage was known as propagation.
For a reasonable matching of patches, we attempted to improve it by means of random searching for stronger matches. Let vo be the current nearest neighbor of T in image P. We attempted to improve the matching by testing sequence of candidate neighbor fields ui with an exponentially deceasing distance from vo:
patches were examined until the current search radius wαi was below 1 pixel. In our solution, w was the maximum image dimen-sion and the value of α was equal to ½.
To accelerate the procedure, the tested image of the cell was rescaled to 32 × 32 pixels, which meant a certain reduction in the original cell images (the typical size of the cells was approximately 100 × 100). The experiments demonstrated that this scaling did not adversely affect the reconstruction quality.