Package gov.nih.mipav.model.algorithms
Class AlgorithmBSmooth
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmBSmooth
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmBSmooth extends AlgorithmBase
Smoothing of VOI using 1 iteration of bSplines. All selected curves in all slices of the voi will be smoothed. The number of interpolated points is user selectable. The user chooses whether or not to trim out nearly collinear points. The user chooses whether or not to remove the original selected curve. If the original curve is not removed, the new curve will have a different color. If the original curve is removed, the new curve will have the same color.- See Also:
AlgorithmBSpline
-
-
Field Summary
Fields Modifier and Type Field Description private VOI
activeVOI
The voi selected by the user.private AlgorithmBSpline
bSpline
private int
nPts
Number of interpolation points.private VOI
resultVOI
The resultant polygon and the evolution has completed.private ModelImage
srcImage
Source image.private boolean
trim
Trim out nearly collinear points.-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmBSmooth()
AlgorithmBSmooth(ModelImage srcImg, VOI activeVOI, int nPts, boolean trim)
Creates a new AlgorithmBSmooth object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
calc2D()
Prepares the data and runs the algorithm for a 2D image.private void
calc3D()
Prepares the data and runs the algorithm for a 3D image.void
finalize()
Prepares this class for destruction.AlgorithmBSpline
getbSplineAlgo()
VOI
getResultVOI()
Accessor that returns a voi that is a smoothed version of the original.void
runAlgorithm()
Starts the smooth algorithm.void
runSmooth(float[] xPoints, float[] yPoints, float[] zPoints, VOIBase resultContour)
Actual function that smooths the voi with bsplines.private void
runSmooth2(float[] xPoints, float[] yPoints, float[] zPoints)
Actual function that smooths the voi with bsplines.void
setNPts(int nPts)
void
setPoints(float[] xPoints, float[] yPoints, float[] zPoints, VOIBase contour)
Takes the polygon and forms two special arrays for use in the Bspline.private void
setPoints2(float[] xPoints, float[] yPoints, float[] zPoints)
Takes the polygon and forms two special arrays for use in the Bspline.-
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, 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
-
activeVOI
private VOI activeVOI
The voi selected by the user.
-
nPts
private int nPts
Number of interpolation points.
-
resultVOI
private VOI resultVOI
The resultant polygon and the evolution has completed.
-
srcImage
private ModelImage srcImage
Source image.
-
trim
private boolean trim
Trim out nearly collinear points.
-
bSpline
private AlgorithmBSpline bSpline
-
-
Constructor Detail
-
AlgorithmBSmooth
public AlgorithmBSmooth()
-
AlgorithmBSmooth
public AlgorithmBSmooth(ModelImage srcImg, VOI activeVOI, int nPts, boolean trim)
Creates a new AlgorithmBSmooth object.- Parameters:
srcImg
- 2D or 3D source imageactiveVOI
- the selected voinPts
- number of interpolation pointstrim
- trim out nearly collinear points
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
getResultVOI
public VOI getResultVOI()
Accessor that returns a voi that is a smoothed version of the original.- Returns:
- resultVOI
-
setNPts
public void setNPts(int nPts)
-
runAlgorithm
public void runAlgorithm()
Starts the smooth algorithm.- Specified by:
runAlgorithm
in classAlgorithmBase
-
calc2D
private void calc2D()
Prepares the data and runs the algorithm for a 2D image.
-
calc3D
private void calc3D()
Prepares the data and runs the algorithm for a 3D image.
-
runSmooth2
private void runSmooth2(float[] xPoints, float[] yPoints, float[] zPoints)
Actual function that smooths the voi with bsplines.- Parameters:
xPoints
- x coordinates that describe the contouryPoints
- y coordinates that describe the contourresultGon
- resultant polygon
-
runSmooth
public void runSmooth(float[] xPoints, float[] yPoints, float[] zPoints, VOIBase resultContour)
Actual function that smooths the voi with bsplines.- Parameters:
xPoints
- x coordinates that describe the contouryPoints
- y coordinates that describe the contourresultGon
- resultant polygon
-
setPoints
public void setPoints(float[] xPoints, float[] yPoints, float[] zPoints, VOIBase contour)
Takes the polygon and forms two special arrays for use in the Bspline.- Parameters:
xPoints
- storage location of array of x coord. pointsyPoints
- storage location array of y coord. pointsgon
- initial polygon
-
setPoints2
private void setPoints2(float[] xPoints, float[] yPoints, float[] zPoints)
Takes the polygon and forms two special arrays for use in the Bspline.- Parameters:
xPoints
- storage location of array of x coord. pointsyPoints
- storage location array of y coord. pointsgon
- initial polygon
-
getbSplineAlgo
public AlgorithmBSpline getbSplineAlgo()
-
-