public class HatSnakeFilter extends Object implements IPadArray
setMode(int)
).
Every window p has assigned a rank. Bigger rank stands for better candidate to remove. Algorithm tries to remove first pnum windows (those with biggest ranks) that meet above rules. If pnum is set to 0 all protrusions with rank > alev are deleted.
Collections.rotate(List, int)
method that shift data left copying
falling out indexes
to end of the set (finally the window is settled in constant position between indexes
<0;window-1>). For each its position r the candidate points are deleted from original
contour and circularity is computed (see getCircularity(List)
). Then candidate points
are passed to getWeighting(List)
method where weight is evaluated. The role of weight is
to promote in rank candidate points that are cumulated in small area over distributed
sets. Thus weight should give larger values for that latter distribution than for cumulated one.
Currently weights are calculated as squared standard deviation of distances of all candidate
points to
center of mass of these points (or mean point if polygon is invalid). There is also mean
intensity calculated by getIntensity(List, List, ImageProcessor)
(not obligatory, it can
be switched off using runPlugin(List)
method.). It is sampled along
shrunk outline produced from input points. Finally
circularity(r) is divided by weight (r) and intensity and stored in circ array.
Additionally in this step the convex/concave is checked. All candidate points are tested whether
all they are inside the contour made without them (for concave option) or whether
any of
them is inside the modified contour (for convex option). Convex/concave sensitivity option can be
modified by setMode(int)
This information is stored in convex array. Finally rank array circ is NOT
normalised.
HatSnakeFilter.WindowIndRange.compareTo(Object)
method
that defines
rules of equality and non relations between ranges. Basically any overlapping range or included
is considered as equal and rejected from storing in ind2rem array.
The second step is repeated until pnum object will be found or end of candidates will be reached. If pnum is 0 all objects that meet above criteria will be found.
Modifier and Type | Field and Description |
---|---|
static int |
ALL
Algorithm will look for cavities and protrusions.
|
static int |
CAVITIES
Algorithm will look for cavities.
|
static int |
PROTRUSIONS
Algorithm will look for protrusions.
|
int |
shrinkAmount
Number of steps used for outline shrinking for intensity sampling.
|
CIRCULARPAD, SYMMETRICPAD
Constructor and Description |
---|
HatSnakeFilter()
Construct HatFilter Input array with data is virtually circularly padded.
|
HatSnakeFilter(int window,
int pnum,
double alev)
Constructor passing algorithm parameters.
|
Modifier and Type | Method and Description |
---|---|
Pair<ArrayList<Double>,ArrayList<Boolean>> |
calculateRank(List<Point2d> points,
ij.process.ImageProcessor orgIp)
Evaluate rank for given outline.
|
List<Point2d> |
runPlugin(List<Point2d> data)
In contrary to
runPlugin(List, ImageProcessor, Pair) this method does not use
intensity weighting nor externally calculated ranks. |
List<Point2d> |
runPlugin(List<Point2d> data,
ij.process.ImageProcessor orgIp)
In contrary to
runPlugin(List, ImageProcessor, Pair) this method does not use
externally calculated ranks. |
List<Point2d> |
runPlugin(List<Point2d> points,
ij.process.ImageProcessor orgIp,
Pair<ArrayList<Double>,ArrayList<Boolean>> ranks)
Main filter runner.
|
void |
setMode(int mode)
Set detection mode.
|
public static final int CAVITIES
setMode(int)
,
Constant Field Valuespublic static final int PROTRUSIONS
setMode(int)
,
Constant Field Valuespublic static final int ALL
setMode(int)
,
Constant Field Valuespublic int shrinkAmount
public HatSnakeFilter()
public HatSnakeFilter(int window, int pnum, double alev)
window
- size of the windowpnum
- number of protrusions to findalev
- thresholdHatSnakeFilter
public List<Point2d> runPlugin(List<Point2d> data) throws QuimpPluginException
runPlugin(List, ImageProcessor, Pair)
this method does not use
intensity weighting nor externally calculated ranks.data
- contour to processQuimpPluginException
- on wrong input datarunPlugin(List, ImageProcessor, Pair)
,
runPlugin(List, ImageProcessor)
public List<Point2d> runPlugin(List<Point2d> data, ij.process.ImageProcessor orgIp) throws QuimpPluginException
runPlugin(List, ImageProcessor, Pair)
this method does not use
externally calculated ranks.data
- contour to processorgIp
- Original image used for sampling intensity, can be nullQuimpPluginException
- on wrong input datarunPlugin(List)
,
runPlugin(List, ImageProcessor, Pair)
public List<Point2d> runPlugin(List<Point2d> points, ij.process.ImageProcessor orgIp, Pair<ArrayList<Double>,ArrayList<Boolean>> ranks) throws QuimpPluginException
This version assumes that user clicked Apply button to populate data from UI to plugin or any other ui element. User can expect that points will be always valid but they optionally may have 0 length.
points
- contour to processorgIp
- Original image used for sampling intensity, can be nullranks
- ranks calculated by calculateRank(List, ImageProcessor)
or null
to let them be evaluated by this method. Ranks values must comply with alev
valueQuimpPluginException
- on problem with input datacalculateRank(List, ImageProcessor)
public Pair<ArrayList<Double>,ArrayList<Boolean>> calculateRank(List<Point2d> points, ij.process.ImageProcessor orgIp)
Rank is evaluated for each position of window (defined in
HatSnakeFilter(int, int, double)
and it takes under account shape and local image
intensity. If image is null only shape features are considered.
points
- Outline as list of pointsorgIp
- Image for sampling intensity along constricted outline. Can be nullpublic void setMode(int mode)
mode
- can be CAVITIES, PROTRUSIONS, BOTHCopyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.