make_segments

petrofit.segmentation.make_segments(image, npixels=None, threshold=3.0)[source]

Segment an image.

Parameters:
imagearray like

Input image

npixelsint

The number of connected pixels, each greater than threshold, that an object must have to be detected. npixels must be a positive integer.

thresholdfloat or array-like

The data value or pixel-wise data values to be used for the detection threshold. A 2D threshold must have the same shape as data. See detect_threshold for one way to create a threshold image.

Returns:
segment_imageSegmentationImage or None

A 2D segmentation image, with the same shape as data, where sources are marked by different positive integer values. A value of zero is reserved for the background. If no sources are found then None is returned.