de.unihalle.informatik.MiToBo.core.datatypes
Class MTBContour2D

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDData
      extended by de.unihalle.informatik.MiToBo.core.datatypes.MTBBorder2D
          extended by de.unihalle.informatik.MiToBo.core.datatypes.MTBContour2D
All Implemented Interfaces:
Cloneable

@ALDDerivedClass
@ALDParametrizedClass
public class MTBContour2D
extends MTBBorder2D

Class to create 2D contour objects with a vector of points, belonging to the contour. Every contour can include a set of inner contours.

Contrary to the super class of 2D borders the points belonging to a contour have a certain ordering.

Author:
misiak

Nested Class Summary
 
Nested classes/interfaces inherited from class de.unihalle.informatik.MiToBo.core.datatypes.MTBBorder2D
MTBBorder2D.BorderConnectivity
 
Field Summary
 
Fields inherited from class de.unihalle.informatik.MiToBo.core.datatypes.MTBBorder2D
connectivity, inner, pointNum, points
 
Constructor Summary
MTBContour2D()
          Standard constructor.
MTBContour2D(Vector<Point2D.Double> _points)
          Constructor to create an 2D contour object from a 2D point vector.
 
Method Summary
 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.
 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.
 void setInner(Vector<MTBBorder2D> C)
          Set the inner contours of the contour object.
 
Methods inherited from class de.unihalle.informatik.MiToBo.core.datatypes.MTBBorder2D
addPixel, countInner, getAllInnerBorders, getBoundingBox, getConnectivity, getPointAt, getPointNum, getPoints, hookPointsUpdated, setConnectivity, toMTBImage, toMTBImageByte
 
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
 

Constructor Detail

MTBContour2D

public MTBContour2D()
Standard constructor. Creates an empty 2D contour object.


MTBContour2D

public MTBContour2D(Vector<Point2D.Double> _points)
Constructor to create an 2D contour object from a 2D point vector.

Parameters:
_points - vector with 2D points
Method Detail

clone

public MTBContour2D clone()
Override java.lang.Object.clone() to create and return a copy of this object.

Overrides:
clone in class MTBBorder2D

getContour

public MTBContour2D getContour()
Get a Contour2D copy of this object.

Returns:
Copy of this Contour2D object.

getChaincode

public int[] getChaincode()
Calculates chaincode from the outer contour. The contour points must be stored in consecutive order and the contour must be closed!

Returns:
Chaincode of outer contour.

getContourLength

public double getContourLength()
Calculates the length of the outer contour using it's chaincode.

Returns:
Length of the contour.

setInner

public void setInner(Vector<MTBBorder2D> C)
              throws MTBDatatypeException
Set the inner contours of the contour object.

Note that an error occurs if the objects are not of type MTBContour2D.

Overrides:
setInner in class MTBBorder2D
Parameters:
C - Vector with inner contours belonging to the contour object.
Throws:
MTBDatatypeException

addInner

public void addInner(MTBBorder2D C)
              throws MTBDatatypeException
Add a inner contour to the existing contour object.

Overrides:
addInner in class MTBBorder2D
Parameters:
C - the new 2D inner contour
Throws:
MTBDatatypeException

getInnerCount

public int getInnerCount()
Get the number of inner contours including in the contour object.

Returns:
The number of inner contours.

getInner

public MTBContour2D getInner(int index)
Get a specific inner contour from the contour object.

Overrides:
getInner in class MTBBorder2D
Parameters:
index - specific index of the inner contour to get from the inner contour vector
Returns:
Inner contour at the specific index as 2D contour object.

getAllInner

public Vector<MTBContour2D> getAllInner()
Get all inner contours from the contour object.

Returns:
Copy of vector with all inner contours.

getRegion

public MTBRegion2D getRegion(int imageSizeX,
                             int imageSizeY)
                      throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                             de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Method to get the included region in a 2D contour as Region2D object.

Parameters:
imageSizeX - width of image that includes the region
imageSizeY - height of image that includes the region
Returns:
2D region included in the 2D contour.
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.