Package gov.nih.mipav.model.algorithms
Class AlgorithmTimeFitting
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmTimeFitting
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.awt.event.WindowListener,java.lang.Runnable,java.util.EventListener
public class AlgorithmTimeFitting extends AlgorithmBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classAlgorithmTimeFitting.FitExponential(package private) classAlgorithmTimeFitting.FitGaussian(package private) classAlgorithmTimeFitting.FitLaplace(package private) classAlgorithmTimeFitting.FitLine(package private) classAlgorithmTimeFitting.FitLorentz(package private) classAlgorithmTimeFitting.FitMultiExponential(package private) classAlgorithmTimeFitting.FitRayleighclassAlgorithmTimeFitting.fittingTask
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringaltTimeTagprivate intbarMarkerprivate java.util.BitSetbitMaskprivate double[]destArrayprivate int[]destExitStatusArrayprivate int[]exitStatusprivate ModelImageexitStatusImageprivate static intEXPONENTIAL_FITprivate booleanfindInitialFromDataprivate intfunctionFitprivate static intGAUSSIAN_FITprivate double[]highBoundsprivate intiprivate double[]initialprivate static intLAPLACE_FITprivate static intLINEAR_FITprivate static intLORENTZ_FITprivate double[]lowBoundsprivate static intMULTIEXPONENTIAL_FITFrom Exponential analysis in physical phenomena by Andrei A.private intnumVariablesprivate intoldBarMarkerprivate double[]paramAverageprivate int[]paramInfprivate double[]paramMaxprivate double[]paramMinprivate int[]paramNaNprivate double[]paramTotalprivate intprocessorsprivate static intRAYLEIGH_FITprivate double[]srcArrayprivate inttDimprivate double[]timeValsA vector of center times for each volumeprivate booleanuseAltTimeTagprivate boolean[]useBoundsprivate booleanuseLogprivate intvalidVoxelsprivate intvolSizeprivate longvoxelsProcessedprivate booleanwholeImageprivate intxDimprivate intyDimprivate intzDim-
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 AlgorithmTimeFitting(ModelImage destImage, ModelImage srcImage, ModelImage exitStatusImage, boolean useLog, int functionFit, int numVariables, boolean findInitialFromData, double[] initial, boolean[] useBounds, double[] lowBounds, double[] highBounds)Creates a new AlgorithmTimeFitting object.AlgorithmTimeFitting(ModelImage destImage, ModelImage srcImage, ModelImage exitStatusImage, boolean useLog, int functionFit, int numVariables, boolean findInitialFromData, double[] initial, boolean[] useBounds, double[] lowBounds, double[] highBounds, boolean useAltTimeTag, java.lang.String altTimeTag)Creates a new AlgorithmTimeFitting object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinalize()Prepares this class for destruction.voidinput(double[] y_array, int i)voidoutput(double[] params, int i, int status, double chi_squared)voidrunAlgorithm()starts the algorithm.-
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
-
LINEAR_FIT
private static final int LINEAR_FIT
- See Also:
- Constant Field Values
-
EXPONENTIAL_FIT
private static final int EXPONENTIAL_FIT
- See Also:
- Constant Field Values
-
GAUSSIAN_FIT
private static final int GAUSSIAN_FIT
- See Also:
- Constant Field Values
-
LAPLACE_FIT
private static final int LAPLACE_FIT
- See Also:
- Constant Field Values
-
LORENTZ_FIT
private static final int LORENTZ_FIT
- See Also:
- Constant Field Values
-
MULTIEXPONENTIAL_FIT
private static final int MULTIEXPONENTIAL_FIT
From Exponential analysis in physical phenomena by Andrei A. Istratov and Oleg F. Vyvenko: Note that for a multiexponential fit nonlinear least squares analysis as used here can handle nonzero baseline offsets. However, for nonlinear least squares initial guesses are needed for the values of unknown decay parameters and, if these initial guesses are poor, the iteration may converge to a local minimum rather than to the absolute minimum. With Prony's method the baseline offset should be removed first. The differentiation of transients only allows the exponent time constants to be determined. It does not allow the amplitudes by which the exponents are multiplied to be determined. Also experimental transients are noisy, and large errors would result from their numerical differentiation. The method of modulating functions does not enable one to determine the amplitude of the transients and is not tolerant to nonzero baseline offsets. The integration method allows one to determine the baseline. However, the solution is more stable and exact if the baseline is subtracted from the raw signal before the analysis. For the integration method, on computed two-component decays with tau1/tau2 = 2.5 the reliable separation of components is impossible if the SNR is less than 30. For tau1/tau2, two components can be separated for a SNR of about 10. When two-component analysis is performed with a baseline determination the mean error of the calculated time constants increases by a factor of about 3-10. Before the method of moments can be applied, the baseline offset must be removed from the data. The Laplace-Pade approximation is not applicable to decays containing baseline offset. Tolerance of the method to baseline offsets may be very important, depending on whether a baseline offset can be encountered in the experiment. Few of the discussed techniques are tolerable of nonzero baseline offsets. Such commonly used methods as Prony's or method of moments will provide wrong results or even crash if a decay contains an offset. Unfortunately, algorithms for extrapolation of baseline offsets are poorly developed and are not always sufficiently exact. Therefore, we would recommend algorithms that do not require baseline corrections and can accommodate transients with a baseline. Taking into account stability for wide range changes in parameters and insensitivity to baseline offsets, the authors select nonlinear least squares as the best fitting method for multiexponential fits. Fitting routines are only accurate if the number of components is correct and the initial approximation is close to the true solution. A way to obtain this initial approximation is to extract it from a spectroscopic method, as was done by Provencher and Mazzola et al.- See Also:
- Constant Field Values
-
RAYLEIGH_FIT
private static final int RAYLEIGH_FIT
- See Also:
- Constant Field Values
-
timeVals
private double[] timeVals
A vector of center times for each volume
-
srcArray
private double[] srcArray
-
i
private int i
-
xDim
private int xDim
-
yDim
private int yDim
-
zDim
private int zDim
-
tDim
private int tDim
-
volSize
private int volSize
-
findInitialFromData
private boolean findInitialFromData
-
initial
private double[] initial
-
useBounds
private boolean[] useBounds
-
lowBounds
private double[] lowBounds
-
highBounds
private double[] highBounds
-
exitStatus
private int[] exitStatus
-
paramNaN
private int[] paramNaN
-
paramInf
private int[] paramInf
-
paramMin
private double[] paramMin
-
paramMax
private double[] paramMax
-
paramTotal
private double[] paramTotal
-
paramAverage
private double[] paramAverage
-
processors
private int processors
-
destArray
private double[] destArray
-
destExitStatusArray
private int[] destExitStatusArray
-
voxelsProcessed
private long voxelsProcessed
-
barMarker
private int barMarker
-
oldBarMarker
private int oldBarMarker
-
bitMask
private java.util.BitSet bitMask
-
validVoxels
private int validVoxels
-
wholeImage
private boolean wholeImage
-
exitStatusImage
private ModelImage exitStatusImage
-
useLog
private boolean useLog
-
functionFit
private int functionFit
-
numVariables
private int numVariables
-
useAltTimeTag
private boolean useAltTimeTag
-
altTimeTag
private java.lang.String altTimeTag
-
-
Constructor Detail
-
AlgorithmTimeFitting
public AlgorithmTimeFitting(ModelImage destImage, ModelImage srcImage, ModelImage exitStatusImage, boolean useLog, int functionFit, int numVariables, boolean findInitialFromData, double[] initial, boolean[] useBounds, double[] lowBounds, double[] highBounds)
Creates a new AlgorithmTimeFitting object.
-
AlgorithmTimeFitting
public AlgorithmTimeFitting(ModelImage destImage, ModelImage srcImage, ModelImage exitStatusImage, boolean useLog, int functionFit, int numVariables, boolean findInitialFromData, double[] initial, boolean[] useBounds, double[] lowBounds, double[] highBounds, boolean useAltTimeTag, java.lang.String altTimeTag)
Creates a new AlgorithmTimeFitting object.
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
starts the algorithm.- Specified by:
runAlgorithmin classAlgorithmBase
-
input
public void input(double[] y_array, int i)
-
output
public void output(double[] params, int i, int status, double chi_squared)
-
-