public final class TLcdBinaryOp extends ALcdImageOperator
// Using the static method:
ALcdBasicImage inputImage = ...;
ALcdBasicImage secondImage = ...;
TLcdBinaryOp.Operation binaryOperation = TLcdBinaryOp.Operation.ADD;
ALcdBasicImage outputImage = TLcdBinaryOp.binaryOp(inputImage, secondImage, binaryOperation);
// Using a data object:
ALcdBasicImage inputImage = ...;
ALcdBasicImage secondImage = ...;
TLcdBinaryOp op = new TLcdBinaryOp();
ILcdDataObject params = op.getParameterDataType().newInstance();
params.setValue(TLcdBinaryOp.INPUT_IMAGE, inputImage);
params.setValue(TLcdBinaryOp.SECOND_IMAGE, secondImage);
params.setValue(TLcdBinaryOp.OPERATION, binaryOperation);
ALcdBasicImage outputImage = op.apply(params);
Convenience shortcut methods are also available for every supported operation:
outputImage = TLcdBinaryOp.add(inputImage,secondImage);
outputImage = TLcdBinaryOp.subtract(inputImage,secondImage);
outputImage = TLcdBinaryOp.multiply(inputImage,secondImage);
outputImage = TLcdBinaryOp.divide(inputImage,secondImage);
outputImage = TLcdBinaryOp.max(inputImage,secondImage);
outputImage = TLcdBinaryOp.min(inputImage,secondImage);
![]() | + | ![]() |
Modifier and Type | Class and Description |
---|---|
static class |
TLcdBinaryOp.Operation
Available binary operations.
|
ALcdImageOperator.ImageOperatorTypeBuilder
Modifier and Type | Field and Description |
---|---|
static TLcdDataType |
BINARY_FILTER_TYPE
Input data type of the operator.
|
static TLcdDataProperty |
INPUT_IMAGE
The input image.
|
static String |
NAME
Name of the operator.
|
static TLcdDataProperty |
OPERATION
Binary operation to apply.
|
static TLcdDataProperty |
SECOND_IMAGE
The second image to use in the binary operation.
|
INPUT_IMAGE_NAME
Constructor and Description |
---|
TLcdBinaryOp()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
static ALcdBasicImage |
add(ALcdBasicImage aImage1,
ALcdBasicImage aImage2)
Add two images together.
|
ALcdImage |
apply(ILcdDataObject aParameters)
Applies this operator to the given input parameters.
|
static ALcdBasicImage |
binaryOp(ALcdBasicImage aImage1,
ALcdBasicImage aImage2,
TLcdBinaryOp.Operation aOperation)
Applies a binary operation to two input images.
|
static ALcdBasicImage |
divide(ALcdBasicImage aImage1,
ALcdBasicImage aImage2)
Divide two images.
|
static ALcdBasicImage |
max(ALcdBasicImage aImage1,
ALcdBasicImage aImage2)
Take the maximum of two images.
|
static ALcdBasicImage |
min(ALcdBasicImage aImage1,
ALcdBasicImage aImage2)
Take the minimum of two images.
|
static ALcdBasicImage |
multiply(ALcdBasicImage aImage1,
ALcdBasicImage aImage2)
Multiply two images.
|
static ALcdBasicImage |
subtract(ALcdBasicImage aImage1,
ALcdBasicImage aImage2)
Subtract two images from each other.
|
createTypeBuilder, createTypeBuilder, equals, getParameterDataType, hashCode, toString
public static final String NAME
public static final TLcdDataProperty INPUT_IMAGE
public static final TLcdDataProperty SECOND_IMAGE
public static final TLcdDataProperty OPERATION
public static final TLcdDataType BINARY_FILTER_TYPE
public ALcdImage apply(ILcdDataObject aParameters)
ALcdImageOperator
apply
in class ALcdImageOperator
aParameters
- the parameters for the operatorpublic static ALcdBasicImage binaryOp(ALcdBasicImage aImage1, ALcdBasicImage aImage2, TLcdBinaryOp.Operation aOperation)
aImage1
- first input image.aImage2
- second input image.aOperation
- operation to apply to the images.public static ALcdBasicImage add(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
aImage1
- first input image.aImage2
- second input image.public static ALcdBasicImage subtract(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
aImage1
- first input image.aImage2
- second input image.public static ALcdBasicImage multiply(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
aImage1
- first input image.aImage2
- second input image.public static ALcdBasicImage divide(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
aImage1
- first input image.aImage2
- second input image.public static ALcdBasicImage min(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
aImage1
- first input image.aImage2
- second input image.public static ALcdBasicImage max(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
aImage1
- first input image.aImage2
- second input image.