Purpose

The module Sigma applies an edge-preserving smoothing effect to an image.

Details

The basic idea for the spatial operations is to replace the central voxel by the average of selected neighbor pixels.

There exists one common problem for most spatial smoothing algorithm: they not only smooth out an image but also blur out the interesting features. For this reason, an edge-preserving smoothing algorithm named Sigma Filter was developed for digital image smoothing.

The Sigma filter only averages over all voxels under the kernel whose value differs by no more than Sigma from the one of the central voxel. Only if there are less than Minimum No. Kernel Voxels for Restricted Averaging found within the sigma interval, the averaging is performed over all kernel voxels.

For example, using 2 as minimum number will use the overall average if only the center voxel lies within the sigma-interval. Using 1 with a non-zero sigma will result in not filtering the center voxel at all if no other voxel lies within the sigma-interval. A value larger than the number of kernel voxels will result in simple average filtering.

If Scale w. local stdDev is enabled, the threshold is not Sigma, but Sigma multiplied by the standard deviation of all voxels under the (potentially filtered) kernel. Since the local stddev computation can be omitted with this flag disabled, computation is substantially faster with a global, constant interval size.

If Use Median As Reference is enabled, the median of the valid kernel voxels (= voxels within the filter kernel interval, if used, not necessarily within the sigma interval) is computed and used as center of the sigma interval instead of the kernel center voxel. In addition, the median is used as fallback value (in case less than the specified minimum number of kernel voxel fall into the sigma interval) instead of the arithmetic mean.

It is also possible to Use linear weighting for the voxels in the Sigma interval, and to clamp the computed local standard deviation to a specified maximum value using the Local StdDev Max parameter.

Due to its close relation to the average filter, the Sigma filter will never provide a stronger smoothing than an ordinary average filter with the same kernel size, but hopefully preserve more edges.

All computation is done in the double domain, no type-specific optimization is provided yet.

Windows

Default Panel

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

Input Fields

input0

name: input0, type: Image

Output Fields

output0

name: output0, type: Image

Parameter Fields

Visible Fields

Border Handling

name: borderHandling, type: Enum, default: PadSrcClamp

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.

Sigma

name: sigma, type: Double, default: 1, minimum: 0

Sets the sigma value.

Local StdDev Max

name: stdDevMax, type: Double, default: -1

Sets a maximum value to clamp the local standard deviation against.

Use negative values to prevent any clamping.

Minimum No. Kernel Voxels for Restricted Averaging

name: minNumValidKernelVoxelsInInterval, type: Integer, default: 2, minimum: 1

Sets a minimum number of valid kernel voxels in interval to apply the restricted averaging.

If the number of valid kernel voxels in the sigma interval is smaller, all valid kernel voxels (i.e. all kernel voxels that are match the current kernel interval settings) are used for averaging.

Scale w. local stdDev

name: multSigmaWithLocalStdDev, type: Bool, default: TRUE

If checked, the Sigma value is scaled with the local standard deviation value.

Use Median As Reference

name: useMedianAsReference, type: Bool, default: TRUE

If checked, the median of the valid kernel voxels is computed and used as center of the sigma interval instead of the kernel center voxel.

In addition, the median is used as fallback value (in case less than the specified minimum number of kernel voxel fall into the sigma interval) instead of the arithmetic mean.

Due to the additional median computation, this decreases computation speed somewhat.

Use linear weighting

name: useTriangleWeighting, type: Bool, default: FALSE

If checked, the kernel voxels in the Sigma interval are not all weighted equally, but relative to their distance to its center.

X

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

Sets the x-extent of the kernel.

Y

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

Sets the y-extent of the kernel.

Z

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

Sets the z-extent of the kernel.

C

name: kernelC, type: Integer, default: 1, minimum: 1, maximum: 999

Sets the c-extent of the kernel.

T

name: kernelT, type: Integer, default: 1, minimum: 1, maximum: 999

Sets the t-extent of the kernel.

U

name: kernelU, type: Integer, default: 1, minimum: 1, maximum: 999

Sets the u-extent of the kernel.

Min (intervalMinOfFilteredVoxels)

name: intervalMinOfFilteredVoxels, type: Double, default: 0

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

Max (intervalMaxOfFilteredVoxels)

name: intervalMaxOfFilteredVoxels, type: Double, default: 1024

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

Use (useIntervalOfFilteredVoxels)

name: useIntervalOfFilteredVoxels, type: Bool, default: FALSE

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

Min (intervalMinOfVoxelsForFiltering)

name: intervalMinOfVoxelsForFiltering, type: Double, default: 0

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

Max (intervalMaxOfVoxelsForFiltering)

name: intervalMaxOfVoxelsForFiltering, type: Double, default: 1024

Sets the maxmimum value threshold for operating on a subset of voxel.

Use (useIntervalOfVoxelsForFiltering)

name: useIntervalOfVoxelsForFiltering, type: Bool, default: FALSE

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

Make kernel spherical

name: makeSpherical, type: Bool, default: FALSE

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

External Kernel

name: externalKernel, type: String

Sets an external kernel as a string.

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

Use (useExternalKernel)

name: useExternalKernel, type: Bool, default: FALSE

If checked, the optionally attached External Kernel is used.

Info

name: kernelInfo, type: String, persistent: no

Shows information about the kernel.

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