@ALDAOperator(genericExecutionMode=ALL, level=STANDARD, shortDescription="Image arithmetics class for MTBImage objects.") public class ImageArithmetics extends MTBOperator
MTBImage
objects.
The arithmetic operations are sub-divided into operations regarding two images (ADD, SUB, MULT, DIV, MIN, MAX, AND, OR) and operations regarding one image and one constant (ADD_CONST, MULT_CONST, DIV_CONST, POW_CONST, INV).
Operations with one input image result in images of the same type!! Operations with two input images result in an image of type of the higher input image precision!!
If two input images do not have the same size the resulting image is null. Each operation is elementwise.
Modifier and Type | Class and Description |
---|---|
static class |
ImageArithmetics.ArithOp
Arithmetic operations:
ADD, SUB, MULT, DIV, MIN, MAX, AND, OR, ABS_DIFF require two input images, ADD_CONST, MULT_CONST, DIV_CONST, POW_CONST require one input image and a constant INV, ABS require one input image only |
Modifier and Type | Field and Description |
---|---|
private ImageArithmetics.ArithOp |
arithmeticOp |
private int |
firstOneImageOneConstOrdinal |
private int |
firstOneImageOnlyOrdinal |
private Double |
inConst |
private MTBImage |
inImg1 |
private MTBImage |
inImg2 |
private MTBImage |
resultImg |
Modifier | Constructor and Description |
---|---|
|
ImageArithmetics()
Create empty ImageArithmetics object.
|
protected |
ImageArithmetics(ImageArithmetics.ArithOp op,
MTBImage inputImage,
double inputConstant)
Constructor for arithmetic operations considering one image and a constant.
|
protected |
ImageArithmetics(ImageArithmetics.ArithOp op,
MTBImage inputImage1,
MTBImage inputImage2)
Constructor for arithmetic operations considering two images.
|
Modifier and Type | Method and Description |
---|---|
protected MTBImage |
abs_diff(MTBImage img1,
MTBImage img2)
Absolute difference of the elements of two images
|
protected MTBImage |
abs(MTBImage img)
Absolute values of the image elements.
|
protected MTBImage |
add(MTBImage img,
double constant)
Add a constant to each image value
|
protected MTBImage |
add(MTBImage img1,
MTBImage img2)
Add the elements of two images
|
protected MTBImage |
and(MTBImage img1,
MTBImage img2)
Bitwise logical AND of two images.
|
protected MTBImage |
div(MTBImage img,
double constant)
Divide each image value by a constant.
|
protected MTBImage |
div(MTBImage img1,
MTBImage img2)
Divide the elements of two images (img1/img2)
|
protected ImageArithmetics.ArithOp |
getArithmeticOperation() |
String |
getDocumentation() |
protected Double |
getInConst() |
protected MTBImage |
getInImg1() |
protected MTBImage |
getInImg2() |
protected MTBImage |
getResultImg() |
protected MTBImage |
inv(MTBImage img)
Inverts the image.
|
protected MTBImage |
max(MTBImage img1,
MTBImage img2)
Pixelwise maximum
|
protected MTBImage |
min(MTBImage img1,
MTBImage img2)
Pixelwise minimum
|
protected MTBImage |
mult(MTBImage img,
double constant)
Multiply each image value by a constant
|
protected MTBImage |
mult(MTBImage img1,
MTBImage img2)
Multiply the elements of two images
|
protected void |
operate() |
protected MTBImage |
or(MTBImage img1,
MTBImage img2)
Bitwise OR of the elements of two images
|
protected MTBImage |
pow(MTBImage img,
double constant)
Raise image values to the power of 'constant'
|
protected void |
setArithmeticOperation(ImageArithmetics.ArithOp op) |
protected void |
setInConst(double inConst) |
protected void |
setInImg1(MTBImage inImg1) |
protected void |
setInImg2(MTBImage inImg2) |
protected void |
setResultImg(MTBImage img) |
protected MTBImage |
sub(MTBImage img1,
MTBImage img2)
Subtract the elements of two images (img1 - img2)
|
void |
validateCustom() |
readResolve
addOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInactiveParameterNames, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterDescriptorUnconditioned, getParameterNames, getParameterUnconditioned, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, hasInOutParameters, hasParameter, isAnnotatedParameter, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, removeParameter, runOp, runOp, runOp, setConstructionMode, setConstructionMode, setConstructionMode, setHidingMode, setName, setParameter, setParameterUnconditioned, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory
@Parameter(label="First input image", required=true, direction=IN, dataIOOrder=1, mode=STANDARD, description="Input image 1") private MTBImage inImg1
@Parameter(label="Second input image", required=false, direction=IN, dataIOOrder=3, mode=STANDARD, description="Input image 2 (if required by operation)") private MTBImage inImg2
@Parameter(label="Result image", required=true, direction=OUT, dataIOOrder=1, mode=STANDARD, description="Resulting image") private MTBImage resultImg
@Parameter(label="Arithmetic operation", required=true, direction=IN, dataIOOrder=2, mode=STANDARD, description="Arithmetic operation on images") private ImageArithmetics.ArithOp arithmeticOp
@Parameter(label="Input constant", required=false, direction=IN, dataIOOrder=4, mode=STANDARD, description="Input constant (if required by operation)") private Double inConst
private final int firstOneImageOneConstOrdinal
private final int firstOneImageOnlyOrdinal
public ImageArithmetics() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected ImageArithmetics(ImageArithmetics.ArithOp op, MTBImage inputImage1, MTBImage inputImage2) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
op
- arithmetic operationinputImage1
- first input imageinputImage2
- second input imagede.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected ImageArithmetics(ImageArithmetics.ArithOp op, MTBImage inputImage, double inputConstant) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
op
- arithmetic operationinputImage
- input imageinputConstant
- input constantde.unihalle.informatik.Alida.exceptions.ALDOperatorException
public void validateCustom() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
validateCustom
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected MTBImage getInImg1()
protected void setInImg1(MTBImage inImg1)
protected MTBImage getInImg2()
protected void setInImg2(MTBImage inImg2)
protected Double getInConst()
protected void setInConst(double inConst)
protected ImageArithmetics.ArithOp getArithmeticOperation()
protected void setArithmeticOperation(ImageArithmetics.ArithOp op)
protected MTBImage getResultImg()
protected void setResultImg(MTBImage img)
protected MTBImage add(MTBImage img, double constant)
img
- input imageconstant
- protected MTBImage mult(MTBImage img, double constant)
img
- input imageconstant
- protected MTBImage div(MTBImage img, double constant)
Note that invalid values might result if constant is zero.
img
- Input image.constant
- Constant.protected MTBImage pow(MTBImage img, double constant)
img
- constant
- protected MTBImage inv(MTBImage img)
img
- Input image.protected MTBImage abs(MTBImage img)
img
- Input image.protected MTBImage sub(MTBImage img1, MTBImage img2)
protected MTBImage div(MTBImage img1, MTBImage img2)
protected MTBImage and(MTBImage img1, MTBImage img2)
img1
- First image.img2
- Second image.protected MTBImage or(MTBImage img1, MTBImage img2)
img1
- First image.img2
- Second image.protected MTBImage abs_diff(MTBImage img1, MTBImage img2)
public String getDocumentation()
getDocumentation
in class de.unihalle.informatik.Alida.operator.ALDOperator
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.