Binary Threshold
Binary Threshold creates a two-class spatial mask from the current IDCubePro display image.
Idcubepro 2026 - Binary Threshold Mask
Overview
Binary Threshold creates a two-class spatial mask from the current IDCubePro display image.
Each pixel is classified as either selected (1) or not selected (0) according to a user-defined intensity interval.
The tool is intended for rapid mask creation when the desired object or region can be separated from its surroundings by image brightness.
When To Use Binary Thresholding
Use Binary Threshold when the region of interest is brighter or darker than surrounding pixels in the current display image.
- Separating bright objects from dark background.
- Isolating dark regions from a brighter field.
- Creating a preliminary foreground/background mask.
- Restricting later segmentation or machine-learning analysis to a selected area.
- Generating a simple mask for annotation or quality control.
Binary thresholding is most appropriate when intensity alone provides meaningful separation.
If the target and background overlap strongly in intensity, a more advanced segmentation or classification method may be more appropriate.
Important - Normalized Display Intensity
Thresholds are applied to the normalized display representation from 0 to 1.
They are NOT applied directly to the raw hyperspectral values stored in myData.Images.
This distinction is important because the displayed image may already reflect band selection, RGB composition, grayscale conversion, or display normalization.
IDCubePro first tries to use the current RGB display.
If an RGB display is present, it is converted to grayscale before thresholding.
If no RGB display is available, the tool tries the current single-band or display image.
If neither is available, it falls back to the mean hyperspectral image.
The selected source is then normalized for display before thresholding.
Normalization maps the displayed intensity range to approximately 0-1 so the threshold controls behave consistently across datasets with different numerical scales.
This makes the tool convenient for interactive visual masking.
However, the threshold values should be interpreted as DISPLAY intensity values rather than calibrated physical measurements.
The display normalization uses robust intensity limits based primarily on the 1st and 99th percentiles.
This reduces the influence of isolated extreme pixels.
Values below the lower display limit are mapped toward 0 and values above the upper display limit are mapped toward 1.
Minimum <= normalized display intensity <= Maximum Included pixels receive mask value 1.
All other pixels receive mask value 0.
Minimum defines the lower intensity boundary of the selected interval.
Increasing Minimum removes darker pixels from the mask.
Use Minimum when you want to exclude dark background or low-intensity structures.
Maximum defines the upper intensity boundary of the selected interval.
Decreasing Maximum removes brighter pixels from the mask.
Use Maximum when you want to exclude very bright structures or isolate an intermediate intensity range.
Using Both Minimum And Maximum
Using both thresholds allows selection of an intensity band rather than simply everything above or below one threshold.
For example, an object with intermediate brightness can be isolated by excluding both dark background and saturated bright regions.
The histogram shows the distribution of normalized display intensities across the image.
The horizontal axis is normalized display intensity.
The vertical axis is the number of pixels.
The Min and Max markers show the current threshold interval.
Peaks often represent major intensity populations such as background, tissue, object, or other image regions.
Valleys between peaks can provide useful starting locations for threshold boundaries.
For a bright object on dark background, place Minimum near the valley separating the darker and brighter populations.
For a dark object on bright background, reduce Maximum until the bright background is excluded.
For an intermediate-intensity target, adjust both Minimum and Maximum around the desired histogram population.
Do not choose a threshold from the histogram alone.
Adjust the threshold while simultaneously inspecting the Binary Mask panel.
A good threshold should select the intended structures while excluding unrelated background and artifacts.
The best threshold is therefore determined by both intensity statistics and spatial plausibility.
The Minimum and Maximum sliders update the mask interactively.
Use the sliders for rapid visual exploration.
Use the numeric edit fields when an exact threshold value is required.
The Threshold Summary reports the current lower threshold, upper threshold, number of selected pixels, and selected area fraction.
These values are useful for documenting a threshold and comparing mask coverage between images.
Pixels selected is the number of image pixels currently assigned mask value 1.
This number changes immediately as the thresholds are adjusted.
Area fraction is the percentage of image pixels included in the mask.
It provides a simple measure of mask coverage.
Area fraction should not automatically be interpreted as physical tissue area unless image geometry and calibration support that interpretation.
Apply Mask sends the current binary result to IDCubePro memory for downstream workflows.
This allows other segmentation, annotation, and machine-learning tools to reuse the mask.
Apply Mask Does Not Modify The Hyperspectral Cube
Applying the mask stores a spatial selection mask.
It does not replace or mathematically alter the hyperspectral intensity values in myData.Images.
Downstream tools may use the stored mask to restrict analysis.
Save exports both a scientific MAT representation and a PNG image.
The MAT file contains a BinaryData structure.
The PNG file stores the binary mask as a black-and-white image.
Use the MAT file when preserving thresholds, metadata, and exact mask values is important.
Use the PNG file for visualization, presentations, or compatibility with external image software.
For scientific reanalysis inside IDCubePro or MATLAB, MAT is generally preferred.
Reset returns Minimum and Maximum to the full available normalized intensity range.
The current binary mask is cleared.
Use Reset when you want to restart threshold selection from the complete image.
1. Open Binary Threshold with the desired IDCubePro image view active.
2. Inspect the Original / Display Image.
3. Inspect the intensity histogram.
4. Decide whether the target is bright, dark, or intermediate relative to the background.
5. Adjust Minimum and/or Maximum.
6. Inspect the Binary Mask while moving the thresholds.
7. Check Pixels selected and Area fraction.
8. Refine the threshold until the mask is spatially plausible.
9. Click Apply Mask if the result will be used by another IDCubePro workflow.
10. Click Save if the mask or threshold settings should be preserved externally.
Bright Target On Dark Background
Keep Maximum near 1 and increase Minimum until most of the dark background is removed.
Stop increasing Minimum when real target pixels begin to disappear.
Dark Target On Bright Background
Keep Minimum near 0 and decrease Maximum until most of the bright background is removed.
Stop decreasing Maximum when real target pixels begin to disappear.
Intermediate-intensity Target
Increase Minimum to exclude dark pixels and decrease Maximum to exclude very bright pixels.
Use the histogram to identify the approximate intensity population, then refine visually.
If isolated pixels appear throughout the mask, intensity overlap or image noise may be present.
- Adjust the threshold range.
- Use a cleaner display band or RGB representation.
- Apply appropriate image preprocessing before thresholding.
- Use a more advanced segmentation method if intensity alone is insufficient.
If true object boundaries disappear, the threshold may be too restrictive.
For a bright target, lower Minimum slightly.
For a dark target, raise Maximum slightly.
Too Much Background Is Included
If background remains selected, tighten the threshold range.
Use the histogram to determine whether background and target intensities are separable.
If their histogram distributions strongly overlap, binary intensity thresholding may not provide a reliable mask.
When the current image is RGB, the RGB image is converted to grayscale before thresholding.
Color differences that have similar grayscale brightness may therefore not be separable with this tool.
If color or spectral differences are important, consider using a specific wavelength, spectral index, contrast-optimized image, or supervised classifier instead.
The usefulness of binary thresholding can depend strongly on which wavelength is displayed.
A wavelength with strong target/background contrast will usually produce a more useful threshold mask than a wavelength with poor contrast.
If thresholding performs poorly, try another informative wavelength before concluding that the target cannot be separated.
Threshold quality can be affected by preprocessing.
Depending on the dataset, useful preprocessing may include reference correction, background correction, denoising, smoothing, removal of saturated pixels, or selection of a better display band.
For comparisons across multiple images, use a consistent preprocessing and display strategy.
Comparing Masks Between Datasets
Because thresholds operate on normalized DISPLAY intensity, the same numerical threshold does not necessarily correspond to the same raw intensity across different datasets.
Therefore, use caution when applying one threshold value to multiple images.
For quantitative multi-image studies, verify that acquisition, preprocessing, display normalization, and threshold strategy are consistent.
A binary mask identifies pixels satisfying an image-intensity rule.
It does not by itself identify a chemical species, tissue type, biological state, or material.
Scientific interpretation should be supported by the imaging context and independent evidence.
When Not To Use Binary Thresholding
Binary thresholding may be inadequate when:
- Target and background intensities strongly overlap.
- Several classes must be separated.
- Spectral shape rather than brightness is the key discriminator.
- Illumination is strongly nonuniform.
- The image contains substantial gradients or shadows.
- Spatial texture or morphology is more informative than intensity.
In these cases, consider clustering, supervised classification, spectral indices, deep learning, or another segmentation approach.
Important
The mask dimensions should remain spatially compatible with the hyperspectral cube used for downstream analysis.
Threshold values refer to normalized display intensity from 0 to 1, not raw hyperspectral intensity.
Always inspect the mask visually before applying or saving it.
Close Binary Threshold help.