@ALDParametrizedClass public class MTBContour2DSet extends de.unihalle.informatik.Alida.operator.ALDData implements Cloneable, MTBDataExportableToImageJROI, Iterable<MTBContour2D>
Modifier and Type | Field and Description |
---|---|
(package private) Vector<MTBContour2D> |
contourSet
The set of contours represented as a Vector.
|
private double |
xMax
Maximal x coordinate of the domain of this contour set.
|
private double |
xMin
Minimal x coordinate of the domain of this contour set.
|
private double |
yMax
Maximal y coordinate of the domain of this contour set.
|
private double |
yMin
Minimal y coordinate of the domain of this contour set.
|
Constructor and Description |
---|
MTBContour2DSet()
Standard constructor.
|
MTBContour2DSet(double _xMin,
double _yMin,
double _xMax,
double _yMax)
Construct an empty set of contours with given extent of domain.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(MTBContour2D contour)
Append a contour (at the end) to the set of contours.
|
MTBContour2DSet |
clone() |
ij.gui.PolygonRoi[] |
convertToImageJRoi()
Function to convert object to ImageJ ROI or set of ROIs.
|
MTBContour2D |
elementAt(int i)
Get a contour by index.
|
de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType |
getContour2DAsXml(MTBContour2D contour,
de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType xmlC)
Copy the information of
contour into the corresponding xml
element xmlContour . |
MTBContour2D |
getContour2DFromXml(de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType xmlContour)
Get a new
MTBContour2D from the information of the
xmlContour . |
double |
getXMax()
Get the maximal x-coordinate of the domain of this contour set.
|
double |
getXMin()
Get the minimal x-coordinate of the domain of this contour set.
|
double |
getYMax()
Get the maximal y-coordinate of the domain of this contour set.
|
double |
getYMin()
Get the minimal y-coordinate of the domain of this contour set.
|
Iterator<MTBContour2D> |
iterator() |
void |
read(de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DSetType xmlContourSet)
Read a contour set from an xml object
xmlContourSet
and set the MTB polygon set accordingly. |
void |
read(String filename)
Read a contour set from an xml file
filename and set the MTB
polygon set accordingly. |
static MTBContour2DSet |
readContoursFromASCIIFiles(String dir,
String delim,
int skipLines)
Read a set of 2D contours from ASCII files in xSV format from the
given directory.
|
void |
removeElementAt(int i)
Delete the i-th contour from the set
|
void |
setElementAt(MTBContour2D contour,
int i)
Set the i-th contour from the set.
|
int |
size()
Get the number of contours of this contour set
|
de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DSetType |
toXMLType()
Convert contour object to MTB XML datatype.
|
void |
write(String filename)
Write this contour set into XML file
filename.xml
Additionally, its processing history is written. |
cloneProperties, getLocation, getProperty, getPropertyKeys, print, setLocation, setProperty
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
@ALDClassParameter(label="Minimal x in domain.") private double xMin
@ALDClassParameter(label="Minimal y in domain") private double yMin
@ALDClassParameter(label="Maximal x in domain") private double xMax
@ALDClassParameter(label="Maximal y in domain") private double yMax
@ALDClassParameter(label="Set of contours") Vector<MTBContour2D> contourSet
public MTBContour2DSet()
public MTBContour2DSet(double _xMin, double _yMin, double _xMax, double _yMax)
_xMin
- minimal x-coordinate of the domain_yMin
- minimal y-coordinate of the domain_xMax
- maximal x-coordinate of the domain_yMax
- maximal y-coordinate of the domainpublic MTBContour2DSet clone()
public int size()
public MTBContour2D elementAt(int i)
i
- Index of border to retrieve.public double getXMin()
public double getXMax()
public double getYMin()
public double getYMax()
public boolean add(MTBContour2D contour)
contour
- Contour to add.public void setElementAt(MTBContour2D contour, int i)
contour
- new contour elementi
- index of the new contourpublic void removeElementAt(int i)
i
- index of contour to removepublic void read(String filename) throws IOException, org.apache.xmlbeans.XmlException
filename
and set the MTB
polygon set accordingly. The processing history is read also if available.
WARNING: currently assume filename WITHOUT extension.
filename
- Filename to read from, WITHOUT extension (for the moment).IOException
- Thrown in case of failure.org.apache.xmlbeans.XmlException
- Thrown in case of failure.public void read(de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DSetType xmlContourSet)
xmlContourSet
and set the MTB polygon set accordingly.
WARNING: currently assume filename WITHOUT extension.
xmlContourSet
- Object from where to read the data.public void write(String filename) throws de.unihalle.informatik.Alida.exceptions.ALDException
filename.xml
Additionally, its processing history is written.
WARNING: currently assume filename WITHOUT extension.
filename
- Filename to write to, WITHOUT extension (for the moment)de.unihalle.informatik.Alida.exceptions.ALDException
- Thrown in case of failure.public de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DSetType toXMLType()
public de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType getContour2DAsXml(MTBContour2D contour, de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType xmlC)
contour
into the corresponding xml
element xmlContour
.
If xmlContour
is null, a new
obejct is created, otherwise the passed object filled.
contour
- Contour object to convert.xmlC
- Optional target object.public MTBContour2D getContour2DFromXml(de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType xmlContour)
MTBContour2D
from the information of the
xmlContour
.xmlContour
- xml contour objectpublic ij.gui.PolygonRoi[] convertToImageJRoi()
MTBDataExportableToImageJROI
convertToImageJRoi
in interface MTBDataExportableToImageJROI
public Iterator<MTBContour2D> iterator()
iterator
in interface Iterable<MTBContour2D>
public static MTBContour2DSet readContoursFromASCIIFiles(String dir, String delim, int skipLines)
It is assumed that all files have the same format and that there are only files containing contours in the directory.
dir
- Directory from where to read the files.delim
- Delimiter in the file.skipLines
- Number of header lines to skip.Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.