java.lang.Object
ij.plugin.filter.UnsharpMask
- All Implemented Interfaces:
DialogListener,ExtendedPlugInFilter,PlugInFilter
This plugin-filter implements ImageJ's Unsharp Mask command.
Unsharp masking subtracts a blurred copy of the image and rescales the image
to obtain the same contrast of large (low-frequency) structures as in the
input image. This is equivalent to adding a high-pass filtered image and
thus sharpens the image.
"Radius (Sigma)" is the standard deviation (blur radius) of the Gaussian blur that
is subtracted. "Mask Weight" determines the strength of filtering, where "Mask Weight"=1
would be an infinite weight of the high-pass filtered image that is added.
-
Field Summary
Fields inherited from interface ij.plugin.filter.ExtendedPlugInFilter
KEEP_PREVIEWFields inherited from interface ij.plugin.filter.PlugInFilter
CONVERT_TO_FLOAT, DOES_16, DOES_32, DOES_8C, DOES_8G, DOES_ALL, DOES_RGB, DOES_STACKS, DONE, FINAL_PROCESSING, KEEP_THRESHOLD, NO_CHANGES, NO_IMAGE_REQUIRED, NO_UNDO, NO_UNDO_RESET, PARALLELIZE_IMAGES, PARALLELIZE_STACKS, ROI_REQUIRED, SNAPSHOT, STACK_REQUIRED, SUPPORTS_MASKING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method is invoked by a Generic Dialog if any of the inputs have changed (CANCEL does not trigger it; OK and running the dialog from a macro only trigger the first DialogListener added to a GenericDialog).voidrun(ImageProcessor ip) This method is invoked for each slice or color channel.voidsetNPasses(int nPasses) Since most computing time is spent in GaussianBlur, forward the information about the number of passes to Gaussian Blur.intMethod to return types supportedvoidsharpenFloat(FloatProcessor fp, double sigma, float weight) Unsharp Mask filtering of a float image.intshowDialog(ImagePlus imp, String command, PlugInFilterRunner pfr) Ask the user for the parameters
-
Constructor Details
-
UnsharpMask
public UnsharpMask()
-
-
Method Details
-
setup
Method to return types supported- Specified by:
setupin interfacePlugInFilter- Parameters:
arg- Not used by this pluginimp- The image to be filtered- Returns:
- Code describing supported formats etc. (see ij.plugin.filter.PlugInFilter invalid input: '&' ExtendedPlugInFilter)
-
run
This method is invoked for each slice or color channel. It filters an image by enhancing high-frequency components. Since this PlugInFilter specifies the CONVERT_TO_FLOAT and SNAPHOT flags, 'ip' is always a FloatProcessor with a valid snapshot.- Specified by:
runin interfacePlugInFilter- Parameters:
ip- The image, slice or channel to filter
-
sharpenFloat
Unsharp Mask filtering of a float image. 'fp' must have a valid snapshot. -
showDialog
Ask the user for the parameters- Specified by:
showDialogin interfaceExtendedPlugInFilter- Parameters:
imp- The active image already passed in thesetup(arg, imp)call. It will be null, however, if theNO_IMAGE_REQUIREDflag has been set.command- The command that has led to the invocation of the plugin-filter. Useful as a title for the dialog.pfr- The PlugInFilterRunner calling this plugin-filter. It can be passed to a GenericDialog byaddPreviewCheckboxto enable preview by calling therun(ip)method of this plugin-filter.pfrcan be also used later for calling back the PlugInFilterRunner, e.g., to obtain the slice number currently processed byrun(ip).- Returns:
- The method should return a combination (bitwise OR)
of the flags specified in interfaces
PlugInFilterandExtendedPlugInFilter.
-
dialogItemChanged
Description copied from interface:DialogListenerThis method is invoked by a Generic Dialog if any of the inputs have changed (CANCEL does not trigger it; OK and running the dialog from a macro only trigger the first DialogListener added to a GenericDialog).- Specified by:
dialogItemChangedin interfaceDialogListener- Parameters:
gd- A reference to the GenericDialog.e- The event that has been generated by the user action in the dialog. Note thateisnullif the dialogItemChanged method is called after the user has pressed the OK button or if the GenericDialog has read its parameters from a macro.- Returns:
- Should be true if the dialog input is valid. False disables the OK button and preview (if any).
-
setNPasses
public void setNPasses(int nPasses) Since most computing time is spent in GaussianBlur, forward the information about the number of passes to Gaussian Blur. The ProgressBar will be handled by GaussianBlur.- Specified by:
setNPassesin interfaceExtendedPlugInFilter
-