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 ModelImageb0ResultStackprivate ViewJFrameImageb0ResultWindowprivate java.lang.Stringb1ImageNameprivate int[]bestToWorstprivate double[]contractionprivate JDialogTreT2dialogThe dialog for accessing GUI specific information, also set during scripting.private double[]expansionprivate booleanhardInterruptprivate ModelImagem0ResultStackprivate ViewJFrameImagem0ResultWindowprivate ModelImager2ResultStackprivate ViewJFrameImager2ResultWindowprivate double[]reflectionprivate double[]shrinkprivate double[][]simplexprivate double[]simplexCentreprivate double[]simplexLineValuesprivate double[]simplexResidualsprivate java.lang.String[]ssfpImageNames_phase0private java.lang.String[]ssfpImageNames_phase180private java.lang.Stringt1ImageNameprivate ModelImaget2ResultStackprivate ViewJFrameImaget2ResultWindowThe frames for result images (if null at end of algorithm src ModelImage is destroyed)private double[]treFA_phase0private double[]treFA_phase180private double[]twoPContractionprivate double[]twoPExpansionprivate double[]twoPReflectionprivate double[]twoPShrinkprivate double[][]twoPSimplexprivate double[]twoPSimplexCentreprivate double[]twoPSimplexLineValuesprivate 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 doublecalculate2PResiduals(double[] simplexLineValues, double b0, double t1, double tr, double[] Signal, double[] sina, double[] cosa, double[] phaseIncrements, int N)voidcalculateBestToWorst(double[] simplexResiduals, int[] bestToWorst, int numVertices)doublecalculateResiduals(double[] simplexLineValues, double t1, double tr, double[] Signal, double[] sina, double[] cosa, double[] phaseIncrements, int N)voidcalculateT2with0Phase()voidcalculateT2with180Phase()voidcalculateT2withApproximateModeling()voidcalculateT2withFullModeling()doublecalculateTwoPResiduals(double[] simplexLineValues, double b0, double t1, double tr, double[] Signal, double[] sina, double[] cosa, double[] phaseIncrements, int N)protected voidcomputeProcessors()protected voiddisplayImages()voidfinalize()Prepares this class for destruction.ModelImagegetB0ResultStack()ModelImagegetM0ResultStack()ModelImagegetR2ResultStack()ModelImagegetT2ResultStack()voidreduceB0Field(double[][] b0Field, double resonancePeriod, int width, int height)voidresetSliceToZero(double[][] field, int width, int height)voidrunAlgorithm()Actually runs the algorithm.voidsmoothField(double[][] field, float[][] fieldValues, int width, int height, int k)voidsmoothFieldB(double[][] field, int width, int height)voidswapMatrixForVector(double[][] fieldField, float[][] fieldValues, int k, int width, int height)voidswapMatrixForVectorB(double[][] fieldField, float[][] fieldValues, int k, int width, int height)voidthreePDownHillSimplex(double[] optimization, double[] initialGuess, double t1, double tr, double[] ssfpSampleData, double[] sina, double[] cosa, double[] phaseIncrements, int N)voidtwoPDownHillSimplex(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:
finalizein classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBaseActually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithmin 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:
computeProcessorsin classAlgorithmTProcess
-
displayImages
protected void displayImages()
- Specified by:
displayImagesin classAlgorithmTProcess
-
-