Skip to content

Main content

Lesion Mask Island Count Tool

Count connected components in an explicitly supplied binary research mask using declared four- or eight-neighbor connectivity.

Loading tool…

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

  1. Enter mask, eightConnected. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
maskMaskRequired. Array of array of finite number; maximum items 128; maximum items 128.
eightConnectedTrue connects diagonal neighbors as well as horizontal and vertical; false uses four-neighbor connectivity.Required. Boolean.
Output fieldInterpretationReturned shape
islandsIslandsRequired. Safe integer.
foregroundPixelsForeground PixelsRequired. Safe integer.
json
{
  "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

  1. Calculation and input contract: dermatology/lesion-mask-island-count — tool.io

Similar or alternative tools