histomicstk.segmentation.positive_pixel_count

class histomicstk.segmentation.positive_pixel_count.Output(NumberWeakPositive, NumberPositive, NumberStrongPositive, NumberTotalPixels, IntensitySumWeakPositive, IntensitySumPositive, IntensitySumStrongPositive, IntensityAverage, RatioStrongToTotal, IntensityAverageWeakAndPositive, RatioStrongToPixels, RatioWeakToPixels, RatioTotalToPixels)

Bases: tuple

IntensityAverage

Alias for field number 7

IntensityAverageWeakAndPositive

Alias for field number 9

IntensitySumPositive

Alias for field number 5

IntensitySumStrongPositive

Alias for field number 6

IntensitySumWeakPositive

Alias for field number 4

NumberPositive

Alias for field number 1

NumberStrongPositive

Alias for field number 2

NumberTotalPixels

Alias for field number 3

NumberWeakPositive

Alias for field number 0

RatioStrongToPixels

Alias for field number 10

RatioStrongToTotal

Alias for field number 8

RatioTotalToPixels

Alias for field number 12

RatioWeakToPixels

Alias for field number 11

class histomicstk.segmentation.positive_pixel_count.Parameters(hue_value, hue_width, saturation_minimum, intensity_upper_limit, intensity_weak_threshold, intensity_strong_threshold, intensity_lower_limit)[source]

Bases: Parameters

Parameters(hue_value, hue_width, saturation_minimum, intensity_upper_limit, intensity_weak_threshold, intensity_strong_threshold, intensity_lower_limit)

hue_value

Center of the hue range in HSI space for the positive color, in the range [0, 1]

hue_width

Width of the hue range in HSI space

saturation_minimum

Minimum saturation of positive pixels in HSI space, in the range [0, 1]

intensity_upper_limit

Intensity threshold in HSI space above which a pixel is considered negative, in the range [0, 1]

intensity_weak_threshold

Intensity threshold in HSI space that separates weak-positive pixels (above) from plain positive pixels (below)

intensity_strong_threshold

Intensity threshold in HSI space that separates plain positive pixels (above) from strong positive pixels (below)

intensity_lower_limit

Intensity threshold in HSI space below which a pixel is considered negative

histomicstk.segmentation.positive_pixel_count.count_image(image, params, mask=None)[source]

Count positive pixels, computing a label mask and summary statistics.

Parameters:
  • image (array-like) – NxMx3 array of RGB data

  • params (Parameters) – An instance of Parameters, which see for further documentation

  • mask (array-like) – A boolean mask. If present, only pixels where the mask is True are considered.

Returns:

  • stats (Output) – Various statistics on the input image. See Output.

  • label_image (array-like) – NxM array of pixel types. See Labels for the different values.

histomicstk.segmentation.positive_pixel_count.count_slide(slide_path, params, region=None, tile_grouping=256, make_label_image=False)[source]

Compute a count of positive pixels in the slide at slide_path. This routine can also create a label image.

Parameters:
  • slide_path (string (path)) – Path to the slide to analyze.

  • params (Parameters) – An instance of Parameters, which see for further documentation

  • region (dict, optional) – A valid region dict (per a large_image TileSource.tileIterator’s region argument)

  • tile_grouping (int) – The number of tiles to process as part of a single task

  • make_label_image (bool, default=False) – Whether to make a label image. See also “Notes”

Returns:

  • stats (Output) – Various statistics on the input image. See Output.

  • label_image (array-like, only if make_label_image is set)

Notes

The return value is either a single or a pair – it is in either case a tuple. Dask is used as configured to compute the statistics, but only if make_label_image is reset. If make_label_image is set, everything is computed in a single-threaded manner.