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,ActionListener,WindowListener,Runnable,EventListener
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFlag 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, useJTEMFields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmPowellOpt2D(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
Modifier and TypeMethodDescriptionvoidadjustTranslation(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.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.getMatrix(int index, double sample) Obtain the transformation vector and convert to the matrix representation, then scale the translation by sample.voidupdatePoint(double[] point, double cost, Vectornd v) Store the optimal point and cost to vMethods 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, setUseJTEMMethods 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, windowOpenedMethods 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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
rigid
private boolean rigidFlag indicating this is a rigid transformation.
-
-
Constructor Details
-
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-truemeans this was a rigid transformation
-
-
Method Details
-
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:
constructPointin 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:
convertToMatrixin classAlgorithmPowellOptBase- Parameters:
toOrigin- the matrix translating the origin to some specified pointfromOrigin- the matrix translating the origin back.vector- a 7-dimension transformation vector including 1 rotation, 2 translations, 2 scalings and 2 skews.- 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:
extractPointin classAlgorithmPowellOptBase- Parameters:
startPoint- the start full 7-dimension transformation vector.- Returns:
- the partial or full transformation vector which will be optimized.
-
adjustTranslation
Description copied from class:AlgorithmPowellOptBaseAdjust the translation of the transformation matrix by the sample pararmeter.- Specified by:
adjustTranslationin classAlgorithmPowellOptBase- Parameters:
mat- the transformation matrixsample- the resolution adjusting parameter.- See Also:
-
getMatrix
Description copied from class:AlgorithmPowellOptBaseObtain the transformation vector and convert to the matrix representation, then scale the translation by sample.- Specified by:
getMatrixin classAlgorithmPowellOptBase- Parameters:
index- the index of transformation vector.sample- the translation scaling parameter.- Returns:
- the scaled transformation matrix.
- See Also:
-
updatePoint
Description copied from class:AlgorithmPowellOptBaseStore the optimal point and cost to v- Specified by:
updatePointin classAlgorithmPowellOptBase- Parameters:
point- the optimal point.cost- the optimal cost.v- the Vectornd variable used by upper level algorithm.
-