### Morph

Category

Transformation

Function

Applies a binary morphological operator to a field.

Syntax

    output = Morph(input, operation, mask);

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`input` | field | none | input data
`operation` | string | "erode" | the operation to be applied
`mask` | value or string | "box" | the mask element

Outputs

Name | Type | Description
--- | --- | ---
`output` | field | morphologically transformed input

Functional Details

This module applies one of the following binary morphological operators to input data:

    "close"    "dilate"    "erode"    "open"

The input data are treated much as booleans are in the C language (e.g., 0 = FALSE and nonzero = TRUE).

The `mask` parameter (see below) is centered on each position in `input` in turn, and all positions corresponding to "1" in the mask are considered for `operation` (see below).

`input` | is the input data to be operated on.

`operation`

specifies one of the following:

- "dilate": The output corresponding to a given data value is true (1) if any data value in `input` corresponding to a "1" in `mask` is true. Otherwise, the output is false.
- "erode": The output corresponding to a given data value is true (1) if all the data values corresponding to a "1" in `mask` are true. Otherwise, the output is false.
- "close": is dilation followed by erosion.
- "open" is erosion followed by dilation.

  Note: Successive openings or closings have no additional effect.

`mask`

specifies one of the following:

- a Filter name (see Filter)
- an explicit matrix.

The function of both is to identify potential operands for `operation` (see above). The dimensions must be odd, and the default is the 3 × 3 box filter of Filter.

The module supports all data types and, like Filter, requires regular connections (quads or cubes). It handles both position- and connection-dependent data.

If the data are vectors, each element of a vector is transformed independently. Because the module returns a 0/1 output, its output is always TYPE_UBYTE.

Note: Data along the boundary are replicated to fill the overlap region for the filter.

Components

Modifies the "data" component. All other components are propagated to the output.

Example Visual Program

    UsingMorph.net

See Also

Compute, Filter

[ OpenDX Home at IBM | OpenDX.org ]