Class LinearFilter

All Implemented Interfaces:
ProgressReporter
Direct Known Subclasses:
GaussianFilter

public class LinearFilter extends GenericFilterScalar
This class represents a 2D linear filter specified by an arbitrary 2D convolution kernel. It is based on GenericFilter and GenericFilterScalar, 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.
  • Constructor Details

    • LinearFilter

      public LinearFilter(Kernel2D kernel)
      Constructor, only the 2D filter kernel needs to be specified.
      Parameters:
      kernel - the 2D filter kernel
  • Method Details

    • doPixel

      protected float doPixel(PixelPack.PixelSlice plane, int u, int v)
      Description copied from class: GenericFilterScalar
      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 a PixelPack.PixelSlice container, which holds the scalar values of one image component. The method PixelPack.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:
      doPixel in class GenericFilterScalar
      Parameters:
      plane - the scalar-valued data for a single image component
      u - the current x-position
      v - the current y-position
      Returns:
      the result of the filter calculation for this pixel