Package com.xinapse.filter
Class PatchSimilarityFilter
java.lang.Object
com.xinapse.filter.PatchSimilarityFilter
- All Implemented Interfaces:
SpatialFilter
Noise reduction filter based in averaging pixel intensities based on the similarity of
patches that are not necessarily local to the pixel.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A FilterSpecifierPanel for a patch similarity noise reduction filter.Nested classes/interfaces inherited from interface com.xinapse.filter.SpatialFilter
SpatialFilter.SpecifierPanel
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.apache.commons.cli.Option
A public Option to specify that the noise suppresion level for a Patch Similarity filter as a noise intensity standard deviation.static final org.apache.commons.cli.Option
A public Option to specify that the noise suppresion level for a Patch Similarity filter as a percentage of the robust image intensity range.Fields inherited from interface com.xinapse.filter.SpatialFilter
N_DOTS
-
Constructor Summary
ConstructorDescriptionPatchSimilarityFilter
(PixelDataType dataType, Float noisePercent, Float noiseSD, boolean threeD) Creates a newPatchSimilarityFilter
suitable for suppressing noise in an image with the givenPixelDataType
. -
Method Summary
Modifier and TypeMethodDescriptionfilter
(ReadableImage image) Filter a ReadableImage, returning a new image which is a filtered version of the supplied image.filter
(ReadableImage image, MonitorWorker worker, boolean verbose) Filter a ReadableImage, returning a new image which is a filtered version of the supplied image.void
filterInPlace
(WritableImage image) Filter a WritableImage "in place".void
filterInPlace
(WritableImage image, MonitorWorker worker, boolean verbose) Filter a WritableImage "in place".void
filterInPlace
(Object pixels, PixelDataType dataType, int nCols, int nRows, int nSlices) Filter an array of pixel values "in place".void
filterInPlace
(Object pixels, PixelDataType dataType, int nCols, int nRows, int nSlices, MonitorWorker worker, boolean verbose) Filter an array of pixel values "in place".static String
getName()
Returns the human-readable name of this filter.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 PatchSimilarityFilter.static PatchSimilarityFilter
newInstance
(PixelDataType dataType, Float noisePercent, Float noiseSD, boolean threeD) Creates a newPatchSimilarityFilter
suitable for suppressing noise in an image with the given PixelDataType.static PatchSimilarityFilter
newInstance
(ReadableImage image, Float noisePercent, Float noiseSD, boolean threeD) Creates a newPatchSimilarityFilter
suitable for suppressing noise in the supplied image.static PatchSimilarityFilter
newInstance
(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) Creates a newPatchSimilarityFilter
using the supplied command line arguments, suitable for filtering the supplied image.toString()
-
Field Details
-
NOISE_SUPPRESSION_LEVEL_PERCENT_OPTION
public static final org.apache.commons.cli.Option NOISE_SUPPRESSION_LEVEL_PERCENT_OPTIONA public Option to specify that the noise suppresion level for a Patch Similarity filter as a percentage of the robust image intensity range. -
NOISE_SD_OPTION
public static final org.apache.commons.cli.Option NOISE_SD_OPTIONA public Option to specify that the noise suppresion level for a Patch Similarity filter as a noise intensity standard deviation.
-
-
Constructor Details
-
PatchSimilarityFilter
public PatchSimilarityFilter(PixelDataType dataType, Float noisePercent, Float noiseSD, boolean threeD) throws IllegalArgumentException Creates a newPatchSimilarityFilter
suitable for suppressing noise in an image with the givenPixelDataType
.- Parameters:
dataType
- the presentationPixelDataType
to which the filter will be applied.noisePercent
- the noise suppression level as a percentage of the robust image intensity range (excluding background) [0..100].noiseSD
- the standard deviation of the noise to suppress.threeD
- whether a 3-D filter should be returned.- Throws:
IllegalArgumentException
- if thePixelDataType
or noise value is invalid.
-
-
Method Details
-
newInstance
public static PatchSimilarityFilter newInstance(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) throws InvalidArgumentException Creates a newPatchSimilarityFilter
using the supplied command line arguments, suitable for filtering 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.- Returns:
- a new
PatchSimilarityFilter
. - Throws:
InvalidArgumentException
- if the arguments are malformed.
-
newInstance
public static PatchSimilarityFilter newInstance(ReadableImage image, Float noisePercent, Float noiseSD, boolean threeD) throws InvalidArgumentException Creates a newPatchSimilarityFilter
suitable for suppressing noise in the supplied image.- Parameters:
image
- the image to which this filter is designed to apply.noisePercent
- the noise suppression level as a percentage of the robust image intensity range [0..100].noiseSD
- the standard deviation of the noise to suppress.threeD
- whether this should be a 3-D filter.- Returns:
- a new
PatchSimilarityFilter
. - Throws:
InvalidArgumentException
- if the noise value is invalid.
-
newInstance
public static PatchSimilarityFilter newInstance(PixelDataType dataType, Float noisePercent, Float noiseSD, boolean threeD) throws InvalidArgumentException Creates a newPatchSimilarityFilter
suitable for suppressing noise in an image with the given PixelDataType.- Parameters:
dataType
- the presentation PixelDataType to which the filter will be applied.noisePercent
- the noise suppression level as a percentage of the robust image intensity range (excluding background) [0..100].noiseSD
- the standard deviation of the noise to suppress.threeD
- whether a 3-D filter should be returned.- Returns:
- a new
PatchSimilarityFilter
. - Throws:
InvalidArgumentException
- if the PixelDataType or noise value is invalid.
-
toString
-
filter
Description copied from interface:SpatialFilter
Filter a ReadableImage, returning a new image which is a filtered version of the supplied image.- Specified by:
filter
in interfaceSpatialFilter
- Parameters:
image
- the image to be filtered.- Returns:
- a filtered version of the supplied image.
- Throws:
InvalidImageException
- if the supplied image cannot be filtered with this filter.IOException
- if an I/O error occurs.
-
filter
public WritableImage filter(ReadableImage image, MonitorWorker worker, boolean verbose) throws InvalidImageException, IOException, CancelledException Description copied from interface:SpatialFilter
Filter a ReadableImage, returning a new image which is a filtered version of the supplied image.- Specified by:
filter
in interfaceSpatialFilter
- Parameters:
image
- the image to be filtered.worker
- the MonitorWorker that may be used to cancel the filter operation.verbose
- whether verbose reporting to System.out is turned on.- Returns:
- a filtered version of the supplied image.
- Throws:
InvalidImageException
- if the supplied image cannot be filtered with this filter.IOException
- if an I/O error occurs.CancelledException
- if the filter operation is cancelled by the user or programmatically.
-
filterInPlace
Description copied from interface:SpatialFilter
Filter a WritableImage "in place".- Specified by:
filterInPlace
in interfaceSpatialFilter
- Parameters:
image
- the image to be filtered.- Throws:
InvalidImageException
- if the supplied image cannot be filtered with this filter.IOException
- if an I/O error occurs.
-
filterInPlace
public void filterInPlace(WritableImage image, MonitorWorker worker, boolean verbose) throws InvalidImageException, IOException, CancelledException Description copied from interface:SpatialFilter
Filter a WritableImage "in place".- Specified by:
filterInPlace
in interfaceSpatialFilter
- Parameters:
image
- the image to be filtered.worker
- the MonitorWorker that may be used to cancel the filter operation.verbose
- whether verbose reporting to System.out is turned on.- Throws:
InvalidImageException
- if the supplied image cannot be filtered with this filter.IOException
- if an I/O error occurs.CancelledException
- if the filter operation is cancelled by the user or programmatically.
-
filterInPlace
Description copied from interface:SpatialFilter
Filter an array of pixel values "in place".- Specified by:
filterInPlace
in interfaceSpatialFilter
- Parameters:
pixels
- the array of image pixel values.dataType
- the PixelDataType of the pixels.nCols
- the number of image columns.nRows
- the number of image rows.nSlices
- the number of image slices.
-
filterInPlace
public void filterInPlace(Object pixels, PixelDataType dataType, int nCols, int nRows, int nSlices, MonitorWorker worker, boolean verbose) throws CancelledException Description copied from interface:SpatialFilter
Filter an array of pixel values "in place".- Specified by:
filterInPlace
in interfaceSpatialFilter
- Parameters:
pixels
- the array of image pixel values.dataType
- the PixelDataType of the pixels.nCols
- the number of image columns.nRows
- 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.
-
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 PatchSimilarityFilter.- 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.
-