deblend_segments

petrofit.segmentation.deblend_segments(image, segm, npixels=None, nlevels=30, contrast=0.001)[source]

Deblend overlapping sources labeled in a segmentation image.

Parameters:
imagearray like

Input image.

segmSegmentationImage 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.

npixelsint

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

nlevelsint, optional

The number of multi-thresholding levels to use. Each source will be re-thresholded at nlevels levels spaced exponentially or linearly (see the mode keyword) between its minimum and maximum values within the source segment.

contrastfloat, optional

The fraction of the total (blended) source flux that a local peak must have (at any one of the multi-thresholds) to be considered as a separate object. contrast must be between 0 and 1, inclusive. If contrast = 0 then every local peak will be made a separate object (maximum deblending). If contrast = 1 then no deblending will occur. The default is 0.001, which will deblend sources with a 7.5 magnitude difference.

Returns:
segment_imageSegmentationImage

A 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.