ij.plugin.filter
public class EDM extends java.lang.Object implements ExtendedPlugInFilter
Modifier and Type | Field and Description |
---|---|
static int |
BYTE
Output type: new 8-bit image
|
static int |
BYTE_OVERWRITE
Output type: overwrite current 8-bit image
|
static int |
FLOAT
Output type: new 32-bit image
|
static int |
ONE
Unit in old make16bitEDM: this pixel value corresponds to a distance of one pixel.
|
static int |
SHORT
Output type: new 16-bit image
|
static int |
SQRT2
In old make16bitEDM this pixel value corresponds to a pixel distance of sqrt(2)
|
static int |
SQRT5
In old make16bitEDM this pixel value corresponds to a pixel distance of sqrt(5)
|
KEEP_PREVIEW
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, PARALLELIZE_IMAGES, PARALLELIZE_STACKS, ROI_REQUIRED, SNAPSHOT, STACK_REQUIRED, SUPPORTS_MASKING
Constructor and Description |
---|
EDM() |
Modifier and Type | Method and Description |
---|---|
static int |
getOutputType()
Returns the current output type (BYTE_OVERWRITE, BYTE, SHORT or FLOAT)
|
ShortProcessor |
make16bitEDM(ImageProcessor ip)
Calculates a 16-bit grayscale Euclidean Distance Map for a binary 8-bit image.
|
FloatProcessor |
makeFloatEDM(ImageProcessor ip,
int backgroundValue,
boolean edgesAreBackground)
Creates the Euclidian Distance Map of a (binary) byte image.
|
void |
run(ImageProcessor ip)
Called by the PlugInFilterRunner to process the image or one frame of a stack
|
void |
setNPasses(int nPasses)
Prepare the progress bar.
|
static void |
setOutputType(int type)
Sets the output type (BYTE_OVERWRITE, BYTE, SHORT or FLOAT)
|
int |
setup(java.lang.String arg,
ImagePlus imp)
Prepare for processing; also called at the very end with argument 'final'
to show any newly created output image.
|
int |
showDialog(ImagePlus imp,
java.lang.String command,
PlugInFilterRunner pfr)
Called by the PlugInFilterRunner after setup.
|
void |
toEDM(ImageProcessor ip)
Converts a binary image into a 8-bit grayscale Euclidean Distance Map
(EDM).
|
void |
toWatershed(ImageProcessor ip)
Do watershed segmentation based on the EDM of the
foreground objects (nonzero pixels) in an 8-bit image.
|
public static final int BYTE_OVERWRITE
public static final int BYTE
public static final int SHORT
public static final int FLOAT
public static final int ONE
public static final int SQRT2
public static final int SQRT5
public int setup(java.lang.String arg, ImagePlus imp)
setup
in interface PlugInFilter
public int showDialog(ImagePlus imp, java.lang.String command, PlugInFilterRunner pfr)
showDialog
in interface ExtendedPlugInFilter
imp
- The active image already passed in the
setup(arg, imp)
call. It will be null, however, if
the NO_IMAGE_REQUIRED
flag 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 by addPreviewCheckbox
to enable preview by calling the run(ip)
method of this
plugin-filter. pfr
can be also used later for calling back
the PlugInFilterRunner, e.g., to obtain the slice number
currently processed by run(ip)
.PlugInFilter
and
ExtendedPlugInFilter
.public void run(ImageProcessor ip)
run
in interface PlugInFilter
public void setNPasses(int nPasses)
setNPasses
in interface ExtendedPlugInFilter
nPasses
- Number of images that this EDM will process.public void toEDM(ImageProcessor ip)
public void toWatershed(ImageProcessor ip)
public ShortProcessor make16bitEDM(ImageProcessor ip)
public FloatProcessor makeFloatEDM(ImageProcessor ip, int backgroundValue, boolean edgesAreBackground)
ip
- The input image, not modified; must be a ByteProcessor.backgroundValue
- Pixels in the input with this value are interpreted as background.
Note: for pixel value 255, write either -1 or (byte)255.edgesAreBackground
- Whether out-of-image pixels are considered backgroundpublic static void setOutputType(int type)
public static int getOutputType()