Skip to main content
. 2019 Aug 30;10(9):666. doi: 10.3390/genes10090666
Algorithm 3: SP-IBC Clustering Algorithm
1. Input: Pre-processed cryo-EM image Ip
2. Return: Super-clustered image Isc
3. Set number of clusters, k
4. Generate the 2D super-pixel over segmentation image
5.  begin/* SLIC */
6.  Initialize the cluster centers Ck=lk,xk,ykT
7.  Move the cluster center cluster centers to the lowest gradient position in a 3 × 3 neighborhood.
8.  Set label li=1 for each pixel i.
9.  Set distance di= for each pixel i.
10.  repeat
11.   for k=1 to K do
12.    for each pixel i in 2S×2S region around Ck do
13.     Compute distance D between Ck and i.
14.     if D<di then
15.      Set di=D.
16.      Set li=k.
17.    end if
18.    end for
19.   end for
20.   Compute new cluster center θk.
21.   Compute residual error E.
22.  until Ethreshold
23.  Generate binary mask
24. end/* SLIC */
25. Transform the intermedia 2D image map Im into 1D Iv which has the intensity values of all the pixels.
26. L← height × width where L is the total number of pixels in the Ip
27. VMaxMaxIv/* maximum values of intensity in the image */
28. VMinMinIv/* minimum values of intensity in the image */
29. K← 4/* set the number of initial cluster based on the interval size = 0.15 */
30. for i = 1 to K do
31.  IntsVMaxVMinK×0.15×0.15/* set the interval size as the vector of intensity range (max min) divided by the cluster number K */
32. end for
33. for i = 1 to K do
34.  θkIntsi /* initialize the cluster center based on the interval size */
35. end for
36. repeat
37.    for i = 1 to K do
38.    for j = 1 to L do
39.     Clusterind min(absθk i Iv j/* assign xn the cluster k whose center (θk) is closest to xn according to the absolute intensity difference between the two */
40.   end for
41.  end for
42.  for n = 1 to K do
43.   θknn=1kClusterkcountones/* update the mean θk of each cluster by calculating the average intensity values of the pixels assigned to the cluster */.
44.  end for
45. until there is no change in cluster centers.