|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.operator.ALDData
de.unihalle.informatik.MiToBo.core.datatypes.MTBBorder2D
@ALDParametrizedClass public class MTBBorder2D
Datatype to represent borders of components.
The border of a component is basically equal to its contours, however, the pixels are not arranged in a special ordering. In particular they are not ordered clockwise or counter-clockwise. Due to this the extraction is faster than using classical contour extraction algorithms.
Nested Class Summary | |
---|---|
static class |
MTBBorder2D.BorderConnectivity
Kind of neighborhood to be applied to border pixels. |
Field Summary | |
---|---|
protected MTBBorder2D.BorderConnectivity |
connectivity
Connectivity of border pixels. |
protected Vector<MTBBorder2D> |
inner
Set of inner borders if available. |
protected int |
pointNum
The number of border points. |
protected Vector<Point2D.Double> |
points
Set of border pixels. |
Constructor Summary | |
---|---|
MTBBorder2D()
Standard constructor. |
|
MTBBorder2D(Vector<Point2D.Double> _points,
MTBBorder2D.BorderConnectivity bc)
Constructor to create an 2D border object from a 2D point vector. |
Method Summary | |
---|---|
void |
addInner(MTBBorder2D ic)
Add an inner border to the existing border object. |
void |
addPixel(int x,
int y)
Add a 2D point to the existing border. |
MTBBorder2D |
clone()
|
int |
countInner()
Get the number of inner borders included. |
Vector<MTBBorder2D> |
getAllInnerBorders()
Get all inner borders from the border object. |
double[] |
getBoundingBox()
Calculates the axes-parallel bounding box of the contour. |
MTBBorder2D.BorderConnectivity |
getConnectivity()
Query the connectivity of pixels within border. |
MTBBorder2D |
getInner(int index)
Get a specific inner border. |
Point2D.Double |
getPointAt(int index)
Get a specific 2D point belonging to the border object. |
int |
getPointNum()
Get the number of points of the border object. |
Vector<Point2D.Double> |
getPoints()
Get all points belonging to the border object. |
protected void |
hookPointsUpdated()
Function to update object state after setting new point list. |
void |
setConnectivity(MTBBorder2D.BorderConnectivity bc)
Set the connectivity. |
void |
setInner(Vector<MTBBorder2D> ic)
Set the inner borders of the border object. |
MTBImage |
toMTBImage(String file,
MTBImage image)
Draws border with all inner borders to a given image. |
MTBImageByte |
toMTBImageByte(String file,
int width,
int height)
Draws a border with all inner borders to a binary image with given size. |
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDData |
---|
cloneProperties, getLocation, getProperty, getPropertyKeys, print, setLocation, setProperty |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@ALDClassParameter(label="Point list", changeValueHook="hookPointsUpdated") protected Vector<Point2D.Double> points
@ALDClassParameter(label="Set of inner borders") protected Vector<MTBBorder2D> inner
protected int pointNum
@ALDClassParameter(label="Connectivity") protected MTBBorder2D.BorderConnectivity connectivity
If nothing is specified, 8-connectivity is assumed.
Constructor Detail |
---|
public MTBBorder2D()
public MTBBorder2D(Vector<Point2D.Double> _points, MTBBorder2D.BorderConnectivity bc)
_points
- Vector with 2D points.bc
- Type of connectivity within point list.Method Detail |
---|
public MTBBorder2D clone()
clone
in class Object
public Vector<Point2D.Double> getPoints()
public Point2D.Double getPointAt(int index)
Index
- of requested point.
public int getPointNum()
public MTBBorder2D.BorderConnectivity getConnectivity()
public void setConnectivity(MTBBorder2D.BorderConnectivity bc)
bc
- Connectivity of border.public void addPixel(int x, int y)
x
- x-coordinate of the new point.y
- y-coordinate of the new point.public void setInner(Vector<MTBBorder2D> ic) throws MTBDatatypeException
ic
- Vector with inner borders.
MTBDatatypeException
public void addInner(MTBBorder2D ic) throws MTBDatatypeException
ic
- New inner 2D border.
MTBDatatypeException
public MTBBorder2D getInner(int index)
index
- Index of desired inner border.
public Vector<MTBBorder2D> getAllInnerBorders()
public int countInner()
public MTBImageByte toMTBImageByte(String file, int width, int height) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
file
- Path where the file should be saved, can be null.width
- Width of the binary image.height
- Height of the binary image.
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
public MTBImage toMTBImage(String file, MTBImage image) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
file
- Path where the file should be saved, can be null.image
- Image to where the borders should be drawn.
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
public double[] getBoundingBox()
The function extracts the coordinates of the upper left and lower right corner of the bounding box of the border. Note that the there is at least one point of the border lying on each side of the bounding box, i.e. the border not just touches the box, but lies on it.
The result array contains the corner coordinates in the following order: [xmin, ymin, xmax, ymax]
protected void hookPointsUpdated()
It is assumed that point list is up-to-date before calling the hook.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |