histomicstk.segmentation.level_set

This package contains functions that implement commonly used level-set based methods for segmenting objects/regions in images.

histomicstk.segmentation.level_set.chan_vese(im_input, im_mask, sigma, dt=1.0, mu=0.2, lambda1=1, lambda2=1, iter=100)[source]

Region-based level sets.

Region-based level set implementation based on the Chan-Vese method. Provides cost terms for boundary length, the variance of intensities inside the zero level-set, and the variance of external intensities. Robust to initialization.

Parameters:
  • im_input (array_like) – A floating-point intensity image.

  • im_mask (array_like) – A binary mask initializing the level set image. Regions corresponding to the interior of the level-set function have value 1, with other regions having value 0.

  • sigma (double) – Standard deviation of smoothing filter for input image im_input.

  • dt (double) – Time step for evolving the level-set function im_phi. Default value = 1.0.

  • mu (double) – Boundary length weight for energy function. Default value = 0.2.

  • lambda1 (double) – Internal variance weight for energy function. Default value = 1.

  • lambda2 (double) – External variance weight for energy function. Default value = 1.

  • iter (double) – Number of iterations to evolve curve level set function over. Default value = 100.

Returns:

im_phi – An intensity image where the zero level set defines object boundaries. Can be further processed with fast marching methods or other to obtain smooth boundaries, or simply thresholded to define the object mask.

Return type:

array_like

References

histomicstk.segmentation.level_set.reg_edge(im_input, im_phi, well='double', sigma=1.5, dt=1.0, mu=0.2, lambda_=1, alpha=-3, epsilon=1.5, iter=100)[source]

Distance-regularized edge-based level sets.

Distance-regularization is used in this edge-based level set implementation to avoid numerical problems requiring costly re-initialization. Provides cost terms for boundary length, area, and regularization of the level set function. Foreground objects are assumed to have larger intensity values than background.

Parameters:
  • im_input (array_like) – A floating-point intensity image.

  • im_phi (array_like) – A floating-point initialization of the level-set image. Interior values are set to -c0, and exterior values set to c0, where c0 > 0.

  • well (string) – Choice of well function for regularization. Can be set to either ‘single’ or ‘double’ for single-well or double-well regularization, or any other value for no regularization. Default value = ‘double’.

  • sigma (double) – Standard deviation of smoothing filter for input image im_input.

  • dt (double) – Time step for evolving im_phi. Default value = 1.0.

  • mu (double) – Regularization weight for energy function. Default value = 0.2.

  • lambda (double) – Boundary length weight for energy function. Default value = 1.0.

  • alpha (double) – Area weight for energy function. A negative value is used to seed the interior of the foreground objects and then evolve the boundary outwards. A positive value assumes that the boundary begins outside the foreground objects and collapses to their high-gradient edges. Default value = -3.

  • epsilon (double) – Coefficient used to smooth the Dirac and Heaviside functions. Default value = 1.5.

  • iter (double) – Number of iterations to evolve curve level set function over. Default value = 100.

Returns:

im_phi – An intensity image where the zero level set defines object boundaries. Can be further processed with fast marching methods or other to obtain smooth boundaries, or simply thresholded to define the object mask.

Return type:

array_like

References