Module imagingbook.common
Class GenericFilterScalarSeparable
java.lang.Object
imagingbook.common.filter.generic.GenericFilter
imagingbook.common.filter.generic.GenericFilterScalarSeparable
- All Implemented Interfaces:
ProgressReporter
- Direct Known Subclasses:
BilateralFilterScalarSeparable
,LinearFilterSeparable
This (abstract) class represents a generic scalar filter whose pixel-operation is x/y-separable. It is similar to
GenericFilterScalar
but requires two methods to be implemented by concrete sub-classes:
doPixelX(PixelSlice, int, int)
and doPixelY(PixelSlice, int, int)
for the x- and y-pass,
respectively, which are invoked in exactly this order. If the processed image has more than one component (e.g., a
RGB color image), this filter is automatically and independently applied to all (scalar-valued) components. The
remaining filter mechanics including multiple components, out-of-bounds coordinate handling, multiple passes and data
copying are handled by this class and its super-class (see GenericFilter
).-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract float
doPixelX
(PixelPack.PixelSlice source, int u, int v) Applies a 1D filter operation in x-direction.protected abstract float
doPixelY
(PixelPack.PixelSlice source, int u, int v) Applies a 1D filter operation in y-direction.protected final double
reportProgress
(double subProgress) This method is used for internal progress reporting through the class hierarchy.protected void
This method performs one pass of the filter, it must be implemented by a sub-class.Methods inherited from class imagingbook.common.filter.generic.GenericFilter
abort, applyTo, applyTo, applyTo, closeFilter, getDepth, getHeight, getPass, getProgress, getWidth, initFilter, initPass, passesRequired, reportProgress
-
Field Details
-
doX
-
doY
-
-
Constructor Details
-
GenericFilterScalarSeparable
public GenericFilterScalarSeparable()
-
-
Method Details
-
runPass
Description copied from class:GenericFilter
This method performs one pass of the filter, it must be implemented by a sub-class. There is usually no need for a custom filter class to override this method.- Specified by:
runPass
in classGenericFilter
- Parameters:
source
- the image source datatarget
- the image target data
-
doPixelX
Applies a 1D filter operation in x-direction. This method must be implemented by concrete sub-classes. This method is invoked beforedoPixelY(PixelSlice, int, int)
. The source data are passed as aPixelPack.PixelSlice
container, which holds the scalar values of one image component. The methodPixelPack.PixelSlice.getVal(int, int)
should be used to read individual pixel values. These data should not be modified but the (float) result of the single-pixel calculation must be returned.- Parameters:
source
- the scalar-valued data for a single image componentu
- the current x-positionv
- the current y-position- Returns:
- the result of the filter calculation for this pixel
-
doPixelY
Applies a 1D filter operation in y-direction. This method must be implemented by concrete sub-classes. This method is invoked afterdoPixelX(PixelSlice, int, int)
. The source data are passed as aPixelPack.PixelSlice
container, which holds the scalar values of one image component. The methodPixelPack.PixelSlice.getVal(int, int)
should be used to read individual pixel values. These data should not be modified but the (float) result of the single-pixel calculation must be returned.- Parameters:
source
- the scalar-valued data for a single image componentu
- the current x-positionv
- the current y-position- Returns:
- the result of the filter calculation for this pixel
-
reportProgress
Description copied from class:GenericFilter
This method is used for internal progress reporting through the class hierarchy. It should not be overridden or modified.- Overrides:
reportProgress
in classGenericFilter
- Parameters:
subProgress
- the current progress reported by the immediate sub-task (0,...,1)- Returns:
- the cumulative progress (0,...,1)
-