CloseGap

MLModule

genre

Morphology

author

MeVis Medical Solutions AG

package

MeVisLab/Standard

dll

MLKernel

definition

MLKernel.def

see also

Morphology, Rank

keywords

kernel, filter, majority, smooth, binary, dilate, dilation, erosion, erode, morphology, contour, point, extraction

Purpose

The module CloseGap performs basic close gap operations for binary images.

Additionally, it allows majority filtering, contour point extraction, as well as ordinary binary dilation and erosion with arbitrary kernels.

Details

The fill value of the binary operations is determined by the max gray value of the input image.

Windows

Default Panel

../../../Modules/ML/MLKernel/mhelp/Images/Screenshots/CloseGap._default.png

Input Fields

input0

name: input0, type: Image

An image of arbitrary type.

Output Fields

output0

name: output0, type: Image

The filtered image of the same type as the input image.

Parameter Fields

Field Index

Border Handling: Enum

Make kernel spherical: Bool

Use (useIntervalOfFilteredVoxels): Bool

External Kernel: String

Max (intervalMaxOfFilteredVoxels): Double

Use (useIntervalOfVoxelsForFiltering): Bool

Fill Value: Double

Max (intervalMaxOfVoxelsForFiltering): Double

Use (filterMode): Enum

Info: String

Min (intervalMinOfFilteredVoxels): Double

Use External Kernel: Bool

Kernel Type: Enum

Min (intervalMinOfVoxelsForFiltering): Double

KernelX: Integer

numKernelElements: Integer

KernelY: Integer

referenceExtentMode: Enum

KernelZ: Integer

Sensitivity: Float

Visible Fields

Border Handling

name: borderHandling, type: Enum, default: PadSrcClamp, deprecated name: edgeMode

Defines the border handling mode.

See Border Handling in Kernel Operations for details.

Values:

Title

Name

​No Pad

​NoPad

​Pad Src Fill

​PadSrcFill

​Pad Dst Fill

​PadDstFill

​Pad Dst Fill With Orig

​PadDstFillWithOrig

​Pad Src Undefined

​PadSrcUndefined

​Pad Dst Undefined

​PadDstUndefined

​Pad Src Clamp

​PadSrcClamp

Fill Value

name: fillValue, type: Double, default: 0

Sets the fill value for certain Border Handling modes.

KernelX

name: kernelX, type: Integer, default: 3, minimum: 1, maximum: 99

Sets the x-extent of the kernel.

KernelY

name: kernelY, type: Integer, default: 3, minimum: 1, maximum: 99

Sets the y-extent of the kernel.

KernelZ

name: kernelZ, type: Integer, default: 1, minimum: 1, maximum: 99

Sets the z-extent of the kernel.

Make kernel spherical

name: makeSpherical, type: Bool, default: FALSE

If checked, the used kernel is a spherical kernel, not a rectangular one.

Min (intervalMinOfFilteredVoxels)

name: intervalMinOfFilteredVoxels, type: Double, default: 0, deprecated name: imageIntervalMin

Sets the minimum value threshold for outputting a subset of voxel.

Max (intervalMaxOfFilteredVoxels)

name: intervalMaxOfFilteredVoxels, type: Double, default: 1024, deprecated name: imageIntervalMax

Sets the maximum value threshold for outputting a subset of voxel.

Use (useIntervalOfFilteredVoxels)

name: useIntervalOfFilteredVoxels, type: Bool, default: FALSE, deprecated name: useImageInterval

If checked, the module outputs only on a subset of voxels defined by a value range.

Min (intervalMinOfVoxelsForFiltering)

name: intervalMinOfVoxelsForFiltering, type: Double, default: 0, deprecated name: kernelIntervalMin

Sets the minimum value threshold for operating on a subset of voxels.

Max (intervalMaxOfVoxelsForFiltering)

name: intervalMaxOfVoxelsForFiltering, type: Double, default: 1024, deprecated name: kernelIntervalMax

Sets the maximum value threshold for operating on a subset of voxels.

Use (useIntervalOfVoxelsForFiltering)

name: useIntervalOfVoxelsForFiltering, type: Bool, default: FALSE, deprecated name: useKernelInterval

If checked, the module operates only on a subset of voxels defined by a value range.

External Kernel

name: externalKernel, type: String, deprecated name: kernelInput

Sets an external kernel as a string.

Use the module KernelEditor for editing the kernel or set the kernel by scripting.

Use External Kernel

name: useExternalKernel, type: Bool, default: FALSE, deprecated name: UseKernelInput

If checked, the optionally attached External Kernel is used.

Info

name: kernelInfo, type: String, persistent: no

Shows information about the used kernel.

Use (filterMode)

name: filterMode, type: Enum, default: CloseGap

Defines the filter mode of this module.

Values:

Title

Name

Deprecated Name

Description

​Id

​Id

​Copies the input image.

​Close-Gap

​CloseGap

​Closes gaps in binary images.

Use only with the CloseGap kernel provided by this module. Using the sensitivity-parameter, it does the following:

newVoxelValue = oldVoxelValue

OR

[(#positiveVoxelPairs / #totalVoxelPairs) > (sensitivity / 100)]

If a 2D kernel dimension is chosen, 4 voxel pairs will be tested. The current voxel lies exactly between each voxel pair in order to avoid contour changes. The 2D situation looks like this:

<----------kernelExt.x-------------->
1                  2                3

4                current            4

3                  2                1

In 3D, there are 8 pairs, each corner of the kernel cube belonging to one. Two voxels with the same number are considered a pair. The logical value of a pair is the AND of the corresponding values in the original image.

Ordinarily, the sequential use of multiple filters with decreasing kernel size performs best, eventually in combination with ordinary dilation and erosion filters.

Input image and result:

../../../Modules/ML/MLKernel/mhelp/Images/lungseg-closegap.jpg

​Majority

​Majority

​Writes the gray value that occurs most often.

All voxels that lie beneath a kernel element will be considered (unless a kernel interval is used). The actual values of the kernel elements specified are irrelevant.

This filter mode is useful for performing morphological operations on images that contain differently gray-value-coded object masks.

For example, in the image shown here, three majority filters of decreasing kernel sizes were used in a row. All three of them used an image interval of [0,0] as well as the CloseGap kernel. To smooth the result at the end, a fourth majority filter was used with a small full kernel, not constrained to any interval.

Result of multiple sequential majority filter operations:

../../../Modules/ML/MLKernel/mhelp/Images/sample-majority.jpg

​Majority Close-Gap

​MajorityCloseGap

​Majority CloseGap

​A combination of the CloseGap and Majority filter modes.

We examine the pairs from the CloseGap filter, but only take into account those pairs (valid pairs) that consist of voxels with equal gray values. We count all valid pairs with the same gray value (while the center voxel counts as a pair itself) and write the value that occurs most often. This filter is supposed to preserve the original structure shapes more effectively than the ordinary majority filter. Just like the CloseGap filter mode, this one is restricted to the CloseGap kernel.

​Binary Dilation

​BinaryDilation

​Binary Dilation

​The voxel elements below the kernel are ORed to determine whether the result voxel will be set or not.

​Binary Erosion

​BinaryErosion

​Binary Erosion

​The voxel elements below the kernel are ANDed to determine whether the result voxel will be set or not.

​Contour Point Filter

​ContourPointFilter

​Contour Point Filter

​This filter deletes all voxels that have more than sensitivity % voxels of the same gray value in their neighborhood (the neighborhood is defined by the kernel).

For example, to obtain the complete 2D contours of a solid object, you could set the kernel type to full, specify the kernel extensions as 3x3x1, and set the sensitivity to 75. You can play with the sensitivity parameter to reduce or increase the number of remaining contour points.

Kernel Type

name: internalKernel, type: Enum, default: CloseGap, deprecated name: selectInternalKernel

Defines the kernel that will be used for the current filter.

Values:

Title

Name

Deprecated Name

Description

​Close-Gap

​CloseGap

​Close Gap

​See Use for detailed information.

​Full

​Full

​The entire kernel mask will be filled with only the value 1.

​Star

​Star

​A 2D/3D star will be used as a kernel.

​Box

​Box

​The only kernel elements set (to 1) will be the center element and all boundary elements.

Sensitivity

name: sensitivity, type: Float, default: 25, minimum: 0, maximum: 100

Sets the percentage of pairs that have to be positive in order to set the result voxel.

This parameter will be used in CloseGap filter mode only.

Hidden Fields

referenceExtentMode

name: referenceExtentMode, type: Enum, default: Overlap

Values:

Title

Name

​Overlap

​Overlap

​Input0 Ext Without Fill

​Input0_ExtWithoutFill

​Input0 Ext With Fill

​Input0_ExtWithFill

​Max Extents Without Fill

​MaxExtentsWithoutFill

​Max Extents With Fill

​MaxExtentsWithFill

numKernelElements

name: numKernelElements, type: Integer, persistent: no