Skip to content

Main content

Binary Mask Seed Component Mask

Select only the connected foreground component containing a supplied in-bounds cell; a background seed yields label zero and an empty mask.

Loading tool…

Description

Select the foreground component containing an in-bounds seed cell, returning an all-zero mask for a background seed.

A binary grid represents foreground as numeric one and background as zero. A stencil is a set of integer [rowOffset,columnOffset] positions relative to a cell. Connectivity describes allowed neighbor steps: four-neighbor connectivity uses orthogonal steps, while eight-neighbor connectivity also includes diagonals. Finite image borders and asymmetric stencils affect the result.

Select the foreground component containing an in-bounds seed cell, returning an all-zero mask for a background seed.

When to use this tool

Use a seed cell to isolate one connected foreground region from a mask containing several regions.

How to use the tool and how it works

  1. Enter mask, eight, row, column using the definitions below.
  2. Run the operation. Resolve input-format errors before interpreting an output.
  3. Read result.label, result.mask, using the stated boundary, ordering, sign and absence conventions.

Label foreground components under the supplied four/eight-neighbor choice. Read the label at the in-bounds seed [row,column] and emit one exactly at cells with that same positive label.1

Input fieldMeaning and unitsAccepted input
maskRectangular numeric 0/1 rows, up to 64×64; row is the first coordinate and column the second.Dense numeric rows, each dimension at most 128; the stated shape rules also apply.
eightTrue uses all eight adjacent neighbors; false uses only four orthogonal neighbors for the foreground/background component specified above.Boolean true or false.
rowZero-based integer seed row, inside the supplied mask.Finite safe integer satisfying the stated bounds.
columnZero-based integer seed column, inside the supplied mask.Finite safe integer satisfying the stated bounds.
Output fieldInterpretation
resultObject containing the fields below.
result.labelPositive foreground component label at the seed, or zero when the seed is background.
result.maskResult grid in original frame dimensions, with numeric cell meanings and any signed subtraction convention described above.
json
{
  "input": {
    "mask": [
      [
        0,
        0,
        0
      ],
      [
        0,
        1,
        0
      ],
      [
        0,
        0,
        0
      ]
    ],
    "eight": false,
    "row": 1,
    "column": 1
  },
  "output": {
    "result": {
      "label": 1,
      "mask": [
        [
          0,
          0,
          0
        ],
        [
          0,
          1,
          0
        ],
        [
          0,
          0,
          0
        ]
      ]
    }
  }
}

Limitations and assumptions

  • A background seed has label zero and returns an all-zero mask. Selection includes the entire connected foreground component and does not follow intensity similarity or a distance threshold.
  • Masks are rectangular dense arrays of numeric 0/1 cells, with at most 64 rows and 64 columns. Empty frames are allowed where no in-bounds seed is required. Stencils are nonempty lists of distinct integer [rowOffset,columnOffset] pairs, each coordinate between -16 and 16. Outside-frame samples are zero at every stage.
  • Every declared outer field is required and unknown outer fields are rejected. Strings and JSON text have size limits, lists are bounded to 128 entries, and JSON nesting/node counts are bounded. Tighter operation-specific bounds stated above take precedence.
  • Numeric outputs must remain finite and within safe-integer magnitude. Original record indexes and cell coordinates are zero-based; stated half-open ranges exclude their end.

Alternative or Complementary methods

Choose a component operation for connected regions and an explicit stencil for local shape tests. Fix connectivity and border policy before comparing masks; convert cell counts to physical area separately when pixel spacing is known.

References

  1. Tool behavior and example: Binary Mask Seed Component Mask — tool.io

Similar or alternative tools