@ALDParametrizedClass public class MTBPolygon2DSet extends de.unihalle.informatik.Alida.operator.ALDData implements Cloneable, MTBDataExportableToImageJROI
MTBPolygon2D
.
A set of 2D polygons lives in a common domain which is a rectangular subset
of R x R. Each polygon is of type Polygon2D or a subclass. For reading and
writing the derived class MTBSnake
is handled in addition to
MTBPolygon2D
.
Modifier and Type | Field and Description |
---|---|
private boolean |
debug
Debug flag for internal use only.
|
(package private) Vector<MTBPolygon2D> |
polygonSet
The set of polygons represented as a Vector.
|
private double |
xMax
Maximal x coordinate of the domain of this polygon set.
|
private double |
xMin
Minimal x coordinate of the domain of this polygon set.
|
private double |
yMax
Maximal y coordinate of the domain of this polygon set.
|
private double |
yMin
Minimal y coordinate of the domain of this polygon set.
|
Constructor and Description |
---|
MTBPolygon2DSet()
Standard constructor
|
MTBPolygon2DSet(double _xMin,
double _yMin,
double _xMax,
double _yMax)
Construct an empty set of polygons with given extent of domain.
|
MTBPolygon2DSet(Vector<MTBPolygon2D> _polys,
double _xMin,
double _yMin,
double _xMax,
double _yMax)
Construct polygon set from given vector.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(MTBPolygon2D polygon)
Append a polygon (at the end) to the set of polygons.
|
MTBPolygon2DSet |
clone() |
ij.gui.PolygonRoi[] |
convertToImageJRoi()
Function to convert object to ImageJ ROI or set of ROIs.
|
MTBPolygon2D |
elementAt(int i)
Get a polygon by index.
|
private static Vector<Point2D.Double> |
extractPointVectorPolygon(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
Extract the list of polygon points for a polygon.
|
private static Vector<MTBSnakePoint2D> |
extractPointVectorSnake(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
Extract the list of polygon points for a snake.
|
MTBPolygon2D |
getPolygon2DFromXml(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
* Get a new
Polygon2D from the information of the
xmlPolygon . |
double |
getXmax()
Returns maximal x coordinate of the domain.
|
double |
getXmin()
Returns minimal x coordinate of the domain.
|
double |
getYmax()
Returns maximal x coordinate of the domain.
|
double |
getYmin()
Returns minimal y coordinate of the domain.
|
void |
read(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DSetType xmlPolygon2DSet)
Read a polygon set from an xml object
xmlPolygon2DSet and set the MTB
polygon set accordingly. |
void |
read(String filename)
Read a polygon set from an xml file
filename and set the MTB
polygon set accordingly. |
void |
setElementAt(int i,
MTBPolygon2D poly)
Set a polygon at i-th position of the set.
|
int |
size()
Get the number of polygons of this polygon set.
|
String |
toString() |
de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DSetType |
toXMLType()
Create a xml representation of this polygon set using MiToBo's xml-scheme MTBXMLPolygon2DSet.xsd
|
void |
write(String filename)
Write this polygon set as xml into file
filename.xml
Additionally the processing history is written. |
void |
write(String filename,
boolean writeHistory)
Write this polygon set as xml into file
filename If flag is
set to true, the processing history is written, too. |
private boolean debug
@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 polygons") Vector<MTBPolygon2D> polygonSet
public MTBPolygon2DSet()
public MTBPolygon2DSet(double _xMin, double _yMin, double _xMax, double _yMax)
_xMin
- minimum value of x-coordinates for the set_yMin
- minimum value of y-coordinates for the set_xMax
- maximum value of x-coordinates for the set_yMax
- maximum value of y-coordinates for the setpublic MTBPolygon2DSet(Vector<MTBPolygon2D> _polys, double _xMin, double _yMin, double _xMax, double _yMax)
_polys
- set of polygons_xMin
- minimum value of x-coordinates for the set_yMin
- minimum value of y-coordinates for the set_xMax
- maximum value of x-coordinates for the set_yMax
- maximum value of y-coordinates for the setpublic MTBPolygon2DSet clone()
public double getXmin()
public double getXmax()
public double getYmin()
public double getYmax()
public int size()
public MTBPolygon2D elementAt(int i)
public void setElementAt(int i, MTBPolygon2D poly)
i
- positionpoly
- polygon object to set at position ipublic boolean add(MTBPolygon2D polygon)
polygon
- Polygon to add.public void read(String filename) throws IOException, org.apache.xmlbeans.XmlException, ClassNotFoundException
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
org.apache.xmlbeans.XmlException
ClassNotFoundException
public void read(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DSetType xmlPolygon2DSet) throws ClassNotFoundException
xmlPolygon2DSet
and set the MTB
polygon set accordingly.
WARNING: currently assume filename WITHOUT extension.
filename
- Filename to read from, WITHOUT extension (for the moment).ClassNotFoundException
public MTBPolygon2D getPolygon2DFromXml(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon) throws ClassNotFoundException
Polygon2D
from the information of the
xmlPolygon
. Returns Polygon2D and Snake type polygons as
appropriate.xmlPolygon
- polygon object stored in the xmlPolygonClassNotFoundException
private static Vector<Point2D.Double> extractPointVectorPolygon(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
xmlPolygon
- the xml polygon to copy the data fromprivate static Vector<MTBSnakePoint2D> extractPointVectorSnake(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
xmlPolygon
- the xml polygon to copy the data frompublic void write(String filename) throws de.unihalle.informatik.Alida.exceptions.ALDException
filename.xml
Additionally the 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
public void write(String filename, boolean writeHistory) throws de.unihalle.informatik.Alida.exceptions.ALDException
filename
If flag is
set to true, the processing history is written, too.filename
- Filename to write to.writeHistory
- If true, the history is written as well.de.unihalle.informatik.Alida.exceptions.ALDException
public de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DSetType toXMLType() throws ClassNotFoundException
ClassNotFoundException
- if the class of the polygons in the set are not known to the implementation
(rather an unknown extending class)public ij.gui.PolygonRoi[] convertToImageJRoi()
MTBDataExportableToImageJROI
convertToImageJRoi
in interface MTBDataExportableToImageJROI
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.