Purpose

The module Mask masks the image of input one with the mask at input two.

Details

Possible output values are the original image of the first input, the original image of the second input, the masked original image, the masked original image on white background, the original image masked with the inverted mask or the original blended with the mask image.

The first input image must be of a scalar type for the three blending modes MaskOverOriginal, MaskInOriginal or InvMaskInOriginal. For all other modes the first input can also be of one of the default extended types: complex, vec2, vec3, vec6, mat2 or mat3.

The second input image must always be of a scalar type.

Windows

Default Panel

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

Input Fields

input0

name: input0, type: Image

input1

name: input1, type: Image

Output Fields

output0

name: output0, type: Image

Parameter Fields

Visible Fields

Mode

name: mode, type: Enum, default: MaskedOriginal, deprecated name: MaskMode

Defines the masking algorithm.

Values:

Title Name Description
Original Original The original image from the first input is passed to the output.
Mask Mask The original image from the second input is passed to the output.
Inv Mask InvMask The image from the second input is inverted and passed to the output.
Masked Original MaskedOriginal

Original where Mask is non-zero and Background else.

All pixels from the first input are passed unchanged to the output if non-zero values are found at their positions in the second input image. Otherwise Background values are passed to the output.

Masked Original On White MaskedOriginalOnWhite

All pixels from the first input are passed unchanged to the output if non-zero values are found at their positions in the second input image.

Otherwise the images’ maximum value is passed to the output.

Masked Original Inv MaskedOriginalInv

Original where mask values are zero and background value elsewhere.

All pixels from the first input are passed unchanged to the output if zero values are found at their positions in the second input image. Otherwise Background values are set to the output.

Mask Over Original MaskOverOriginal All mask pixels are blended with the original image with the given Blending weight.
Mask In Original MaskInOriginal

All non-zero mask pixels are blended with the original image with the given Blending weight.

Original pixels at zero mask positions are not modified.

Inv Mask In Original InvMaskInOriginal

All pixels from the first input are passed unchanged to the output if non-zero values are found at their positions in the second input image.

Otherwise the voxel from the first input is multiplied with Blending.

Inv Original InvOriginal

All pixels from the input image are subtracted from the image maximum and the image minimum is added.

So the values are flipped between image minimum and image maximum value which leads to a visible inversion.

Output Image Size

name: outputImageSize, type: Enum, default: InvalidateOutputIfSizesDiffer

Defines how the module reacts if the sizes of the input images differ.

Values:

Title Name Description
Use Smallest Input UseSmallestInput The image and the page extent of the smallest input image is used for the output image.
Invalidate Output If Sizes Differ InvalidateOutputIfSizesDiffer If the image extents of the input images differ, the output image is invalidated.

Blending

name: blending, type: Double, default: 0.5, minimum: 0, maximum: 1, deprecated name: blendFactor

Sets a blending weight for the Mode settings MaskOverOriginal and MaskInOriginal.

Background

name: background, type: Double, default: 0

Sets the background value used in various modes.