Package gov.nih.mipav.model.algorithms
Class AlgorithmPowellOpt2D
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmPowellOptBase
-
- gov.nih.mipav.model.algorithms.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 Summary
Fields Modifier and Type Field Description private boolean
rigid
Flag indicating this is a rigid transformation.-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmPowellOptBase
costFunction, dof, fromOrigin, maxIterations, parallelPowell, parent, pathRecorded, paths, points, savedStartPoint, tolerance, toOrigin, useJTEM
-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
adjustTranslation(TransMatrixd mat, double sample)
Adjust the translation of the transformation matrix by the sample pararmeter.double[]
constructPoint(double[] defaultPoint, double[] point)
Construct a full 7-dimension transformation vector from the partial transformation vector.TransMatrixd
convertToMatrix(TransMatrixd toOrigin, TransMatrixd fromOrigin, double[] vector)
Convert a 7-dimension transformation vector to a 3x3 transformation matrix.double[]
extractPoint(double[] startPoint)
Extract the partial or full transformation vector from the start transformation vector, which will be optimized.TransMatrixd
getMatrix(int index, double sample)
Obtain the transformation vector and convert to the matrix representation, then scale the translation by sample.void
updatePoint(double[] point, double cost, Vectornd v)
Store the optimal point and cost to v-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmPowellOptBase
convertToMatrix, convertToMatrix, copyPoint, createTerrain, disposeLocal, eval, getCost, getFromOrigin, getMatrix, getMaxIterations, getNumberOfVariables, getPoint, getPoint, getPoints, getToOrigin, isParallelPowell, isPathRecorded, lineMinimization, measureCost, measureCost, optimize, optimizeBlock, print, runAlgorithm, scalePoint, scalePoint, setMaxIterations, setParallelPowell, setPathRecorded, setPoints, setUseJTEM
-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, finalize, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
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 classAlgorithmPowellOptBase
- 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 classAlgorithmPowellOptBase
- 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 pointfromOrigin
- 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 classAlgorithmPowellOptBase
- Parameters:
startPoint
- the start full 7-dimension transformation vector.- Returns:
- the partial or full transformation vector which will be optimized.
-
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 classAlgorithmPowellOptBase
- Parameters:
mat
- the transformation matrixsample
- the resolution adjusting parameter.- See Also:
AlgorithmPowellOptBase.adjustTranslation(TransMatrixd, double)
-
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 classAlgorithmPowellOptBase
- Parameters:
index
- the index of transformation vector.sample
- the translation scaling parameter.- Returns:
- the scaled transformation matrix.
- See Also:
AlgorithmPowellOptBase.getMatrix(int, double)
-
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 classAlgorithmPowellOptBase
- Parameters:
point
- the optimal point.cost
- the optimal cost.v
- the Vectornd variable used by upper level algorithm.
-
-