Check out the Hyperspy Workshop May 13-17, 2024 Online

separate_learning_segments#

LearningSegment.separate_learning_segments(min_intensity_threshold=0, min_distance=2, min_size=10, max_size=inf, max_number_of_grains=inf, marker_radius=2, threshold=False, exclude_border=False)[source]#

Segmentation of loading maps by the watershed segmentation method implemented in scikit-image [1,2].

Parameters:
  • min_intensity_threshold (float) – Loading segments with a maximum intensity below min_intensity_threshold are discarded.

  • min_distance (int) – Minimum distance (in pixels) between grains required for them to be considered as separate grains.

  • min_size (float) – Grains with size (i.e. total number of pixels) below min_size are discarded.

  • max_size (float) – Grains with size (i.e. total number of pixels) above max_size are discarded.

  • max_number_of_grains (int) – Maximum number of grains included in the returned separated grains. If it is exceeded, those with highest peak intensities will be returned.

  • marker_radius (float) – If 1 or larger, each marker for watershed is expanded to a disk of radius marker_radius. marker_radius should not exceed 2*min_distance.

  • threshold (bool) – If True, a mask is calculated by thresholding the VDF image by the Li threshold method in scikit-image. If False (default), the mask is the boolean VDF image.

  • exclude_border (int or True, optional) – If non-zero integer, peaks within a distance of exclude_border from the boarder will be discarded. If True, peaks at or closer than min_distance of the boarder, will be discarded.

References

[1] http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_watershed.html [2] https://scikit-image.org/docs/dev/auto_examples/segmentation/plot_expand_labels.html#sphx-glr-auto-examples-segmentation-plot-expand-labels-py

Returns:

learning_segment – LearningSegment where the loadings have been segmented and some factors have been repeated according to the new number of loading segments.

Return type:

LearningSegment