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

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDData
      extended by de.unihalle.informatik.MiToBo.core.datatypes.MTBRegion3D

@ALDParametrizedClass
public class MTBRegion3D
extends de.unihalle.informatik.Alida.operator.ALDData

Class to create a 3D region object. The center of mass and the volume of the 3D region can be calculated as well as other 3D region properties.

Author:
glass

Constructor Summary
MTBRegion3D()
          Construct a new MTBRegion3D object.
MTBRegion3D(de.unihalle.informatik.MiToBo_xml.MTBXMLRegion3DType xmlregion3D)
          Construct a new MTBRegion3D from a 3D-region in xml-representation.
MTBRegion3D(Vector<MTBPoint3D> p)
          Construct a new MTBRegion3D object from the given points.
MTBRegion3D(Vector<MTBPoint3D> p, int id)
          Construct a new MTBRegion3D object from the given points and set its id
 
Method Summary
 void addPoint(double px, double py, double pz)
          Append a point to the region from the given coordinates.
 void addPoint(MTBPoint3D p)
          Append a 3D point to the region.
 MTBPoint3D calcCentre(Vector<MTBPoint3D> p)
          Calculate the centroid (not yet normalized by volume) of a given vector of points.
 double[] getBoundingBox()
          Calculates the axes-parallel bounding box of the region.
 double getCentralMoment(int p, int q, int r)
           
 MTBPoint3D getCentre()
          Return the center of the region as 3D point.
 double getCentreX()
          Return the x-coordinate of the center of the region.
 double getCentreY()
          Return the y-coordinate of the center of the region.
 double getCentreZ()
          Return the z-coordinate of the center of the region.
 double getCompactness()
          calculates compactness value according to
Carlos Martinez-Ortiz. "2D and 3D Shape Descriptors".
 int getID()
          Return the ID of the region.
 double getMoment(int p, int q, int r)
           
 Vector<MTBPoint3D> getPoints()
          Return the points which are included in the 3D region.
 int getSizeX()
          Calculate the expansion in x-direction of the region.
 int getSizeY()
          Calculate the expansion in y-direction of the region.
 int getSizeZ()
          Calculate the expansion in z-direction of the region.
 double getVolume()
          Return the volume of the 3D region (number of points within the region).
protected  void hookPointsUpdated()
          Function to update object state after setting new point list.
 void regionToFile(String fileName)
          Write the coordinates of the included 3D points into a text file.
 void setID(int id)
          Set the ID of the region.
 de.unihalle.informatik.MiToBo_xml.MTBXMLRegion3DType toXMLType()
           
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDData
cloneProperties, getLocation, getProperty, getPropertyKeys, print, setLocation, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MTBRegion3D

public MTBRegion3D()
Construct a new MTBRegion3D object.


MTBRegion3D

public MTBRegion3D(Vector<MTBPoint3D> p)
Construct a new MTBRegion3D object from the given points.

Parameters:
p - vector of region points

MTBRegion3D

public MTBRegion3D(Vector<MTBPoint3D> p,
                   int id)
Construct a new MTBRegion3D object from the given points and set its id

Parameters:
p -
id -

MTBRegion3D

public MTBRegion3D(de.unihalle.informatik.MiToBo_xml.MTBXMLRegion3DType xmlregion3D)
Construct a new MTBRegion3D from a 3D-region in xml-representation.

Parameters:
xmlregion3D - 3D-region in xml-representation
Method Detail

toXMLType

public de.unihalle.informatik.MiToBo_xml.MTBXMLRegion3DType toXMLType()

setID

public void setID(int id)
Set the ID of the region. Uniqueness is not guaranteed nor checked!

Parameters:
id - region ID

getID

public int getID()
Return the ID of the region. Uniqueness is publicnot guaranteed nor checked!

Returns:
Region ID

getPoints

public Vector<MTBPoint3D> getPoints()
Return the points which are included in the 3D region.

Returns:
Region points.

getVolume

public double getVolume()
Return the volume of the 3D region (number of points within the region).

Returns:
Region volume.

getCentre

public MTBPoint3D getCentre()
Return the center of the region as 3D point.

Returns:
Center of region.

getCentreX

public double getCentreX()
Return the x-coordinate of the center of the region.

Returns:
Coordinate of the center in x-dimension.

getCentreY

public double getCentreY()
Return the y-coordinate of the center of the region.

Returns:
Coordinate of the center in y-dimension.

getCentreZ

public double getCentreZ()
Return the z-coordinate of the center of the region.

Returns:
Coordinate of the center in z-dimension.

addPoint

public void addPoint(MTBPoint3D p)
Append a 3D point to the region. The point is added at the end of the point list.

Parameters:
p - point to add

addPoint

public void addPoint(double px,
                     double py,
                     double pz)
Append a point to the region from the given coordinates. The point is added at the end of the point list.

Parameters:
px - coordinate in x-dimension
py - coordinate in y-dimension
pz - coordinate in z-dimension

calcCentre

public MTBPoint3D calcCentre(Vector<MTBPoint3D> p)
Calculate the centroid (not yet normalized by volume) of a given vector of points.

Parameters:
p - vector of Point3D
Returns:
The centroid (not yet normalised by volume).

getMoment

public double getMoment(int p,
                        int q,
                        int r)
Parameters:
p -
q -
r -
Returns:
moment of order p, q, r of the region

getCentralMoment

public double getCentralMoment(int p,
                               int q,
                               int r)
Parameters:
p -
q -
r -
Returns:
central moment of order p, q, r of the region (invariant under translation)

getCompactness

public double getCompactness()
calculates compactness value according to
Carlos Martinez-Ortiz. "2D and 3D Shape Descriptors". PhD thesis. 2010.
compactness measures the deviation of an object's shape from a sphere
its values range between (0,1], wheras 1 indicates a sphere

Returns:
compactness

getSizeZ

public int getSizeZ()
Calculate the expansion in z-direction of the region.

Returns:
Expansion of the region in z-direction.

getSizeY

public int getSizeY()
Calculate the expansion in y-direction of the region.

Returns:
Expansion of the region in y-direction.

getSizeX

public int getSizeX()
Calculate the expansion in x-direction of the region.

Returns:
Expansion of the region in x-direction.

regionToFile

public void regionToFile(String fileName)
Write the coordinates of the included 3D points into a text file.

Parameters:
fileName - File name to store the region on disk.

getBoundingBox

public double[] getBoundingBox()
Calculates the axes-parallel bounding box of the region.

The function extracts the coordinates of the back upper left and front lower right corner of the bounding box of the region. Note that the there is at least one point of the region lying on each side of the bounding box, i.e. the region not just touches the box, but lies on it.

The result array contains the corner coordinates in the following order: [xmin, ymin, zmin, xmax, ymax, zmax]

Returns:
Coordinates of back upper left and front lower right corners.

hookPointsUpdated

protected void hookPointsUpdated()
Function to update object state after setting new point list.

It is assumed that point list is up-to-date before calling the hook.



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