snow_partitioning_n#

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.

Parameters
  • 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 True indicating peaks; scipy.ndimage.label with cubic connectivity is used to label them. If this argument is provided then r_max and sigma are ignored, since these are specfically used in the peak finding process.

Returns

results – A custom object with the following data as attributes:

  • ’im’

    The original image of the porous material

  • ’dt’

    The combined distance transform in alll phases of the image

  • ’phase_max_label’

    The list of max label of each phase in order to distinguish between each other

  • ’regions’

    The partitioned regions of n phases using a marker based watershed with the peaks found by the SNOW algorithm

Return type

Results object

References

[1] Gostick, J. “A versatile and efficient network extraction algorithm using marker-based watershed segmentation”. Physical Review E. (2017)

[2] 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)

Notes

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.

Examples

Click here to view online example.