T
- Outline or Snake classpublic class OutlineProcessor<T extends Shape<?>> extends Object
ANA_
,
PointListProcessor
Constructor and Description |
---|
OutlineProcessor(T outline)
Assign outline to be processed to object.
|
Modifier and Type | Method and Description |
---|---|
double |
amplificationFactor(double curv,
double sigma,
double magn)
Return amplification factor dependent on curvature.
|
OutlineProcessor<T> |
averageCurvature(double averdistance)
Compute average curvature of
Outline . |
T |
getO()
Outline getter.
|
OutlineProcessor<T> |
runningMean(int window,
int iters)
Apply running mean filter to Shape.
|
OutlineProcessor<T> |
runningMedian(int window,
int iters)
Apply running median filter to Shape.
|
void |
shrinkLin(double steps,
double stepRes,
double angleTh,
double freezeTh)
Shrink outline linearly.
|
void |
shrinknl(double steps,
double stepRes,
double angleTh,
double freezeTh,
double sigma,
double magn,
double averageCurvDist,
double averageNormalsDist)
Shrink the outline nonlinearly.
|
OutlineProcessor<T> |
sumCurvature(double averdistance)
Sum smoothed curvature over a region of the membrane.
|
public OutlineProcessor(T outline)
outline
- Reference to Outline to be processedpublic OutlineProcessor<T> runningMean(int window, int iters)
Do not create new Shape but modify nodes of existing one. Compute
Shape.calcCentroid()
, Shape.updateNormals(boolean)
and
Shape.setPositions()
. Normals are updated inwards.
window
- size of filter window, must be uneveniters
- number of smoothing iterationspublic OutlineProcessor<T> runningMedian(int window, int iters)
Do not create new Shape but modify nodes of existing one. Compute
Shape.calcCentroid()
, Shape.updateNormals(boolean)
and
Shape.setPositions()
. Normals are updated inwards.
window
- size of filter window, must be uneveniters
- number of smoothing iterationspublic OutlineProcessor<T> averageCurvature(double averdistance)
Outline
.
Does not apply to Snake
. Require Outline.updateCurvature()
to be called
first to fill Vert.curvatureLocal
field.
averdistance
- Average distance in pixels to compute curvature. Nodes in half of distance
on left and right from current node will be included in average curvature for this node.public OutlineProcessor<T> sumCurvature(double averdistance)
Outline
only.
Does not apply to Snake
. Require averageCurvature(double)
to be called
first to fill Vert.curvatureSmoothed
field.
averdistance
- Average distance in pixels to compute curvature. Nodes in half of distance
on left and right from current node will be included in average curvature for this node.public void shrinkLin(double steps, double stepRes, double angleTh, double freezeTh)
steps
- stepsstepRes
- stepResangleTh
- angleThfreezeTh
- freezeThshrinknl(double, double, double, double, double, double, double, double)
public void shrinknl(double steps, double stepRes, double angleTh, double freezeTh, double sigma, double magn, double averageCurvDist, double averageNormalsDist)
This method uses Vert.curvatureSum
computed by
sumCurvature(double)
to produce nonlinear scaling. Scaling factor
depends on Vert.curvatureSum
and it is computed by
amplificationFactor(double, double, double)
method. Nodes are shifted inwards
according to normals (PointsList.getNormal()
). If parameter averageNormalsDist is
greater than zero, nodes within this distance to current node will be analysed to find lowest
(must be negative) Vert.curvatureSum
and then normal vector of this node will be copied
to all other nodes
in current window.
amplificationFactor(double, double, double)
increase step size used by
shrinkLin(double, double, double, double)
maximally by factor of amplificationFactor(double, double, double)
option).
For linear shrinking use
steps
- number of steps - integerstepRes
- length of the stepangleTh
- angle thresholdfreezeTh
- freeze thresholdsigma
- sigma of Gaussianmagn
- maximum amplification (for curv<<0)averageCurvDist
- number of neighbouring nodes to average curvature over. This is
multiplier of average node distance. Always at least three nodes are averaged
(n-1,n,n+1).averageNormalsDist
- number of neighbouring nodes to set normals the same (set 0 to
disable).Outline.scaleOutline(double, double, double, double)
,
amplificationFactor(double, double, double)
public double amplificationFactor(double curv, double sigma, double magn)
For positive curvature it returns 1, for negative a reversed Gaussian curve scaled between 1.0 and specified magnitude is returned.
x=linspace(-2,0,100);
sig = 0.3;
u = 0;
a = 4
y = (a*(1-exp(-0.5*((x-u)/sig).^2)))/(a/(a-1))+1;
plot(x,y)
curv
- curvature value to compute magnification coefficient forsigma
- sigma of Gaussianmagn
- maximum amplification (for curv<<0). Set to 1.0 for constant output of 1.0public T getO()
Copyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.