Class AlgorithmFRAP

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmFRAP
    extends AlgorithmBase
    Fluorescence Recovery after PhotoBleaching Only 1 color will be used from a color image.

    An optional registration may be performed before FRAP. In this registration slices are registered to the first slice after photobleaching - firstSliceNum. AlgorithmRegOAR25D is used with the cost function and firstSliceNum being the only registration parameters the user can vary in the dialog box. Correlation ratio is the default cost function, but the user can also select least squares, normalized cross correlation, or normalized mutual information. The FRAP will be performed on the registered image rather than on the original image.

    The narrow band code is based on compartmental models. These compartments must be homogeneous in composition; there must be no spatial gradients inside a compartment. If a compartment is not homogeneous, it must be divided into multiple compartments or partial differential equations must be used to describe the system. The code here uses equations in the Carrero reference for the case which has a photobleached narrow band with 2 neighboring unbleached regions.

    Solutions are also implemented for the pure 1D diffusion case and for the single exponential model.

    The 2D circle case is implemented according to the full reaction-diffusion system model equations found in Evidence of a Common Mode of Transcription Factor Interaction with Chromatin as Revealed by Improved Quantitative Fluorescence Recovery after Photobleaching by Florian Mueller, Paul Wach, and James McNally.

    The code here assumes the presence of 1, 2 or 3 VOI regions. The photobleached region is always required. The whole organ region is required for whole organ normalization, which must always be used in the narrow band case and the 2D circle case, since Fa/Fo, the afterBeforeRatio = wholeOrganIntensity[firstSliceNum]/wholeOrganIntensity[firstSliceNum - 1] is required in this case. However, whole organ normalization is optional in the pure 1D diffusion and single exponential. Curves can be placed in any slice. There is no reason to propagate curves to more than 1 slice. When the algorithm executes, the photobleached and whole organ VOIs will be propagated to the other slices.

    Radio buttons in the dialog box are used to select a red photobleached, a green whole organ, or a blue background VOI. Either an ellipse VOI, rectangle VOI, polyline VOI, or levelset VOI will be selected from the top MIPAV toolbar. There is no need to hit the NEW_VOI button. The photobleached VOI should be contained within the whole organ VOI. The whole organ region will have a greater average intensity than the photobleached region and the background region will have a smaller average intensity than the photobleached region.

    The VOIs should be set after the dialog is created, so that the photobleached VOI has the correct red hue = 0.0, the whole organ VOI has the correct green hue = 1/3, and the background VOI has the correct blue hue = 2/3. If the VOIs are set before the dialog is created, the VOIs might not have the required hue values of 0, 1/3, or 2/3.

    The average of the background VOI is used to obtain the backgroundConstant which is subtracted from the photoBleachedIntensity and wholeOrganIntensity arrays.

    Then, Fa/F0 of the whole organ VOI is obtained, the ratio of the first slice after photobleaching to the slice just before photobleaching. If whole organ normalization is used, the background corrected photobleached values are divided by the background corrected whole organ values to correct for the loss of fluorescence.

    Even with low illumination during the recovery phase, there is expected to be fluorescence loss through photobleaching over the course of the recovery curve. For this loss the time that matters is the exposure time for each slice picture and not the absolute time at which the exposure was made so the time here is be proportional to the number of slices.

    If whole organ normalization is used, the values of corrected photobleached/corrected whole organ are normalized by dividing by the value of this ratio just before photobleaching. These normalized photobleached ratios are fitted to a slightly modified version of equation 19 in the Carrero article: R(t;alpha,beta,gamma) = bottom + span*(1 - gamma*exp(alpha*t) - (1 - gamma)*exp(beta*t)) The mobile fraction equals bottom + span. In this curve fitting the time used is the time elapsed since photobleaching. Alpha, beta, gamma, and the ratio of the whole organ region fluorescence after bleaching to before bleaching are output. The dissociation rate, the association rate, and the diffusion transfer coefficient are obtained from alpha, beta, gamma, and the afterBeforeRatio.

    For 1D pure diffusion fitting: I(t) = Ifinal(1 - 1/sqrt(1 + 4*PI*D*t/w**2)), where w is the width of the bleaching along the membrane in um and D is the effective 1-D diffusion to fit (um**2/sec). Solve for D/w**2

    For the 2D circle case: Feq = koff/(kon + koff) Ceq = kon/(kon + koff) In the 2D circle case the user inputs the photbleached circle radius, the radius to the nuclear membrane, and diffusion constant and nonlinear fitting is used to obtain kon and koff. where correction(t) is an unbleached control region originally identical in fluorescence to the photobleached region and the background has no fluorescence. The whole organ VOI is used to correct for observational photobleaching.

    If whole organ normalization is not used, the values of corrected photobleached are normalized by assuming a mobile fraction of 1 and dividing by the maximum value of the corrected photobleached array occurring after bleaching.

    For narrow band 2D the effective diffusion coefficient in micrometers**2/sec is found from the diffusion transfer coefficient. The photobleached width is measured as the minimum dimension of the photobleached VOI bounding box and the whole organ length is measured along the same direction. Deff = Dt * photobleached width * (whole organ length - photobleached width)/4.0 Note that the expected asymptote effect as whole organ length goes to infinity is missing from this equation. For pure 1D diffusion: Deff = D/w**2 * photobleached width * photobleached width

    An optional checkbox titled Grid search with parameter variation can be selected to doublecheck the nonlinear fitting results with a simple grid search pattern. The sum of squares of errors (sse) is calculated at every point on a grid. The sum of the squares of the (fitted photobleached data minus the actual photobleached data) is found for every slice starting with the first slice after photobleaching. For 2D narrow band a 3D grid with 201 alpha points, 201 beta points, and 101 gamma points is used. alpha and beta are both varied from 0.05 times the values found in the nonlinear fit to 20 times the values found in the nonlinear fit. The values are geometrically incremented so that each value is about 1.03 times as great as the previous value. gamma is arithmetically incremented by 0.01 from 0 to 1. The global sse minimum is found and in addition if present any local sse minimums which are the lowest point in a 5 by 5 by 5 cube are also found. The 3D space is searched with the restriction that beta alpha are not included in the 3D search and are simply filled in with sse values equal to 1.1 times the sse maximum found over the permissible space. The search is conducted with the bottom and span values kept fixed at the values found by the nonlinear fit. Since these values are very likely to have been accurately determined, this should not be a problem. In any event a search over a five dimensional space would be very time consuming. A 201 by 201 by 101 3D error image is created to display the calculated sse values. The error image name is the source image name with _err appended on the end. Point VOIs appear at the locations of the global minimum and at local minimums if any exist. The point VOIs are stored in a folder titled defaultVOI_sourceImageName_err. For the pure 1D fit and the single exponential fit the search is simply one dimensional so no error image is created. For the pure 1D fit 201 D/w**2 values going from 0.05 times the nonlinear fit value to 20 times the nonlinear fit value are used to calculate sse. For the single exponential fit 201 thalf values going form 0.05 times the nonlinear fit value to 20 times the nonlinear fit value are used to calculate sse. For circular 2D diffusion a 201 by 201 kon by koff grid is generated.

    References: 1.) Evidence for a Common Mode of Transcription Factor Interaction with Chromatin as Revealed by Improved Quantitative Fluorescence Recovery after Photobleaching by Florian Mueller, Paul Wach, and James G. McNally, Biophysical Journal, Volume 94, April 2008, pp. 3323-3339 and accompanying supplemental material.

    2.) Randall H. Morse (ed.) Chromatin Remodeling: Methods and Protocols, Methods in Molecular Biology, vol. 833, Chapter 11, "Monitoring Dynamic Binding of Chromatin Proteins in Vivo by Fluorescence Recovery After PhotoBleaching", Florian Mueller, Tatiana S. Karpova, Davide Mazza, and James G. McNally.

    3.) Mobility Measurement By Analysis of Fluorescence Photobleaching Recovery Kinetics by D. Axelrod, D.E. Koppel, J. Schlessinger, E. Elson, and W.W. Webb, Biophysical Journal, Volume 16, 1976, pp. 1055-1069.

    4.) Monitoring the Dynamics and Mobility of Membrane Proteins Tagged with Green Flurorescent Protein by J. Lippincott-Schwartz, J.F. Presley, K.J.M. Zaal, K. Hirschberg, C.D. Miller, and J. Ellenberg, Methods in Cell Biology, Volume 58, 1999, pp. 261-281.

    5.) Using FRAP and mathematical modeling to determine the in vivo kinetics of nuclear proteins by Gustavo Carrero, Darin McDonald, Ellen Crawford, Gerda de Vries, and Michael J. Hendzel, Methods, Volume 29, 2003, pp. 14-28

    6.) Practical Kinetic Modeling of Large Scale Biological Systems by Robert D. Phair at http://www.bioinformaticsservices.com/bis/resources/ cybertext/IBcont.html

    • Field Detail

      • NARROW_BAND_2D

        private static final int NARROW_BAND_2D
        Diffusion models.
        See Also:
        Constant Field Values
      • backgroundIndex

        private int backgroundIndex
        DOCUMENT ME!
      • cost

        private int cost
        DOCUMENT ME!
      • createRegImage

        private boolean createRegImage
        DOCUMENT ME!
      • findDiffusion

        private boolean findDiffusion
      • diffusion

        private double diffusion
        Diffusion constant in um*um/sec.
      • firstSliceNum

        private int firstSliceNum
        DOCUMENT ME!
      • model

        private int model
        DOCUMENT ME!
      • paramVary

        private boolean paramVary
        DOCUMENT ME!
      • photoBleachedIndex

        private int photoBleachedIndex
        DOCUMENT ME!
      • constantRadius

        private double constantRadius
        Radius of uniform poriton of the initial bleach
      • radius

        private double radius
        Radius of bleach spot in um.
      • nuclearRadius

        private double nuclearRadius
        Radius of nuclear membrane in um.
      • register

        private boolean register
        DOCUMENT ME!
      • timeStamp

        private double[] timeStamp
        DOCUMENT ME!
      • useBlue

        private boolean useBlue
        DOCUMENT ME!
      • useGreen

        private boolean useGreen
        DOCUMENT ME!
      • useRed

        private boolean useRed
        DOCUMENT ME!
      • useTestData

        private boolean useTestData
        DOCUMENT ME!
      • wholeOrganIndex

        private int wholeOrganIndex
        DOCUMENT ME!
      • theta

        private double theta
      • sigma

        private double sigma
      • numParam

        private int numParam
      • alpha

        private double[] alpha
      • avgJ0

        private double[] avgJ0
      • RN2J02

        private double[] RN2J02
      • bessInt

        private double[] bessInt
    • Constructor Detail

      • AlgorithmFRAP

        public AlgorithmFRAP​(ModelImage srcImg,
                             boolean useRed,
                             boolean useGreen,
                             boolean useBlue,
                             int firstSliceNum,
                             int photoBleachedIndex,
                             int wholeOrganIndex,
                             int backgroundIndex,
                             int model,
                             boolean register,
                             int cost,
                             boolean createRegImage,
                             boolean paramVary,
                             double diffusion,
                             boolean findDiffusion)
        Creates a new AlgorithmFRAP object.
        Parameters:
        srcImg - source image
        useRed - If true, use the red color values for the FRAP
        useGreen - If true, use the green color values for the FRAP
        useBlue - If true, use the blue color values for the FRAP
        firstSliceNum - first slice after bleach operation
        photoBleachedIndex - the index of the photoBleached VOI
        wholeOrganIndex - the index of the wholeOrgan VOI if >= 0
        backgroundIndex - the index of the background VOI if >= 0
        model - NARROW_BAND_2D, CIRCLE_2D, or PURE_1D
        register - If true register all slices to the wholeOrgan slice before FRAP
        cost - Cost function used in registration
        createRegImage - If register = true and createRegImage = true, then create a frame with the registered image
        paramVary - Calculate sum of square of errors for different parameter values and output the minimum
        diffusion - diffusion constant in um*um/sec
        findDiffusion -
    • Method Detail

      • finalize

        public void finalize()
        Prepares this class for destruction.
        Overrides:
        finalize in class AlgorithmBase
      • runTest24D

        public void runTest24D()
        DOCUMENT ME!
      • updateFileInfo

        public void updateFileInfo​(ModelImage image,
                                   ModelImage resultImage)
        Copy important file information to resultant image structure.
        Parameters:
        image - Source image.
        resultImage - Resultant image.
      • actInt

        private double actInt​(double x)
        DOCUMENT ME!
        Parameters:
        x - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • runFullModelTest

        private void runFullModelTest()
        DOCUMENT ME!
      • runIntegrationTest2

        private void runIntegrationTest2()
        private void runIntegrationTest2() { IntModel2 imod; double lower = 0.0; double upper = 1.0; int routine = Integration2.DQAGPE; double breakPoints[] = new double[4]; breakPoints[0] = 1.0/7.0; breakPoints[1] = 2.0/3.0; double epsabs = 0.0; double epsrel = 1.0E-4; int limit = 100; double numInt; int errorStatus; double absError; int neval; double eps = 5.0e-7; int steps; imod = new IntModel2(lower, upper, routine, breakPoints, epsabs, epsrel, limit); imod.driver(); numInt = imod.getIntegral(); errorStatus = imod.getErrorStatus(); absError = imod.getAbserr(); neval = imod.getNeval(); Preferences.debug("Numerical Integral = " + numInt + " after " + neval +" integrand evaluations used\n", Preferences.DEBUG_ALGORITHM); Preferences.debug("Error status = " + errorStatus +" with absolute error = " + absError + "\n", Preferences.DEBUG_ALGORITHM);
      • runLapTest

        private void runLapTest()
        DOCUMENT ME!
      • runLapTest2

        private void runLapTest2()
        DOCUMENT ME!
      • runLapTestqd

        private void runLapTestqd()
        DOCUMENT ME!
      • runTest

        private void runTest()
        DOCUMENT ME!
      • fitFullModel

        private void fitFullModel​(double[] timeFunction,
                                  double[] time,
                                  double kon,
                                  double koff,
                                  double diffusion)
      • testComputeJ1

        public void testComputeJ1()
      • computeJ1

        private double computeJ1​(int m)
      • testJYZO

        public void testJYZO()
      • JYZO

        private void JYZO​(int N,
                          int NT,
                          double[] RJ0,
                          double[] RJ1,
                          double[] RY0,
                          double[] RY1)
      • JYNDD

        private void JYNDD​(int N,
                           double X,
                           double[] BJN,
                           double[] DJN,
                           double[] FJN,
                           double[] BYN,
                           double[] DYN,
                           double[] FYN)