Class AlgorithmCellTrackingAGVF
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmAGVF
-
- gov.nih.mipav.model.algorithms.AlgorithmCellTrackingAGVF
-
- All Implemented Interfaces:
AlgorithmInterface
,java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmCellTrackingAGVF extends AlgorithmAGVF
Active Contour class optimized for Cell Tacking, based on the following paper:"Active Contours for Cell Tracking", by Nilanjan Ray and Scott T. Acton. 5th IEEE Southwest Symposium on Image Analysis and Interpretation (SSIAI'02), 2002.
Most functionality is inherited from AlgorithmAGVF, the runSnake function is optimized with the following constraints for cell-tracking:
1). Constrained Gradient Vector Flow: using a Dirichlet boundary condition, the gradient inside the initial user-defined snake is set to a user-defined velocity vector.
2). Shape-size constraint: the shape and size of the snake is constrained to be circular with a user-defined cell radius.
3). Implicit Resampling: the points along the snake curve are minimized such that they maintain an equal distance between points.
The gradient vector flow is calculated for each frame in the image sequence. Once the GVF is calculated, the points inside the initial snake (either the user-defined snake for frame 0, or the snake for the previous frame) are set to the velocity vector. runSnake then minimizes the shape-size and resampling constraints for the new GVF, based on the user-defined constraint contributions (see the Lambda member variable). The output snake is used as the initial guess for the next frame in the image sequence.
- See Also:
AlgorithmAGVF
,GenerateGaussian
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
m_afX
Previous snake results (X-position):.private float[]
m_afY
Previous snake results (Y-position):.private boolean
m_bDilate
whether or not to dilate the cell contour before solving for the cell on the next frame (dilation helps capture cells that are moving fast).private boolean
m_bUseVelocity
boolean when true, use the velocity vector:.private float
m_fDilationFactor
Amount to dilate the cell (multiple of the cell radius).private float
m_fK
expected cell radius:.private float
m_fLambda1
Constraint factor for the cell shape:.private float
m_fLambda2
Constraint factor for the cell size:.private float
m_fLambda3
Constraint factor for sampling:.private float
m_fTolerance
tolerance factor for snake evolution:.private Jama.Matrix
m_kC
Cos matrix: = cos( 2*pi*i/n).private Jama.Matrix
m_kG
G Matrix, equation 19:.private Jama.Matrix
m_kH
H Matrix, equation 19:.private java.awt.Polygon
m_kPreviousSnake
Previous snake polygon:.private Jama.Matrix
m_kQ
Q Matrix, equation 24 (inverse calculated once per image sequence on the inital frame):.private Jama.Matrix
m_kS
Sin matrix: = sin( 2*pi*i/n).private WildMagic.LibFoundation.Mathematics.Vector2f
m_kVelocity
Velocity vector (either the initial user-defined guess, or the calculated velocity (new snake center - previous snake center):.-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmAGVF
boundaryIterations, extents, xDim, yDim, zDim
-
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 AlgorithmCellTrackingAGVF(ModelImage resultImage, ModelImage srcImg, float[] sigmas, int gvfIterations, int boundaryIterations, float k, float smoothness, VOI srcVOI, boolean do25D, float radiusConstraint, float shapeConstraint, float sizeConstraint, float resamplingConstraint, boolean bDilate, float fDilation, float fDx, float fDy)
Creates a new AlgorithmCellTrackingAGVF object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Prepares this class for destruction.private void
initSnakeConstants(int iNPoints)
Initializes the H, G, and Q matrices once per image sequence on the first frame.protected void
runSnake(float[] xPoints, float[] yPoints, float[] u, float[] v, java.awt.Polygon resultGon)
Actual function that evolves the boundary.-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmAGVF
algorithmPerformed, cleanLine, cleanup, getBilinear, getResultVOI, runAlgorithm, runSnake, setPropagation
-
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
-
m_afX
private float[] m_afX
Previous snake results (X-position):.
-
m_afY
private float[] m_afY
Previous snake results (Y-position):.
-
m_bDilate
private boolean m_bDilate
whether or not to dilate the cell contour before solving for the cell on the next frame (dilation helps capture cells that are moving fast).
-
m_bUseVelocity
private boolean m_bUseVelocity
boolean when true, use the velocity vector:.
-
m_fDilationFactor
private float m_fDilationFactor
Amount to dilate the cell (multiple of the cell radius).
-
m_fK
private float m_fK
expected cell radius:.
-
m_fLambda1
private float m_fLambda1
Constraint factor for the cell shape:.
-
m_fLambda2
private float m_fLambda2
Constraint factor for the cell size:.
-
m_fLambda3
private float m_fLambda3
Constraint factor for sampling:.
-
m_fTolerance
private float m_fTolerance
tolerance factor for snake evolution:.
-
m_kC
private Jama.Matrix m_kC
Cos matrix: = cos( 2*pi*i/n).
-
m_kG
private Jama.Matrix m_kG
G Matrix, equation 19:.
-
m_kH
private Jama.Matrix m_kH
H Matrix, equation 19:.
-
m_kPreviousSnake
private java.awt.Polygon m_kPreviousSnake
Previous snake polygon:.
-
m_kQ
private Jama.Matrix m_kQ
Q Matrix, equation 24 (inverse calculated once per image sequence on the inital frame):.
-
m_kS
private Jama.Matrix m_kS
Sin matrix: = sin( 2*pi*i/n).
-
m_kVelocity
private WildMagic.LibFoundation.Mathematics.Vector2f m_kVelocity
Velocity vector (either the initial user-defined guess, or the calculated velocity (new snake center - previous snake center):.
-
-
Constructor Detail
-
AlgorithmCellTrackingAGVF
public AlgorithmCellTrackingAGVF(ModelImage resultImage, ModelImage srcImg, float[] sigmas, int gvfIterations, int boundaryIterations, float k, float smoothness, VOI srcVOI, boolean do25D, float radiusConstraint, float shapeConstraint, float sizeConstraint, float resamplingConstraint, boolean bDilate, float fDilation, float fDx, float fDy)
Creates a new AlgorithmCellTrackingAGVF object.- Parameters:
resultImage
- image of GVF field magnitudesrcImg
- 2D or 3D source imagesigmas
- describe the scale of the gaussian in each dimensiongvfIterations
- iterations in calculating GVF fieldboundaryIterations
- iterations in calculating boundaryk
- GVF constantsmoothness
- factor for smoothing points on contour (see AlgorithmAGVF)srcVOI
- VOI that is to be evolveddo25D
- only applies to 3D, if true do slice by sliceradiusConstraint
- The user-defined cell radiusshapeConstraint
- The contribution of the shape constraint in the minimizationsizeConstraint
- The contribution of the size constraint in the minimizationresamplingConstraint
- The contribution of the resampling constraint in the minimizationbDilate
- Whether to dilate the cell radius before optimizingfDilation
- dilation factor (multiple of the cell radius)fDx
- The initial cell velocity (x-component)fDy
- The initial cell velocity (y-component)
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmAGVF
-
runSnake
protected void runSnake(float[] xPoints, float[] yPoints, float[] u, float[] v, java.awt.Polygon resultGon)
Actual function that evolves the boundary.- Overrides:
runSnake
in classAlgorithmAGVF
- Parameters:
xPoints
- x coordinates that describe the contouryPoints
- y coordinates that describe the contouru
- x component of the GVFv
- y component of the GVFresultGon
- resultant polygon
-
initSnakeConstants
private void initSnakeConstants(int iNPoints)
Initializes the H, G, and Q matrices once per image sequence on the first frame. The matrix inverse only has to be computed once.- Parameters:
iNPoints
- the number of points in the initial VOI (snake)
-
-