Package com.xinapse.filter
Class MedianFilter
java.lang.Object
com.xinapse.filter.AbstractKernelFilter
com.xinapse.filter.MedianFilter
- All Implemented Interfaces:
SpatialFilter
A
SpatialFilter
for performing median filtering of an image.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A FilterSpecifierPanel for a median filter.Nested classes/interfaces inherited from interface com.xinapse.filter.SpatialFilter
SpatialFilter.SpecifierPanel
-
Field Summary
Fields inherited from class com.xinapse.filter.AbstractKernelFilter
bc
Fields inherited from interface com.xinapse.filter.SpatialFilter
N_DOTS
-
Constructor Summary
ConstructorDescriptionMedianFilter
(int[] kernelSize, BoundaryCondition boundaryCondition) Construct a MedianFilter with a kernel size specified by the argument. -
Method Summary
Modifier and TypeMethodDescriptionvoid
filterInPlaceFloat
(float[] pixels, int nCols, int nRows, int nSlices, MonitorWorker worker, boolean verbose) Filter an array of floating-point pixel values "in place".static String
getName()
Returns the human-readable name of this filter.int
Returns the number of columns in the filter kernel.int
Returns the number of rows in the filter kernel.int
Returns the number of slices in the filter kernel.static String
Returns the name of this type of filter when specifying it in program optional arguments.static org.apache.commons.cli.Options
Returns the options for this type of filter.static SpatialFilter.SpecifierPanel
getSpecifierPanel
(String preferencesNodeName) Returns a SpatialFilter.SpecifierPanel that can be used to set the parameters for a MedianFilter.static void
Runs a self-test of this class.static MedianFilter
newInstance
(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) Creates a newMedianFilter
using the supplied command line arguments.toString()
Returns a String describing this MedianFilter.Methods inherited from class com.xinapse.filter.AbstractKernelFilter
filter, filter, filter, filterInPlace, filterInPlace, filterInPlace, filterInPlace, filterInPlace, filterInPlace, filterInPlace, filterInPlaceBinary, filterInPlaceByte, filterInPlaceDouble, filterInPlaceInt, filterInPlaceLong, filterInPlaceShort, filterInPlaceUByte, filterInPlaceUInt, filterInPlaceUShort
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.xinapse.filter.SpatialFilter
filter, filter, filterInPlace, filterInPlace, filterInPlace, filterInPlace
-
Constructor Details
-
MedianFilter
public MedianFilter(int[] kernelSize, BoundaryCondition boundaryCondition) throws IllegalArgumentException Construct a MedianFilter with a kernel size specified by the argument.- Parameters:
kernelSize
- the kernel size in each direction.boundaryCondition
- theBoundaryCondition
to apply when this filter is applied to an array of pixels.- Throws:
IllegalArgumentException
- if any of the kernel size values is illegal.
-
-
Method Details
-
getNKernelCols
public int getNKernelCols()Description copied from class:AbstractKernelFilter
Returns the number of columns in the filter kernel.- Specified by:
getNKernelCols
in classAbstractKernelFilter
- Returns:
- the number of columns in the filter kernel.
-
getNKernelRows
public int getNKernelRows()Description copied from class:AbstractKernelFilter
Returns the number of rows in the filter kernel.- Specified by:
getNKernelRows
in classAbstractKernelFilter
- Returns:
- the number of rows in the filter kernel.
-
getNKernelSlices
public int getNKernelSlices()Description copied from class:AbstractKernelFilter
Returns the number of slices in the filter kernel.- Specified by:
getNKernelSlices
in classAbstractKernelFilter
- Returns:
- the number of slices in the filter kernel.
-
newInstance
public static MedianFilter newInstance(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) throws InvalidArgumentException Creates a newMedianFilter
using the supplied command line arguments.- Parameters:
commandLine
- the command line from which a program is invoked.image
- the image to which this filter is designed to apply. Not used in the design of a MedianFilter.- Returns:
- a new
MedianFilter
. - Throws:
InvalidArgumentException
- if the filter cannot be constructed from the arguments.
-
filterInPlaceFloat
public void filterInPlaceFloat(float[] pixels, int nCols, int nRows, int nSlices, MonitorWorker worker, boolean verbose) throws CancelledException Description copied from class:AbstractKernelFilter
Filter an array of floating-point pixel values "in place".- Specified by:
filterInPlaceFloat
in classAbstractKernelFilter
- Parameters:
pixels
- the array of image pixel values.nCols
- the number of image columnsnRows
- the number of image rows.nSlices
- the number of image slices.worker
- the MonitorWorker that may be used to cancel the filter operation.verbose
- whether verbose reporting to System.out is turned on.- Throws:
CancelledException
- if the filter operation is cancelled by the user or programmatically.
-
toString
Returns a String describing this MedianFilter. -
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
Returns a SpatialFilter.SpecifierPanel that can be used to set the parameters for a MedianFilter.- 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
Returns the human-readable name of this filter.- Returns:
- the human-readable name of this filter.
-
main
Runs a self-test of this class.- Parameters:
args
- the program aguments (ignored).
-