|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectij.plugin.filter.MaximumFinder
public class MaximumFinder
This ImageJ plug-in filter finds the maxima (or minima) of an image. It can create a mask where the local maxima of the current image are marked (255; unmarked pixels 0). The plug-in can also create watershed-segmented particles: Assume a landscape of inverted heights, i.e., maxima of the image are now water sinks. For each point in the image, the sink that the water goes to determines which particle it belongs to. When finding maxima (not minima), pixels with a level below the lower threshold can be left unprocessed. Except for segmentation, this plugin works with ROIs, including non-rectangular ROIs. Since this plug-in creates a separate output image it processes only single images or slices, no stacks. version 09-Nov-2006 Michael Schmid version 21-Nov-2006 Wayne Rasband. Adds "Display Point Selection" option and "Count" output type. version 28-May-2007 Michael Schmid. Preview added, bugfix: minima of calibrated images, uses Arrays.sort (Java2 required) version 07-Aug-2007 Michael Schmid. Fixed a bug that could delete particles when doing watershed segmentation of an EDM.
Nested Class Summary | |
---|---|
(package private) class |
MaximumFinder.MaxPoint
Coordinates and the value of a local maximum. |
Field Summary | |
---|---|
static int |
COUNT
Do not create an image, just count maxima and add count to Results table |
(package private) int[] |
dirOffset
|
(package private) int[] |
dirXoffset
|
(package private) int[] |
dirYoffset
|
(package private) static byte |
ELIMINATED
|
(package private) static byte |
EQUAL
|
static int |
IN_TOLERANCE
Output type all points around the maximum within the tolerance |
(package private) static int |
IS_DOT
|
(package private) static int |
IS_LINE
|
(package private) static byte |
LISTED
|
(package private) static byte |
MAX_AREA
|
(package private) static byte |
MAX_POINT
|
(package private) static byte |
MAXIMUM
the following constants are used to set bits corresponding to pixel types |
(package private) static byte[] |
outputTypeMasks
type masks corresponding to the output types |
(package private) static java.lang.String[] |
outputTypeNames
output type names |
static int |
POINT_SELECTION
Do not create image, only mark points |
(package private) static byte |
PROCESSED
|
static int |
SEGMENTED
Output type watershed-segmented image |
static int |
SINGLE_POINTS
Output type single points |
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, NO_CHANGES, NO_IMAGE_REQUIRED, NO_UNDO, PARALLELIZE_STACKS, ROI_REQUIRED, SNAPSHOT, STACK_REQUIRED, SUPPORTS_MASKING |
Constructor Summary | |
---|---|
MaximumFinder()
|
Method Summary | |
---|---|
(package private) void |
analyzeAndMarkMaxima(ImageProcessor ip,
ByteProcessor typeP,
MaximumFinder.MaxPoint[] maxPoints,
boolean excludeEdgesNow,
boolean isEDM,
float globalMin,
double tolerance)
Check all maxima in list maxPoints, mark type of the points in typeP |
(package private) void |
cleanupExtraLines(ImageProcessor ip)
Delete single dots and lines ending somewhere within a segmented particle Needed for post-processing watershed-segmented images that can have local minima |
(package private) void |
cleanupMaxima(ByteProcessor outIp,
ByteProcessor typeP,
MaximumFinder.MaxPoint[] maxPoints)
eliminate unmarked maxima for use by watershed. |
(package private) void |
deleteEdgeParticles(ByteProcessor ip,
ByteProcessor typeP)
delete particles corresponding to edge maxima |
(package private) void |
deleteParticle(int x,
int y,
ByteProcessor ip,
ij.gui.Wand wand)
delete a particle (set from value 255 to current fill value). |
boolean |
dialogItemChanged(ij.gui.GenericDialog gd,
java.awt.AWTEvent e)
Read the parameters (during preview or after showing the dialog) |
ByteProcessor |
findMaxima(ImageProcessor ip,
double tolerance,
double threshold,
int outputType,
boolean excludeOnEdges,
boolean isEDM)
Here the processing is done: Find the maxima of an image (does not find minima) |
(package private) MaximumFinder.MaxPoint[] |
getSortedMaxPoints(ImageProcessor ip,
ByteProcessor typeP,
boolean excludeEdgesNow,
boolean isEDM,
float globalMin,
double threshold)
Find all local maxima (irrespective whether they finally qualify as maxima or not) |
(package private) int |
isLineOrDot(ImageProcessor ip,
int x,
int y)
analyze the neighbors of a pixel (x, y) in a byte image; pixels <255 are considered part of lines. |
(package private) boolean |
isWithin(ImageProcessor ip,
int x,
int y,
int direction)
returns whether the neighbor in a given direction is within the image NOTE: it is assumed that the pixel x,y itself is within the image! |
(package private) ByteProcessor |
make8bit(ImageProcessor ip,
ByteProcessor typeP,
boolean isEDM,
float globalMin,
float globalMax,
double threshold)
Create an 8-bit image by scaling the pixel values of ip (background 0) and mark maximum areas as 255. |
void |
run(ImageProcessor ip)
The plugin is inferred from ImageJ by this method |
void |
setNPasses(int nPasses)
unused method required by interface ExtendedPlugInFilter |
int |
setup(java.lang.String arg,
ImagePlus imp)
Method to return types supported |
int |
showDialog(ImagePlus imp,
java.lang.String command,
PlugInFilterRunner pfr)
This method is called after setup(arg, imp) unless the
DONE flag has been set. |
(package private) int |
trueEdmHeight(int x,
int y,
ImageProcessor ip)
Get estimated "true" height of a maximum or saddle point of a Euclidian Distance Map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SINGLE_POINTS
public static final int IN_TOLERANCE
public static final int SEGMENTED
public static final int POINT_SELECTION
public static final int COUNT
static final java.lang.String[] outputTypeNames
int[] dirOffset
int[] dirXoffset
int[] dirYoffset
static final int IS_LINE
static final int IS_DOT
static final byte MAXIMUM
static final byte LISTED
static final byte PROCESSED
static final byte MAX_AREA
static final byte EQUAL
static final byte MAX_POINT
static final byte ELIMINATED
static final byte[] outputTypeMasks
Constructor Detail |
---|
public MaximumFinder()
Method Detail |
---|
public int setup(java.lang.String arg, ImagePlus imp)
setup
in interface PlugInFilter
arg
- Not used by this plugin-filterimp
- The image to be filtered
public int showDialog(ImagePlus imp, java.lang.String command, PlugInFilterRunner pfr)
ExtendedPlugInFilter
setup(arg, imp)
unless the
DONE
flag has been set.
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 boolean dialogItemChanged(ij.gui.GenericDialog gd, java.awt.AWTEvent e)
dialogItemChanged
in interface ij.gui.DialogListener
public void setNPasses(int nPasses)
setNPasses
in interface ExtendedPlugInFilter
public void run(ImageProcessor ip)
run
in interface PlugInFilter
ip
- The image where maxima (or minima) should be foundpublic ByteProcessor findMaxima(ImageProcessor ip, double tolerance, double threshold, int outputType, boolean excludeOnEdges, boolean isEDM)
ip
- The input imagetolerance
- Height tolerance: maxima are accepted only if protruding more than this value from the ridge to a higher maximumthreshold
- minimum height of a maximum (uncalibrated); for no minimum height set it to ImageProcessor.NO_THRESHOLDoutputType
- What to mark in output image: SINGLE_POINTS, IN_TOLERANCE or SEGMENTED. No output image is created for
output types POINT_SELECTION and COUNT.excludeOnEdges
- Whether to exclude edge maximaisEDM
- Whether the image is a 16-bit Euclidian Distance Map
MaximumFinder.MaxPoint[] getSortedMaxPoints(ImageProcessor ip, ByteProcessor typeP, boolean excludeEdgesNow, boolean isEDM, float globalMin, double threshold)
ip
- The image to be analyzedtypeP
- A byte image, same size as ip, where the maximum points are marked as MAXIMUM
(do not use it as output: for rois, the points are shifted w.r.t. the input image)excludeEdgesNow
- Whether to exclude edge pixelsisEDM
- Whether ip is a 16-bit Euclidian distance mapglobalMin
- The minimum value of the image or roithreshold
- The threshold (calibrated) below which no pixels are processed. Ignored if ImageProcessor.NO_THRESHOLD
void analyzeAndMarkMaxima(ImageProcessor ip, ByteProcessor typeP, MaximumFinder.MaxPoint[] maxPoints, boolean excludeEdgesNow, boolean isEDM, float globalMin, double tolerance)
ip
- the image to be analyzedtypeP
- 8-bit image, here the point types are marked by type: MAX_POINT, etc.maxPoints
- input: a list of all local maxima, sorted by heightexcludeEdgesNow
- whether to avoid edge maximaisEDM
- whether ip is a 16-bit Euclidian distance mapglobalMin
- minimum pixel value in iptolerance
- minimum pixel value difference for two separate maximaByteProcessor make8bit(ImageProcessor ip, ByteProcessor typeP, boolean isEDM, float globalMin, float globalMax, double threshold)
ip
- The original image that should be segmentedtypeP
- Pixel types in ipisEDM
- Whether ip is an Euclidian distance mapglobalMin
- The minimum pixel value of ipglobalMax
- The maximum pixel value of ipthreshold
- Pixels of ip below this value (calibrated) are considered background. Ignored if ImageProcessor.NO_THRESHOLD
int trueEdmHeight(int x, int y, ImageProcessor ip)
x
- x-position of the pointy
- y-position of the pointip
- the EDM (16-bit, scaling as defined in EDM class)
void cleanupMaxima(ByteProcessor outIp, ByteProcessor typeP, MaximumFinder.MaxPoint[] maxPoints)
outIp
- the image containing the pixel valuestypeP
- the types of the pixels are marked heremaxPoints
- array containing the coordinates of all maxima that might be relevantvoid cleanupExtraLines(ImageProcessor ip)
ip
- 8-bit image with background = 0, lines between 1 and 254 and segmented particles = 255int isLineOrDot(ImageProcessor ip, int x, int y)
ip
- x
- y
-
void deleteEdgeParticles(ByteProcessor ip, ByteProcessor typeP)
typeP
- Here the pixel types of the original image are noted,
pixels with bit MAX_AREA at the edge are considered indicators of an edge maximum.ip
- the image resulting from watershed segmentaiton
(foreground pixels, i.e. particles, are 255, background 0)void deleteParticle(int x, int y, ByteProcessor ip, ij.gui.Wand wand)
boolean isWithin(ImageProcessor ip, int x, int y, int direction)
x
- x-coordinate of the pixel that has a neighbor in the given directiony
- y-coordinate of the pixel that has a neighbor in the given directiondirection
- the direction from the pixel towards the neighbor (see makeDirectionOffsets)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |