histomicstk.filters.shape

This package contains functions to enhance and/or detect objects of different shapes (e.g. blobs, vessels)

histomicstk.filters.shape.cdog(im_input, im_mask, sigma_min, sigma_max, num_octave_levels=3)[source]

SCale-adaptive Multiscale Difference-of-Gaussian (DoG) filter for nuclei/blob detection.

Computes the maximal DoG response over a series of scales where in the applicable scales at each pixel are constrained to be below an upper-bound equal to 2 times the distance to the nearest non-nuclear/background pixel.

This function uses an approach similar to SIFT interest detection where in the scale space between the specified min and max sigma values is divided into octaves (scale/sigma is doubled after each octave) and each octave is divided into sub-levels. The gaussian images are downsampled by 2 at the end of each octave to keep the size of convolutional filters small.

Parameters:
  • im_input (array_like) – A hematoxylin intensity image obtained from ColorDeconvolution. Objects are assumed to be dark with a light background.

  • mask (array_like) – A binary image where nuclei pixels have non-zero values

  • sigma_min (double) – Minimum sigma value for the scale space. For blob detection, set this equal to minimum-blob-radius / sqrt(2).

  • sigma_max (double) – Maximum sigma value for the scale space. For blob detection, set this equal to maximum-blob-radius / sqrt(2).

  • num_octave_levels (int) – Number of levels per octave in the scale space.

Returns:

  • im_dog_max (array_like) – An intensity image containing the maximal DoG response across all scales for each pixel

  • im_sigma_max (array_like) – An intensity image containing the sigma value corresponding to the maximal LoG response at each pixel. The nuclei/blob radius for a given sigma value can be calculated as sigma * sqrt(2).

References

histomicstk.filters.shape.clog(im_input, im_mask, sigma_min, sigma_max)[source]

Constrained Laplacian of Gaussian filter.

Takes as input a grayscale nuclear image and binary mask of cell nuclei, and uses the distance transform of the nuclear mask to constrain the LoG filter response of the image for nuclear seeding. Returns a LoG filter image of type float. Local maxima are used for seeding cells.

Parameters:
  • im_input (array_like) – A hematoxylin intensity image obtained from ColorDeconvolution. Objects are assumed to be dark with a light background.

  • im_mask (array_like) – A binary image where nuclei pixels have value 1/True, and non-nuclear pixels have value 0/False.

  • sigma_min (double) – Minimum sigma value for the scale space. For blob detection, set this equal to minimum-blob-radius / sqrt(2).

  • sigma_max (double) – Maximum sigma value for the scale space. For blob detection, set this equal to maximum-blob-radius / sqrt(2).

Returns:

  • im_log_max (array_like) – An intensity image containing the maximal LoG filter response across all scales for each pixel

  • im_sigma_max (array_like) – An intensity image containing the sigma value corresponding to the maximal LoG response at each pixel. The nuclei/blob radius value for a given sigma can be estimated to be equal to sigma * sqrt(2).

References

histomicstk.filters.shape.glog(im_input, alpha=1, range=None, theta=0.7853981633974483, tau=0.6, eps=0.6)[source]

Performs generalized Laplacian of Gaussian blob detection.

Parameters:
  • im_input (array_like) – A hematoxylin intensity image obtained from ColorDeconvolution.

  • alpha (double) – A positive scalar used to normalize the gLoG filter responses. Controls the blob-center detection and eccentricities of detected blobs. Larger values emphasize more eccentric blobs. Default value = 1.

  • range (array_like) – Scale range

  • theta (double) – Angular increment for rotating gLoG filters. Default value = np.pi / 6.

  • tau (double) – Tolerance for counting pixels in determining optimal scale SigmaC

  • eps (double) – range to define SigmaX surrounding SigmaC

Returns:

  • Rsum (array_like) – Sum of filter responses at specified scales and orientations

  • Maxima (: array_like) – A binary mask highlighting maxima pixels

Notes

Return values are returned as a namedtuple

References

histomicstk.filters.shape.vesselness(im_input, sigma)[source]

Calculates vesselness measure for grayscale image im_input at scale sigma. Also returns eigenvalues and vectors used for vessel salience filters.

Parameters:
  • im_input (array_like) – M x N grayscale image.

  • sigma (double) – standard deviation of gaussian kernel.

Returns:

  • Deviation (array_like) – M x N image of deviation from blob

  • Frobenius (array_like) – M x N image of frobenius norm of Hessian - measures presence of structure.

  • E (array_like) – M x N x 2 eigenvalue image - see eigen.py.

  • Theta (array_like) – M x N eigenvector angle image for E(:,:,0) in radians see eigen.py. Oriented parallel to vessel structures.

References