Class AlgorithmPowellOpt2D

  • All Implemented Interfaces:
    de.jtem.numericalMethods.calculus.function.RealFunctionOfSeveralVariables, java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmPowellOpt2D
    extends AlgorithmPowellOptBase
    Runs Powell's method for a 2D image. Check the parent class comment for more detailed information.
    Version:
    0.1 Oct 1, 2001, 0.2 March 27, 2008
    Author:
    Neva Cherniavsky, Matthew McAuliffe, Hailong Wang, Ph.D
    • Field Detail

      • rigid

        private boolean rigid
        Flag indicating this is a rigid transformation.
    • Constructor Detail

      • AlgorithmPowellOpt2D

        public AlgorithmPowellOpt2D​(AlgorithmBase parent,
                                    WildMagic.LibFoundation.Mathematics.Vector2f com,
                                    int degreeOfFreedom,
                                    AlgorithmOptimizeFunctionBase costFunc,
                                    double[] tols,
                                    int maxIter,
                                    boolean _rigid)
        Constructs a new algorithm with the given centers of mass (needed for setting the transformations), the given cost function (which was constructed with the proper images), the initial point we're looking at, some tolerance within that point to look for the minimum, and the maximum number of iterations.
        Parameters:
        parent - Algorithm that called this optimization.
        com - Center of Mass of the input image.
        degreeOfFreedom - Degree of freedom for transformation (must be 2, 3, 4, 5, 7).
        costFunc - Cost function to use.
        tols - Tolerance for each dimension (tols.length == degreeOfFreedom).
        maxIter - Maximum number of iterations.
        _rigid - true means this was a rigid transformation
    • Method Detail

      • constructPoint

        public double[] constructPoint​(double[] defaultPoint,
                                       double[] point)
        Construct a full 7-dimension transformation vector from the partial transformation vector. For missing values in point, the values in defaultPoint will be used. Different degree of freedom has different meanings: 2: only 2 translations 3: rigid: 1 rotation and 2 translations non-rigid: global scaling and 2 translations 4: 1 rotation, 2 translations and global scaling 5: 1 rotation, 2 translations and scalings 7: 1 rotation, 2 translations, scalings and skews
        Specified by:
        constructPoint in class AlgorithmPowellOptBase
        Parameters:
        defaultPoint - a default full 7-dimension transformation vector.
        point - a partial or full transformation vector.
        Returns:
        a full transformation vector.
      • convertToMatrix

        public TransMatrixd convertToMatrix​(TransMatrixd toOrigin,
                                            TransMatrixd fromOrigin,
                                            double[] vector)
        Convert a 7-dimension transformation vector to a 3x3 transformation matrix.
        Specified by:
        convertToMatrix in class AlgorithmPowellOptBase
        Parameters:
        vector - a 7-dimension transformation vector including 1 rotation, 2 translations, 2 scalings and 2 skews.
        toOrigin - the matrix translating the origin to some specified point
        fromOrigin - the matrix translating the origin back.
        Returns:
        a 3x3 transformation matrix
      • extractPoint

        public double[] extractPoint​(double[] startPoint)
        Extract the partial or full transformation vector from the start transformation vector, which will be optimized.
        Specified by:
        extractPoint in class AlgorithmPowellOptBase
        Parameters:
        startPoint - the start full 7-dimension transformation vector.
        Returns:
        the partial or full transformation vector which will be optimized.
      • updatePoint

        public void updatePoint​(double[] point,
                                double cost,
                                Vectornd v)
        Description copied from class: AlgorithmPowellOptBase
        Store the optimal point and cost to v
        Specified by:
        updatePoint in class AlgorithmPowellOptBase
        Parameters:
        point - the optimal point.
        cost - the optimal cost.
        v - the Vectornd variable used by upper level algorithm.