Mask Creation
Manual Mask Creation lets you define spatial regions of interest (ROIs) on the current IDCubePro image and convert them into a mask aligned with the hyperspectral dataset.
IDCubePro 2026 - Manual Mask Creation
Overview
Manual Mask Creation lets you define spatial regions of interest (ROIs) on the current IDCubePro image and convert them into a mask aligned with the hyperspectral dataset.
Masks can be used to restrict analysis to selected regions, exclude unwanted pixels, define objects or tissue compartments, prepare segmentation inputs, and support machine-learning workflows.
A mask answers the spatial question: which pixels belong to a selected region or region category?
A binary mask usually separates included pixels from excluded pixels.
A multiclass mask assigns different integer values to different ROIs or spatial regions.
For supervised classification where several semantic classes need repeated training ROIs, the dedicated Label Creation tool may be more appropriate.
Background pixels have value 0.
In Binary mode, every drawn ROI receives value 1.
In Multiclass mode, ROI 1 receives value 1, ROI 2 receives value 2, ROI 3 receives value 3, and so forth.
Choose Binary when all selected ROIs represent one common included region.
Typical uses include separating sample from background, selecting tissue from surrounding material, excluding irrelevant image regions, or defining one combined analysis area.
All ROIs receive the same value of 1, so disconnected ROIs become parts of the same binary mask.
Choose Multiclass when separate ROIs need distinct integer identities.
ROI values are assigned sequentially according to drawing order: 1, 2, 3, ...
This can be useful for separating spatial compartments, individual objects, or regions that must remain distinguishable downstream.
Important Difference In Multiclass Mode
In this tool, each ROI receives a new sequential value.
If you need several separate ROIs to share the same semantic class ID, use the Label Creation tool instead of assuming that multiple mask ROIs automatically represent one class.
The # masks field controls how many ROIs the tool asks you to draw during one Draw operation.
For example, entering 3 causes the tool to request three ROIs.
In Binary mode all three receive value 1.
In Multiclass mode they receive values 1, 2, and 3.
Rectangle, Ellipse, Polygon, and Freehand are supported.
Use Rectangle for simple box-shaped or approximately rectangular regions.
It is fast and reproducible but may include unwanted pixels when the true boundary is irregular.
Use Ellipse for approximately circular or oval structures.
It is useful when a smooth curved boundary describes the region more accurately than a rectangle.
Use Polygon for irregular regions with boundaries that can be represented by connected straight segments.
Polygon often provides a useful balance between accuracy and reproducibility.
Use Freehand for complex irregular boundaries.
It provides maximum flexibility but is more dependent on operator judgment.
For reproducible scientific analysis, apply consistent boundary criteria across samples.
WHICH ROI TYPE SHOULD I USE?
Use the simplest shape that captures the intended region without including substantial unwanted pixels.
When precise boundaries matter, Polygon or Freehand may be preferable.
When only a representative interior region is needed, a simpler ROI can be more reproducible.
Draw ROIs on the Original Image panel.
The displayed image is used as the spatial reference for annotation while the mask dimensions remain aligned with the hyperspectral image cube.
Use an image representation in which the intended region can be identified reliably.
Depending on the dataset, this may be an RGB image, selected spectral band, composite, or another validated display representation.
If the boundary is not visible or scientifically justified, avoid drawing it solely from expectation.
1. Select Binary or Multiclass.
3. Enter the number of masks to draw.
5. Draw each requested ROI on the Original Image.
6. Complete each ROI before proceeding to the next.
8. Clear and redraw if the result is incorrect.
9. Save when the mask is complete.
When ROIs overlap, pixels in the newer ROI are assigned the newer mask value.
In Binary mode this usually has no visible effect because all ROIs equal 1.
In Multiclass mode an overlapping later ROI can overwrite values assigned by an earlier ROI.
Inspect overlaps carefully when region identity matters.
The Mask Image panel displays the current mask.
Background is value 0 and mask regions contain positive integer values.
Colors are visualization aids; the actual scientific information is the integer mask value at each pixel.
Clear deletes all ROI objects and resets the complete mask image to 0.
Use Clear when you want to restart mask creation.
The current mask is stored in application data as:
These keys allow downstream IDCubePro tools to access the mask.
Save creates a MAT mask dataset and a PNG preview.
Mat File - Recommended Scientific Format
The MAT file stores a MaskData structure.
The current implementation includes:
Use the MAT file when exact mask values, metadata, and downstream MATLAB compatibility are important.
MaskData.BinaryMask is true wherever MaskImage is greater than zero.
This provides a simple logical included-versus-background representation even when the original MaskImage is multiclass.
The PNG is primarily a visual representation of the mask.
For multiclass scientific analysis, preserve the MAT file because the MAT structure contains the original integer mask and metadata.
The mask must remain spatially aligned with the hyperspectral cube used downstream.
The number of rows and columns must correspond to the same spatial pixels.
If the cube is cropped, resized, rotated, registered, or otherwise geometrically transformed after mask creation, the mask must undergo the same transformation or be regenerated.
Choose boundaries according to the scientific purpose of the mask.
For exclusion masks, it may be appropriate to remove artifacts and uncertain edge pixels conservatively.
For object masks, boundaries may need to follow the object geometry more closely.
For spectral analysis, remember that edge pixels can contain mixed spectral contributions because of spatial resolution, scattering, registration, or partial-volume effects.
When To Use A Conservative Interior Mask
If the goal is to characterize the spectrum of a region rather than measure its exact area, an interior mask can reduce contamination from neighboring materials.
This is especially useful when boundaries are uncertain or spatial resolution is limited.
When Precise Boundaries Matter
If the mask will be used for morphology, area measurement, object size, segmentation validation, or spatial statistics, boundary accuracy becomes more important.
Use an appropriate display image and validated boundary criterion.
Masks are useful for excluding pixels affected by glare, saturation, shadows, damaged detector regions, sample holders, background, or other known artifacts.
Do not exclude difficult pixels simply because they produce unexpected scientific results; exclusion criteria should be defined objectively.
Multiple Disconnected Regions
Binary mode is appropriate when several disconnected ROIs should all belong to one included region.
For example, several separated tissue fragments can all receive value 1.
Multiclass Region Interpretation
In Multiclass mode, document what each integer value represents if the values have scientific meaning.
Because values are assigned by ROI drawing order, the number itself does not automatically encode biological meaning.
Quality Control Before Saving
Before saving, inspect the complete mask and ask:
- Does the mask align with the original image?
- Are intended regions included?
- Are unwanted regions excluded?
- Are there accidental overlaps?
- Is Binary versus Multiclass mode appropriate?
- Does each multiclass ROI have the intended identity?
- Are boundary pixels scientifically justified?
- Are artifacts handled consistently?
A mask can define which pixels are eligible for training, prediction, or evaluation.
It can also restrict analysis to a sample region and prevent background pixels from dominating the dataset.
However, a mask does not by itself guarantee valid training labels. Use Label Creation when explicit semantic target classes are required.
Masks can provide regions for segmentation workflows, validation regions, or spatial constraints.
When comparing automated segmentation with a manual mask, ensure both are defined using the same spatial geometry and class interpretation.
Use masks to extract spectra only from scientifically relevant regions.
Check whether edge pixels, shadows, saturation, or heterogeneous subregions could distort the spectral statistics.
For heterogeneous samples, consider whether one large mask or several separate regions better reflects the analysis question.
Common Mistake - Using Multiclass When Binary Is Intended
If all ROIs represent the same included region, Binary mode is simpler and avoids unnecessary separate integer values.
COMMON MISTAKE - USING BINARY WHEN REGIONS MUST REMAIN DISTINCT If downstream analysis must distinguish different ROIs, use Multiclass mode.
Common Mistake - Confusing Masks With Training Classes
Sequential multiclass mask values are not automatically equivalent to semantic class labels.
Use the Label Creation tool when repeated ROIs must share defined class identities.
Common Mistake - Large Imprecise Rois
A large ROI may include background, boundaries, or unwanted material.
Choose ROI geometry according to the scientific objective rather than simply maximizing selected area.
Common Mistake - Misaligned Masks
A visually correct mask becomes invalid if it no longer corresponds pixel-for-pixel with the hyperspectral cube.
Always verify spatial alignment after cropping, registration, resizing, or other image transformations.
Common Mistake - Relying Only On The Png
The PNG is useful for visualization but the MAT file should be retained when exact mask values and metadata are required.
For scientific studies, document the mask purpose, mode, ROI criteria, display representation, exclusion rules, and meaning of multiclass values.
When several users create masks, establish consistent annotation rules before processing the complete dataset.
Define the scientific purpose of the mask before drawing.
Choose Binary when the question is primarily include versus exclude.
Choose Multiclass when spatial regions must remain separately identifiable.
Use Label Creation instead when the goal is supervised semantic class annotation with repeated ROIs per class.
Inspect alignment and boundaries before saving.
Preserve the MAT dataset for reproducible downstream analysis.