edu.jhu.ece.iacl.algorithms.dti
Class DTEMRLTensor

java.lang.Object
  extended by edu.jhu.ece.iacl.algorithms.dti.DTEMRLTensor

public class DTEMRLTensor
extends java.lang.Object

This class is used to minimize the least likelihood estimator from data from diffusion weighted imaging. It appears that all the algorithms but Line Search using Newton's method are very stable. The Line Searches are fairly slow since they have to iterate through the optimizer so many times. Both Downhill Simplex and LM are very fast, with Downhill Simplex only slightly faster with this function. With nicer functions LM can be significantly faster than Downhill Simplex as demonstrated by the optimization of simpler functions in TestNDOptimizations.

Author:
Hanlin Wan Added support for non-Euler parameterization., Bennett Landman

Field Summary
static double PLUS_EPSILON
           
 
Constructor Summary
DTEMRLTensor()
           
 
Method Summary
 void baseInit(Matrix imgMatrix, double b0, double sigma, double[] obsB0, double[] obsDW, double[] kspaceAverages)
           
 double getB0()
          Gets the value of b0
 Matrix getD()
          Gets the D matrix
 int getIterations()
          Gets the number of iterations required to calculate the result.
 double getSigma()
          Gets the value of sigma.
 void init(Matrix imgMatrix, double b0, double sigma, double[] obsB0, double[] obsDW, double[] dInit, double[] kspaceAverages)
          Initializes MLTensor with these parameters
 void init(Matrix imgMatrix, double b0, double sigma, double[] obsB0, double[] obsDW, float[] dInit, double[] kspaceAverages)
           
 double LLvalue()
          Calculates the log-likelihood (LL) value
static void LLvalue(double[] modelTruth, double sigma, double[] obs, double[] swap, double[] result)
           
 boolean optimize6D2D()
          Lets you specify which algorithm to use and the maximum number of iterations.
 boolean optimize6D2D(int method)
           
 boolean optimize6D2D(int method, int maxIter)
           
 boolean optimize8D()
          Lets you specify which algorithm to use to optimize all 8 parameters at once.
 boolean optimize8D(int method)
           
 void setB0(double b0)
           
 void setD(double[] dInit)
           
 void setD(float[] dInit)
           
 void setDFactor(double d)
          Sets the scaling factor for D.
 void setDomain(double[] min, double[] max)
          Sets the domain minimum and maximum values.
 void setLikelihoodThreshold(double t)
           
 void setMethod(int m)
          Sets the method used to calculate the derivatives.
 void setNoiseLevelPrior(double mean, double std)
           
 void setNoiseLevelPriorOff()
           
 void setSigma(double s)
           
 void setSigmaFactor(double s)
          Sets the scaling factor for sigma.
 void setStepSize(double s)
          Sets the step size used in calculating derivatives.
 void setTolerance(double t)
          Sets the tolerance.
 void setUseDirectTensorRepresentation(boolean useDirect)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUS_EPSILON

public static double PLUS_EPSILON
Constructor Detail

DTEMRLTensor

public DTEMRLTensor()
Method Detail

setLikelihoodThreshold

public void setLikelihoodThreshold(double t)

setNoiseLevelPriorOff

public void setNoiseLevelPriorOff()

setNoiseLevelPrior

public void setNoiseLevelPrior(double mean,
                               double std)

setUseDirectTensorRepresentation

public void setUseDirectTensorRepresentation(boolean useDirect)

init

public void init(Matrix imgMatrix,
                 double b0,
                 double sigma,
                 double[] obsB0,
                 double[] obsDW,
                 double[] dInit,
                 double[] kspaceAverages)
Initializes MLTensor with these parameters

Parameters:
imgMatrix - image matrix
b0 - initial b0
sigma - initial standard deviation
obsB0 - observed b0's
obsDW - observed diffusion weighted tensor

init

public void init(Matrix imgMatrix,
                 double b0,
                 double sigma,
                 double[] obsB0,
                 double[] obsDW,
                 float[] dInit,
                 double[] kspaceAverages)

baseInit

public void baseInit(Matrix imgMatrix,
                     double b0,
                     double sigma,
                     double[] obsB0,
                     double[] obsDW,
                     double[] kspaceAverages)

optimize8D

public boolean optimize8D()
Lets you specify which algorithm to use to optimize all 8 parameters at once.

Parameters:
method - 0 - Downhill Simplex; 1 - LM; 2 - Line Search using Golden Section Search 3 - Line Search using Brent's Method; 4 - Line Search using Newton
Returns:
whether the optimization was successful

optimize8D

public boolean optimize8D(int method)

optimize6D2D

public boolean optimize6D2D()
Lets you specify which algorithm to use and the maximum number of iterations. It will optimize alternate between optimizing D and optimizing b0 and sigma.

Parameters:
method - 0 - Downhill Simplex; 1 - LM; 2 - Line Search using Golden Section Search 3 - Line Search using Brent's; 4 - Line Search using Newton
maxIter - maximum number of iterations
Returns:
whether the optimization was successful

optimize6D2D

public boolean optimize6D2D(int method)

optimize6D2D

public boolean optimize6D2D(int method,
                            int maxIter)

LLvalue

public double LLvalue()
Calculates the log-likelihood (LL) value

Returns:
LLvalue

LLvalue

public static void LLvalue(double[] modelTruth,
                           double sigma,
                           double[] obs,
                           double[] swap,
                           double[] result)

getB0

public double getB0()
Gets the value of b0

Returns:
b0

setB0

public void setB0(double b0)

getSigma

public double getSigma()
Gets the value of sigma. If sigma is less than 1e-6, 1e-6 is returned.

Returns:
sigma

setSigma

public void setSigma(double s)

getD

public Matrix getD()
Gets the D matrix

Returns:
D

setD

public void setD(double[] dInit)

setD

public void setD(float[] dInit)

setSigmaFactor

public void setSigmaFactor(double s)
Sets the scaling factor for sigma. You want a value that when multiplied by sigma, you get a number in the same order of magnitude as b0. This is to ensure that when optimizing, the parameters are not too far apart. The default sigmaFactor is set to be b0/(10*sigma).

Parameters:
s - number to scale sigma by

setDFactor

public void setDFactor(double d)
Sets the scaling factor for D. The default is set to 1e6.

Parameters:
d - number to scale D by

setTolerance

public void setTolerance(double t)
Sets the tolerance. Default value is 0.001.

Parameters:
t - tolerance

setStepSize

public void setStepSize(double s)
Sets the step size used in calculating derivatives. The default is set to 0.1.

Parameters:
s - step size

setMethod

public void setMethod(int m)
Sets the method used to calculate the derivatives. The default is set to 3-point.

Parameters:
m - method

setDomain

public void setDomain(double[] min,
                      double[] max)
Sets the domain minimum and maximum values. The default values are as follows: b0 and sigma - 0.5 to 2 times the initial value D - minimum is 0. Maximum is 2 times the initial value but is at least 1e-3.

Parameters:
min - domain minimum array of size 8
max - domain maximum array of size 8

getIterations

public int getIterations()
Gets the number of iterations required to calculate the result.

Returns:
number of iterations