Package com.xinapse.filter
Class ColourImageFilter
java.lang.Object
com.xinapse.filter.ColourImageFilter
- All Implemented Interfaces:
SpatialFilter
A SpatialFilter for altering the colour components of a colour image.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A FilterSpecifierPanel for a colour image 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 the formula used to calculate the new blue component values in the output image.static final org.apache.commons.cli.Option
A public Option to specify the formula used to calculate the new green component values in the output image.static final org.apache.commons.cli.Option
A public Option to specify the formula used to calculate the new red component values in the image.Fields inherited from interface com.xinapse.filter.SpatialFilter
N_DOTS
-
Constructor Summary
ConstructorDescriptionColourImageFilter
(String redFormula, String greenFormula, String blueFormula) Creates a newColourImageFilter
based on three formulae used to compute the red, green and blue colour components. -
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 ColourImageFilter.static void
Runs a self-test of this class.static ColourImageFilter
newInstance
(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) Creates a newColourImageFilter
using the supplied command line arguments, suitable for filtering the supplied image.
-
Field Details
-
RED_FORMULA_OPTION
public static final org.apache.commons.cli.Option RED_FORMULA_OPTIONA public Option to specify the formula used to calculate the new red component values in the image. -
GREEN_FORMULA_OPTION
public static final org.apache.commons.cli.Option GREEN_FORMULA_OPTIONA public Option to specify the formula used to calculate the new green component values in the output image. -
BLUE_FORMULA_OPTION
public static final org.apache.commons.cli.Option BLUE_FORMULA_OPTIONA public Option to specify the formula used to calculate the new blue component values in the output image.
-
-
Constructor Details
-
ColourImageFilter
public ColourImageFilter(String redFormula, String greenFormula, String blueFormula) throws InvalidArgumentException Creates a newColourImageFilter
based on three formulae used to compute the red, green and blue colour components.- Parameters:
redFormula
- the formula to calculate the new red colour component.greenFormula
- the formula to calculate the new green colour component.blueFormula
- the formula to calculate the new blue colour component.- Throws:
InvalidArgumentException
- if any of the formulae is invalid.
-
-
Method Details
-
newInstance
public static ColourImageFilter newInstance(org.apache.commons.cli.CommandLine commandLine, ReadableImage image) throws InvalidArgumentException Creates a newColourImageFilter
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
ColourImageFilter
. - Throws:
InvalidArgumentException
- if theColourImageFilter
cannot be created using the supplied command line arguments.
-
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 ColourImageFilter.- 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.
-
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.
-
main
Runs a self-test of this class.- Parameters:
args
- the program aguments (ignored).
-