ddd_pylib.image_manip.

ImageCalculatorOperator#

class ddd_pylib.image_manip.ImageCalculatorOperator[source]#

Bases: ImageOperator

Applies a binary operation between two images. The operation can be one of the following: Add, Subtract, Multiply, Divide, OR, AND, Difference, Minimum, Maximum, or Average. The data type of the output image is the one used by the main image (left hand of the operation). All operations are clipped to the data type for integer types. The AND and OR operations are numeric. They work as expected for booleans, but for numeric values, they return the first non-zero value (for OR) or the second value if the first is non-zero (for AND). The division is not secured against division by zero.

Methods

static defaultOperationName()[source]#

Set the Add operation by default.

Return type:

str

getCurrentOperation()[source]#

Return the current operation function

Return type:

Callable[[DataArray, DataArray], DataArray]

getCurrentOperationName()[source]#

Return the name of the current operation

Return type:

str

getPrefix()[source]#

Prefix added to the input image name to generate the output image name.

Return type:

str

getSecondaryImage()[source]#

Return the secondary image used in the operation

Return type:

DataArray

sanityCheck()[source]#

Simple check to prevent simple error, it may be implemented in subclasses to check more precise stuff

setOperation(operationName)[source]#

Set the operation that needs to be executed

Parameters:

operationName (str) – name of the operation to execute

setSecondaryImage(img)[source]#

Set the secondary image for the binary operation.

Parameters:

img (DataArray) – The secondary image