Method 500 may begin at block 510 where the method may obtain a biological sample image, where, as discussed above, the biological sample may have been stained with staining platform 123, and the image of the biological sample may have been obtained by scanning platform 125. At block 520, the method may generate a plurality of superpixels for the image, i.e., group the pixels within the image into a plurality of superpixels, using, for example, superpixel generator 110. At block 530, the method may extract, for each superpixel (or substantially for each superpixel as in some embodiments some superpixels can be omitted or disregarded) a feature vector comprising a plurality of image features that characterize the superpixel. As discussed above, this operation can be performed, for example, by feature extractor 111.
At block 540, the method may use k-means clustering or another suitable algorithm to group the superpixels into a predefined number of clusters, using, for example, clustering engine 112, as discussed above. At block 550, the method may store for each superpixel its clustering information (e.g., its cluster's identifier), using, for example, storage interface 113, as discussed above. At block 560, the method may store either the centroid vectors of all clusters, or the precalculated distances between each two clusters, or both, using, for example, storage interface 113, as discussed above.