edu.rit.mri
Class SpinSignalDifference

java.lang.Object
  extended by edu.rit.mri.SpinSignalDifference
All Implemented Interfaces:
VectorFunction

public class SpinSignalDifference
extends Object
implements VectorFunction

Class SpinSignalDifference provides an object that computes the difference between a measured spin signal and a model spin signal. Class SpinSignalDifference implements interface VectorFunction.

An instance of class SpinSignalDifference is constructed with two data series, each an instance of class Series. The first data series contains the measurement times ti. The second data series contains the measured spin signals S(ti). The vector function's result vector length, M, is the same as the length of the data series.

The vector function's argument vector x gives parameters for the model spin signal. The argument vector consists of one or more pairs of consecutive values. Each pair of consecutive values corresponds to one tissue. The first value of the pair is ρj, the spin density for tissue j. The second value of the pair is Rj, the spin relaxation rate for tissue j. The number of tissues is specified as a constructor parameter. The vector function's argument vector length, N, is twice the number of tissues.

The vector function is calculated as follows. For each i, 0 <= i <= M−1:

fi(x) = Model S(ti;x) − Measured S(ti)

The model spin signal is defined as follows:

Model S(ti;x) = Σjρj [1 − 2 exp(−Rj ti)]

To find the model spin signal parameters x that best fit the measured spin signal, use an instance of class SpinSignalDifference with the nonlinear least squares algorithm in class NonLinearLeastSquares.


Constructor Summary
SpinSignalDifference(Series t_series, Series S_series, int L)
          Construct a new spin signal difference function.
SpinSignalDifference(XYSeries data_series, int L)
          Construct a new spin signal difference function.
 
Method Summary
 int argumentLength()
          Returns the length of the argument vector, N.
 void df(double[] x, double[][] dydx)
          Calculate this function's Jacobian matrix with the given argument vector.
 void f(double[] x, double[] y)
          Evaluate this function with the given argument vector.
 int resultLength()
          Returns the length of the result vector, M.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpinSignalDifference

public SpinSignalDifference(XYSeries data_series,
                            int L)
Construct a new spin signal difference function.

Parameters:
data_series - X-Y series of measured time values (X) and measured spin signal values (Y).
L - Number of tissues in the model spin signal.
Throws:
NullPointerException - (unchecked exception) Thrown if data_series is null.
IllegalArgumentException - (unchecked exception) Thrown if the series' length is 0. Thrown if L <= 0.

SpinSignalDifference

public SpinSignalDifference(Series t_series,
                            Series S_series,
                            int L)
Construct a new spin signal difference function.

Parameters:
t_series - Series of measured time values.
S_series - Series of measured spin signal values.
L - Number of tissues in the model spin signal.
Throws:
NullPointerException - (unchecked exception) Thrown if t_series is null or S_series is null.
IllegalArgumentException - (unchecked exception) Thrown if either series' length is 0. Thrown if the two series have different lengths. Thrown if L <= 0.
Method Detail

resultLength

public int resultLength()
Returns the length of the result vector, M.

Specified by:
resultLength in interface VectorFunction
Returns:
M.

argumentLength

public int argumentLength()
Returns the length of the argument vector, N.

Specified by:
argumentLength in interface VectorFunction
Returns:
N.

f

public void f(double[] x,
              double[] y)
Evaluate this function with the given argument vector. The result is stored in the vector y. Specifically, for i = 0 to M−1, yi = fi(x).

Specified by:
f in interface VectorFunction
Parameters:
x - Argument vector (input). Must be an N-element array.
y - Result vector (output). Must be an M-element array.
Throws:
DomainException - (unchecked exception) Thrown if any argument in x is outside the allowed set of values for this function.
RangeException - (unchecked exception) Thrown if any element of the result vector is outside the range of type double.

df

public void df(double[] x,
               double[][] dydx)
Calculate this function's Jacobian matrix with the given argument vector. The result is stored in the matrix dydx. Specifically, for i = 0 to M−1 and j = 0 to N−1, dydxi,j = ∂fi(x) ⁄ ∂xj .

Specified by:
df in interface VectorFunction
Parameters:
x - Argument vector (input). Must be an N-element array.
dydx - Jacobian matrix (output). Must be an M×N-element matrix.
Throws:
DomainException - (unchecked exception) Thrown if any argument in x is outside the allowed set of values for this function.
RangeException - (unchecked exception) Thrown if any element of the Jacobian matrix is outside the range of type double.


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.