Image Segmentation

Thresholding

(requires: Automatic Measurement)

A Basic Way to Threshold an Image

Specifying correct threshold limits is a crucial procedure of the automated image analysis. The point is to determine which pixels will and which will not be included in the binary layer and thereby distinguish objects to be analyzed from background. Thresholding can be performed in the following modes:

  1. Open or capture the image to be thresholded.

  2. Run the View > Analysis Controls > Thresholding command to display the Thresholding panel:

  3. In the top toolbar, select the color mode which will be used for thresholding. According to the type of image opened, the following modes could be available: RGB, HSI, Intensity and MCH. See Color Modes.

  4. Select one of the pixel-picking tools (e.g. ) and start clicking on objects in the image you want to detect. Color values of each of the clicked pixel(s) are used to adjust the low and the high threshold values so that the clicked pixel would stay inside the thresholded interval.

    Apart from this clicking method, the thresholds can be adjusted directly within the histogram by dragging the vertical lines which highlight the thresholded interval.

  5. All pixels having their numeric values inside the thresholded interval become a part of the resulting binary layer.

  6. Very often, also other binary objects appear in the image which you did not intend to detect, for example dust particles with intensity similar to the specimen, etc. To eliminate these mis-detected object, use one or more tools available at the bottom of the panel. You can either apply some morphology functions to the binary layer or apply size or circularity restrictions to detected objects. See Tips and Tricks.

Color Modes

RGB

The RGB thresholding mode is available only if an RGB image is opened. There are two ways how to define the threshold limits, by choosing reference points within the image, or by defining the limit values for each color channel.

HSI

The HSI thresholding mode is available only if an RGB image is opened. The thresholding procedure works the same way as in the RGB mode except that the pixel values are displayed in the HSI (Hue, Saturation, Intensity) color space and that the Saturation and Intensity channels can be switched OFF. Therefore you can threshold over the H, HS, or HI channels only. Switch the channel off by deselecting the check box in the top-left corner of the channel histogram.

Per channel

In this mode, the channels are handled separately, a binary layer is created for each channel and also, the binary processing functions (Smooth, ...) can be adjusted differently for each channel. Switch between the channels by selecting their names in the bottom pull-down menu.

This mode is dedicated to perform threshold on multichannel images, but can be applied to RGB images as well. It is not available when working with a monochromatic (single channel) image.

Intensity

The thresholding procedure works the same way as in the RGB mode except that it is performed on the intensity pixel values.

Thresholding Tools

Reset

This button erases the threshold settings (no binary objects are created).

Single point threshold tool

Select it and click inside the image to define the threshold. The threshold ranges will be adjusted so the selected pixel will fit inside.

3 point circle tool

Picks threshold from the radius of 3 pixels.

6 point circle tool

Picks threshold from the radius of 6 pixels.

Undo

Reverses the previous threshold operation.

Redo

Returns the threshold as it had been before the Undo button was used.

Re-threshold image

Use this button to update the binary layer according to the current settings. The purpose of this button is to obtain the original binary layer in case it has been modified e.g. by a command from the binary layer.

Keep Updating Binary

Press this button to keep the binary layer up-to-date all the time. You may find this function useful especially when thresholding is applied to the live image.

Threshold ND image

When an ND2 file is opened, this button appears. Define the threshold limits on the current frame and use the button to apply it on the whole ND2 file.

Full Image/Use ROI

If selected, threshold is defined only on the area of the Region Of Interest.

Save / Load Threshold Settings

This button invokes a pull-down menu which enables the user to load/save the current threshold settings from/to an external file (*.threshold).

Zoom

Zoom the histogram in/out.

Auto Zoom

Zooms the histogram to fit the preview window.

Auto Range

Zooms the histogram so that the high and low threshold lines are distinguishable. For example, if a small intensity range is defined on a 16bit image the low and high lines are displayed as one-pixel line. Pressing this button will stretch the histogram in order to display the lines separately.

Example Procedure

(requires: Automatic Measurement)

  1. Threshold the image using the Intensity measurement option in the Thresholding control panel.

  2. Clean the image to remove detected small non-nuclei areas.

  3. Select features to be measured in the Automated Measurement Results control panel. Press the Options button and choose the Select Object Features command. An Object Measurement Setup window appears. Add or remove features you want to measure.

  4. Press the Update measurement button in the Automated Measurement Results control panel to measure image features. Overview the results. Press the Store Data button to save the data for future reference.

  5. Right click the Turn ROI On/Off button in the right document toolbar. Choose the ROI > Move Binary to ROI command. Each binary object turns into separate ROI.

  6. Threshold the cell nucleoli in the nuclei the same way as was already described above using the Thresholding control panel.

  7. Measure the thresholded nucleoli using the Update measurement button in the Automated measurement Results control panel. Press the Store Data button to save the data.

  8. Group results per ROI: drag the title of the column called RoiID into the grey area above the columns. You can drag and drop any combination of features as well. Results always group according to such selected features.

  9. Turn on the graph using the Show Histogram button.

    The histogram displays the selected feature of interest. If you want to display different feature - press the right mouse button over the data table on the left and open the Feature of Interest submenu. Select another feature. The histogram recalculates automatically.

  10. To get the information about area percentage, select the Field measurement option in the top toolbar of the Automated measurement Results control panel.

    Field 1 displays results of measurement when measured without ROI. That means % of nucleoli in the entire image.

    Field 2 displays results of measurement when measure with ROI on. That means % of nucleoli within the nuclei.

  11. You can export the result to various locations using the Export command.

Tips and Tricks

Threshold Adjustments

Thresholding parameters can be adjusted very precisely in the following way:

  • Threshold limits of each channel can be adjusted by rewriting the values in the top-left/top-right corner of each channel histogram.

  • Threshold range of each channel (the colored stripe) can be shifted by mouse. Place the cursor in the middle of the range (a circle appears) and drag it left or right.

  • Threshold limits of each channel can be adjusted by mouse. Place the cursor on the edge of the thresholding range and drag it left or right.

The two last behaviors can be further modified by pressing additional keys:

  • Move the threshold using the right mouse button - the binary layer in the image is not updated continuously, but is updated only once after the mouse button is released. Such operation saves some computing and therefore is quicker.

  • Hold Shift while moving the threshold limits - the threshold adjustment is performed on all channels together (RGB images only).

  • Hold Ctrl while moving the threshold limits - both the low and the high threshold limits move in opposite directions.

Binary Operations

Four basic operations can be performed on the binary layer before it is displayed on screen. To turn the operation on, click on the up arrow button in order to define the number of its iterations:

Clean

Removes small objects from binary image.

Smooth

Smooths the binary image contours.

Fill Holes

Fills holes within binary objects.

Separate

Separates objects.

Restrictions

Size

Define size range using min/max value in the edit boxes or using the slider.

Circularity

Define circularity range using min/max value in the edit boxes or using the slider.

Thresholding Large Images 
If thresholding images larger than 5000 x 5000 pixels, a new check box called Preview on selected area only is displayed. This feature displays the threshold preview just on a limited area to speed up the thresholding adjustment.

Changing Appearance of the Binary Layer 
To change the color or transparency of the layer, right-click the Overlay button in the right image toolbar. A contextual menu appears, where you can select one of the predefined transparency levels, or run the Colorize Binary Objects command. This command displays the binary objects in several different colors. The algorithm ensures that two neighboring objects are never colored by similar colors.

See Mathematical Morphology Basics.