Description
Count connected foreground islands in a binary mask.
Skin-image research can record scale, annotation geometry, visibility and timing. Pixel counts, mask components and supplied metadata are technical summaries rather than disease findings or proof an image is suitable for diagnosis.
Count connected foreground islands in a binary mask.
When to use this tool
Use Lesion Mask Island Count when checking a supplied dermatology research image or annotation record.
How to use the tool and how it works
- Enter mask, eightConnected. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read islands, foregroundPixels. Use the output convention below.
Count connected foreground islands in a binary mask. Require equal row widths and values exactly zero or one; traverse each unseen foreground component using four neighbors or eight when eightConnected, also counting foreground pixels.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| mask | Mask | Required. Array of array of finite number; maximum items 128; maximum items 128. |
| eightConnected | True connects diagonal neighbors as well as horizontal and vertical; false uses four-neighbor connectivity. | Required. Boolean. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| islands | Islands | Required. Safe integer. |
| foregroundPixels | Foreground Pixels | Required. Safe integer. |
{
"input": {
"mask": [
[
1,
0
],
[
0,
1
]
],
"eightConnected": false
},
"output": {
"islands": 2,
"foregroundPixels": 2
}
} Limitations and assumptions
- An empty mask returns zero counts; connectivity is a convention, not a count of clinically meaningful lesions.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Use calibrated imaging and professional clinical assessment for any health interpretation; validate annotation and measurement methods separately.
References
Similar or alternative tools
- Lesion Outline Convex Deficit Share
Return convex-hull deficit and its area share.
- Lesion Annotation Holes Area Term
Subtract annotation holes with a supplied shared-area correction.