Class CAAMPropsReader
- java.lang.Object
-
- gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMObject
-
- gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMPropsReader
-
public class CAAMPropsReader 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 $ Simple lo-fi property reader. Used as naive parser/scanner for the .asf, acf files.- Author:
- Ruida Cheng
-
-
Field Summary
Fields Modifier and Type Field Description char
COMMENT_CHAR
char
CR
java.util.Scanner
in
Java Scanner API.char
LF
private java.lang.String
previousLine
java.io.FileReader
reader
File reader
-
Constructor Summary
Constructors Constructor Description CAAMPropsReader(java.lang.String filename)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
CalcShapeDistances(CAAMShape optimized, CAAMShape groundTruth, double[] ptpt, double[] ptcrv, CDVector pvDists)
Calculates optimization results.void
dispose()
dispose memoryvoid
ExpandImg2DyadicSize(ModelSimpleImage img, ModelSimpleImage out)
Expands an image to have dynamic size.java.lang.String
FindVacantFilename(java.lang.String filename_suggestion)
Finds a file name that is not 'occupied'.boolean
IsValid()
Returns true if the file is valid.void
MirrorEdge(ModelSimpleImage img, ModelSimpleImage mask, int edgeWidth)
Mirrors the edge of an arbitrary shape mask in an image using poor-mans mirroring.void
MirrorEdge(CDMatrix m, ModelSimpleImage mask, int edgeWidth)
Mirrors the edge of an arbitrary shape mask in a matrix using poor-mans mirroring.void
processCoordinatePoints(int[] path_id, int[] type, float[] x_rel, float[] y_rel, int[] point_nb, int[] from, int[] to)
Process point info from the in stream linevoid
processImageName(java.lang.String[] fileName)
Process image file.void
RegistrationMovie(java.lang.String filename, java.lang.String asfPath, boolean useConvexHull, boolean writeRefShape)
Writes a movie file containing all shapes from a directory warped to their mean shape.void
SampleTextures(CAAMShapeCollection unalignedShapes, java.util.Vector<CDVector> vTextures, CAAMReferenceFrame outputRF, int imageReduction, boolean removeMean, boolean useTSP, boolean useConvexHull)
Samples a set of texture vectors given a set of shape in absolute (i.e. image) coordinates.java.lang.String
Secs2Mins(double secs)
Converts seconds to a MM:SS string.boolean
ShapeInsideImage(CAAMShape s, ModelSimpleImage img)
Tests if a shape is fully inside an image.double
ShapeOverlap(CAAMShape model, CAAMShape gt)
Calculates the overlap between two shapes as specified in "Active Shape Model Segmentation With Optimal Features" Bram van Ginneken et al., IEEE TMI 21(8) Aug. 2002.void
SkipLines()
Skip comment line or empty lineint
Sync()
Sync to read number.-
Methods inherited from class gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMObject
FromFile, ToFile
-
-
-
-
Method Detail
-
processCoordinatePoints
public void processCoordinatePoints(int[] path_id, int[] type, float[] x_rel, float[] y_rel, int[] point_nb, int[] from, int[] to)
Process point info from the in stream line- Parameters:
path_id
- path idtype
- point typex_rel
- x coordinatey_rel
- y coordinatepoint_nb
- point numberfrom
- from indexto
- to index
-
processImageName
public void processImageName(java.lang.String[] fileName)
Process image file.- Parameters:
fileName
- image file name
-
Sync
public int Sync()
Sync to read number.- Returns:
- -1 fail, otherwise, return int number.
-
SkipLines
public void SkipLines()
Skip comment line or empty line
-
IsValid
public boolean IsValid()
Returns true if the file is valid.- Returns:
- if in stream is valid
-
dispose
public void dispose()
dispose memory
-
ExpandImg2DyadicSize
public void ExpandImg2DyadicSize(ModelSimpleImage img, ModelSimpleImage out)
Expands an image to have dynamic size.- Parameters:
img
- Input image.out
- Output dyadic image.
-
MirrorEdge
public void MirrorEdge(CDMatrix m, ModelSimpleImage mask, int edgeWidth)
Mirrors the edge of an arbitrary shape mask in a matrix using poor-mans mirroring.- Parameters:
img
- Input matrix. Overwritten by mirrored version.mask
- Image mask defining the shape.edgeWidth
- The width of the edge.
-
MirrorEdge
public void MirrorEdge(ModelSimpleImage img, ModelSimpleImage mask, int edgeWidth)
Mirrors the edge of an arbitrary shape mask in an image using poor-mans mirroring.- Parameters:
img
- Input image. Overwritten by mirrored version.mask
- Image mask defining the shape.edgeWidth
- The width of the edge.
-
ShapeInsideImage
public boolean ShapeInsideImage(CAAMShape s, ModelSimpleImage img)
Tests if a shape is fully inside an image.- Parameters:
s
- Input shape.img
- Input image.- Returns:
- True if the shape is fully inside the image.
-
CalcShapeDistances
public void CalcShapeDistances(CAAMShape optimized, CAAMShape groundTruth, double[] ptpt, double[] ptcrv, CDVector pvDists)
Calculates optimization results.- Parameters:
optimized
- Model shape.groundTruth
- Ground truth shape.ptpt
- Average point to point landmark error.ptcrv
- Average point to curve landmark error. NOTICE: This is not a symmetric measure!
-
Secs2Mins
public java.lang.String Secs2Mins(double secs)
Converts seconds to a MM:SS string.- Parameters:
secs
- Time in seconds.- Returns:
- The time in MM:SS.
-
FindVacantFilename
public java.lang.String FindVacantFilename(java.lang.String filename_suggestion)
Finds a file name that is not 'occupied'. This method finds a file name that is not 'occupied' by adding at number to the base part of the suggested file name.- Parameters:
filename_suggestion
- Suggestion including extension.- Returns:
- An unused filename resembling the suggstion.
-
SampleTextures
public void SampleTextures(CAAMShapeCollection unalignedShapes, java.util.Vector<CDVector> vTextures, CAAMReferenceFrame outputRF, int imageReduction, boolean removeMean, boolean useTSP, boolean useConvexHull)
Samples a set of texture vectors given a set of shape in absolute (i.e. image) coordinates.- Parameters:
unalignedShapes
- Shapes in absolute coordinates.vTextures
- The set of textures.outputRF
- The output reference frame generated for sampling the textures.removeMean
- If true the mean from each texture vector (i.e. the DC) is removed.useTSP
- Use tangent space projection to align the shapes.useConvexHull
- If true the convex hull is used to determine the extent of a shape.
-
RegistrationMovie
public void RegistrationMovie(java.lang.String filename, java.lang.String asfPath, boolean useConvexHull, boolean writeRefShape)
Writes a movie file containing all shapes from a directory warped to their mean shape.- Parameters:
filename
- Output movie filename.asfPath
- Path to annotation files.useConvexHull
- If true the convex hull is used to determine the extent of a shape.writeRefShape
- If true the reference shape corresponding to the movie file is written as "regshape.asf".
-
ShapeOverlap
public double ShapeOverlap(CAAMShape model, CAAMShape gt)
Calculates the overlap between two shapes as specified in "Active Shape Model Segmentation With Optimal Features" Bram van Ginneken et al., IEEE TMI 21(8) Aug. 2002. Notice that this only makes sense for one-path closed shapes.- Parameters:
model
- Model shapegt
- Ground truth shape- Returns:
- The shape overlap (1 = perfect match, 0 = no overlap).
-
-