Package gov.nih.mipav.model.algorithms
Class AlgorithmVOISimplexOpt
java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.AlgorithmVOISimplexOpt
- All Implemented Interfaces:
de.jtem.numericalMethods.calculus.function.RealFunctionOfSeveralVariables,ActionListener,WindowListener,Runnable,EventListener
public class AlgorithmVOISimplexOpt
extends AlgorithmBase
implements de.jtem.numericalMethods.calculus.function.RealFunctionOfSeveralVariables
Perform Simplex Optimization on a VOI that has been propagated to a slice to find a transformation which will make an
affine "fit" a structure which the VOI fit on the previous slice (used in RFASegTool when propagating liver
segmentation VOIs). Minimize cost = -sum of Gradient magnitude under propagated ROI in match image
- Version:
- 1.0 July, 2003
- Author:
- Evan McCreedy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classClass for specifying optimization function for the simplex opt algorithm.Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatThe sum of the gradient magnitude along the polygon.protected intWhich cost function to use (MINDIFF or MAXSUM).private intThe slice number the VOI is in.protected float[]The gradient magnitude of the slice.private ModelImageThe source image.protected VOIContourThe polygon of the VOI we are fitting.static final intIndicates that the maximum summation cost function should be used (this is the perferred cost function).static final intIndicates that the minimum difference cost function should be used (MAXSUM is perferred).private float[]the kernel size to use in calculating the gradient magnitude image.private intSize of the simplex vertex array (5 == tx, ty, rot, zoomx, zoomy).private float[]The image slice that holds the VOI we are working on.protected intThe slice size in the x dimension.protected intThe slice size in the y dimension.Fields 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
ConstructorsConstructorDescriptionAlgorithmVOISimplexOpt(ModelImage image, float[] sigmas, int costFunc) Set up the algorithm to perform optimizations on an image.AlgorithmVOISimplexOpt(ModelImage image, VOIContour inputGon, float[] sigmas, int costFunc) Set up the algorithm to perform optimizations on an image. -
Method Summary
Modifier and TypeMethodDescriptiondoubleeval(double[] x) voidfinalize()Prepares this class for destruction.intprotected TransMatrixgetTransform(double[] x) Converts a row of p into 3x3 transformation matrix.goOptimize(float[] sliceBuf, VOIContour inputGon) Run the simplex opt algorithm on a polygon (VOI) in a slice of an image.voidRun the algorithm on a polygon already specified through the constructor.private VOIContoursearch()Find the best fit for the VOI polygon we have loaded into this algorithm.voidsetCurrentSlice(int currentSlice) Specify the slice containing the VOI to optimize.voidsetPolygon(VOIContour poly) Spefify the VOI polygon to optimize.Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, 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
-
MINDIFF
public static final int MINDIFFIndicates that the minimum difference cost function should be used (MAXSUM is perferred).- See Also:
-
MAXSUM
public static final int MAXSUMIndicates that the maximum summation cost function should be used (this is the perferred cost function).- See Also:
-
baseVOIGradMagSum
protected float baseVOIGradMagSumThe sum of the gradient magnitude along the polygon. -
costFunc
protected int costFuncWhich cost function to use (MINDIFF or MAXSUM). -
currentSlice
private int currentSliceThe slice number the VOI is in. -
gradMagBuf
protected float[] gradMagBufThe gradient magnitude of the slice. -
image
The source image. -
inputGon
The polygon of the VOI we are fitting. -
sigmas
private float[] sigmasthe kernel size to use in calculating the gradient magnitude image. -
simplexDim
private int simplexDimSize of the simplex vertex array (5 == tx, ty, rot, zoomx, zoomy). -
sliceBuf
private float[] sliceBufThe image slice that holds the VOI we are working on. -
xDim
protected int xDimThe slice size in the x dimension. -
yDim
protected int yDimThe slice size in the y dimension. -
func
-
-
Constructor Details
-
AlgorithmVOISimplexOpt
Set up the algorithm to perform optimizations on an image. The individual Polygons to optimize will be provided later (usegoOptimize())- Parameters:
image- the image containing the VOI(s) to run the SimplexOpt algorithm onsigmas- the kernel size to use in calculating the gradient magnitude imagecostFunc- which cost function to use (MINDIFF or MAXSUM)
-
AlgorithmVOISimplexOpt
Set up the algorithm to perform optimizations on an image. To be used in conjunction with therunmethod.- Parameters:
image- the image containing the VOI(s) to run the SimplexOpt algorithm oninputGon- the Polygon to optimize the fit ofsigmas- the kernel size to use in calculating the gradient magnitude imagecostFunc- which cost function to use (MINDIFF or MAXSUM)
-
-
Method Details
-
finalize
public void finalize()Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
goOptimize
Run the simplex opt algorithm on a polygon (VOI) in a slice of an image.- Parameters:
sliceBuf- the slice the polygon resides ininputGon- the polygon to optimize the fit of- Returns:
- the optimized polygon
-
runAlgorithm
public void runAlgorithm()Run the algorithm on a polygon already specified through the constructor.- Specified by:
runAlgorithmin classAlgorithmBase
-
setCurrentSlice
public void setCurrentSlice(int currentSlice) Specify the slice containing the VOI to optimize.- Parameters:
currentSlice- the slice with the VOI to optimize
-
setPolygon
Spefify the VOI polygon to optimize.- Parameters:
poly- the polygon
-
getTransform
Converts a row of p into 3x3 transformation matrix.- Parameters:
x- row of p[][] (one of the simplex vertices)- Returns:
- the transformation matrix corresponding to
x
-
search
Find the best fit for the VOI polygon we have loaded into this algorithm.- Returns:
- the optimized polygon
-
eval
public double eval(double[] x) - Specified by:
evalin interfacede.jtem.numericalMethods.calculus.function.RealFunctionOfSeveralVariables
-
getNumberOfVariables
public int getNumberOfVariables()- Specified by:
getNumberOfVariablesin interfacede.jtem.numericalMethods.calculus.function.RealFunctionOfSeveralVariables
-