@ALDDerivedClass @ALDParametrizedClass public class MTBContour2D extends MTBBorder2D implements MTBDataExportableToImageJROI
Contrary to the super class of 2D borders the points belonging to a contour have a certain ordering.
MTBBorder2D.BorderConnectivityconnectivity, inner, pointNum, points| Constructor and Description |
|---|
MTBContour2D()
Standard constructor.
|
MTBContour2D(Vector<Point2D.Double> _points)
Constructor to create a 2D contour object from a 2D point vector.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addInner(MTBBorder2D C)
Add a inner contour to the existing contour object.
|
MTBContour2D |
clone()
Override java.lang.Object.clone() to create and return a copy of this
object.
|
ij.gui.PolygonRoi[] |
convertToImageJRoi()
Function to convert object to ImageJ ROI or set of ROIs.
|
void |
drawContour(MTBImage img,
Color color)
Draw a contour into an image.
|
Vector<MTBContour2D> |
getAllInner()
Get all inner contours from the contour object.
|
int[] |
getChaincode()
Calculates chaincode from the outer contour.
|
MTBContour2D |
getContour()
Get a Contour2D copy of this object.
|
double |
getContourLength()
Calculates the length of the outer contour using it's chaincode.
|
MTBContour2D |
getInner(int index)
Get a specific inner contour from the contour object.
|
int |
getInnerCount()
Get the number of inner contours including in the contour object.
|
MTBRegion2D |
getRegion(int imageSizeX,
int imageSizeY)
Method to get the included region in a 2D contour as Region2D object.
|
static MTBContour2D |
readContourFromASCIIFile(String file,
String delim,
int skipLines)
Read a 2D contour object from an ASCII file in xSV format.
|
void |
setInner(Vector<MTBBorder2D> C)
Set the inner contours of the contour object.
|
MTBContour2D |
smoothContour(double gaussSigma)
Smoothes the contour by convolving x and y coordinates with a
Gaussian kernel.
|
private static Vector<Point2D.Double> |
smoothPointVector(Vector<Point2D.Double> pList,
double sigma)
Convolves a list of 2D points with a Gaussian kernel.
|
addPixel, countInner, getAllInnerBorders, getBoundingBox, getConnectivity, getPointAt, getPointNum, getPoints, hookPointsUpdated, readBorderFromASCIIFile, setConnectivity, toMTBImage, toMTBImageBytepublic MTBContour2D()
public MTBContour2D(Vector<Point2D.Double> _points)
_points - vector with 2D pointspublic MTBContour2D clone()
clone in class MTBBorder2Dpublic MTBContour2D getContour()
public int[] getChaincode()
public double getContourLength()
public void setInner(Vector<MTBBorder2D> C) throws MTBDatatypeException
Note that an error occurs if the objects are not of type
MTBContour2D.
setInner in class MTBBorder2DC - Vector with inner contours belonging to the contour object.MTBDatatypeException - Thrown in case of failure.public void addInner(MTBBorder2D C) throws MTBDatatypeException
addInner in class MTBBorder2DC - the new 2D inner contourMTBDatatypeException - Thrown in case of failure.public int getInnerCount()
public MTBContour2D getInner(int index)
getInner in class MTBBorder2Dindex - specific index of the inner contour to get from the inner contour
vectorpublic Vector<MTBContour2D> getAllInner()
public MTBRegion2D getRegion(int imageSizeX, int imageSizeY) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
imageSizeX - width of image that includes the regionimageSizeY - height of image that includes the regionde.unihalle.informatik.Alida.exceptions.ALDOperatorException - Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException - Thrown in case of failure.public ij.gui.PolygonRoi[] convertToImageJRoi()
MTBDataExportableToImageJROIconvertToImageJRoi in interface MTBDataExportableToImageJROIpublic MTBContour2D smoothContour(double gaussSigma) throws MTBDatatypeException, de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Note that the outer contour and all inner contours are smoothed.
gaussSigma - Standard deviation of the Gaussian kernel.MTBDatatypeException - Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException - Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDOperatorException - Thrown in case of failure.public void drawContour(MTBImage img, Color color)
img - Image where to draw the contour into.color - Color in which to draw the contour.public static MTBContour2D readContourFromASCIIFile(String file, String delim, int skipLines)
The file is expected to contain a single point in each row, first the x-coordinate and then the y-coordinate. Both coordinates should be separated by the delimiter character.
file - File name from where to read the points.delim - Delimiter in the file.skipLines - Number of header lines to skip.private static Vector<Point2D.Double> smoothPointVector(Vector<Point2D.Double> pList, double sigma) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
x and y coordinates are each convolved with a Gaussian kernel.
For convolution an operator of type GaussFilterDouble1D
is applied. Take a look at its documentation for more details.
Note that we assume here that the list of points is periodic, e.g., represents a closed contour.
pList - List of points.sigma - Standard deviation of Gaussian kernel.de.unihalle.informatik.Alida.exceptions.ALDOperatorException - Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException - Thrown in case of failure.Copyright © 2010–2025 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.