pywsi.segmentation package¶
Submodules¶
pywsi.segmentation.binary_segmentation module¶
-
pywsi.segmentation.binary_segmentation.
gmm_thresholding
(image_rgb)[source]¶ Perform thresholding based on Gaussian mixture models.
The image is assumed to be a mixture of two gaussians. A lower mean sample belongs to the blobs while the higher mean shows the white background.
Parameters: - image_rgb: array_like
RGB input
- Returns
- ——
- gmm_threshold: float
GMM mean (minimum) of the two mixing populations
- clf: sklearn.GaussianMixture
The entire sklearn model
-
pywsi.segmentation.binary_segmentation.
poisson_deconvolve
(h_channel_image)[source]¶ Separate baclground and foreground intensities by doing a poisson partition.
For the i_th pixel h(i) = P0*P(i|0) + P1*P(i|1) where P0,P1 are prior probabilities of background and foreground.
For a threshold t, the parameters are given by: P(t) = sum_{i=0}^t h(i) mu_0(t) = 1/P0(t) * sum_{i=0}^t i*h(i)
P1(t) = sum_{i=t+1}^I_max h(i) mu_1(t) = 1/P1(t) * sum_{i=t+1}^I_max i*h(i)
Parameters: - h_channel_image: array_like
uint8 image (single channel)
pywsi.segmentation.diff_gaussian module¶
pywsi.segmentation.fractal_dimension module¶
pywsi.segmentation.graph_cut module¶
pywsi.segmentation.helpers module¶
-
pywsi.segmentation.helpers.
collapse_labels
(labelled_image)[source]¶ Collapse labels in a labeleled image so that all labels are contigous
Parameters: - labelled_image: array_like
An image with labels
Returns: - label_collapsed_image: array_like
Image with contigous labels
-
pywsi.segmentation.helpers.
collapse_small_area
(labelled_image, minimum_area)[source]¶ Collapse labelled image removing areas with too low are.
Parameters: - labelled_image: array_like
An image with labels
- minimum_area: float
Areas with this and above area are retained
- Returns
- ——-
- label_collapsed_image: array_like
Image with contigous labels
pywsi.segmentation.max_clustering module¶
-
pywsi.segmentation.max_clustering.
max_clustering
(im_response, im_fgnd_mask, r=10)[source] Local max clustering pixel aggregation for nuclear segmentation. Takes as input a constrained log or other filtered nuclear image, a binary nuclear mask, and a clustering radius. For each pixel in the nuclear mask, the local max is identified. A hierarchy of local maxima is defined, and the root nodes used to define the label image. References [1] and [2]
Parameters: - im_response : array_like
A filtered-smoothed image where the maxima correspond to nuclear center. Typically obtained by constrained-LoG filtering on a hematoxylin intensity image obtained from ColorDeconvolution.
- im_fgnd_mask : array_like
A binary mask of type boolean where nuclei pixels have value ‘True’, and non-nuclear pixels have value ‘False’.
- r : float
A scalar defining the clustering radius. Default value = 10.
Returns: - im_label : array_like
im_label image where positive values correspond to foreground pixels that share mutual sinks.
- seeds : array_like
An N x 2 array defining the (x,y) coordinates of nuclei seeds.
- max_response : array_like
An N x 1 array containing the maximum response value corresponding to seeds.
References
[1] XW. Wu et al “The local maximum clustering method and its application in microarray gene expression data analysis,” EURASIP J. Appl. Signal Processing, volume 2004, no.1, pp.53-63, 2004. [2] Y. Al-Kofahi et al “Improved Automatic Detection and Segmentation of Cell Nuclei in Histopathology Images” in IEEE Transactions on Biomedical Engineering,vol.57,no.4,pp.847-52, 2010.
Module contents¶
-
pywsi.segmentation.
max_clustering
(im_response, im_fgnd_mask, r=10)[source]¶ Local max clustering pixel aggregation for nuclear segmentation. Takes as input a constrained log or other filtered nuclear image, a binary nuclear mask, and a clustering radius. For each pixel in the nuclear mask, the local max is identified. A hierarchy of local maxima is defined, and the root nodes used to define the label image. References [3] and [4]
Parameters: - im_response : array_like
A filtered-smoothed image where the maxima correspond to nuclear center. Typically obtained by constrained-LoG filtering on a hematoxylin intensity image obtained from ColorDeconvolution.
- im_fgnd_mask : array_like
A binary mask of type boolean where nuclei pixels have value ‘True’, and non-nuclear pixels have value ‘False’.
- r : float
A scalar defining the clustering radius. Default value = 10.
Returns: - im_label : array_like
im_label image where positive values correspond to foreground pixels that share mutual sinks.
- seeds : array_like
An N x 2 array defining the (x,y) coordinates of nuclei seeds.
- max_response : array_like
An N x 1 array containing the maximum response value corresponding to seeds.
References
[3] XW. Wu et al “The local maximum clustering method and its application in microarray gene expression data analysis,” EURASIP J. Appl. Signal Processing, volume 2004, no.1, pp.53-63, 2004. [4] Y. Al-Kofahi et al “Improved Automatic Detection and Segmentation of Cell Nuclei in Histopathology Images” in IEEE Transactions on Biomedical Engineering,vol.57,no.4,pp.847-52, 2010.