Purpose

The module ConnectedComponents performs a connected component analysis on 2D / 3D grayscale or vector images.

Usage

Connect an input image, select a Neighborhood Relation Used and a Background Value, and press Update Analysis. The leftmost output image now contains a label image where all interconnected non-background voxels are labeled with the same image value.

The module works only on the sub image identified by c = 0, t =0, and u = 0. Any other image part is filled with 0 for all outputs.

Tips

  • The analysis is very fast on images with few components, but can be extremely time-consuming for images with, say, a million clusters.
  • The Background Gray Value that shall be ignored (Background Gray Value) from the input image as well as the input image itself are casted to unsigned, so negative Background Gray Values maybe bring trouble.
  • In Similar Intensities cluster mode all input images are casted to uint32, so 64 Bit input is not handled correctly.

Windows

Default Panel

../../../Modules/ML/MLCluster/mhelp/Images/Screenshots/ConnectedComponents._default.png

Input Fields

input0

name: input0, type: Image

A grayscale or vector image where connected components shall be identified.

input1

name: input1, type: Image

A mask image that defines which voxels in input0 are processed. Mask value 0 means the corresponding voxels in input0 are let out. The mask image must have same dimension as the input0 image.

inputMarkers

name: inputMarkers, type: MLBase

(Optional) marker list, used for output1 component (de)selection.

Output Fields

output0

name: output0, type: Image

A label image where all background voxels have the label 0, and foreground voxels have the label of their component. Labels range from 1 to Number of Remaining Components, with decreasing cluster size (number of component voxels).

output1

name: output1, type: Image

A label image holding only certain clusters derived from the input markers and the additional marker parameter.

output2

name: output2, type: Image

This image holds only the largest or smallest component, depending on Invert component selection.

output3

name: output3, type: Image

For each voxel, the volume of the containing cluster is given in the unit defined by the parameter Cluster Size Interpretation. Background voxels have value 0.

Parameter Fields

Visible Fields

Update Analysis

name: update, type: Trigger, deprecated name: precompute

If pressed, the analysis is performed and the output images are updated.

Update Component Selection

name: updateSelectedClusters, type: Trigger, deprecated name: addCluster

If pressed, the analysis is only performed anew regarding changed markers.

Auto Update

name: autoUpdate, type: Bool, default: FALSE

If checked, the module computes anew on input change.

Use additional seed point

name: useAdditionalSeed, type: Bool, default: FALSE

Sets a seed with Position that is used in addition to those at the marker list input.

Position

name: additionalSeed, type: String, default: 0 0 0 0 0 0

Sets a position of the additional seed point.

Only active if Use additional seed point is checked.

Type

name: additionalSeedType, type: Integer, default: 0

Sets the (marker) type of the additional seed point.

Only active if Use additional seed point is checked.

Interpretation

name: additionalSeedCoordSystem, type: Enum, default: VoxelCoordinates

Defines the coordinate system for the additional seed point Position.

Values:

Title Name
Voxel Coordinates VoxelCoordinates
World Coordinates WorldCoordinates

Cluster Mode

name: clusterMode, type: Enum, default: IdenticalIntensities

Defines the cluster rule.

Values:

Title Name Description
Identical Intensities IdenticalIntensities The intensities or vector directions of adjacent voxels need to be identical to form a cluster.
Similar Intensities SimilarIntensities

The intensities of adjacent voxels need to be similar to form a cluster.

Set the similarity tolerance with Similarity tolerance.

Similar Vector Directions SimilarVectorDirections

The vector directions of adjacent voxels need to be identical to form a cluster.

Set the similarity tolerance with Similarity dot-product. This is the threshold for the dot-product of vectors in adjacent voxels.

Similarity tolerance

name: similarityToleranceIntensities, type: Double, default: 0

Sets the tolerance for the Cluster Mode Similar Intensities.

Similarity dot-product

name: similarityToleranceVectors, type: Double, default: 0.98

Sets the tolerance for the Cluster Mode Similar Vector Directions.

Number of Remaining Components

name: numberOfClusters, type: Integer, persistent: no

Shows the number of components found and not filtered out by the size filter set by Minimum Cluster Size.

Background Value

name: fillValue, type: Integer, default: 0

Sets the background value for the output image.

Keep object values from input

name: originalObject, type: Bool, default: FALSE

If checked, the component values are taken from the input image.

New Object Value

name: objectValue, type: Integer, default: 255

Shows the value of the selected component if Keep object values from input is unchecked.

Minimum Cluster Size

name: minClusterSize, type: Double, default: 0

Sets an amount of voxel to limit the output clusters' size (see Cluster Size Interpretation for units).

Cluster Size Interpretation

name: clusterSizeInterpretation, type: Enum, default: ml

Defines the unit for Minimum Cluster Size.

Values:

Title Name Deprecated Name
Voxels Voxels  
ml ml Volume (ml)

Invert component selection

name: invertClusterSelection, type: Bool, default: FALSE

If checked, not the clusters selected by the markers are shown at the second output, but those who are not selected. For the rightmost output this means that all clusters except the largest are shown.

Background Gray Value

name: inputIgnoreValue, type: Integer, default: 0

Sets the voxel value to be ignored. The background value function is not used in vector mode.

Neighborhood Relation Used

name: neighborhoodType, type: Enum, default: NBH_3D_18_XYZ

Defines the connectedness relation for the analysis.

Values:

Title Name
2D-4-Neighborhood (x,y) NBH_2D_4_XY
2D-8-Neighborhood (x,y) NBH_2D_8_XY
3D-6-Neighborhood (x,y,z) NBH_3D_6_XYZ
3D-18-Neighborhood (x,y,z) NBH_3D_18_XYZ
3D-26-Neighborhood (x,y,z) NBH_3D_26_XYZ

Use mask

name: useMask, type: Bool, default: FALSE

If checked, the input mask is used.

Hidden Fields

clusterArraySizeHint

name: clusterArraySizeHint, type: Integer, default: 300000