lazyslide_models.tile_prediction.cv_features.Contrast

lazyslide_models.tile_prediction.cv_features.Contrast#

class Contrast(lower_percentile=1, upper_percentile=99)#

Bases: _CVFeatures

contrast Spread between the 1st and 99th gray-level percentiles

Calculate the contrast of a tile.

Contrast is the gray-level range between lower_percentile and upper_percentile, as a fraction of the dtype range.

The tile can be in shape (H, W, C) for a single image or (B, C, H, W) for a batch of images.

Parameters:
lower_percentilefloat

Lower percentile for contrast calculation.

upper_percentilefloat

Upper percentile for contrast calculation.

columns = ('contrast',)#

Subclasses whose _func returns a dict set this explicitly; for the rest it is derived below from the class name, which is the same rule _process_batch uses to key its result.