Package gov.nih.mipav.model.algorithms
Class AlgorithmASM
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmASM
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.awt.event.WindowListener,java.lang.Runnable,java.util.EventListener
public class AlgorithmASM extends AlgorithmBase implements java.awt.event.ActionListener
- Author:
- William Gandler This is a port of active shape model code from MATLAB to Java. The license is given below: Copyright (c) 2010, Dirk-Jan Kroon All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAlgorithmASM.AppDataclassAlgorithmASM.ASMDataclassAlgorithmASM.FileMATLABclassAlgorithmASM.LandDataclassAlgorithmASM.OptionsclassAlgorithmASM.PclassAlgorithmASM.PDataclassAlgorithmASM.SDataclassAlgorithmASM.TData
-
Field Summary
Fields Modifier and Type Field Description private booleanfatalErrorprivate java.lang.StringfileDirprivate VOIinitialVOIprivate ModelImageItestprivate int[][]Linesprivate javax.swing.JButtonOKButtonprivate AlgorithmASM.Ppprivate javax.swing.JDialogpauseDialogprivate booleanpressedOKprivate ViewJFrameImagetestFrameprivate double[][]Vertices-
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 AlgorithmASM()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent event)Calls various methods depending on the action.voidASM_2D_example()private voidASM_align_data_inverse2D(double[][] pos, AlgorithmASM.TData tform)private voidASM_align_data2D(double[][] Vertices, AlgorithmASM.TData tform)private voidASM_ApplyModel2D(ModelImage Itest, AlgorithmASM.TData tform, AlgorithmASM.SData ShapeData, AlgorithmASM.AppData[] AppearanceData, AlgorithmASM.Options options)private double[][]ASM_GetContourNormals2D(double[][] V, int[][] L)private voidASM_getProfileAndDerivatives2D(ModelImage I, double[][] P, double[][] N, int k, double[][] gtc, double[][] dgtc)private voidASM_MakeAppearanceModel2D(AlgorithmASM.ASMData[] TrainingData, AlgorithmASM.Options options, AlgorithmASM.AppData[] AppearanceData)private voidASM_MakeShapeModel2D(AlgorithmASM.ASMData[] TrainingData, AlgorithmASM.SData ShapeData)private voidcreatePauseDialog(java.awt.event.ActionListener al)voidfinalize()Prepares this class for destruction.private voidlinspace_multi(double[] d1, double[] d2, int n, double[][] X)private voidLoadDataSetNiceContour(java.lang.String fileName, int nBetween, boolean verbose)private voidPCA(double[][] x, double[] Evalues, double[][] Evectors, double[] x_mean)voidrunAlgorithm()Starts the algorithm.-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
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, 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
-
-
-
-
Field Detail
-
fileDir
private java.lang.String fileDir
-
fatalError
private boolean fatalError
-
p
private AlgorithmASM.P p
-
Vertices
private double[][] Vertices
-
Lines
private int[][] Lines
-
pauseDialog
private javax.swing.JDialog pauseDialog
-
Itest
private ModelImage Itest
-
initialVOI
private VOI initialVOI
-
OKButton
private javax.swing.JButton OKButton
-
pressedOK
private boolean pressedOK
-
testFrame
private ViewJFrameImage testFrame
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
ASM_2D_example
public void ASM_2D_example()
-
ASM_ApplyModel2D
private void ASM_ApplyModel2D(ModelImage Itest, AlgorithmASM.TData tform, AlgorithmASM.SData ShapeData, AlgorithmASM.AppData[] AppearanceData, AlgorithmASM.Options options)
-
createPauseDialog
private void createPauseDialog(java.awt.event.ActionListener al)
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
Calls various methods depending on the action.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Overrides:
actionPerformedin classAlgorithmBase- Parameters:
event- event that triggered function
-
ASM_align_data_inverse2D
private void ASM_align_data_inverse2D(double[][] pos, AlgorithmASM.TData tform)
-
ASM_MakeAppearanceModel2D
private void ASM_MakeAppearanceModel2D(AlgorithmASM.ASMData[] TrainingData, AlgorithmASM.Options options, AlgorithmASM.AppData[] AppearanceData)
-
ASM_getProfileAndDerivatives2D
private void ASM_getProfileAndDerivatives2D(ModelImage I, double[][] P, double[][] N, int k, double[][] gtc, double[][] dgtc)
-
linspace_multi
private void linspace_multi(double[] d1, double[] d2, int n, double[][] X)
-
ASM_GetContourNormals2D
private double[][] ASM_GetContourNormals2D(double[][] V, int[][] L)
-
ASM_MakeShapeModel2D
private void ASM_MakeShapeModel2D(AlgorithmASM.ASMData[] TrainingData, AlgorithmASM.SData ShapeData)
-
PCA
private void PCA(double[][] x, double[] Evalues, double[][] Evectors, double[] x_mean)
-
ASM_align_data2D
private void ASM_align_data2D(double[][] Vertices, AlgorithmASM.TData tform)
-
LoadDataSetNiceContour
private void LoadDataSetNiceContour(java.lang.String fileName, int nBetween, boolean verbose)
-
runAlgorithm
public void runAlgorithm()
Starts the algorithm.- Specified by:
runAlgorithmin classAlgorithmBase
-
-