java.lang.Object
imagingbook.common.filter.generic.GenericFilter
imagingbook.common.filter.generic.GenericFilterScalar
- All Implemented Interfaces:
ProgressReporter
- Direct Known Subclasses:
BilateralFilterScalar
,ExampleFilter3x3Scalar
,KuwaharaFilterScalar
,LinearFilter
,NagaoMatsuyamaFilterScalar
,PeronaMalikFilterScalar
,ScalarMedianFilter
This (abstract) class represents a filter which treats all pixel values 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. The filter calls the method doPixel(PixelSlice, int, int)
for each image pixel,
which must be implemented by any concrete sub-class.
Thus a custom filter based on this class only needs to specify the steps to be performed for a single pixel. 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
).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract float
doPixel
(PixelPack.PixelSlice source, int u, int v) This method defines the steps to be performed for a single image pixel and must be implemented by any concrete sub-class.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
-
Constructor Details
-
GenericFilterScalar
public GenericFilterScalar()
-
-
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
-
doPixel
This method defines the steps to be performed for a single image pixel and must be implemented by any concrete sub-class. 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)
-