Skip to content

masks

get_dab_mask(ihc, dab_thr=0.03, object_min_size=1000, hole_min_size=1000, tissue_mask=None, he=None, binary_op=None, r=10)

Computes a mask using otsu thresholding on DAB channel on an immunohistochemistry image.

Parameters:

Name Type Description Default
ihc NDImage

input immunohistochemistry image.

required
dab_thr float

minimum value to use for thresholding.

0.03
object_min_size int

the smallest allowable object size.

1000
hole_min_size int

the smallest allowable hole size.

1000
tissue_mask Optional[NDBoolMask]

mask to use on input image.

None
he Optional[NDImage]

input H&E image. If specified, pixels where DAB value is high for both ihc and he will be negative. This can be used for artifact detection.

None
binary_op Optional[Callable]

must be a binary operation from skimage.morphology (dilation, erosion, opening or closing).

None
r int

radius of the disk to use as footprint for binary_op

10

Returns:

Type Description
NDBoolMask

DAB thresholded mask.

get_mask_AE1AE3(he, ihc)

Compute mask on paired AE1AE3 immunohistochemistry and H&E images.

Parameters:

Name Type Description Default
he Union[Image, NDImage]

input H&E image. Mask is computed using a threshold on H channel.

required
ihc Union[Image, NDImage]

input immunohistochemistry image. Mask is computed using a threshold on DAB channel.

required

Returns:

Type Description
NDBoolMask

Intersection of H&E and IHC masks.

get_mask_PHH3(he, ihc)

Compute mask on paired PHH3 immunohistochemistry and H&E images.

Parameters:

Name Type Description Default
he Union[Image, NDImage]

input H&E image. Mask is computed using a threshold on H channel.

required
ihc Union[Image, NDImage]

input immunohistochemistry image. Mask is computed using a threshold on DAB channel.

required

Returns:

Type Description
NDBoolMask

Intersection of H&E and IHC masks.

get_mask_function(ihc_type)

Get mask function corresponding to an immunohistochemistry type.

Parameters:

Name Type Description Default
ihc_type str

name of the IHC technique.

required

Returns:

Type Description
Callable

Corresponding masking function.

get_tissue_mask(img_G, blacktol=0, whitetol=247)

Get basic tissue mask from grayscale image.

Parameters:

Name Type Description Default
img_G NDByteGrayImage

grayscale input image as numpy byte array.

required
blacktol int

minimum value to be considered foreground.

0
whitetol int

maximul value to be considered foreground.

247

Returns:

Type Description

Mask as a boolean array.

update_full_mask(full_mask, mask, x, y)

Update a portion of a large mask using a smaller mask.

Parameters:

Name Type Description Default
full_mask NDBoolMask

large mask to update.

required
mask NDBoolMask

small mask to use for update.

required
x int

x coordinate of top-left corner of mask on full_mask.

required
y int

y coordinate of top-left corner of mask on full_mask.

required

update_full_mask_mp(full_mask, mask, x, y, w, h)

Update a portion of a large mask using a smaller mask.

Parameters:

Name Type Description Default
full_mask Array

large mask to update.

required
mask NDBoolMask

small mask to use for update.

required
x int

x coordinate of top-left corner of mask on full_mask.

required
y int

y coordinate of top-left corner of mask on full_mask.

required