Purpose

The module IntervalThresh processes an image by filtering just those image values that lie in a certain grey value interval.

Voxels outside this range can be set to zero or to a user defined value. This can be useful for the segmentation of objects that are expected to have grey values in a defined interval.

Details

The interval can be defined in several ways: either by setting a center and a width of the interval or by setting a maximum and a minimum value. The interval is closed, i.e. Min and Max are considered to be part of the inner range.

The user can define new values for voxels lying above, below or inside the interval.

If the value output below/above the interval is the same as for the inner range, one of the thresholds is effectively disabled. In particular, this means that IntervalThreshold can be used as a simple thresholding module with configurable behavior for the exact threshold value (i.e. greater-or-equal vs. greater comparators):

  • With >= t1, only Min is used as threshold, and the threshold value is mapped to 1 (as values above).
  • With > t2, only Max is used as threshold, and the threshold value is mapped to 0 (as values below).

Tips

Important: Note that the slider range clamps the threshold fields even if the panel is not open. That is why Static is the default, with large bounds. This behavior might change in the future, because it easily leads to bugs (if thresholds silently change due to temporarily small input image ranges).

Some common cases are optimized and will be performed faster than the general case:

  • There is a binary inside vs. outside interval decision, i.e. the configured output for above and below values is the same (cf. presets).
  • Only one of the two thresholds is used, i.e. the configured output for the inner interval and either above or below values is the same.
  • In both cases, ImgMaxMinusImgOrig must not be used for any of the three output type fields in order to benefit from the special implementations.

Note that for the ImgMaxMinusImgOrig mode, the difference between the maximum possible value and the current image value is casted to the same datatype as the input and output has (in fact, the computation is performed in-place). This may lead to unexpected results with negative image values in signed integer images.

Windows

Default Panel

../../../Modules/ML/MLMiscModules/mhelp/Images/Screenshots/IntervalThreshold._default.png

Input Fields

input0

name: input0, type: Image

Output Fields

output0

name: output0, type: Image

Parameter Fields

Field Index

> t2: Trigger Clamped Orig: Trigger Min. (imageMin): Double
>= t1: Trigger imageRange: Double Min. (changedMin): Double
Above Value: Enum Inner Value: Enum Static: Bool
Below Value: Enum Masked Orig: Trigger User Def. (lowerUserValue): Double
Binary: Trigger Max: Double User Def. (innerUserValue): Double
Center: Double Max. (imageMax): Double User Def. (upperUserValue): Double
centerWidthSet: Bool Max. (changedMax): Double Width: Double
Clamp: Trigger Min: Double  

Visible Fields

Below Value

name: lowerType, type: Enum, default: UserDef

Defines which value is set in the output image for voxels below the lower border value.

Values:

Title Name Deprecated Name Description
Img Min ImgMin   Set the minimum value of the output image.
Img Max ImgMax   Set the maximum value of the output image.
Img Orig ImgOrig   Set the original value of the input image.
ImgMax-ImgOrig ImgMaxMinusImgOrig ImgMax-ImgOrig Set the maximum value of the output image minus the input image’s original value (casted to the same datatype!).
User Def UserDef   Set the value defined in User Def..
Interval Min IntervalMin IntervallMin Set the minimum value of the interval.
Interval Max IntervalMax IntervallMax Set the maximum value of the interval.

Inner Value

name: innerType, type: Enum, default: UserDef

Defines which value is set in the output image for voxels insire the defined interval.

The options are the same as for Below Value.

Values:

Title Name Deprecated Name
Img Min ImgMin  
Img Max ImgMax  
Img Orig ImgOrig  
ImgMax-ImgOrig ImgMaxMinusImgOrig ImgMax-ImgOrig
User Def UserDef  
Interval Min IntervalMin IntervallMin
Interval Max IntervalMax IntervallMax

Above Value

name: upperType, type: Enum, default: UserDef

Defines which value is set in the output image for voxels above the upper border value.

The options are the same as for Below Value.

Values:

Title Name Deprecated Name
Img Min ImgMin  
Img Max ImgMax  
Img Orig ImgOrig  
ImgMax-ImgOrig ImgMaxMinusImgOrig ImgMax-ImgOrig
User Def UserDef  
Interval Min IntervalMin IntervallMin
Interval Max IntervalMax IntervallMax

Min. (imageMin)

name: imageMin, type: Double, persistent: no

Max. (imageMax)

name: imageMax, type: Double, persistent: no

Center

name: threshCenter, type: Double, default: 0, minimum: :field:`imageMin`, maximum: :field:`imageMax`

Sets the center of the threshold interval.

Width

name: threshWidth, type: Double, default: 200000, minimum: 0, maximum: :field:`imageRange`

Sets the width of the threshold interval.

Min

name: threshMin, type: Double, default: -100000, minimum: :field:`imageMin`, maximum: :field:`imageMax`

Sets the lower bound of the (closed) threshold interval.

Max

name: threshMax, type: Double, default: 100000, minimum: :field:`imageMin`, maximum: :field:`imageMax`

Sets the upper bound of the (closed) threshold interval.

User Def. (lowerUserValue)

name: lowerUserValue, type: Double, default: 0

Sets a value to be used for voxels with values below the lower bound.

User Def. (innerUserValue)

name: innerUserValue, type: Double, default: 1

Sets a value to be used for voxels with values inside defined interval.

User Def. (upperUserValue)

name: upperUserValue, type: Double, default: 0

Sets a value to be used for voxels with values above the upper bound.

Static

name: changeMinMax, type: Bool, default: FALSE

If checked, the slider range is overwritten by Min. and Max.. Otherwise, it is set to the input image range.

Min. (changedMin)

name: changedMin, type: Double, default: 0

Sets a new minimum value for the output image.

Max. (changedMax)

name: changedMax, type: Double, default: 1000

Sets a new maximum value for the output image.

Clamp

name: clampThresholds, type: Trigger

Clamp slider range and thresholds to image (/static) range

Binary

name: presetBinary, type: Trigger

Activates preset for binary mask (0 for background, 1 for voxels within specified interval)

>= t1

name: presetThreshMin, type: Trigger

Activates preset for binary mask, using only the lower threshold (see Details)

> t2

name: presetThreshMax, type: Trigger

Activates preset for binary mask, using only the upper threshold (see Details)

Clamped Orig

name: presetClampedOrig, type: Trigger

Activates preset for clamped original (values outside specified interval are clamped to interval borders)

Masked Orig

name: presetMaskedOrig, type: Trigger

Activates preset for masked original (values outside specified interval are set to image minimum)

Hidden Fields

imageRange

name: imageRange, type: Double, persistent: no

centerWidthSet

name: centerWidthSet, type: Bool, default: FALSE