Class AlgorithmPowellOpt3D

All Implemented Interfaces:
de.jtem.numericalMethods.calculus.function.RealFunctionOfSeveralVariables, ActionListener, WindowListener, Runnable, EventListener

public class AlgorithmPowellOpt3D extends AlgorithmPowellOptBase
Runs Powell's method for a 3D image. Check the parent class comment for more detailed information.
Version:
0.1 Oct 1, 2001, 0.2 March 27, 2008
Author:
Neva Cherniavsky, Hailong Wang, Ph.D
  • Constructor Details

    • AlgorithmPowellOpt3D

      public AlgorithmPowellOpt3D(AlgorithmBase parent, WildMagic.LibFoundation.Mathematics.Vector3f com, int degreeOfFreedom, AlgorithmOptimizeFunctionBase costFunc, double[] tols, int maxIter)
      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 3, 4, 6, 7, 9, or 12).
      costFunc - Cost function to use.
      tols - Tolerance for each dimension (tols.length == degreeOfFreedom).
      maxIter - Maximum number of iterations.
  • Method Details

    • constructPoint

      public double[] constructPoint(double[] defaultPoint, double[] point)
      Construct a full 12-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: 3: only 3 translations 4: 3 translation and global scaling 6: 3 rotations and translations 7: 3 rotations and translations, and global scaling 9: 3 rotations, translations and scalings 12: 3 rotations, translations, scalings and skewings.
      Specified by:
      constructPoint in class AlgorithmPowellOptBase
      Parameters:
      defaultPoint - a default full 12-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 12-dimension transformation vector to a 4x4 transformation matrix.
      Specified by:
      convertToMatrix in class AlgorithmPowellOptBase
      Parameters:
      toOrigin - the matrix translating the origin to some specified point
      fromOrigin - the matrix translating the origin back.
      vector - a 12-dimension transformation vector including 3 rotations, translations, scalings and skews.
      Returns:
      a 4x4 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 12-dimension transformation vector.
      Returns:
      the partial or full transformation vector which will be optimized.
    • getMatrix

      public TransMatrixd getMatrix(int index, double sample)
      Description copied from class: AlgorithmPowellOptBase
      Obtain the transformation vector and convert to the matrix representation, then scale the translation by sample.
      Specified by:
      getMatrix in class AlgorithmPowellOptBase
      Parameters:
      index - the index of transformation vector.
      sample - the translation scaling parameter.
      Returns:
      the scaled transformation matrix.
      See Also:
    • getMatrix

      public TransMatrixd getMatrix(double[] point, double sample)
      See Also:
    • adjustTranslation

      public void adjustTranslation(TransMatrixd mat, double sample)
      Description copied from class: AlgorithmPowellOptBase
      Adjust the translation of the transformation matrix by the sample pararmeter.
      Specified by:
      adjustTranslation in class AlgorithmPowellOptBase
      Parameters:
      mat - the transformation matrix
      sample - the resolution adjusting parameter.
      See Also:
    • getMatrixHalf

      public TransMatrixd getMatrixHalf(int index)
      Obtain the transformation vector, scale it by 0.5, then convert it to transformation matrix.
      Parameters:
      index - the index of transformation vector.
      Returns:
      the scaled transformation matrix.
    • getMatrixHalf

      public TransMatrixd getMatrixHalf(int index, double sample)
      Obtain the transformation vector, scale it by 0.5, then convert it to transformation matrix and scale the translations by sample parameter.
      Parameters:
      index - the index of transformation vector.
      sample - the translation scaling parameter.
      Returns:
      the scaled transformation matrix.
    • convertToMidsagittal

      public double[] convertToMidsagittal(double[] point)
      Converts a full transformation vector into a midsagittal transformation vector.
      Parameters:
      point - the full 12-dimension transformation vector.
      Returns:
      the transformation vector complying with midsagittal alignment algorithm.
    • getMatrixMidsagittal

      public TransMatrixd getMatrixMidsagittal(int index)
      Accessor that returns the matrix representing the best tranformation. This transformation contains only the z rotation and the x and y translation, to be used in the midsagittal alignment algorithm.
      Returns:
      matrix representing the best transformation's z rot and x and y trans.
    • getMatrixMidsagittal

      public TransMatrixd getMatrixMidsagittal(int index, double sample)
      Accessor that returns the matrix representing the best tranformation. The passed in parameter represents the resolution (same in all directions and for both input and reference images, since resampled isotropically). Since the optimization was done in pixel space, not millimeter space, the translation parameters need to be scaled by the sample value. This transformation contains only the z rotation and the x and y translation, to be used in the midsagittal alignment algorithm.
      Parameters:
      sample - the voxel resolution
      Returns:
      matrix representing the best transformation's z rot and x and y trans.
    • 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.
      See Also: