Package gov.nih.mipav.model.algorithms
Class AlgorithmTreT2
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmTProcess
-
- gov.nih.mipav.model.algorithms.AlgorithmTreT2
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmTreT2 extends AlgorithmTProcess
This class is adapted from the ImageJ version originally written by Sean Deoni while working at the National Institutes of Health. This class performs T2 calculations given any number of SPGR images.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nih.mipav.model.algorithms.AlgorithmTProcess
AlgorithmTProcess.CalculateT
-
-
Field Summary
Fields Modifier and Type Field Description private ModelImage
b0ResultStack
private ViewJFrameImage
b0ResultWindow
private java.lang.String
b1ImageName
private int[]
bestToWorst
private double[]
contraction
private JDialogTreT2
dialog
The dialog for accessing GUI specific information, also set during scripting.private double[]
expansion
private boolean
hardInterrupt
private ModelImage
m0ResultStack
private ViewJFrameImage
m0ResultWindow
private ModelImage
r2ResultStack
private ViewJFrameImage
r2ResultWindow
private double[]
reflection
private double[]
shrink
private double[][]
simplex
private double[]
simplexCentre
private double[]
simplexLineValues
private double[]
simplexResiduals
private java.lang.String[]
ssfpImageNames_phase0
private java.lang.String[]
ssfpImageNames_phase180
private java.lang.String
t1ImageName
private ModelImage
t2ResultStack
private ViewJFrameImage
t2ResultWindow
The frames for result images (if null at end of algorithm src ModelImage is destroyed)private double[]
treFA_phase0
private double[]
treFA_phase180
private double[]
twoPContraction
private double[]
twoPExpansion
private double[]
twoPReflection
private double[]
twoPShrink
private double[][]
twoPSimplex
private double[]
twoPSimplexCentre
private double[]
twoPSimplexLineValues
private double[]
twoPSimplexResiduals
-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmTProcess
computeDataThreads, do4D, Gaussian, hardNoiseThreshold, loadDataThreads, lowerLeftCorner, lowerRightCorner, MAX_PROCESS, noiseScale, nSlices, processDataThreads, upperLeftCorner, upperRightCorner, useHardThresholding, useSmartThresholding
-
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 AlgorithmTreT2(ModelImage destImage, ModelImage srcImage, JDialogTreT2 dialog, double[] treFAPhase0, double[] treFAPhase180, java.lang.String[] ssfpImageNamesPhase0, java.lang.String[] ssfpImageNamesPhase180, java.lang.String t1ImageName, java.lang.String b1ImageName, double[] simplexLineValues, double[] simplexResiduals, double[] simplexCentre, double[] reflection, double[] expansion, double[] contraction, double[] shrink, double[][] simplex, double[] twoPSimplexLineValues, double[] twoPSimplexResiduals, double[] twoPSimplexCentre, double[] twoPReflection, double[] twoPExpansion, double[] twoPContraction, double[] twoPShrink, double[][] twoPSimplex, int[] bestToWorst, java.lang.String[] wList)
AlgorithmTreT2(JDialogTreT2 dialog, double[] treFAPhase0, double[] treFAPhase180, java.lang.String[] ssfpImageNamesPhase0, java.lang.String[] ssfpImageNamesPhase180, java.lang.String t1ImageName, java.lang.String b1ImageName, double[] simplexLineValues, double[] simplexResiduals, double[] simplexCentre, double[] reflection, double[] expansion, double[] contraction, double[] shrink, double[][] simplex, double[] twoPSimplexLineValues, double[] twoPSimplexResiduals, double[] twoPSimplexCentre, double[] twoPReflection, double[] twoPExpansion, double[] twoPContraction, double[] twoPShrink, double[][] twoPSimplex, int[] bestToWorst, java.lang.String[] wList)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
calculate2PResiduals(double[] simplexLineValues, double b0, double t1, double tr, double[] Signal, double[] sina, double[] cosa, double[] phaseIncrements, int N)
void
calculateBestToWorst(double[] simplexResiduals, int[] bestToWorst, int numVertices)
double
calculateResiduals(double[] simplexLineValues, double t1, double tr, double[] Signal, double[] sina, double[] cosa, double[] phaseIncrements, int N)
void
calculateT2with0Phase()
void
calculateT2with180Phase()
void
calculateT2withApproximateModeling()
void
calculateT2withFullModeling()
double
calculateTwoPResiduals(double[] simplexLineValues, double b0, double t1, double tr, double[] Signal, double[] sina, double[] cosa, double[] phaseIncrements, int N)
protected void
computeProcessors()
protected void
displayImages()
void
finalize()
Prepares this class for destruction.ModelImage
getB0ResultStack()
ModelImage
getM0ResultStack()
ModelImage
getR2ResultStack()
ModelImage
getT2ResultStack()
void
reduceB0Field(double[][] b0Field, double resonancePeriod, int width, int height)
void
resetSliceToZero(double[][] field, int width, int height)
void
runAlgorithm()
Actually runs the algorithm.void
smoothField(double[][] field, float[][] fieldValues, int width, int height, int k)
void
smoothFieldB(double[][] field, int width, int height)
void
swapMatrixForVector(double[][] fieldField, float[][] fieldValues, int k, int width, int height)
void
swapMatrixForVectorB(double[][] fieldField, float[][] fieldValues, int k, int width, int height)
void
threePDownHillSimplex(double[] optimization, double[] initialGuess, double t1, double tr, double[] ssfpSampleData, double[] sina, double[] cosa, double[] phaseIncrements, int N)
void
twoPDownHillSimplex(double[] optimization, double[] initialGuess, double b0, double t1, double tr, double[] ssfpSampleData, double[] sina, double[] cosa, double[] phaseIncrements, int N)
-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmTProcess
cloneFileInfo
-
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
-
treFA_phase0
private final double[] treFA_phase0
-
treFA_phase180
private final double[] treFA_phase180
-
simplexLineValues
private double[] simplexLineValues
-
simplexResiduals
private double[] simplexResiduals
-
simplexCentre
private double[] simplexCentre
-
reflection
private double[] reflection
-
expansion
private double[] expansion
-
contraction
private double[] contraction
-
shrink
private double[] shrink
-
simplex
private double[][] simplex
-
twoPSimplexLineValues
private double[] twoPSimplexLineValues
-
twoPSimplexResiduals
private double[] twoPSimplexResiduals
-
twoPSimplexCentre
private double[] twoPSimplexCentre
-
twoPReflection
private double[] twoPReflection
-
twoPExpansion
private double[] twoPExpansion
-
twoPContraction
private double[] twoPContraction
-
twoPShrink
private double[] twoPShrink
-
twoPSimplex
private double[][] twoPSimplex
-
bestToWorst
private int[] bestToWorst
-
hardInterrupt
private boolean hardInterrupt
-
t2ResultStack
private ModelImage t2ResultStack
-
m0ResultStack
private ModelImage m0ResultStack
-
r2ResultStack
private ModelImage r2ResultStack
-
b0ResultStack
private ModelImage b0ResultStack
-
t2ResultWindow
private ViewJFrameImage t2ResultWindow
The frames for result images (if null at end of algorithm src ModelImage is destroyed)
-
m0ResultWindow
private ViewJFrameImage m0ResultWindow
-
r2ResultWindow
private ViewJFrameImage r2ResultWindow
-
b0ResultWindow
private ViewJFrameImage b0ResultWindow
-
ssfpImageNames_phase0
private java.lang.String[] ssfpImageNames_phase0
-
ssfpImageNames_phase180
private java.lang.String[] ssfpImageNames_phase180
-
t1ImageName
private java.lang.String t1ImageName
-
b1ImageName
private java.lang.String b1ImageName
-
dialog
private final JDialogTreT2 dialog
The dialog for accessing GUI specific information, also set during scripting.
-
-
Constructor Detail
-
AlgorithmTreT2
public AlgorithmTreT2(JDialogTreT2 dialog, double[] treFAPhase0, double[] treFAPhase180, java.lang.String[] ssfpImageNamesPhase0, java.lang.String[] ssfpImageNamesPhase180, java.lang.String t1ImageName, java.lang.String b1ImageName, double[] simplexLineValues, double[] simplexResiduals, double[] simplexCentre, double[] reflection, double[] expansion, double[] contraction, double[] shrink, double[][] simplex, double[] twoPSimplexLineValues, double[] twoPSimplexResiduals, double[] twoPSimplexCentre, double[] twoPReflection, double[] twoPExpansion, double[] twoPContraction, double[] twoPShrink, double[][] twoPSimplex, int[] bestToWorst, java.lang.String[] wList)
-
AlgorithmTreT2
public AlgorithmTreT2(ModelImage destImage, ModelImage srcImage, JDialogTreT2 dialog, double[] treFAPhase0, double[] treFAPhase180, java.lang.String[] ssfpImageNamesPhase0, java.lang.String[] ssfpImageNamesPhase180, java.lang.String t1ImageName, java.lang.String b1ImageName, double[] simplexLineValues, double[] simplexResiduals, double[] simplexCentre, double[] reflection, double[] expansion, double[] contraction, double[] shrink, double[][] simplex, double[] twoPSimplexLineValues, double[] twoPSimplexResiduals, double[] twoPSimplexCentre, double[] twoPReflection, double[] twoPExpansion, double[] twoPContraction, double[] twoPShrink, double[][] twoPSimplex, int[] bestToWorst, java.lang.String[] wList)
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in classAlgorithmBase
-
calculateT2with0Phase
public void calculateT2with0Phase()
-
calculateT2with180Phase
public void calculateT2with180Phase()
-
calculateT2withApproximateModeling
public void calculateT2withApproximateModeling()
-
calculateT2withFullModeling
public void calculateT2withFullModeling()
-
twoPDownHillSimplex
public void twoPDownHillSimplex(double[] optimization, double[] initialGuess, double b0, double t1, double tr, double[] ssfpSampleData, double[] sina, double[] cosa, double[] phaseIncrements, int N)
-
threePDownHillSimplex
public void threePDownHillSimplex(double[] optimization, double[] initialGuess, double t1, double tr, double[] ssfpSampleData, double[] sina, double[] cosa, double[] phaseIncrements, int N)
-
calculateTwoPResiduals
public double calculateTwoPResiduals(double[] simplexLineValues, double b0, double t1, double tr, double[] Signal, double[] sina, double[] cosa, double[] phaseIncrements, int N)
-
calculateResiduals
public double calculateResiduals(double[] simplexLineValues, double t1, double tr, double[] Signal, double[] sina, double[] cosa, double[] phaseIncrements, int N)
-
calculate2PResiduals
public double calculate2PResiduals(double[] simplexLineValues, double b0, double t1, double tr, double[] Signal, double[] sina, double[] cosa, double[] phaseIncrements, int N)
-
calculateBestToWorst
public void calculateBestToWorst(double[] simplexResiduals, int[] bestToWorst, int numVertices)
-
reduceB0Field
public void reduceB0Field(double[][] b0Field, double resonancePeriod, int width, int height)
-
smoothField
public void smoothField(double[][] field, float[][] fieldValues, int width, int height, int k)
-
smoothFieldB
public void smoothFieldB(double[][] field, int width, int height)
-
resetSliceToZero
public void resetSliceToZero(double[][] field, int width, int height)
-
swapMatrixForVector
public void swapMatrixForVector(double[][] fieldField, float[][] fieldValues, int k, int width, int height)
-
swapMatrixForVectorB
public void swapMatrixForVectorB(double[][] fieldField, float[][] fieldValues, int k, int width, int height)
-
getT2ResultStack
public ModelImage getT2ResultStack()
-
getM0ResultStack
public ModelImage getM0ResultStack()
-
getR2ResultStack
public ModelImage getR2ResultStack()
-
getB0ResultStack
public ModelImage getB0ResultStack()
-
computeProcessors
protected void computeProcessors()
- Specified by:
computeProcessors
in classAlgorithmTProcess
-
displayImages
protected void displayImages()
- Specified by:
displayImages
in classAlgorithmTProcess
-
-