Flags for the ApplyMathematicalLogicCommand

The following flags indicate the channel that will be used:

Value

Meaning

Master

All channels.

Red

Red channel only.

Green

Green channel only.

Blue

Blue channel only.

The following flags indicate how to treat the color value:

Value

Meaning

ValueDoNothing

No change.

ValueNot

Invert the color, resulting in its complement.

ValueZero

Change all bits to 0.

ValueOne

Change all bits to 1.

The following flags indicate the mathematical operation to use. The operations are performed between each component (R, G and B) and Factor:

Value

Meaning

OperationAnd

Combine each pixel component value and nFactor using a bitwise AND (&).

(pixel = pixel & Factor)

OperationOr

Combine each pixel component value and nFactor using a bitwise OR ( ¦ ).

(pixel = pixel | Factor)

OperationXor

Combine each pixel component value and nFactor using a bitwise XOR (^).

(pixel = pixel ^ Factor)

OperationAdd

Add pixel component value to the nFactor clamping the result to the maximum allowed pixel value.

(pixel = min(pixel + Factor, MaximumPixelValue) )

OperationSubtractFactor

Subtract each pixel component value from the nFactor, clamping the result to the allowed pixel range.

(pixel = min(max(Factor - pixel, MinimumPixelValue), MaximumPixelValue) )

OperationSubtractValue

Subtract nFactor from each pixel component value, clamping the result to the allowed pixel range

(pixel = min(max(pixel - Factor), MinimumPixelValue, MaximumPixelValue) )

OperationAbsoluteDifference

Calculate the absolute difference between Factor and each pixel component value.

(pixel = abs(pixel - Factor))

OperationMultiply

Multiply each pixel component value by Factor/100.

(pixel = pixel * Factor / 100)

OperationDivisionByFactor

Divide each pixel component value by Factor/100. An error will be returned if Factor = 0.

(pixel = pixel * 100 / Factor)

OperationDivisionByValue

Divide nFactor by each pixel values. If the pixel values are 0, the result set to maximum allowed pixel value. (pixel = pixel ? min(Factor / pixel, MaximumPixelValue) : MaximumPixelValue)

OperationAverage

Use the average of the each pixel component value and Factor. (pixel = (pixel+Factor) / 2).

OperationMinimum

Use the lesser of the pixel component values and Factor:

(pixel = min(pixel, Factor) )

OperationMaximum

Use the greater of the pixel component values and Factor:

(pixel = max(pixel, Factor) )

The way MinimumPixelValue and MaximumPixelValue are calculated depends on the bits per pixel and whether the image is signed or unsigned:

if the image is unsigned (most common):

MaximumPixelValue will be : 255 (8-bit), 4095 (12-bit) or 65535 (16-bit)

MinimumPixelValue = 0

if the image is signed (rare case):

MaximumPixelValue will be : 127 (8-bit), 2047 (12-bit) or 32767 (16-bit)

MinimumPixelValue will be -128 (8-bit), -2048 (12-bit) or -32768 (16-bit)

The following flags indicate how to treat the output value:

Value

Meaning

ResultDoNothing

No change.

ResultNot

Invert the color, resulting in its complement.

ResultZero

Change all bits to 0.

ResultOne

Change all bits to 1.

If the Flags property is OperationAnd, OperationOr, OperationXor, OperationAdd, OperationMinumum, OperationMultiply, OperationMaximum, OperationDivisionByValue , or OperationSubtractValue, the valid range of Factor is:

From MinimumPixelValue to MaximumPixelValue.

For Flags equal to OperationSubtractFator, OperationDifference, OperationAverage, the valid range of Factor is: From 2 * MinimumPixelValue to 2 * MaximumPixelValue.

Help Version 22.0.2023.7.17
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Imaging, Medical, and Document
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.