- snow_partitioning_n(im, r_max=4, sigma=0.4, peaks=None)[source]#
This function partitions an imaging oontain an arbitrary number of phases into regions using a marker-based watershed segmentation.
im (ndarray) – Image of porous material where each phase is represented by unique integer starting from 1 (0’s are ignored).
r_max (scalar) – The radius of the spherical structuring element to use in the Maximum filter stage that is used to find peaks. The default is 4.
sigma (scalar) – The standard deviation of the Gaussian filter used. The default is 0.4. If 0 is given then the filter is not applied.
peaks (ndarray, optional) – Optionally, it is possible to supply an array containing peaks, which are used as markers in the watershed segmentation. Must be a boolean array with
scipy.ndimage.labelwith cubic connectivity is used to label them. If this argument is provided then
sigmaare ignored, since these are specfically used in the peak finding process.
results – A custom object with the following data as attributes:
The original image of the porous material
The combined distance transform in alll phases of the image
The list of max label of each phase in order to distinguish between each other
The partitioned regions of n phases using a marker based watershed with the peaks found by the SNOW algorithm
- Return type:
 Gostick, J. “A versatile and efficient network extraction algorithm using marker-based watershed segmentation”. Physical Review E. (2017)
 Khan, ZA et al. “Dual network extraction algorithm to investigate multiple transport processes in porous materials: Image-based modeling of pore and grain-scale processes”. Computers in Chemical Engineering. (2019)
In principle it is possible to perform a distance transform on each phase separately, merge these into a single image, then apply the watershed only once. This, however, has been found to create edge artifacts between regions arising from the way watershed handles plateaus in the distance transform. To overcome this, this function applies the watershed to each of the distance transforms separately, then merges the segmented regions back into a single image.
Click here to view online example.