Class 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 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 magnitude
        srcImg - 2D or 3D source image
        sigmas - describe the scale of the gaussian in each dimension
        gvfIterations - iterations in calculating GVF field
        boundaryIterations - iterations in calculating boundary
        k - GVF constant
        smoothness - factor for smoothing points on contour (see AlgorithmAGVF)
        srcVOI - VOI that is to be evolved
        do25D - only applies to 3D, if true do slice by slice
        radiusConstraint - The user-defined cell radius
        shapeConstraint - The contribution of the shape constraint in the minimization
        sizeConstraint - The contribution of the size constraint in the minimization
        resamplingConstraint - The contribution of the resampling constraint in the minimization
        bDilate - Whether to dilate the cell radius before optimizing
        fDilation - 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 class AlgorithmAGVF
      • 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 class AlgorithmAGVF
        Parameters:
        xPoints - x coordinates that describe the contour
        yPoints - y coordinates that describe the contour
        u - x component of the GVF
        v - y component of the GVF
        resultGon - 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)