MaskedBypass

MLModule

authors

Hans Meine, Felix Thielke

package

FMEstable/ReleaseMeVis

dll

MLMaskedBypass

definition

MaskedBypass.def

see also

Mask, BroadcastingMask

keywords

dead, space, elimination, removal, page

Purpose

The MaskedBypass is an efficient variant of Mask that only queries those pages of the input image that are not completely masked away. For every voxel it copies the value of inImage to outImage if the corresponding voxel of inMask is non-zero, and writes Fill Value otherwise.

Usage

  1. Connect an image to inImage.n2. Connect a mask image to inMask. Each dimension of the mask must either be 1 (in which case it is broadcast) or equal to the corresponding dimension of the input image.n3. Optionally set Fill Value to the value written for masked-out voxels.n4. Trigger Update to run the computation manually, or set On Input Change Behavior to Update for automatic recomputation on input changes.n5. Read the result from outImage and inspect outPageMask for the page-level mask used to skip empty pages.

Details

The module behaves like a voxel-wise mask: the output voxel value is taken from inImage where inMask is non-zero and replaced with Fill Value where inMask is zero.nnTo improve performance, the mask is first analyzed at page granularity. All pages that contain only zero mask voxels are recorded in the outPageMask and are skipped entirely during the actual output computation, eliminating dead space. A page is therefore only read from the input when it contains at least one non-zero mask voxel.nnThe mask may be broadcast along any dimension by using a size of 1 there. In that case the mask value for a whole page is taken from the single slice, and the corresponding page dimensions in outPageMask collapse to 1 as well.

Interaction

The default panel exposes Fill Value plus the standard AlgorithmModule control and status fields. Use Update for explicit execution, Clear to reset the outputs (including outPageMask) to a clean initial state, and On Input Change Behavior to control automatic behavior when inputs change. Check Status Code and Has Valid Output to verify the result.

Tips

The module is most beneficial for sparse masks where large parts of the input are masked away, since those pages are not read from disk. Use broadcasting (mask size 1 along a dimension) to reduce memory and speed up scanning. For a steady stream of changing inputs, set On Input Change Behavior to Update to keep the outputs current automatically.

Windows

The default window shows the fill value setting together with the standard algorithm control/status fields.

Default Panel

Shows the Fill Value setting and the common control/status fields (Update, Clear, Status Code, Has Valid Output).

Input Fields

Connect the image to be masked and the mask image that determines which voxels are kept.

inImage

name: inImage, type: Image, deprecated name: input0

Input image whose voxels are copied through where the mask is non-zero.

inMask

name: inMask, type: Image, deprecated name: input1

Mask image. A voxel with a non-zero value keeps the corresponding input voxel, a zero value replaces it with Fill Value. Each dimension must either be 1 (broadcast) or match the input image dimension.

Output Fields

The masked image and the internal page-level mask that was used to skip fully masked pages.

outImage

name: outImage, type: Image, deprecated name: output0

Result image: the input voxel value where the mask is non-zero, and Fill Value where the mask is zero.

outPageMask

name: outPageMask, type: BitImage(MLBase)

Page-level mask, one bit per page of the input, indicating which pages contain at least one non-zero mask voxel. Fully masked pages (bit cleared) are skipped during output computation. Broadcast dimensions collapse to size 1.

Parameter Fields

Field Index

[]: Trigger

Update: Trigger

Clear: Trigger

doNotClearOnFailedUpdate: Bool

Fill Value: Double

Has Valid Output: Bool

On Input Change Behavior: Enum

Status Code: Enum

Status Message: String

Use the AlgorithmModule control fields to trigger updates, reset state, and inspect whether the latest result is valid.

Visible Fields

Update

name: update, type: Trigger, deprecated name: updateMask

Initiates update of all output field values.

Clear

name: clear, type: Trigger, deprecated name: clearMask

Clears all output field values to a clean initial state.

On Input Change Behavior

name: onInputChangeBehavior, type: Enum, default: Clear, deprecated name: shouldAutoUpdate,shouldUpdateAutomatically

Declares how the module should react if a value of an input field changes.

Values:

Title

Name

Deprecated Name

Description

Update

Update

TRUE

Recompute outputs when an input changes.

Clear

Clear

FALSE

Clear outputs when an input changes; run Update manually afterward.

Status Code

name: statusCode, type: Enum, persistent: no

Reflects module’s status (successful or failed computations) as one of some predefined enumeration values.

Values:

Title

Name

Ok

Ok

Invalid input object

Invalid input object

Invalid input parameter

Invalid input parameter

Internal error

Internal error

Status Message

name: statusMessage, type: String, persistent: no

Gives additional, detailed information about status code as human-readable message.

Has Valid Output

name: hasValidOutput, type: Bool, persistent: no

Indicates validity of output field values (success of computation).

[]

name: updateDone, type: Trigger, persistent: no

Notifies that an update was performed (Check status interface fields to identify success or failure).

Fill Value

name: inFillValue, type: Double, default: 0, deprecated name: fillValue

Value written to output voxels where the mask is zero.

Hidden Fields

doNotClearOnFailedUpdate

name: doNotClearOnFailedUpdate, type: Bool, persistent: no

Prevents automated clear after update failed. This does not affect status fields. It enables the developer to analyze module’s state after failure.