This function propgates out the identified segments into the rest of the image, only region identified in the mask will not be assigned to a segment. To assign pixels a mixture of the Euclidian distance and the local gradient is used (as described below). The purpose of this routine is to identify all pixels in the image with their most likely segment (whether nominally object or sky pixel). The true sky pixels identified as belonging to a segment should also provide the best possible local estimate of the sky level.
For internal completeness, the below description is taken almost verbatim from the EBImage propagate function.
The method operates by computing a discretized approximation of the Voronoi regions for given seed points on a Riemann manifold with a metric controlled by local image features.
Under this metric, the infinitesimal distance d between points v and v+dv is defined by:
d^2 = ( (t(dv)*g)^2 + lambda*t(dv)*dv )/(lambda + 1)
, where g is the gradient of image x at point v.
lambda controls the weight of the Euclidean distance term. When lambda tends to infinity, d tends to the Euclidean distance. When lambda tends to 0, d tends to the intensity gradient of the image.
The gradient is computed on a neighborhood of 3x3 pixels.
Segmentation of the Voronoi regions in the vicinity of flat areas (having a null gradient) with small values of lambda can suffer from artifacts coming from the metric approximation.