Class AbstractOperator<I>
- java.lang.Object
-
- science.aist.imaging.core.imageprocessing.operator.AbstractOperator<I>
-
- All Implemented Interfaces:
BiFunction<ImageWrapper<I>,ImageWrapper<I>,ImageWrapper<I>>
,BinaryOperator<ImageWrapper<I>>
- Direct Known Subclasses:
AddFunction
,DivFunction
,MulFunction
,SubFunction
public abstract class AbstractOperator<I> extends Object implements BinaryOperator<ImageWrapper<I>>
Abstract operator implementation for combining two images
- Since:
- 1.0
- Author:
- Christoph Praschl
-
-
Field Summary
Fields Modifier and Type Field Description protected ImageFactory<I>
provider
ImageProvider used to create a new result-image
-
Constructor Summary
Constructors Constructor Description AbstractOperator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ImageWrapper<I>
apply(ImageWrapper<I> wrapper1, double scalar)
Applies the operator for the given image with the scalar valueImageWrapper<I>
apply(ImageWrapper<I> wrapper1, double scalar, ImageWrapper<I> mask)
Applies the operator for the given image with the scalar valueImageWrapper<I>
apply(ImageWrapper<I> wrapper, ImageWrapper<I> wrapper2)
ImageWrapper<I>
apply(ImageWrapper<I> wrapper1, ImageWrapper<I> wrapper2, ImageWrapper<I> mask)
Applies the operator for the two imagesprotected void
checkMask(ImageWrapper<I> mask)
Checks the given maskprotected abstract double
execute(double val1, double val2)
Method that calculates the new value based on the two source valuesprotected ImageWrapper<I>
prepareResult(ImageWrapper<I> wrapper1)
Prepare the result image using the image provider or the given image-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.function.BiFunction
andThen
-
-
-
-
Field Detail
-
provider
protected ImageFactory<I> provider
ImageProvider used to create a new result-image
-
-
Method Detail
-
apply
public ImageWrapper<I> apply(ImageWrapper<I> wrapper, ImageWrapper<I> wrapper2)
- Specified by:
apply
in interfaceBiFunction<ImageWrapper<I>,ImageWrapper<I>,ImageWrapper<I>>
-
apply
public ImageWrapper<I> apply(ImageWrapper<I> wrapper1, ImageWrapper<I> wrapper2, ImageWrapper<I> mask)
Applies the operator for the two images
- if mask == null: for every pixel
- else where mask > 0.0
- Parameters:
wrapper1
- operator 1wrapper2
- operator 2mask
- optional mask used for restricting operator to certain positions- Returns:
- the modified wrapper1 or a new image if
provider
was set
-
apply
public ImageWrapper<I> apply(ImageWrapper<I> wrapper1, double scalar)
Applies the operator for the given image with the scalar value
- Parameters:
wrapper1
- operator 1scalar
- scalar value to be applied- Returns:
- the modified wrapper1 or a new image if
provider
was set
-
apply
public ImageWrapper<I> apply(ImageWrapper<I> wrapper1, double scalar, ImageWrapper<I> mask)
Applies the operator for the given image with the scalar value
- if mask == null: for every pixel
- else where mask > 0.0
- Parameters:
wrapper1
- operator 1scalar
- scalar value to be appliedmask
- optional mask used for restricting operator to certain positions- Returns:
- the modified wrapper1 or a new image if
provider
was set
-
checkMask
protected void checkMask(ImageWrapper<I> mask)
Checks the given mask- Parameters:
mask
- to be checked
-
prepareResult
protected ImageWrapper<I> prepareResult(ImageWrapper<I> wrapper1)
Prepare the result image using the image provider or the given image- Parameters:
wrapper1
- used for creating the result image or used as result image- Returns:
- result image
-
execute
protected abstract double execute(double val1, double val2)
Method that calculates the new value based on the two source values- Parameters:
val1
- source value of image 1val2
- source value of image 2- Returns:
- combined values
-
-