java.lang.Object
imagingbook.common.filter.generic.GenericFilter
imagingbook.common.filter.generic.GenericFilterScalarSeparable
imagingbook.common.filter.linear.LinearFilterSeparable
- All Implemented Interfaces:
ProgressReporter
- Direct Known Subclasses:
GaussianFilterSeparable
This class represents a 2D linear filter that is x/y-separable and specified by two 1D-kernels. It is based on
GenericFilter
and GenericFilterScalarSeparable
, which take care of all data copying and filter
mechanics. Since it is a "scalar" filter, pixel values are treated as scalars. 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. To apply to an image, use the GenericFilter.applyTo(ij.process.ImageProcessor)
method, for
example.-
Field Summary
Fields inherited from class imagingbook.common.filter.generic.GenericFilterScalarSeparable
doX, doY
-
Constructor Summary
ConstructorsConstructorDescriptionLinearFilterSeparable
(Kernel1D kernelXY) Constructor, takes a 1D convolution kernel to be applied both in x- and y-direction.LinearFilterSeparable
(Kernel1D kernelX, Kernel1D kernelY) Constructor, takes two 1D convolution kernels to be applied in x- and y-direction, respectively. -
Method Summary
Modifier and TypeMethodDescriptionprotected float
doPixelX
(PixelPack.PixelSlice source, int u, int v) Applies a 1D filter operation in x-direction.protected float
doPixelY
(PixelPack.PixelSlice source, int u, int v) Applies a 1D filter operation in y-direction.Methods inherited from class imagingbook.common.filter.generic.GenericFilterScalarSeparable
reportProgress, runPass
Methods inherited from class imagingbook.common.filter.generic.GenericFilter
abort, applyTo, applyTo, applyTo, closeFilter, getDepth, getHeight, getPass, getProgress, getWidth, initFilter, initPass, passesRequired, reportProgress
-
Constructor Details
-
LinearFilterSeparable
Constructor, takes a 1D convolution kernel to be applied both in x- and y-direction.- Parameters:
kernelXY
- a 1D convolution kernel
-
LinearFilterSeparable
Constructor, takes two 1D convolution kernels to be applied in x- and y-direction, respectively. One (but not both) of the supplied kernels may benull
. If this is the case, filtering in the associated direction is skipped.- Parameters:
kernelX
- a 1D kernel for convolution in x-directionkernelY
- a 1D kernel for convolution in y-direction
-
-
Method Details
-
doPixelX
Description copied from class:GenericFilterScalarSeparable
Applies a 1D filter operation in x-direction. This method must be implemented by concrete sub-classes. This method is invoked beforeGenericFilterScalarSeparable.doPixelY(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.- Specified by:
doPixelX
in classGenericFilterScalarSeparable
- 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
Description copied from class:GenericFilterScalarSeparable
Applies a 1D filter operation in y-direction. This method must be implemented by concrete sub-classes. This method is invoked afterGenericFilterScalarSeparable.doPixelX(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.- Specified by:
doPixelY
in classGenericFilterScalarSeparable
- 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
-