Class CAAMModelMS


  • public class CAAMModelMS
    extends CAAMModel
    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 $ Multi-scale derivation of CAAModel. Smaller models are stored in m_vModels.
    Author:
    Ruida Cheng
    • Field Detail

      • m_vModels

        protected java.util.Vector<CAAMModel> m_vModels
        Model vector.
      • m_vImagePyr

        protected java.util.Vector<ModelSimpleImage> m_vImagePyr
        Image VOIs vector.
    • Constructor Detail

      • CAAMModelMS

        public CAAMModelMS()
        Default multi-scale constructor.
    • Method Detail

      • dispose

        public void dispose()
        dispose memory
        Overrides:
        dispose in class CAAMModel
      • BuildAllLevels

        public void BuildAllLevels​(int nLevels,
                                   java.lang.String inDir,
                                   java.lang.String acf)
        Wrapper for automate model generation.
        Parameters:
        nLevels - number level in multi-scale
        inDir - input dir
        acf - aam configuration file
      • BuildAllLevels

        public void BuildAllLevels​(int nLevels,
                                   java.lang.String inDir,
                                   java.lang.String acf,
                                   int modelReduction,
                                   int excludeShape)
        Driver method for model generation. This method automates the model generation as much as possible by using the various class methods for all the sequences in the task of producing a model.
        Parameters:
        nLevels - The number of levels the multi-scale AAM should be in. Default 3.
        inDir - Input directory where annotations (.asf) resides.
        acf - Filename of an AAM configuration file. If omitted defaults are used.
        modelReduction - Model reduction multiplier. Default off == 1. This sets the size of the lowest level in the model pyramid, i.e. level 0.
        excludeShape - Excludes one shape number 'excludeShape' from the input directory. Default -1, i.e. no shapes are removed. Used to perform leave-one-out testing.
      • BuildAllLevels

        public void BuildAllLevels​(int nLevels,
                                   java.util.Vector<java.lang.String> asfFiles,
                                   java.lang.String acf,
                                   int modelReduction,
                                   int excludeShape)
        Driver method for model generation. This method automates the model generation as much as possible by using the various class methods for all the sequences in the task of producing a model.
        Parameters:
        nLevels - The number of levels the multi-scale AAM should be in. Default 3.
        asfFiles - Vector of asf filenames.
        acf - Filename of an AAM configuration file. If omitted defaults are used.
        modelReduction - Model reduction multiplier. Default off == 1. This sets the size of the lowest level in the model pyramid, i.e. level 0.
        excludeShape - Excludes one shape number 'excludeShape' from the input directory. Default -1, i.e. no shapes are removed. Used to perform leave-one-out testing.
      • WriteModel

        public boolean WriteModel​(java.lang.String filename,
                                  boolean txt_only)
        Writes the complete multi-scale AAMModel to disk as a set of .txt and an .amf files.
        Overrides:
        WriteModel in class CAAMModel
        Parameters:
        filename - Output filename without any extension. Multi-scale prefixes will be added.
        txt_only - If true binary model data is not written.
        Returns:
        true on success, false on file errors.
      • ReadModel

        public boolean ReadModel​(java.lang.String basename)
        Reads the complete AAMModel from disk.
        Overrides:
        ReadModel in class CAAMModel
        Parameters:
        filename - Input filename without any extension and scale prefixes. E.g. if the files on disk are 'model_msl.txt' & 'model_msl.amf' -> filename = 'model'
        Returns:
        true on success, false on file errors.
      • OptimizeModel

        public CAAMOptRes OptimizeModel​(ModelSimpleImage image,
                                        CAAMShape s,
                                        CDVector c,
                                        int maxIterations,
                                        java.util.Vector<CAAMOptState> pOptStates,
                                        boolean disableDamping)
        Performs AAM optimization of a shape containing initial pose using a model pyramid.
        Overrides:
        OptimizeModel in class CAAMModel
        Parameters:
        image - The image to search in (in size corresponding to level zero).
        s - The initial shape (also containing the inital pose, thus; not a normalized shape). Actually only the pose of 's' is used (to align the reference shape as the initial shape). NOTE: The optimal shape is returned in 's' after execution. NOTE: 's' is defined at level 0, i.e. shapes should have the same size as when calling CAAMModel::OptimizeModel() directly.
        c - The optimal model parameters at level zero. Unlike CAAMModel::OptimizeModel() the content of this vector is not used, since the optimisation is started the smallest (i.e. top) level of the pyramid. NOTE: The optimal model parameters are returned in 'c' after execution.
        maxIterations - The maximum iterations allowed at each level.
        pOptStates - Optional parameter convergence info (at level zero) can be returned in. See CAAMOptState.
        disableDamping - Disables the damping steps (default false).
        Returns:
        The results of the optimization in the form of a 'CAAMOptRes' instance.
      • BuildPyr

        public void BuildPyr​(ModelSimpleImage image)
        Builds an image pyramid (if its not cached beforehand). The pyramid is stored in m_VImagePyr.
        Parameters:
        image - Input image that should be convertet to a pyramid. This image is assumed to live to the *complete* usage of the pyramid, since level 0 is a pointer to this image.
      • Model

        public final CAAMModel Model​(int i)
        Get the model at level i.
        Parameters:
        i - level
        Returns:
        model
      • NLevels

        public final int NLevels()
        Get the number of levels.
        Returns:
        levels number
      • GetSmallest

        public final CAAMModel GetSmallest()
        Get the smallest model
        Returns:
        model