### Plant growth simulation algorithm (PGSA)

The PGSA is a bionic random algorithm guided by plant phototropism (the ability of a plant to bend towards the light source). The light source is the global optimal solution and the PGSA simulates the mechanism of plant phototropism by assessing the morphactin concentration on the growth points of the plant. This morphactin concentration decides the growth of branches and leaves and is dependent on the intensity of light. PGSA regards the feasible region of Integer programming as plant growth environment and evaluates the probability on different growth points according to the changes in the light intensities taken as the corresponding objective function (Li and Wang 2008; Bhattacharjee and Paul 2016). The algorithm emphasises on a plant system’s method of making decisions which are based on plant’s growth rules and probability models. Biological experiments state the following plant growth laws: First, the node on the plant with a higher morphactin concentration has a greater probability to grow into a branch. Second, the morphactin concentrations on these nodes vary according to the environmental information and the relative positions of these nodes on the plant. If a node has the highest morphactin concentration and hence, if it grows into a branch, the morphactin concentrations of all the remaining plant nodes will be freshly allotted as per the new environment and the just branched node will have a concentration equal to zero.

### Mathematical model for plant growth

According to the probability model of PGSA, *f*(*i*) is the fitness function for the node *i* on the plant to grow in the given environment. The biological laws of plant growth specifies that if the value of *f*(*i*) is smaller, then node *i* has a better environment for growing into a new branch. The mathematical model of PGSA is as follows. Given a root \(R_{0}\), a trunk *T* grows from the root. Assuming that there are *n* nodes on the trunk *T* that might provide a more thriving growth environment than the root, i.e. the fitness function \(f(R_{Ti}\)) < \(f(R_{0} )\; \left( {i = 1,2, \ldots ,n} \right),\) the morphactin concentrations \(C_{Ti}\) of these nodes are shown in Eq. (1).

$$C_{Ti} = \frac{{f\left( {R_{0} } \right) - f\left( {R_{Ti} } \right)}}{{\mathop \sum \nolimits_{i = 1}^{n} \left( {f\left( {R_{0} } \right) - f\left( {R_{Ti} } \right)} \right)}}\quad \left( {{\text{i}} = 1,2, \ldots ,{\text{n}}} \right)$$

(1)

The above equation shows that the morphactin concentration of a node in a plant is dependent on the growth environment of all the nodes on the plant. A change in the concentration of one node, therefore effects the rest. These concentrations can be imagined as a state space of the interval [0,1] because the \(\sum {C_{Ti} }\) = 1. The state space can be shown as in Fig. 1.

Now, from the state space of concentrations a random number is obtained which returns a random concentration \(C_{TM}\). The corresponding preferential node \(R_{TM}\) takes the priority in the next iteration to branch out. However, the node \(R_{TM}\) will grow into a branch only if the random number *β* satisfies the following two Eqs. (2) and (3).

$$0 \, \le \beta \le \mathop \sum \limits_{i = 1}^{M} C_{Ti} \quad \left( {M = 1} \right)$$

(2)

$$\mathop \sum \limits_{i = 1}^{M - 1} C_{Ti} < \beta \le \mathop \sum \limits_{i = 1}^{M} C_{Ti} \quad \left( {M = 2,3, \ldots ,n} \right)$$

(3)

After the branch sprouts out, the morphactin concentration of the current node, \(R_{TM} ,\) is set to zero and the morphactin concentration of the remaining nodes is reallocated as follows:

$$C_{Ti} = \frac{{f\left( {R_{0} } \right) - f\left( {R_{Ti} } \right)}}{{\mathop \sum \nolimits_{i = 1,i \ne M}^{n} \left( {f\left( {R_{0} } \right) - f\left( {R_{Ti} } \right)} \right) + \mathop \sum \nolimits_{j = 1}^{p} \left( {f\left( {R_{0} } \right) - f\left( {R_{bj} } \right)} \right)}}$$

(4)

$$C_{Ti} = \frac{{f\left( {R_{0} } \right) - f\left( {R_{bj} } \right)}}{{\mathop \sum \nolimits_{i = 1,i \ne M}^{n} \left( {f\left( {R_{0} } \right) - f\left( {R_{Ti} } \right)} \right) + \mathop \sum \nolimits_{j = 1}^{p} \left( {f\left( {R_{0} } \right) - f\left( {R_{bj} } \right)} \right)}}$$

(5)

After the reallocation of the concentrations to all the nodes on the plant except \(R_{TM}\), the state space of concentrations is again formed with the same interval [0, 1]. Assuming, the newly grown branch *b* has *p* nodes, such that \(f(R_{bi}\)) < \(f\left( {R_{0} } \right) \;\left( {i = 1,2, \ldots ,p} \right),\) again a random number *β* is thrown in the state space and a new node branches out in the next iteration. The new state space has greater number of nodes now, i.e. the nodes previously present (*n* nodes) and the nodes on the new branch *b* (*p* nodes). This growth process stops in the bionic world when the plant has reached its maturity and cannot further branch out.

The PGSA has huge potential to be used in optimization problems. Here, the control parameters are the fitness function [*f*(*i*)], the initial solution (root), search domain of candidate solutions (length of the trunk and branches) and candidate solutions (plant nodes). Further, it has a well-balanced exploration to exploitation ratio (Crepinsek et al. 2013). This method keeps exploring the entire search space with random node selection in the search interval [0, 1]. Although, candidate solutions (nodes) grow in each iteration the search space still remains in the interval [0, 1]. After the exploration, upon the selection of the best candidate solution (preferential node), the morphactin concentrations are reassigned by a neighbourhood like search that assesses the nodes in the vicinity of the just grown branch. The morphactin is not only assigned to the nodes on the new branch by exploitation but also to the previous nodes on the trunk by exploration in a given iteration. This is mainly because the objective function (growth environment) is dependent on the concentration of all the nodes on the plant. Thus PGSA has a well-balanced exploration to exploitation ratio which is necessary for any search optimization algorithm.

There have been many algorithms, both traditional and evolutionary, that have been used for circle detection. As has been stated in the background study, all these methods had some disadvantages. PGSA, being inspired from plant phototropism has many advantages that can be used to solve the circle detection problem. The steps of the algorithm has been outlined in Fig. 2.

Our approach is to use the above efficient naturally occurring technique to solve the leukocyte detection problem the overview of which is presented hereunder (Figs. 3, 4).

#### Data pre-processing

To employ the proposed scheme with respect to leukocyte detection, the smear images are pre-processed to obtain two new images. (1) The segmented image and (2) The edge pixel map of the segmented image. For the segmentation pre-processing part, the WBCs are isolated from other structures including red blood cells and the background pixels. Information of colour, brightness, and gradients are used with a corresponding threshold to generate classes to classify each pixel. A histogram thresholding has been incorporated to segment the WBCs.

Now that the segmentation is done, the corresponding edge map is produced. The edge map maintains the total object structure while being just a simple representation of the original image. There many different methods to detect the edges, but for our work the morphological edge detection procedure has been used (Fu and Han 2012; Chandrasiri and Samarasinghe 2014) where erosion followed by inversion of the original image is carried out to ultimately compare it pixel-by-pixel with the original image. This results in the detection of pixels which are present in both the images. This gives the calculated edge map.

Thereafter, the (\(x_{i} , y_{i}\)) coordinates for every pixel \(p_{i}\) defining the image edge is stored in the image edge pixel vector P = \(\{ p_{1, } p_{2} , \ldots ,p_{Np} \}\), with \(N_{p}\) being the total number of pixels defining the edge of the analysed image.

#### Particle representation for candidate solutions

For the implementation of the algorithm the set of candidate solutions needs to be initialized. For this purpose, the circle candidates need to be constructed using the three non-collinear points on the edge of the circle, previously stored in the vector P. The indices which represent three edge pixel points are grouped assuming that the circle’s contour map connects them together. Let the indices be \(e_{i} , i = \left\{ {1,2,3} \right\}\), then the circle *C* passing through these points can be the potential candidate solution for the circle detection problem. *C* = {\(p_{{e_{1} }} , p_{{e_{2} }} , p_{{e_{3} }}\)}. The centre and radius of the circle *C* are given by the well-known second degree equation as seen in Eq. (6).

$$\left( {x - x_{0} } \right)^{2} + \left( {y - y_{0} } \right)^{2} = r^{2}$$

(6)

Here \(x_{0}\) and \(y_{0}\) are computed using

$$x_{0} = \frac{\det \left( A \right)}{{4\left( {\left( {x_{j - } x_{i} } \right)\left( {y_{k} - y_{i} } \right) - \left( {x_{k - } x_{i} } \right)\left( {y_{j} - y_{i} } \right)} \right)}},\quad y_{0} = \frac{\det \left( B \right)}{{4\left( {\left( {x_{j - } x_{i} } \right)\left( {y_{k} - y_{i} } \right) - \left( {x_{k - } x_{i} } \right)\left( {y_{j} - y_{i} } \right)} \right)}}$$

(7)

where,

$$A = \left[ {\begin{array}{*{20}l} {x_{j}^{2} + y_{j}^{2} - \left( {x_{j}^{2} + y_{j}^{2} } \right)} \hfill & {\quad 2\left( {y_{j} - y_{i} } \right)} \hfill \\ {x_{k}^{2} + y_{k}^{2} - \left( {x_{i}^{2} + y_{i}^{2} } \right)} \hfill & {\quad 2\left( {y_{k} - y_{i} } \right)} \hfill \\ \end{array} } \right]$$

and

$$B = \left[ {\begin{array}{*{20}l} {2\left( {x_{j} - x_{i} } \right)} \hfill & {\quad x_{j}^{2} + y_{j}^{2} - \left( {x_{i}^{2} + y_{i}^{2} } \right)} \hfill \\ {2\left( {x_{k} - x_{i} } \right)} \hfill & {\quad x_{k}^{2} + y_{k}^{2} - \left( {x_{i}^{2} + y_{i}^{2} } \right)} \hfill \\ \end{array} } \right]$$

and

$$r = \sqrt {\left( {x - x_{b} } \right)^{2} + \left( {y - y_{b} } \right)^{2} }$$

Here det(.) stands for the determinant and \(b \in \{ e_{1} ,e_{2} ,e_{3} \}\). Therefore, a set of parameters is represented for each circle \([x_{0} ,y_{0} ,r]\) as a transformation *T* for all edge vector indices \(e_{1} ,e_{2} ,e_{3}\) which yields:

$$[x_{0} ,y_{0} ,r] = T\left( {e_{1} ,e_{2} ,e_{3} } \right)$$

(8)

By considering each index as a particle in the search space, the continuous search space is explored by using PGSA for a lookup of circle parameters [\(x_{0} ,y_{0} ,r].\)

#### Fitness function for the circle detection problem

Before defining the fitness function of the proposed scheme in context of the problem at hand, it is necessary to validate whether the circumference coordinates of the candidate circle *C* exists in the edge image. Upon this validation, the fitness function can be calculated. The coordinates spanning the circle circumference are \(J = \{ j_{1} ,j_{2} , \ldots ,j_{N} \}\), where \(N\) is the total number of pixel points used for validating the circle coordinates i.e. whether the candidate circle is in the edge map of the image. Thereafter, the fitness function *f*(*C*) is defined as the pixel by pixel similarity error between the above set of pixels J of the circle candidate *C* (particle) and the pixels of the edge map, giving a greater fitness value for a higher resemblance. This function is given as follows,

$$f(\varvec{C}) = 1 - \frac{{\mathop \sum \nolimits_{i = 1}^{N} E(j_{i} )}}{N} - \frac{{W_{p} }}{{B_{p} }}$$

(9)

where, \(E(j_{i} )\) is the expectation function of the presence of the candidate circle pixel at \(j_{i}\). Thus, \(E(j_{i} )\) has maximum value of 1 if the pixel \(j_{i}\) is an edge pixel point. For all other pixel points, the expectation function has a zero value. Also, \(W_{p}\) is the amount of white pixel falling inside the candidate circle represented by *C* and \(B_{p}\) is the amount of black pixels falling inside *C* (Cuevas et al. 2012a, b, c). These two parameters have been taken into the calculation of the objective function as analysis of smear images cannot be done by directly applying the PGSA algorithm to such images. Smear images present different imaging conditions and staining intensities, which result in noisy edge maps. Thus, in order to use PGSA based circle detector within the context of WBC detection, the fitness function requires these parameters.

#### PGSA implementation

The PGSA has the following steps.

*Step 1* The Canny filter finds and stores the edges in the vector *P* as discussed in the pre-processing step, where *P* contains the set of all edge pixels of the image. The iteration index is set to 1.

*Step 2* *k* initial particles are generated \((C_{a,iteration = 1} ,a \in [1.{\text{k}}])\) in the plant growth environment state space.

*Step 3* The fitness function \(f\left( {C_{a,iteration = i} } \right)\) is evaluated to find the best candidate solution like \(B_{M2}\) as mentioned in the PGSA discussion in the previous section. This best candidate solution is named as \(C^{best} \leftarrow \arg \hbox{min} \{ f(C_{a,iteration = i} )\} .\)

*Step 4* As per the PGSA discussed in the previous section, the constraint satisfaction at each of these particles (nodes) is checked, that is their morphactin concentration is calculated as per the Eq. (1). The particle with the higher morphactin concentration has a higher probability to branch out or move to the next iteration as an evolved candidate solution.

*Step 5* The new branch position, which is the new particle’s position is stored and the morphactin concentrations of all the particles are calculated again according Eq. (4) and Eq. (5) except for \(C^{best}\) as it has already produced a branch i.e. it is the best solution and hence is the current local optimum solution.

*Step 6* For every new particle, a maximum number of *q* particles are generated as per *j* = 1, 2,…,*q* discussed previously and based on the newly calculated morphactin concentration in *Step 5*, the new best candidate is found on the current generated branch in the previous step. This accounts for a neighbourhood like search for optimal candidate solutions. This process of generating new candidate solutions continues till a better minimized objective function is achieved and stops till there is no improvement in the fitness value of the generated candidate solutions.

*Step 7* The set of all nodes that have branched out are the possible candidate solution with the final node \(C^{best}\) being the global best solution and others the local optimal solutions.

*Step 8* From the original edge map, the algorithm marks the points corresponding to \(C^{best}\). In case of multi-circle detection it jumps to *Step 2*.

*Step 9* Finally, the best particle \(C_{{N_{c} }}^{best}\) from each circle is used to draw (over the original image) the detected circles, where \(N_{c}\) is the number of circles detected.