Class CAAMTest


  • public class CAAMTest
    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 $ Container for all sorts of test functions. In this way a history of all mock-up test functions developed during debugging and testing are kept. All functions are implemented as static functions. Thus no instantiation the CAAMTest are needed.
    Author:
    Ruida Cheng
    • Constructor Summary

      Constructors 
      Constructor Description
      CAAMTest()
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void AnalyzeTest​(CAAMShape refShape, CAAMShape s, ModelSimpleImage image, boolean useConvexHull)
      Benchmarks the software warping method against the OpenGL.
      private static void counterClockwise​(float[] x, float[] y, float[] z, int nPts)
      Change the VOI points to counter clock wise order.
      void dispose()
      dispose memory
      static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel, ModelImage targetImageSlice, ModelImage sampleImage, java.lang.String gt_path, java.lang.String result_file, boolean writeStills, boolean writeMovies, boolean autoinit, boolean dump2screen)
      Wrapper to optimizes a set of images and compares the result to a ground truth annotation.
      static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel, ModelImage targetImageSlice, ModelImage sampleImage, java.lang.String gt_path, java.lang.String result_file, boolean writeStills, boolean writeMovies, boolean autoinit, boolean dump2screen, CAAMLowerBounds pLB)
      Optimizes a set of images and compares the result to a ground truth annotation.
      static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel, ModelImage targetImageSlice, java.lang.String gt_path, java.lang.String result_file, boolean writeStills, boolean writeMovies, boolean autoinit, boolean dump2screen)
      Wrapper to optimizes a set of images and compares the result to a ground truth annotation.
      static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel, ModelImage targetImageSlice, java.lang.String gt_path, java.lang.String result_file, boolean writeStills, boolean writeMovies, boolean autoinit, boolean dump2screen, CAAMLowerBounds pLB)
      Wrapper to optimizes a set of images and compares the result to a ground truth annotation.
      static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel, java.lang.String gt_path, java.lang.String result_file, boolean writeStills, boolean writeMovies, boolean autoinit, boolean dump2screen)
      Optimizes a set of images and compares the result to a ground truth annotation.
      static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel, java.lang.String gt_path, java.lang.String result_file, boolean writeStills, boolean writeMovies, boolean autoinit, boolean dump2screen, CAAMLowerBounds pLB)
      Optimizes a set of images and compares the result to a ground truth annotation.
      static CAAMEvaluationResults EvaluateModelSeq​(CAAMModelSeq modelSeq, java.lang.String gt_path, java.lang.String result_file, boolean writeStills, boolean writeMovies, boolean autoinit, boolean dump2screen)
      Wrapper to optimize a set of images and compares the result to a ground truth annotation using a sequence of AAMs.
      static CAAMEvaluationResults EvaluateModelSeq​(CAAMModelSeq modelSeq, java.lang.String gt_path, java.lang.String result_file, boolean writeStills, boolean writeMovies, boolean autoinit, boolean dump2screen, CAAMLowerBounds pLB)
      Optimizes a set of images and compares the result to a ground truth annotation using a sequence of AAMs.
      static void GetRotationTest​(CAAMShape s1, CAAMShape s2)
      Tests CAAMShape:GetRotation() for rotations in the range [0;360].
      static void pause()
      debug function
      static void TestPosePrediction​(CAAMModel model, java.lang.String path)
      Tests the prediction matrices ability to predict pose displacements.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CAAMTest

        public CAAMTest()
        Constructor.
    • Method Detail

      • dispose

        public void dispose()
        dispose memory
      • GetRotationTest

        public static void GetRotationTest​(CAAMShape s1,
                                           CAAMShape s2)
        Tests CAAMShape:GetRotation() for rotations in the range [0;360].
        Parameters:
        s1 - First shape.
        s2 - Second shape.
      • AnalyzeTest

        public static void AnalyzeTest​(CAAMShape refShape,
                                       CAAMShape s,
                                       ModelSimpleImage image,
                                       boolean useConvexHull)
        Benchmarks the software warping method against the OpenGL.
        Parameters:
        refShape - Reference shape, i.e. mean shape scale to mean size.
        s - Input shape in relative or absolute coordinates.
        image - Host image of 's'.
        useConvexHull - If true the convex hull is used.
      • TestPosePrediction

        public static void TestPosePrediction​(CAAMModel model,
                                              java.lang.String path)
        Tests the prediction matrices ability to predict pose displacements.
        Parameters:
        model - The AAM to test.
        path - The path where test images and annotations are placed (including terminating backslash).
      • EvaluateModel

        public static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel,
                                                          java.lang.String gt_path,
                                                          java.lang.String result_file,
                                                          boolean writeStills,
                                                          boolean writeMovies,
                                                          boolean autoinit,
                                                          boolean dump2screen)
        Optimizes a set of images and compares the result to a ground truth annotation. As initialization the ground truth pose is systematically displaced (default) or an automatic initialization is performed.
        Parameters:
        model - The model to evaluate.
        gt_path - Path to ground truth images and annotations.
        result_file - The file to write the results in.
        writeStills - If true two model border images are written; one of the initialization and one of the optimization.
        writeMovies - It true a movie of the whole optimization is written, one frame per iteration.
        autoinit - If true automatic initialization is performed instead of the systematic displacement of the ground truth pose.
        dump2screen - If true, results are written to the screen also (default true).
        Returns:
        evaluation results
      • EvaluateModel

        public static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel,
                                                          java.lang.String gt_path,
                                                          java.lang.String result_file,
                                                          boolean writeStills,
                                                          boolean writeMovies,
                                                          boolean autoinit,
                                                          boolean dump2screen,
                                                          CAAMLowerBounds pLB)
        Optimizes a set of images and compares the result to a ground truth annotation. As initialization the ground truth pose is systematically displaced (default) or an automatic initialization is performed.
        Parameters:
        model - The model to evaluate.
        gt_path - Path to ground truth images and annotations.
        result_file - The file to write the results in.
        writeStills - If true two model border images are written; one of the initialisation and one of the optimization.
        writeMovies - It true a movie of the whole optimization is written, one frame per iteration.
        autoinit - If true automatic initialization is performed instead of the systematic displacement of the ground truth pose.
        dump2screen - If true, results are written to the screen also (default true).
        pLB - Optional pointer to a CAAMLowerBounds object.
        Returns:
        Evaluation results.
      • EvaluateModel

        public static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel,
                                                          ModelImage targetImageSlice,
                                                          ModelImage sampleImage,
                                                          java.lang.String gt_path,
                                                          java.lang.String result_file,
                                                          boolean writeStills,
                                                          boolean writeMovies,
                                                          boolean autoinit,
                                                          boolean dump2screen)
        Wrapper to optimizes a set of images and compares the result to a ground truth annotation. Optimizes a set of images and compares the result to a ground truth annotation. As initialization the ground truth pose is systematically displaced (default) or an automatic initialization is performed.
        Parameters:
        model - The model to evaluate.
        targeImageSlice - target image 2D slice
        sampleImage - reference sample image
        gt_path - Path to ground truth images and annotations.
        result_file - The file to write the results in.
        writeStills - If true two model border images are written; one of the initialisation and one of the optimization.
        writeMovies - It true a movie of the whole optimization is written, one frame per iteration.
        autoinit - If true automatic initialization is performed instead of the systematic displacement of the ground truth pose.
        dump2screen - If true, results are written to the screen also (default true).
        Returns:
        Evaluation results.
      • EvaluateModel

        public static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel,
                                                          ModelImage targetImageSlice,
                                                          java.lang.String gt_path,
                                                          java.lang.String result_file,
                                                          boolean writeStills,
                                                          boolean writeMovies,
                                                          boolean autoinit,
                                                          boolean dump2screen)
        Wrapper to optimizes a set of images and compares the result to a ground truth annotation. Optimizes a set of images and compares the result to a ground truth annotation. As initialization the ground truth pose is systematically displaced (default) or an automatic initialization is performed.
        Parameters:
        model - The model to evaluate.
        targeImageSlice - target image 2D slice
        gt_path - Path to ground truth images and annotations.
        result_file - The file to write the results in.
        writeStills - If true two model border images are written; one of the initialisation and one of the optimization.
        writeMovies - It true a movie of the whole optimization is written, one frame per iteration.
        autoinit - If true automatic initialization is performed instead of the systematic displacement of the ground truth pose.
        dump2screen - If true, results are written to the screen also (default true).
        Returns:
        Evaluation results.
      • EvaluateModel

        public static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel,
                                                          ModelImage targetImageSlice,
                                                          ModelImage sampleImage,
                                                          java.lang.String gt_path,
                                                          java.lang.String result_file,
                                                          boolean writeStills,
                                                          boolean writeMovies,
                                                          boolean autoinit,
                                                          boolean dump2screen,
                                                          CAAMLowerBounds pLB)
        Optimizes a set of images and compares the result to a ground truth annotation. As initialization the ground truth pose is systematically displaced (default) or an automatic initialisation is performed.
        Parameters:
        model - The model to evaluate.
        targeImageSlice - target image 2D slice
        sampleImage - reference sample image
        gt_path - Path to ground truth images and annotations.
        result_file - The file to write the results in.
        writeStills - If true two model border images are written; one of the initialisation and one of the optimization.
        writeMovies - It true a movie of the whole optimization is written, one frame per iteration.
        autoinit - If true automatic initialization is performed instead of the systematic displacement of the ground truth pose.
        dump2screen - If true, results are written to the screen also (default true).
        pLB - Optional pointer to a CAAMLowerBounds object.
        Returns:
        Evaluation results.
      • counterClockwise

        private static void counterClockwise​(float[] x,
                                             float[] y,
                                             float[] z,
                                             int nPts)
        Change the VOI points to counter clock wise order.
        Parameters:
        x - x coordinates
        y - y coordinates
        z - z coordinates
        nPts - number of points
      • EvaluateModel

        public static CAAMEvaluationResults EvaluateModel​(CAAMModel pModel,
                                                          ModelImage targetImageSlice,
                                                          java.lang.String gt_path,
                                                          java.lang.String result_file,
                                                          boolean writeStills,
                                                          boolean writeMovies,
                                                          boolean autoinit,
                                                          boolean dump2screen,
                                                          CAAMLowerBounds pLB)
        Wrapper to optimizes a set of images and compares the result to a ground truth annotation. Optimizes a set of images and compares the result to a ground truth annotation. As initialization the ground truth pose is systematically displaced (default) or an automatic initialization is performed.
        Parameters:
        model - The model to evaluate.
        targeImageSlice - target image 2D slice
        gt_path - Path to ground truth images and annotations.
        result_file - The file to write the results in.
        writeStills - If true two model border images are written; one of the initialisation and one of the optimization.
        writeMovies - It true a movie of the whole optimization is written, one frame per iteration.
        autoinit - If true automatic initialization is performed instead of the systematic displacement of the ground truth pose.
        dump2screen - If true, results are written to the screen also (default true).
        pLB - Optional pointer to a CAAMLowerBounds object.
        Returns:
        Evaluation result
      • pause

        public static void pause()
        debug function
      • EvaluateModelSeq

        public static CAAMEvaluationResults EvaluateModelSeq​(CAAMModelSeq modelSeq,
                                                             java.lang.String gt_path,
                                                             java.lang.String result_file,
                                                             boolean writeStills,
                                                             boolean writeMovies,
                                                             boolean autoinit,
                                                             boolean dump2screen)
        Wrapper to optimize a set of images and compares the result to a ground truth annotation using a sequence of AAMs. As initialization the ground truth pose is systematically displaced (default) or an automatic initialization is performed.
        Parameters:
        modelSeq - A sequence of models.
        gt_path - Path to ground truth images and annotations.
        result_file - The file to write the results in.
        writeStills - If true two model border images are written; one of the initialisation and one of the optimization.
        writeMovies - It true a movie of the whole optimization is written, one frame per iteration.
        autoinit - If true automatic initialization is performed instead of the systematic displacement of the ground truth pose.
        dump2screen - If true, results are written to the screen also (default true).
        Returns:
        Evaluation results.
      • EvaluateModelSeq

        public static CAAMEvaluationResults EvaluateModelSeq​(CAAMModelSeq modelSeq,
                                                             java.lang.String gt_path,
                                                             java.lang.String result_file,
                                                             boolean writeStills,
                                                             boolean writeMovies,
                                                             boolean autoinit,
                                                             boolean dump2screen,
                                                             CAAMLowerBounds pLB)
        Optimizes a set of images and compares the result to a ground truth annotation using a sequence of AAMs. As initialization the ground truth pose is systematically displaced (default) or an automatic initialisation is performed.
        Parameters:
        modelSeq - A sequence of models.
        gt_path - Path to ground truth images and annotations.
        result_file - The file to write the results in.
        writeStills - If true two model border images are written; one of the initialisation and one of the optimization.
        writeMovies - It true a movie of the whole optimization is written, one frame per iteration.
        autoinit - If true automatic initialization is performed instead of the systematic displacement of the ground truth pose.
        dump2screen - If true, results are written to the screen also (default true).
        pLBS - Optional pointer to a CAAMLBShapeModel object.
        Returns:
        Evaluation results.