Class CAAMMesh
- java.lang.Object
-
- gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMObject
-
- gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMMesh
-
public class CAAMMesh extends CAAMObject
This is the Java modified version of C++ active appearance model API (AAM_API). It is modified with a subset of required functions for automatic MRI prostate segmentation. AAM-API LICENSE - file: license.txt This software is freely available for non-commercial use such as research and education. Please see the full disclaimer below. All publications describing work using this software should cite the reference given below. Copyright (c) 2000-2003 Mikkel B. Stegmann, mbs@imm.dtu.dk IMM, Informatics & Mathematical Modelling DTU, Technical University of Denmark Richard Petersens Plads, Building 321 DK-2800 Lyngby, Denmark http://www.imm.dtu.dk/~aam/ REFERENCES Please use the reference below, when writing articles, reports etc. where the AAM-API has been used. A draft version the article is available from the homepage. I will be happy to receive pre- or reprints of such articles. /Mikkel ------------- M. B. Stegmann, B. K. Ersboll, R. Larsen, "FAME -- A Flexible Appearance Modelling Environment", IEEE Transactions on Medical Imaging, IEEE, 2003 (to appear) ------------- 3RD PART SOFTWARE The software is partly based on the following libraries: - The Microsoft(tm) Vision Software Developers Kit, VisSDK - LAPACK DISCLAIMER This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any non-commercial purpose, and to alter it, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. -- No guarantees of performance accompany this software, nor is any responsibility assumed on the part of the author or IMM. This software is provided by Mikkel B. Stegmann and IMM ``as is'' and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall IMM or Mikkel B. Stegmann be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. $Revision: 1.4 $ $Date: 2003/04/23 14:49:15 $ This class implements the concept of a 2D triangular mesh. Included functionality is a hit test and matlab export capability.- Author:
- Ruida Cheng
-
-
Field Summary
Fields Modifier and Type Field Description private int
m_iPrevTriangle
previous triangle index.private java.util.Vector<CAAMPoint>
m_vPoints
A vector of points.private java.util.Vector<CAAMTriangle>
m_vTriangles
A vector of triangles.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
Area()
Returns the total area of all triangles in the mesh.CAAMMesh
assign(CAAMMesh m)
Assignment operator.void
Clear()
Deletes all points and triangles.void
dispose()
dispose memoryvoid
Insert(CAAMPoint p)
Adds a point to the end.void
Insert(CAAMTriangle t)
Adds a triangle to the end.boolean
IsInside(CAAMPoint p)
Performs a hit test on the point p.boolean
IsInside(CAAMPoint p, int[] triangle, double[] alpha, double[] beta, double[] gamma)
Performs a hit test on the point p.int
NPoints()
Returns the total number of points in the mesh.int
NTriangles()
Returns the total number of triangles in the mesh.java.util.Vector<CAAMPoint>
Points()
Returns a vector of pointsvoid
ReplacePoints(CAAMShape s)
Replaces the points in the mesh with the one given by a shape.int
ToMatlab(java.lang.String sFilename)
Writes mesh structure to a matlab file containing three vectors: xTri X-points. yTri Y-points.java.util.Vector<CAAMTriangle>
Triangles()
Returns a vector of triangles-
Methods inherited from class gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMObject
FromFile, ToFile
-
-
-
-
Field Detail
-
m_vTriangles
private java.util.Vector<CAAMTriangle> m_vTriangles
A vector of triangles.
-
m_vPoints
private java.util.Vector<CAAMPoint> m_vPoints
A vector of points.
-
m_iPrevTriangle
private int m_iPrevTriangle
previous triangle index.
-
-
Constructor Detail
-
CAAMMesh
public CAAMMesh()
Constructor.
-
CAAMMesh
public CAAMMesh(CAAMMesh m)
Copy constructor.- Parameters:
m
- Mesh to copy.
-
-
Method Detail
-
dispose
public void dispose()
dispose memory
-
Insert
public void Insert(CAAMPoint p)
Adds a point to the end.- Parameters:
p
- Point to add.
-
ReplacePoints
public void ReplacePoints(CAAMShape s)
Replaces the points in the mesh with the one given by a shape. Preserves the triangles.- Parameters:
s
- Shape to fecth points from.
-
Insert
public void Insert(CAAMTriangle t)
Adds a triangle to the end.- Parameters:
t
- Triangle to add.
-
ToMatlab
public int ToMatlab(java.lang.String sFilename)
Writes mesh structure to a matlab file containing three vectors: xTri X-points. yTri Y-points. Tri Triangles defined as an (ntriangles x 3) matrix. Thus each row defines a triangle using three indices pointing to the point-vectors.- Parameters:
sFilename
- The filename to be written. The file is overwritten if it already exists.- Returns:
- Zero on succes, non-zero if the mesh is empty.
-
Area
public double Area()
Returns the total area of all triangles in the mesh.- Returns:
- The area.
-
Triangles
public java.util.Vector<CAAMTriangle> Triangles()
Returns a vector of triangles- Returns:
- triangle vector
-
Points
public java.util.Vector<CAAMPoint> Points()
Returns a vector of points- Returns:
- mesh points vector
-
NPoints
public int NPoints()
Returns the total number of points in the mesh.- Returns:
- number of points
-
NTriangles
public int NTriangles()
Returns the total number of triangles in the mesh.- Returns:
- number of triangles
-
Clear
public void Clear()
Deletes all points and triangles.
-
IsInside
public boolean IsInside(CAAMPoint p)
Performs a hit test on the point p.- Parameters:
p
- The point to test- Returns:
- True if the point is inside, otherwise false.
-
IsInside
public boolean IsInside(CAAMPoint p, int[] triangle, double[] alpha, double[] beta, double[] gamma)
Performs a hit test on the point p.- Parameters:
p
- The point to testtriangle
- Triangle index.alpha
- Relative position on triangle (barycentric coordinate).beta
- Relative position on triangle (barycentric coordinate).gamme
- Relative position on triangle (barycentric coordinate).- Returns:
- True if the point is inside, otherwise false.
-
-