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
Nested ClassesModifier and TypeClassDescriptionstatic classA 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
bcFields inherited from interface com.xinapse.filter.SpatialFilter
N_DOTS -
Constructor Summary
ConstructorsConstructorDescriptionMedianFilter(int[] kernelSize, BoundaryCondition boundaryCondition) Construct a MedianFilter with a kernel size specified by the argument. -
Method Summary
Modifier and TypeMethodDescriptionvoidfilterInPlaceFloat(float[] pixels, int nCols, int nRows, int nSlices, MonitorWorker worker, boolean verbose) Filter an array of floating-point pixel values "in place".static StringgetName()Returns the human-readable name of this filter.intReturns the number of columns in the filter kernel.intReturns the number of rows in the filter kernel.intReturns the number of slices in the filter kernel.static StringReturns the name of this type of filter when specifying it in program optional arguments.static org.apache.commons.cli.OptionsReturns the options for this type of filter.static SpatialFilter.SpecifierPanelgetSpecifierPanel(String preferencesNodeName) Returns a SpatialFilter.SpecifierPanel that can be used to set the parameters for a MedianFilter.static voidRuns a self-test of this class.static MedianFilternewInstance(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) Creates a newMedianFilterusing 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, filterInPlaceUShortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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- theBoundaryConditionto 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:AbstractKernelFilterReturns the number of columns in the filter kernel.- Specified by:
getNKernelColsin classAbstractKernelFilter- Returns:
- the number of columns in the filter kernel.
-
getNKernelRows
public int getNKernelRows()Description copied from class:AbstractKernelFilterReturns the number of rows in the filter kernel.- Specified by:
getNKernelRowsin classAbstractKernelFilter- Returns:
- the number of rows in the filter kernel.
-
getNKernelSlices
public int getNKernelSlices()Description copied from class:AbstractKernelFilterReturns the number of slices in the filter kernel.- Specified by:
getNKernelSlicesin 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 newMedianFilterusing 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:AbstractKernelFilterFilter an array of floating-point pixel values "in place".- Specified by:
filterInPlaceFloatin 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).
-