ZEISS Microscopy Knowledge Base
Help
ZEISS Microscopy Knowledge Base

Morphology Group

Morphology transformations enable you to analyze and modify structures and shapes in an image. Morphology transformations are non-linear and thus allow you to modify the image selectively while other portions of the image remain unchanged. Typical fields of application are quality assurance or medical image processing.

Morphology transformations are a type of neighborhood transformation: the image is analyzed pixel by pixel and each pixel is transformed depending on its neighbors. Thus the results of a morphology transformations depend on two factors:

  • The type of morphology operation: the mathematical function used to evaluate each pixel and its neighbors
  • The most common operations from which most others are derived are erosion (remove pixels from a bright structure) and dilution (add pixels to a bright structure).
  • The structure element: the shape and size of the neighborhood taken into account for the analysis of each pixel
  • The structure element reflects the structures in the image you wish to analyze. For example, to find vertical structures use the Vertical structure element.
Diagram: left grid with white blob, center cross-shaped structuring element and blue arrow, right grid showing erosion result
Erosion, one of the basic morphology transformations, using the structure element Cross

You can imagine the structure element as a stencil which is moved over the image pixel by pixel. Only the pixels within in the stencil area are visible and taken into account for the morphology transformation. The applied operation (e.g. erosion or delusion) then determines if and how the central pixel within the stencil area is changed.

In the software you first the specify the morphology operation by selecting the corresponding tool. From the tool you then select the structure element and its size (defined by the number of repetitions the structure element is applied).

Structure Elements

The shape of the structure element makes the morphology transformation sensitive to specific shapes in the input image.

Type

Appearance

Horizontal

Grid of zeros with three '1's in a horizontal line near center

Diagonal 45°

Grid of zeros with three '1's in a 45° diagonal near center

Vertical

Grid of zeros with three '1's in a vertical line near center

Diagonal 135°

Grid of zeros with three '1's in a 135° diagonal near center

Cross

Grid of zeros with five '1's forming a small cross at the center

Square

Grid of digits with a central 3x3 block of 1s surrounded by 0s

Octagon

Grid of digits showing a larger centered square of 1s surrounded by 0s

The size of the structure elements is fixed to five times five pixels. You can increase the effective size by applying a structure element multiple times. This is equal to applying an equivalent larger structure element once.

Diagram of gray pixel grids with blue arrows labeled 1 and 2 showing a central white pixel expanding to a cross-shaped region

1

Dilation applied once with a larger structure element.

2

Dilation applied twice with a smaller structure element yielding the same result.

This method is used in the morphology tools.

Close Tool

This tool connects bright structures on a darker background in the input image while the size of the structures is preserved as far as possible.

The Close tool applies Dilate to expand the structures and connect them and then Erode to restore their size.

Parameter

Description

Structure Element

Defines the shape of the neighborhood around each pixel taken into account while applying the morphology operation.

Count

Enables you to increase the effective size of the structure element by controlling how often the morphology operation is applied.

Binary

  • Activated: Increases calculation speed by creating a binary image before the morphology operation is applied.
  • The resulting image contains black or white pixels instead of gray values.
  • Deactivated: Applies the morphology operation to a gray scale image.
  • The results are finer graded compared to the results of the morphology operation applied to a binary image.

Dilate Tool

This tool expands bright structures on a darker background in the input image by adding pixels to the boundaries of these structures. Small gaps between structures are filled and these structures are connected.

If the structure element touches at least one bright pixel, the pixel currently operated on is turned into a bright pixel.

Three panels: left grid with small white cluster, center small grid above blue arrow, right grid with larger white blob

Parameter

Description

Structure Element

Defines the shape of the neighborhood around each pixel taken into account while applying the morphology operation.

Count

Enables you to increase the effective size of the structure element by controlling how often the morphology operation is applied.

Binary

  • Activated: Increases calculation speed by creating a binary image before the morphology operation is applied.
  • The resulting image contains black or white pixels instead of gray values.
  • Deactivated: Applies the morphology operation to a gray scale image.
  • The results are finer graded compared to the results of the morphology operation applied to a binary image.

Erode Tool

This tool reduces the size of bright structures on a darker background in the input image. Thin connections between structures and smaller structures disappear.

If the structure element touches at least one dark pixel, the pixel currently operated on is turned into a dark pixel.

Diagram: left grid with white blob, center cross-shaped structuring element and blue arrow, right grid showing erosion result

Parameter

Description

Structure Element

Defines the shape of the neighborhood around each pixel taken into account while applying the morphology operation.

Count

Enables you to increase the effective size of the structure element by controlling how often the morphology operation is applied.

Binary

  • Activated: Increases calculation speed by creating a binary image before the morphology operation is applied.
  • The resulting image contains black or white pixels instead of gray values.
  • Deactivated: Applies the morphology operation to a gray scale image.
  • The results are finer graded compared to the results of the morphology operation applied to a binary image.

Gradient Tool

This tool emphasizes image areas of varying gray values (intensity). The results are similar to those of an edge detector.

A dilated and an eroded version of the input image is created using the same structure element. Then the two images are subtracted from each other. As a result, each pixel is replaced by the difference between the maximum and minimum gray value in its neighborhood. The difference is zero for regions of constant gray values and increases for larger changes in gray values (i.e. edges).

Parameter

Description

Structure Element

Defines the shape of the neighborhood around each pixel taken into account while applying the morphology operation.

Count

Enables you to increase the effective size of the structure element by controlling how often the morphology operation is applied.

Gray Reconstruction Tool

This tool expands (i.e. dilates) bright structures on a darker background in one input image (marker) repetitively until the structures fill shapes provided by another input image (mask). The bright structures cannot expand beyond the areas defined by the mask shapes and the process stops automatically when the shapes are completely filled.

Three gray grids: left small white pixels, center larger white shapes, right shapes filled; blue plus and arrow between.

For example, you can use gray reconstruction to extract marked structures, to filter out structures touching the image border, or to detect or fill holes within a structure. You can find an example of use in Morphology Examples.

Parameter

Description

in1 (Marker)

The image to be reconstructed by dilation

in2 (Mask)

The image providing the shapes which constrain the dilation of the first image

Structure Element

Defines the shape and size of the neighborhood around each pixel taken into account while applying the dilations

This has an effect on how the structures originating from the "seed pixels" in the marker image are reconstructed. If you are unsure which one to use, try generic uniform structure elements like Square or Octagon first.

Open Tool

This tool separates bright structures on a darker background in the input image while the size of the structures is preserved as far as possible. Thin connections between structures and smaller structures disappear.

The Open tool applies Erode to remove the undesired pixels and then Dilate to restore the size of the desired structures.

Parameter

Description

Structure Element

Defines the shape of the neighborhood around each pixel taken into account while applying the morphology operation.

Count

Enables you to increase the effective size of the structure element by controlling how often the morphology operation is applied.

Binary

  • Activated: Increases calculation speed by creating a binary image before the morphology operation is applied.
  • The resulting image contains black or white pixels instead of gray values.
  • Deactivated: Applies the morphology operation to a gray scale image.
  • The results are finer graded compared to the results of the morphology operation applied to a binary image.

Top Hat Black Tool

This tool retains the dark structures of the image that are smaller than the structuring element. You can use this tool to correct uneven illumination when the background is bright.

The black top-hat is defined as the morphological closing of an image minus the image itself.

Parameter

Description

Structure Element

Defines the shape of the neighborhood around each pixel taken into account while applying the morphology operation.

Count

Enables you to increase the effective size of the structure element by controlling how often the morphology operation is applied.

Top Hat White Tool

This tool retains the bright structures of the images that are smaller than the structuring element. You can use this tool to correct uneven illumination when the background is dark.

The white top-hat of an image is defined as the image minus its morphological opening.

Parameter

Description

Structure Element

Defines the shape of the neighborhood around each pixel taken into account while applying the morphology operation.

Count

Enables you to increase the effective size of the structure element by controlling how often the morphology operation is applied.

Watersheds Tool

This tool enables you to segment (i.e. to separate) touching structures within an image.

The image is interpreted as a topographic map in which gray values represent elevation. Bright pixels are interpreted as mountains and dark pixels as valleys. The tool virtually floods the valleys and finds the barriers encircling each valley. These barriers are the watersheds used for segmentation of the image.

Two connected gray lobes at left, blue arrow to right, same shapes with dotted outer outline and white dividing line

A valley is defined as a local gray value minimum from which the gray value increases in any direction and is limited by local maxima. As a result, the degree of segmentation is often higher than expected by the visual impression of the image. To improve results you can increase the contrast by applying the Top Hat White and Top Hat Black tools in combination.

Parameter

Description

Basins

  • Activated: The output image is the area of the flooded valleys (i.e. basins). The valleys are displayed in different shades and thus can be distinguished from one another.
  • Deactivated: The output image is the plot of the watersheds as white lines on a black background.

Morphology Examples

Most morphology transformations are based on erosion and/or dilation. The examples below show how a bright structure on a dark background can be expanded using dilation or made smaller using erosion. The structure element determines how the structure is modified and thus how the final result looks like. In the example the structure element Cross is used:

Grid of zeros with five '1's forming a small cross at the center

Erosion

Erosion removes pixels from bright structures. The structure element scans the input image pixel by pixel. Each pixel is set to the minimum value of all neighboring pixels currently covered by the structure element.

The example below shows erosion applied to a binary image (i.e. only black or white and no gray scale). In this case, a pixel is set to black if at least one of the neighboring pixels covered by the structure element is black. If all neighboring pixels covered by the structure element are white, the central pixel remains white.

Diagram: left grid with white blob, center cross-shaped structuring element and blue arrow, right grid showing erosion result

Dilation

Dilation adds pixels to bright structures. The structure element scans the input image pixel by pixel. Each pixel is set to the maximum value of all neighboring pixels currently covered by the structure element.

The example below shows dilation applied to a binary image (i.e. only black or white and no gray scale). In this case, a pixel is set to white if at least one of the neighboring pixels covered by the structure element is white. If all neighboring pixels covered by the structure element are black, the central pixel remains black.

Three panels: left grid with small white cluster, center small grid above blue arrow, right grid with larger white blob

Gray Reconstruction

Gray reconstruction can be used to extract elements with a characteristic feature. The example below shows how in two steps letters with long vertical features can be extracted from a text.

White centered text lines 'Lorem ipsum dolor sit', 'amet, consectetur', 'adipisci velit' on black background

In the first step the image is eroded using the Erode tool so that only bright pixels of vertical structures are left, i.e. pixels of the vertical elements of letters such as L, p, or d. Vertical is used as the Structure Element.

In order to remove a sufficient number of bright pixels to isolate the lengthy elements but not to remove too many pixels, the effective size of the structure element is adjusted. A Count of six yields the image below:

Black background with scattered small white dots and pixel clusters

In the second step all letters containing long vertical elements are reconstructed using the Gray Reconstruction tool. The image above is used as the marker (in1) and the original image is used as the mask (in2). To reconstruct the letters uniformly in both directions, the structure elements Square or Octagon are suited.

The gray reconstruction results in the image below:

Black image showing fragmented white letters and isolated character pieces
Impressum
Carl-Zeiss-Strasse 22
73447 Oberkochen
Germany
Legal