Precise explanations for Threshold / Size setting for segmentation by object

I would like to perform a segmentation by object after having performed a classification by pixel.

Trained as a biologist, I would like to know, with not too technical indications, how the software makes the segmentations according to the different parameters possible to adjust.
The information noted in the documentation does not go into enough detail to be able to understand enough how the software works.
Would it be possible to have details for:

  • Smooth for X / Y / Z
  • Threshold Core / Final
  • Size filter Min / max

Thank you very much in advance!


welcome to the community! :slight_smile:

The goal of thresholding is to find the pixels that belong to individual objects. This is done by looking at the probability image. The probability image is normalized from 0 to 1 - we assume that the pixel values correspond to the probability that a pixel belongs to a specific class.

There are two different methods for thresholding, simple thresholding, and hysteresis thresholding. Both operate only on the probability image - in thresholding, the raw data is never accessed.

Simple thresholding

The probability image is cut off at a given value, the threshold. All pixels with a value greater than this threshold are considered object pixels. All below will be background.

Meaning of parameters in simple thresholding

  • smooth x, y, z: We allow you to apply a gaussian filter to the probability image. The sigma values operate per spacial direction (width, height, depth, respectively). Usually, images are isotropic in-plane, so you’d use the same values for x and y. But z could be different (since ilastik does not take into account image scaling, you can “correct” for anisotropic images by using a different (usually smaller) sigma in the z-direction). The larger values you choose, the more smoothing (blurring) is applied to the probabilities. In practice, fine details are reduced, but small holes could be closed by applying smoothing. It’s best to play around with those values and observe the results so you develop an intuition.
  • threshold: the value used to decide for each pixel, whether it is an object pixel or a background pixel
  • size filter min / max. The minimum and maximum number of neighboring pixels that are considered an object. Objects below the min and above the max are not considered in further analysis - they will not be detected as objects for further analysis. Useful to exclude small (or very large) “objects” in your image that you might not be interested in analyzing further, e.g. artifacts.

Hysteresis thresholding

Hysteresis thresholding is seeded watershed with a size filter for the seeds (core channel). Seeded Watershed is an image segmentation technique. Very roughly, it entails two steps:

  1. the detection step: determine starting objects (seeds) in the (probability) image. And
  2. the segmentation step: starting from the pixels of the seed objects, look into the selected final channel and check neighboring pixels if they meet specific criteria (and then include their neighbors, too, and so on).

Those two steps can be performed on different channels of your probability image.
During last year’s neubias webinar we have outlined the main idea (recording). This explains the seeded watershed bit and hints at the meanings of core and final threshold. The idea behind it is that you might have acquired multiple channels, with one being easily segmented and the other one more on the tough side (e.g., touching objects and the likes). Using something reliable as a seed (core) (as e.g., dapi, where you are usually sure that you’ll only have one per cell) helps you segmenting the other objects (e.g., cytosol).

Meaning of parameters in hysteresis thresholding

  • smoothing is the same as in simple threshold
  • core threshold: This is used to determine the seeds (sometimes this is also referred to as detection threshold). All pixels above this value in the selected core channel will be starting points for objects.
  • final threshold: this value is used in the segmentation step. Pixels in the final channel are included as object pixels if they are above the final threshold. When two objects “touch”, they will be preserved as individual objects, if the “* Don’t merge objects*” checkbox is checked (objects will be merged otherwise).
  • size filter. Basically, the same as in simple thresholding. It is important to note, that the threshold is applied to the seed channel (so very small/large seeds can be excluded and don’t result in objects).

I hope this helps you understand those values better. If not, please be persistent and ask for more information!

1 Like