Class BoxBlurFilter

All Implemented Interfaces:
SpatialFilter

public final class BoxBlurFilter extends FixedWeightsKernelFilter implements SpatialFilter
A FixedWeightsKernelFilter for performing a blurring of an image with a box filter.
  • Field Details

    • MAX_SIZE

      public static final int MAX_SIZE
      The maximum size in any dimension of a BoxBlurFilter.
      See Also:
    • THREE_D_BOX_3

      public static final FixedWeightsKernelFilter THREE_D_BOX_3
      A 3-D BoxBlurFilter with 3x3x3 kernel.
    • THREE_D_BOX_5

      public static final FixedWeightsKernelFilter THREE_D_BOX_5
      A 3-D BoxBlurFilter with 5x5x5 kernel.
    • THREE_D_BOX_7

      public static final FixedWeightsKernelFilter THREE_D_BOX_7
      A 3-D BoxBlurFilter with 7x7x7 kernel.
    • THREE_D_BOX_9

      public static final FixedWeightsKernelFilter THREE_D_BOX_9
      A 3-D BoxBlurFilter with 9x9x9 kernel.
    • THREE_D_BOX_11

      public static final FixedWeightsKernelFilter THREE_D_BOX_11
      A 3-D BoxBlurFilter with 11x11x11.
    • TWO_D_BOX_3

      public static final FixedWeightsKernelFilter TWO_D_BOX_3
      A 2-D BoxBlurFilter with 3x3 kernel.
    • TWO_D_BOX_5

      public static final FixedWeightsKernelFilter TWO_D_BOX_5
      A 2-D BoxBlurFilter with 5x5 kernel.
    • TWO_D_BOX_7

      public static final FixedWeightsKernelFilter TWO_D_BOX_7
      A 2-D BoxBlurFilter with 7x7 kernel.
    • TWO_D_BOX_9

      public static final FixedWeightsKernelFilter TWO_D_BOX_9
      A 2-D BoxBlurFilter with 9x9 kernel.
    • TWO_D_BOX_11

      public static final FixedWeightsKernelFilter TWO_D_BOX_11
      A 2-D BoxBlurFilter with 11x11 kernel.
    • BOX_BLUR_SIZE_OPTION

      public static final org.apache.commons.cli.Option BOX_BLUR_SIZE_OPTION
      Command line option for setting the size for a BoxBlurFilter.
  • Method Details

    • newInstance

      public static BoxBlurFilter newInstance(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) throws InvalidArgumentException
      Creates a new BoxBlurFilter using the supplied command line arguments, suitable for blurring the supplied image.
      Parameters:
      commandLine - the command line from which a program is invoked.
      image - the image to which this filter is designed to apply (unused).
      Returns:
      a new BoxBlurFilter.
      Throws:
      InvalidArgumentException - if the arguments are malformed.
    • newInstance

      public static BoxBlurFilter newInstance(ReadableImage image, int[] size) throws InvalidArgumentException
      Creates a new BoxBlurFilter suitable for blurring the supplied image. A BoundaryCondition.FIXED is used with a fixed value of zero.
      Parameters:
      image - the image to which this filter is designed to apply. Not used.
      size - the size of the Box blurring filter in each spatial dimension of the image. size may be of length 2 (for a 2-D in-plane blur) or length 3 (for a 3-D blur). The first value in this array applies to the along-row (x) direction; the second value applies to the along-column (y) direction; and the third value (if present) applies to the through-slice (z) direction.
      Returns:
      a new BoxBlurFilter.
      Throws:
      InvalidArgumentException - if any of the size values are non-positive, or greater than MAX_SIZE, or if the array length is incorrect.
    • newInstance

      public static BoxBlurFilter newInstance(ReadableImage image, int[] size, BoundaryCondition bc) throws InvalidArgumentException
      Creates a new BoxBlurFilter suitable for blurring the supplied image.
      Parameters:
      image - the image to which this filter is designed to apply. Not used.
      size - the size of the Box blurring filter in each spatial dimension of the image. size may be of length 2 (for a 2-D in-plane blur) or length 3 (for a 3-D blur). The first value in this array applies to the along-row (x) direction; the second value applies to the along-column (y) direction; and the third value (if present) applies to the through-slice (z) direction.
      bc - the BoundaryCondition contition to apply at the edges of the image.
      Returns:
      a new BoxBlurFilter.
      Throws:
      InvalidArgumentException - if any of the size values are non-positive, or greater than MAX_SIZE, or if the array length is incorrect.
    • newInstance

      public static BoxBlurFilter newInstance(int[] size) throws InvalidArgumentException
      Creates a new BoxBlurFilter suitable for blurring an image with the given pixel sizes. A BoundaryCondition.FIXED is used with a fixed value of zero.
      Parameters:
      size - the size of the Box blurring filter in each spatial dimension of the image. size may be of length 2 (for a 2-D in-plane blur) or length 3 (for a 3-D blur). The first value in this array applies to the along-row (x) direction; the second value applies to the along-column (y) direction; and the third value (if present) applies to the through-slice (z) direction.
      Returns:
      a new BoxBlurFilter.
      Throws:
      InvalidArgumentException - if any of the size values are non-positive, or greater than MAX_SIZE, or if the array length is incorrect.
    • newInstance

      public static BoxBlurFilter newInstance(int[] size, BoundaryCondition bc) throws InvalidArgumentException
      Creates a new BoxBlurFilter suitable for blurring an image with the given pixel sizes.
      Parameters:
      size - the size of the Box blurring filter in each spatial dimension of the image. size may be of length 2 (for a 2-D in-plane blur) or length 3 (for a 3-D blur). The first value in this array applies to the along-row (x) direction; the second value applies to the along-column (y) direction; and the third value (if present) applies to the through-slice (z) direction.
      bc - the BoundaryCondition contition to apply at the edges of the image.
      Returns:
      a new BoxBlurFilter.
      Throws:
      InvalidArgumentException - if any of the size values are non-positive, or greater than MAX_SIZE, or if the array length is incorrect.
    • getOptionName

      public static String getOptionName()
      Returns the name of this type of filter when specifying it in program optional arguments.
      Returns:
      the name of the filter for selection in program arguments.
    • getOptions

      public static org.apache.commons.cli.Options getOptions()
      Returns the options for this type of filter.
      Returns:
      the options for this type of filter.
    • getSpecifierPanel

      public static SpatialFilter.SpecifierPanel getSpecifierPanel(String preferencesNodeName)
      Returns a SpatialFilter.SpecifierPanel that can be used to set the parameters for a BoxBlurFilter.
      Parameters:
      preferencesNodeName - the preferences node name from which the initial settings will be taken.
      Returns:
      a SpatialFilter.SpecifierPanel to set the parameters for this type of filter.
    • getName

      public static String getName()
      Returns the human-readable name of this filter.
      Returns:
      the human-readable name of this filter.
    • main

      public static void main(String[] args)
      Runs a self-test of this class.
      Parameters:
      args - the program aguments (ignored).