Class AlgorithmFRAP
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.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. Points with 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
AlgorithmFRAP.distanceIntensityComparator
private class
AlgorithmFRAP.distanceIntensityItem
(package private) class
AlgorithmFRAP.Fit24DModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitDoubleExponentialModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitDoubleExponentialNoWholeConstrainedModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitDoubleExponentialNoWholeModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitDoubleExponentialNoWholeNL2solModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitExpModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitExpModelqd
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitFullIntModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitFullIntModel2i
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitFullIntModel2p
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitFullIntModel2s
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitFullModel2
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitFullModelqd
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitIntensityProfile
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitPure1DModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitPure1DNoWholeModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitSineModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitSingleExponentialModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitSingleExponentialNoWholeModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitWholeNL2solInt2
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitWholeNL2solModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitWholeNLConInt2
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitWholeNLConModel
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitWholeNLConModel2
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitWholeNLConModel3
DOCUMENT ME!(package private) class
AlgorithmFRAP.FitWholeNLConModelqd
DOCUMENT ME!(package private) class
AlgorithmFRAP.IntModel
class IntModel extends Integration { public IntModel(double lower, double upper, int routine, double eps) { super(lower, upper, routine, eps); } public double intFunc(double x) { double function = 0.0; if ((x !(package private) class
AlgorithmFRAP.IntModel2
class IntModel2 extends Integration2 { public IntModel2(double lower, double upper, int routine, double breakPoints[], double epsabs, double epsrel, int limit) { super(lower, upper, routine, breakPoints, epsabs, epsrel, limit); } public double intFunc(double x) { double function = 0.0; if ((x !(package private) class
AlgorithmFRAP.IntModelBessel
(package private) class
AlgorithmFRAP.IntModelI0NuclearArea
-
Field Summary
Fields Modifier and Type Field Description private double[]
alpha
private double[]
avgJ0
private int
backgroundIndex
DOCUMENT ME!private double[]
bessInt
private static int
CIRCLE_2D
DOCUMENT ME!private double
constantRadius
Radius of uniform poriton of the initial bleachprivate int
cost
DOCUMENT ME!private boolean
createRegImage
DOCUMENT ME!private double
diffusion
Diffusion constant in um*um/sec.private boolean
findDiffusion
private int
firstSliceNum
DOCUMENT ME!private int
model
DOCUMENT ME!private static int
NARROW_BAND_2D
Diffusion models.private double
nuclearRadius
Radius of nuclear membrane in um.private int
numParam
private boolean
paramVary
DOCUMENT ME!private int
photoBleachedIndex
DOCUMENT ME!private static int
PURE_1D
DOCUMENT ME!private double
radius
Radius of bleach spot in um.private boolean
register
DOCUMENT ME!private double[]
RN2J02
private double
sigma
private double
theta
private double[]
timeStamp
DOCUMENT ME!private boolean
useBlue
DOCUMENT ME!private boolean
useGreen
DOCUMENT ME!private boolean
useRed
DOCUMENT ME!private boolean
useTestData
DOCUMENT ME!private int
wholeOrganIndex
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 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private double
actInt(double x)
DOCUMENT ME!private double
computeJ1(int m)
void
finalize()
Prepares this class for destruction.private void
fitFullModel(double[] timeFunction, double[] time, double kon, double koff, double diffusion)
private void
JYNDD(int N, double X, double[] BJN, double[] DJN, double[] FJN, double[] BYN, double[] DYN, double[] FYN)
private void
JYZO(int N, int NT, double[] RJ0, double[] RJ1, double[] RY0, double[] RY1)
void
runAlgorithm()
starts the algorithm.private void
runFullModelTest()
DOCUMENT ME!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);private void
runLapTest()
DOCUMENT ME!private void
runLapTest2()
DOCUMENT ME!private void
runLapTestqd()
DOCUMENT ME!private void
runTest()
DOCUMENT ME!void
runTest24D()
DOCUMENT ME!void
testComputeJ1()
void
testJYZO()
void
updateFileInfo(ModelImage image, ModelImage resultImage)
Copy important file information to resultant image structure.-
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
-
NARROW_BAND_2D
private static final int NARROW_BAND_2D
Diffusion models.- See Also:
- Constant Field Values
-
CIRCLE_2D
private static final int CIRCLE_2D
DOCUMENT ME!- See Also:
- Constant Field Values
-
PURE_1D
private static final int PURE_1D
DOCUMENT ME!- 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 imageuseRed
- If true, use the red color values for the FRAPuseGreen
- If true, use the green color values for the FRAPuseBlue
- If true, use the blue color values for the FRAPfirstSliceNum
- first slice after bleach operationphotoBleachedIndex
- the index of the photoBleached VOIwholeOrganIndex
- the index of the wholeOrgan VOI if >= 0backgroundIndex
- the index of the background VOI if >= 0model
- NARROW_BAND_2D, CIRCLE_2D, or PURE_1Dregister
- If true register all slices to the wholeOrgan slice before FRAPcost
- Cost function used in registrationcreateRegImage
- If register = true and createRegImage = true, then create a frame with the registered imageparamVary
- Calculate sum of square of errors for different parameter values and output the minimumdiffusion
- diffusion constant in um*um/secfindDiffusion
-
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
starts the algorithm.- Specified by:
runAlgorithm
in classAlgorithmBase
-
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)
-
-