Binary Threshold  
Top  Previous  Next

 
Toolbar:   threshold  
Menu:   Processing > Threshold ->Binary  
Script   threshold  

Use this command to separate objects of interest from the background by specifying the range of pixel intensities that represents the foreground.

The segmented image can be created as a binary one or assigned the same type as the input image. You can adjust the range of intensities for the foreground pixels interactively and preview the segmented areas in real time, as the color overlay highlights the objects of interest in the input image.

If you choose this command, the Binary Threshold dialog box will appear with the following options:

Input
 
Displays the input image frame number. If you want to apply thresholding to another image, type or select the corresponding value. Note that if the input image is a color one, it will be automatically converted and displayed as a grayscale image while the Binary Threshold dialog box is open.  

Output
 
Displays the number of the frame in which the segmented image will be created. Depending on the Preferences. ImageWarp will set it either to the first available value or to the Input frame number. Type or select another value if you want the output image to be created in a different frame.  

Histogram display
 
Displays the luminance histogram for the input image or its selection. As you adjust the minimum and maximum levels for the foreground pixels, two red markers move over the histogram graph visually representing the boundaries of the threshold range.  

Y-scale
 
Use the Y-scale slider located on the right side of the Histogram display to change the scale of the Y-axis of the histogram chart. The default range of the Y-axis is determined by the largest frequency value.  

Intensity ruler
 
Displays the luminance scale and highlights the intensity range of the foreground pixels. Use the Intensity ruler as a visual reference while adjusting the threshold levels. To move the threshold range along the intensity scale, click the highlighted area of the ruler and drag it to the desired position. The sliders' positions and entries in the boxes on the left of the sliders will update accordingly.  
 
Mode
 
Lets you choose the mode for selecting the threshold range.  
In the Dialog mode, the minimum and maximum levels for the threshold range corresponding to the active phase are selected by moving the two sliders located at the bottom of the dialog box. As you move the sliders, the color overlay on the input image expands or contracts highlighting the foreground pixels. The numbers in the boxes on the left and the color markers in the histogram are updated accordingly, displaying the current intensity range for the foreground selection. You can also edit the threshold levels by selecting or typing the desired values in the boxes on the right of the sliders and pressing ENTER, or by dragging the highlighted area on the Intensity ruler.  
 
In the Mouse mode, the foreground range is selected by moving the mouse in the horizontal and vertical directions. Moving the mouse upward and downward widens or narrows the foreground range respectively. Moving the mouse rightward or leftward raises or lowers the foreground range respectively. As the sliders are moved, the color overlay on the input image expands or contracts, highlighting the foreground pixels. Press the left mouse button to apply the threshold to the image. Press the right mouse button to switch to the Dialog mode. Note that if the Threshold function was called from the script with the MOUSE mode selected, the dialog box will not appear.  
Select the Preset mode if you want to generate a script command that will perform automatic segmentation without displaying the Binary Threshold dialog box. Select the threshold range by using the sliders or boxes on the right of the sliders, and then click Apply. Make sure the Script Editor is in the Record mode. The Threshold function will be recorded into the script with the selected levels, and its Mode parameter will be set to AUTO.  

Manual sampling
 
Click this button to sample the image and create the segmentation range based on the values of the sampled pixels. When you move the cursor over the input image, the cursor will take shape of an eyedropper. Position the cursor over the area you want to define as the foreground and click the left mouse button. If the segmentation range for the current image has not been assigned yet, it will be set to the range of the pixel values within the Sampling window. Otherwise, the currently selected range will be expanded to include the average intensity of the area under the cursor.  

Undo sampling
 
Click this button to undo the last change in the foreground range made by manual sampling.  

Sampling window
 
Lets you select the size of the square area covered by manual sampling. The size of side of the square is measured in pixels, and it can be set to the length from 1 to 15.  

Binary
 
Select this check box to create the output image as a binary one. A binary image is an image of the multiphase type that contains only two phases, 0 and 1. The foreground pixels whose values fall within the specified range will be converted into 1s, while the background pixels with values outside the range will be set to 0s. Clear the Binary check box if you want the output image to be of the same type as the input one. In this case, the foreground pixels will be transferred into the output image unchanged, while the pixels with values outside the specified range will be assigned the black level.  

Invert
 
Select this check box to invert the selected foreground range. The pixels whose value fall within the range between the minimum and maximum levels will be treated as background ones, while the pixels with values outside the range will be treated as foreground ones.  

Preview Color
 
Allows you to select the overlay color used to highlight the foreground pixels in the input image. You may choose between six basic colors: Red, Green, Yellow, Blue, Magenta, and Cyan.  

Preview mode
 
Select one of the following modes for previewing foreground pixels:  
 
Opaque  
 
The foreground pixels corresponding to the objects of interest in the image are highlighted with the solid color selected in the Preview Color box.  
 
Transparent  
 
The foreground pixels are highlighted with the transparent color selected in the Preview Color box. In this mode, you can see the original objects through the transparent overlay.  
 
Apply
 
Applies the function to the input image and creates the output image.  
 
Record

Inserts the corresponding script command into the Script Editor without applying the function.