Class CAAMReferenceFrame
java.lang.Object
gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMReferenceFrame
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 invalid input: '&' 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 $
The geometrical reference frame (or shape-free frame). This class defined the
geomtrical reference frame of an AAM. Hence, it is the spatial layout where
all texture sampling takes place.
The main objective of this class is to provide fast conversions from a
shape-free image to a texture vector and vice versa.
- Author:
- Ruida Cheng
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classdefines a sub-part of a horizontal line in an image -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanflag to use convex hull.private intnumber of texture samples.private ModelSimpleImagemask image.private CAAMMeshprivate CAAMShapereference shape.private Vector<CAAMReferenceFrame.sScanLinePart> scan lines. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionAssignment operator.voidCalcMaskImage(boolean useConvexHull) Calculates a reference mask image.voidCalculates the scanlines of the mask image.voidWrites some of the class data to disk.voiddispose()Deletes any reference shape, mesh and mask image.booleanFindTriangle(CAAMPoint p, int[] triangle, double[] alpha, double[] beta, double[] gamma) Find the corresponding triangle in the source mesh for a point.voidReads the class data form disk.voidImage2Vector(ModelSimpleImage refImg, CDVector v) Conversion from shape-free image to a texture vector.final ModelSimpleImageReturns the mask image.intReturns the number of texture samples in the texture model.intReturns the height of the reference image.intReturns the width of the reference image.final CAAMMeshRefMesh()Returns the reference mesh.final CAAMShapeRefShape()Returns the reference shape.doubleReturns the height of the reference shape.doubleReturns the width of the reference shape.Direct access to the scanline parts (not commonly used)voidSets up the class with the reference shape and information about how to determine the extent of the shape.voidWrites the class data to disk.booleanReturns true of the convex hull determines the shape extent.Vector2Image(CDVector v, ModelSimpleImage outImg) Conversion from a texture vector to a shape-free image.voidVector2Matrix(CDVector v, CDMatrix m) Conversion from a texture vector to a shape-free matrix.
-
Field Details
-
m_pReferenceShape
reference shape. -
m_pReferenceMesh
-
m_pMaskImage
mask image. -
m_ScanlineParts
scan lines. -
m_iTextureSamples
private int m_iTextureSamplesnumber of texture samples. -
m_bUseConvexHull
private boolean m_bUseConvexHullflag to use convex hull.
-
-
Constructor Details
-
CAAMReferenceFrame
public CAAMReferenceFrame()Constructor. -
CAAMReferenceFrame
Copy constructor.- Parameters:
rf- Reference frame object to be copied by construction.
-
-
Method Details
-
assign
Assignment operator.- Parameters:
rf- Object to copy from.
-
Setup
Sets up the class with the reference shape and information about how to determine the extent of the shape.- Parameters:
referenceShape- The reference shape.useConvexHull- If true the convex hull of the reference shape is used to determine its extent.
-
ToFile
Writes the class data to disk. This method writes the class data to disk. Actually it is only the reference shape and the convex hull option that is written. The rest is reconstructed during read.- Parameters:
fh- Open file handle to a binary file.
-
FromFile
Reads the class data form disk. This method reads the class data from disk. Actually it is only the reference shape and the convex hull option that is read. The rest is reconstructed.- Parameters:
fh- Open file handle to a binary file.
-
DebugDump
public void DebugDump()Writes some of the class data to disk. -
dispose
public void dispose()Deletes any reference shape, mesh and mask image. -
CalcMaskImage
public void CalcMaskImage(boolean useConvexHull) Calculates a reference mask image. This method calculates a reference mask image, where the shape area is set to 255 and the background to zero. The resulting image is stored in 'm_pMaskImage'.- Parameters:
useConvexHull- If true the convex hull is used to define the extent of the reference shape.
-
CalcScanLines
public void CalcScanLines()Calculates the scanlines of the mask image. This method calculates the scanlines of the mask image. A scanline is a subpart of a horsontal image line that is occupied but a subpart of the reference shape. The resulting scanlines are used for quick'n'easy conversion from spatial to vector layout (and back). Scanlines are stored in 'm_ScanlineParts'. -
RefShapeWidth
public double RefShapeWidth()Returns the width of the reference shape.- Returns:
- The width.
-
RefShapeHeight
public double RefShapeHeight()Returns the height of the reference shape.- Returns:
- The height.
-
Image2Vector
Conversion from shape-free image to a texture vector. This method performs a quick conversion from a shape-free image to a texture vector.- Parameters:
refImg- Destination reference image.v- Input texture vector.
-
Vector2Image
Conversion from a texture vector to a shape-free image. This method performs a quick conversion from a texture vector to a shape-free image.- Parameters:
v- Input texture vector.refImg- Destination reference image.
-
Vector2Matrix
Conversion from a texture vector to a shape-free matrix. This method performs a quick conversion from a texture vector to a shape-free image on matrix form. Will currently only work on single band AAMs.- Parameters:
v- Input texture vector.refImg- Destination reference image.
-
RefImageWidth
public int RefImageWidth()Returns the width of the reference image.- Returns:
- The width.
-
RefImageHeight
public int RefImageHeight()Returns the height of the reference image.- Returns:
- The height.
-
FindTriangle
public boolean FindTriangle(CAAMPoint p, int[] triangle, double[] alpha, double[] beta, double[] gamma) Find the corresponding triangle in the source mesh for a point.- Parameters:
p- Input pointtriangle- Triangle index.alpha- Relative position on triangle (barycentric coordinate).beta- Relative position on triangle (barycentric coordinate).gamma- Relative position on triangle (barycentric coordinate).- Returns:
- True if the point is inside the source mesh.
-
UseConvexHull
public boolean UseConvexHull()Returns true of the convex hull determines the shape extent.- Returns:
- flag to indiciate to use convexHull or not.
-
RefShape
Returns the reference shape.- Returns:
- shape
-
NTextureSamples
public int NTextureSamples()Returns the number of texture samples in the texture model.- Returns:
- number of texture samples
-
RefMesh
Returns the reference mesh.- Returns:
- mesh
-
MaskImage
Returns the mask image.- Returns:
- mask image
-
ScanlineParts
Direct access to the scanline parts (not commonly used)- Returns:
- scanline
-