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

get_vdf_segments#

VirtualDarkFieldImage.get_vdf_segments(min_distance=1, min_size=1, max_size=inf, max_number_of_grains=inf, marker_radius=1, threshold=False, exclude_border=False)[source]#

Separate segments from each of the virtual dark field (VDF) images using edge-detection by the Sobel transform and the watershed segmentation method implemented in scikit-image [1,2]. Obtain a VDFSegment, similar to VDFImage, but where each image is a segment of a VDF and the vectors correspond to each segment and are not necessarily unique.

Parameters:
  • 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:

vdfsegs – VDFSegment object containing segments (i.e. grains) of single virtual dark field images with corresponding vectors.

Return type:

VDFSegment