Package gov.nih.mipav.model.algorithms
Class AlgorithmArcLength
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmArcLength
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmArcLength extends AlgorithmBase
This algorithm calculates the arc-length of a Bspline fit to user defined control points. This algorithm calculates the entire curve length and also is able to calculate the arc-length between two points.- Version:
- 0.1 April 27, 1998
-
-
Field Summary
Fields Modifier and Type Field Description private AlgorithmBSpline
bSpline
DOCUMENT ME!static int
INTEGRAL_ORDER
DOCUMENT ME!static int
INVLEN_MAXITER
DOCUMENT ME!static float
INVLEN_TOLERANCE
DOCUMENT ME!private float[][]
rom
DOCUMENT ME!private float
totalLen
DOCUMENT ME!private float[]
xPoints
DOCUMENT ME!private float[]
yPoints
DOCUMENT ME!private float[]
zPoints
DOCUMENT ME!-
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 AlgorithmArcLength(float[] xPts, float[] yPts)
Algorithm constructor.AlgorithmArcLength(float[] xPts, float[] yPts, float[] zPts)
Algorithm constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getTotalArcLength()
Returns total arc-length of the segment.float
invlen(float pct)
Finds the point at some percentage along the curve using simple midpoint root finding algorithm.float
invlenNewton(float pct)
Finds the point at some percentage along the curve using Newtons method of root finding.float
length(float a, float b)
The length is calculated between to points a,b using Romberg integration.void
runAlgorithm()
DOCUMENT ME!void
setPoints(float[] xPts, float[] yPts)
Sets the controls points of the Bspline and calculates the total arc-length.void
setPoints(float[] xPts, float[] yPts, float[] zPts)
Sets the controls points of the Bspline and calculates the total arc-length.private float
speed(float q)
Calculates the speed at some point q.-
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
-
-
-
-
Field Detail
-
INTEGRAL_ORDER
public static final int INTEGRAL_ORDER
DOCUMENT ME!- See Also:
- Constant Field Values
-
INVLEN_MAXITER
public static final int INVLEN_MAXITER
DOCUMENT ME!- See Also:
- Constant Field Values
-
INVLEN_TOLERANCE
public static final float INVLEN_TOLERANCE
DOCUMENT ME!- See Also:
- Constant Field Values
-
bSpline
private AlgorithmBSpline bSpline
DOCUMENT ME!
-
rom
private float[][] rom
DOCUMENT ME!
-
totalLen
private float totalLen
DOCUMENT ME!
-
xPoints
private float[] xPoints
DOCUMENT ME!
-
yPoints
private float[] yPoints
DOCUMENT ME!
-
zPoints
private float[] zPoints
DOCUMENT ME!
-
-
Constructor Detail
-
AlgorithmArcLength
public AlgorithmArcLength(float[] xPts, float[] yPts)
Algorithm constructor.- Parameters:
xPts
- x coordinate control pointsyPts
- y coordinate control points
-
AlgorithmArcLength
public AlgorithmArcLength(float[] xPts, float[] yPts, float[] zPts)
Algorithm constructor.- Parameters:
xPts
- x coordinate control pointsyPts
- y coordinate control points
-
-
Method Detail
-
getTotalArcLength
public float getTotalArcLength()
Returns total arc-length of the segment.- Returns:
- DOCUMENT ME!
-
invlen
public float invlen(float pct)
Finds the point at some percentage along the curve using simple midpoint root finding algorithm.- Parameters:
pct
- percentage indicating where one would- Returns:
- position indicates
-
invlenNewton
public float invlenNewton(float pct)
Finds the point at some percentage along the curve using Newtons method of root finding.- Parameters:
pct
- percentage indicating where one would- Returns:
- position indicates
-
runAlgorithm
public void runAlgorithm()
DOCUMENT ME!- Specified by:
runAlgorithm
in classAlgorithmBase
-
setPoints
public void setPoints(float[] xPts, float[] yPts)
Sets the controls points of the Bspline and calculates the total arc-length.- Parameters:
xPts
- x coordinate control pointsyPts
- y coordinate control points
-
setPoints
public void setPoints(float[] xPts, float[] yPts, float[] zPts)
Sets the controls points of the Bspline and calculates the total arc-length.- Parameters:
xPts
- x coordinate control pointsyPts
- y coordinate control points
-
length
public float length(float a, float b)
The length is calculated between to points a,b using Romberg integration.- Parameters:
a
- starting positionb
- ending position b > a and b range- Returns:
- length returns arc-length of the segment
-
speed
private float speed(float q)
Calculates the speed at some point q.- Parameters:
q
- the point where the speed is calculated- Returns:
- speed the speed ( magnitude ) is returned
-
-