public class Outline extends Shape<Vert> implements Cloneable, IQuimpSerialize
Outline can have the same Shape as Snake but distribution of Vert may be different than distribution of Node in Snake. Outline is produced after ECMM and used in further analysis.
BAD_HEAD, BAD_LINKING, BAD_NUM_POINTS, centroid, head, LIST_OK, MAX_NODES, nextTrackNumber, NO_HEAD, POINTS
Constructor and Description |
---|
Outline()
Default constructor.
|
Outline(double[] x,
double[] y)
Construct Outline object from X and Y arrays.
|
Outline(List<? extends Tuple2d> list)
Construct Outline object from list of nodes.
|
Outline(Outline src)
Copy constructor.
|
Outline(Roi roi)
Create an outline from an Roi.
|
Outline(Snake src)
Conversion constructor.
|
Outline(Vert h)
Blank outline.
|
Outline(Vert h,
int nn)
Create a Outline from existing linked list
|
Modifier and Type | Method and Description |
---|---|
void |
afterSerialize()
This method is called after restoring object from JSON but before returning the object.
|
void |
beforeSerialize()
This method is called just before JSON is generated.
|
double |
calcArea()
calcArea.
|
double |
calcVolume()
calcVolume.
|
boolean |
checkCoordErrors()
checkCoordErrors.
|
void |
clearFluores()
clearFluores.
|
Object |
clone()
Deprecated.
Change to copy constructor
|
void |
coordReset()
Set head node coord to zero.
|
void |
correctDensity(double max,
double min)
Insert or remove nodes according to criteria.
|
boolean |
cutSelfIntersects()
Done once at the end of each frame to cut out any parts of the contour that self intersect.
|
static int |
distBetweenInts(Vert intA,
Vert intB)
distBetweenInts.
|
boolean |
equals(Object obj) |
Vert |
findCoordEdge(double a)
findCoordEdge.
|
Vert |
findFirstNode(char c)
Find the first node in terms of coord (c) or fcoord (f) ie closest to zero.
|
static Vert |
findIntersect(Vert v,
int id)
findIntersect.
|
void |
freezeProx(double angleTh,
double freezeTh)
Freeze a node and corresponding edge if its to close && close to parallel.
|
static Vert |
getNextIntersect(Vert v)
getNextIntersect.
|
int |
hashCode() |
Vert |
insertInterpolatedVert(Vert v)
Insert a vertex in-between v and v.next with interpolated values
|
Vert |
insertVert(Vert v)
Insert default Vert after Vert v.
|
double |
interpolateCoord(double a,
double b)
interpolate between co-ordinates (that run 0-1).
|
static int |
invertsBetween(Vert intA,
Vert intB)
invertsBetween.
|
void |
print()
Old toString.
|
boolean |
removeNanoEdges()
Remove really small edges that cause numerical inaccuracy when checking for self intersects.
|
void |
removeProx(double d1th,
double d2th)
Remove close vertexes.
|
void |
removeVert(Vert v)
Remove selected Vert from list.
|
void |
resetAllCoords()
|
void |
scaleOutline(double amount,
double stepRes,
double angleTh,
double freezeTh)
Scale the outline proportionally.
|
void |
setResolution(double density)
Evenly spaces a new vertices around the outline by following vectors between verts.
|
void |
setResolutionN(double numVerts)
Evenly spaces a new vertices around the outline by following vectors between verts.
|
String |
toString()
Print Shape nodes.
|
void |
updateCurvature()
Update curvature for all Vert in Outline.
|
addPoint, asFloatRoi, asIntRoi, asList, asPolygon, calcCentroid, checkIsHead, clearElements, countPoints, freezeAll, getCentroid, getDoubleBounds, getHead, getLength, getNumPoints, insertPoint, iterator, makeAntiClockwise, removePoint, reverseShape, scale, setHead, setHead, setHeadClosestTo, setPositions, unfreezeAll, updateNormals, validateShape, xtoArr, ytoArr
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Outline()
public Outline(Vert h, int nn)
Behaviour of this method was changed. Now it does not make copy of Vert. In old approach there was dummy node deleted in this constructor.
index = 0;
head = new Vert(index); // dummy head node head.setHead(true);
prevn = head;
index++; // insert next nodes here
h
- head node of linked listnn
- number of nodes in listpublic Outline(Vert h)
h
- Initial Vertpublic Outline(Outline src)
src
- Source Outlinepublic Outline(Snake src)
Convert only basic properties. Do not forget that many of Vert properties are set during ECMM or Q Analysis.
Set normals outwards. This can be changed by calling Shape.updateNormals(boolean)
afterwards.
src
- Snake to be converted to Outlinepublic Outline(Roi roi)
roi
- Initial ROIpublic Outline(List<? extends Tuple2d> list)
list
- list of nodes as Vector2dpublic Outline(double[] x, double[] y)
x
- x coordinates of nodesy
- y coordinates of nodespublic void print()
public void removeVert(Vert v)
Perform check if removed Vert was head and if it was, the new head is randomly selected. Neighbours are linked together
v
- Vert to removepublic void updateCurvature()
public Vert insertVert(Vert v)
v
- Vert to insert new Vert afterpublic Vert insertInterpolatedVert(Vert v)
Modify current Outline
v
- vertex to insert other vertex after itpublic double interpolateCoord(double a, double b)
a
- start coordb
- end coordpublic void setResolution(double density)
density
- densitypublic void setResolutionN(double numVerts)
numVerts
- numVertspublic double calcVolume()
public double calcArea()
public static Vert getNextIntersect(Vert v)
v
- vpublic static Vert findIntersect(Vert v, int id)
v
- vid
- idpublic static int distBetweenInts(Vert intA, Vert intB)
intA
- intAintB
- intBpublic static int invertsBetween(Vert intA, Vert intB)
intA
- intAintB
- intBpublic void correctDensity(double max, double min)
It does not redistribute nodes equally. Removing has priority over inserting, inserted vertex can be next removed if it is too close. Does not work vice-versa as inserting does not push current node forward (to next in list) but removing does. And removing condition is checked first
max
- max allowed distancemin
- min allowed distancepublic boolean cutSelfIntersects()
Similar to cutLoops, but check all edges (interval up to NODES/2) and cuts out the smallest section
Snake.cutLoops()
,
Snake.cutIntersects()
public boolean removeNanoEdges()
Tends to happen when migrating edges get pushed together
public void coordReset()
Prevents circulating of the zero coord
public void resetAllCoords()
public Object clone()
clone
in class Object
Object.clone()
public boolean checkCoordErrors()
public Vert findFirstNode(char c)
c
- coordinate codepublic void clearFluores()
public Vert findCoordEdge(double a)
a
- apublic void scaleOutline(double amount, double stepRes, double angleTh, double freezeTh)
Shape is constricted in given number of steps. Method updates shape normals setting them in inner direction. Results can differ (slightly) on each run due to random selection of head on point remove.
Updates centroid and normalised position.
amount
- scalestepRes
- shift done in one stepangleTh
- angle thresholdfreezeTh
- freeze thresholdpublic void removeProx(double d1th, double d2th)
For each element distances are calculated to next and previous elements. If any of distances is smaller than given threshold, element is removed (if not frozen).
d1th
- distance threshold between previous and currentd2th
- distance threshold between current and nextpublic void freezeProx(double angleTh, double freezeTh)
angleTh
- angle thresholdfreezeTh
- freeze thresholdpublic void beforeSerialize()
IQuimpSerialize
beforeSerialize
in interface IQuimpSerialize
beforeSerialize
in class Shape<Vert>
Serializer.save(String)
public void afterSerialize() throws Exception
IQuimpSerialize
afterSerialize
in interface IQuimpSerialize
afterSerialize
in class Shape<Vert>
Exception
- from wrapped object in any problem. This is implementation dependentSerializer.load(String)
Copyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.