Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.astro.louisville.edu/software/astroimagej/imagej/api/ij/plugin/filter/EDM.html
Дата изменения: Thu Dec 2 23:03:11 2010
Дата индексирования: Mon Oct 1 23:06:02 2012
Кодировка:

Поисковые слова: п п п п п п п п п п п п п п п п п п п п п п п п п п п п п р п р п р п р п р п р п р п р п р п
EDM (ImageJ API)

ij.plugin.filter
Class EDM

java.lang.Object
  extended by ij.plugin.filter.EDM
All Implemented Interfaces:
ExtendedPlugInFilter, PlugInFilter

public class EDM
extends java.lang.Object
implements ExtendedPlugInFilter

This plugin implements the Euclidean Distance Map (EDM), Watershed, Ultimate Eroded Points and Voronoi commands in the Process/Binary submenu. - Euclidean Distance Map: The value of each pixel is the distance to the nearest background pixel (for background pixels, the EDM is 0) - Ultimate Eroded Points (UEPs) are maxima of the EDM. In the output, the points are assigned the EDM value, which is equal to the radius of the largest circle that fits into the particle, with the UEP as the center. - Watershed segmentation of the EDM splits particles at "necks"; starting at maxima of the EDM. - 'Voronoi' splits the image by lines of points having equal distance to the borders of the two nearest particles. Thus, the Voronoi cell of each particle includes all points that are nearer to this particle than any other particle. For the case of the priticles being single points, this is a Voronoi tessellation (also known as Dirichlet tessellation). In the output, the value inside the Voronoi cells is zero; the pixel values of the dividing lines between the cells are equal to the distance to the two nearest particles. This is similar to a medial axis transform of the background, but there are no lines in inner holes of particles. Watershed, Ultimate Eroded Points and Voronoi are handled by the MaximumFinder plugin applied to the EDM Note: These functions do not take ROIs into account. Setup is called with argument "" (empty string) for EDM, "watershed" for watershed segmentation, "points" for ultimate eroded points and "voronoi" for Voronoi segmentation of the background The EDM algorithm is similar to the 8SSEDT in F. Leymarie, M. D. Levine, in: CVGIP Image Understanding, vol. 55 (1992), pp 84-94 http://dx.doi.org/10.1016/1049-9660(92)90008-Q The algorithm provides a fast approximation of the EDM, with the deviation from a full calculation being between -0.09 and 0. The algorithm is exact for distances<13. For d>=13, deviations from the true result can occur, but are very rare: typically the fraction of pixels deviating from the exact result is in the 10^-5 range, with most deviations between -0.03 and -0.04. Limitations: Maximum image diagonal for EDM: 46340 pixels (sqrt(2^31)); if the particles are dense enough it also works for width, height <=65534. Version 30-Apr-2008 Michael Schmid: more accurate EDM algorithm, 16-bit and float output possible, parallel processing for stacks Voronoi output added


Field Summary
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)
 
Fields inherited from interface ij.plugin.filter.ExtendedPlugInFilter
KEEP_PREVIEW
 
Fields 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, PARALLELIZE_STACKS, ROI_REQUIRED, SNAPSHOT, STACK_REQUIRED, SUPPORTS_MASKING
 
Constructor Summary
EDM()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTE_OVERWRITE

public static final int BYTE_OVERWRITE
Output type: overwrite current 8-bit image

See Also:
Constant Field Values

BYTE

public static final int BYTE
Output type: new 8-bit image

See Also:
Constant Field Values

SHORT

public static final int SHORT
Output type: new 16-bit image

See Also:
Constant Field Values

FLOAT

public static final int FLOAT
Output type: new 32-bit image

See Also:
Constant Field Values

ONE

public static final int ONE
Unit in old make16bitEDM: this pixel value corresponds to a distance of one pixel. For compatibility only.

See Also:
Constant Field Values

SQRT2

public static final int SQRT2
In old make16bitEDM this pixel value corresponds to a pixel distance of sqrt(2)

See Also:
Constant Field Values

SQRT5

public static final int SQRT5
In old make16bitEDM this pixel value corresponds to a pixel distance of sqrt(5)

See Also:
Constant Field Values
Constructor Detail

EDM

public EDM()
Method Detail

setup

public 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.

Specified by:
setup in interface PlugInFilter

showDialog

public int showDialog(ImagePlus imp,
                      java.lang.String command,
                      PlugInFilterRunner pfr)
Called by the PlugInFilterRunner after setup. Asks the user in case of a stack and prepares a separate ouptut stack if required

Specified by:
showDialog in interface ExtendedPlugInFilter
Parameters:
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).
Returns:
The method should return a combination (bitwise OR) of the flags specified in interfaces PlugInFilter and ExtendedPlugInFilter.

run

public void run(ImageProcessor ip)
Called by the PlugInFilterRunner to process the image or one frame of a stack

Specified by:
run in interface PlugInFilter

setNPasses

public void setNPasses(int nPasses)
Prepare the progress bar. Without calling it or if nPasses=0, no progress bar will be shown.

Specified by:
setNPasses in interface ExtendedPlugInFilter
Parameters:
nPasses - Number of images that this EDM will process.

toEDM

public void toEDM(ImageProcessor ip)
Converts a binary image into a 8-bit grayscale Euclidean Distance Map (EDM). Each foreground (nonzero) pixel in the binary image is assigned a value equal to its distance from the nearest background (zero) pixel.


toWatershed

public void toWatershed(ImageProcessor ip)
Do watershed segmentation based on the EDM of the foreground objects (nonzero pixels) in an 8-bit image. Particles are segmented by their shape; segmentation lines added are background pixels (value = 0);


make16bitEDM

public ShortProcessor make16bitEDM(ImageProcessor ip)
Calculates a 16-bit grayscale Euclidean Distance Map for a binary 8-bit image. Each foreground (nonzero) pixel in the binary image is assigned a value equal to its distance from the nearest background (zero) pixel, multiplied by EDM.ONE. For compatibility with previous versions of ImageJ only.


makeFloatEDM

public FloatProcessor makeFloatEDM(ImageProcessor ip,
                                   int backgroundValue,
                                   boolean edgesAreBackground)
Creates the Euclidian Distance Map of a (binary) byte image.

Parameters:
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 background
Returns:
The EDM, containing the distances to the nearest background pixel. Returns null if the thread is interrupted.

setOutputType

public static void setOutputType(int type)
Sets the output type (BYTE_OVERWRITE, BYTE, SHORT or FLOAT)


getOutputType

public static int getOutputType()
Returns the current output type (BYTE_OVERWRITE, BYTE, SHORT or FLOAT)