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
Nested ClassesModifier and TypeClassDescriptionstatic classA FilterSpecifierPanel for a patch similarity noise reduction filter.Nested classes/interfaces inherited from interface com.xinapse.filter.SpatialFilter
SpatialFilter.SpecifierPanel -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.commons.cli.OptionA 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.OptionA 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
ConstructorsConstructorDescriptionPatchSimilarityFilter(PixelDataType dataType, Float noisePercent, Float noiseSD, boolean threeD) Creates a newPatchSimilarityFiltersuitable 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.voidfilterInPlace(WritableImage image) Filter a WritableImage "in place".voidfilterInPlace(WritableImage image, MonitorWorker worker, boolean verbose) Filter a WritableImage "in place".voidfilterInPlace(Object pixels, PixelDataType dataType, int nCols, int nRows, int nSlices) Filter an array of pixel values "in place".voidfilterInPlace(Object pixels, PixelDataType dataType, int nCols, int nRows, int nSlices, MonitorWorker worker, boolean verbose) Filter an array of pixel values "in place".static StringgetName()Returns the human-readable name of this filter.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 PatchSimilarityFilter.static PatchSimilarityFilternewInstance(PixelDataType dataType, Float noisePercent, Float noiseSD, boolean threeD) Creates a newPatchSimilarityFiltersuitable for suppressing noise in an image with the given PixelDataType.static PatchSimilarityFilternewInstance(ReadableImage image, Float noisePercent, Float noiseSD, boolean threeD) Creates a newPatchSimilarityFiltersuitable for suppressing noise in the supplied image.static PatchSimilarityFilternewInstance(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) Creates a newPatchSimilarityFilterusing 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 newPatchSimilarityFiltersuitable for suppressing noise in an image with the givenPixelDataType.- Parameters:
dataType- the presentationPixelDataTypeto 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 thePixelDataTypeor noise value is invalid.
-
-
Method Details
-
newInstance
public static PatchSimilarityFilter newInstance(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) throws InvalidArgumentException Creates a newPatchSimilarityFilterusing 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 newPatchSimilarityFiltersuitable 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 newPatchSimilarityFiltersuitable 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:SpatialFilterFilter a ReadableImage, returning a new image which is a filtered version of the supplied image.- Specified by:
filterin 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:SpatialFilterFilter a ReadableImage, returning a new image which is a filtered version of the supplied image.- Specified by:
filterin 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:SpatialFilterFilter a WritableImage "in place".- Specified by:
filterInPlacein 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:SpatialFilterFilter a WritableImage "in place".- Specified by:
filterInPlacein 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:SpatialFilterFilter an array of pixel values "in place".- Specified by:
filterInPlacein 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:SpatialFilterFilter an array of pixel values "in place".- Specified by:
filterInPlacein 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.
-