Class SpinSignalDifference
- java.lang.Object
-
- edu.rit.mri.SpinSignalDifference
-
- All Implemented Interfaces:
- VectorFunction
public class SpinSignalDifference extends java.lang.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
Constructors Constructor and Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intargumentLength()Returns the length of the argument vector, N.voiddf(double[] x, double[][] dydx)Calculate this function's Jacobian matrix with the given argument vector.voidf(double[] x, double[] y)Evaluate this function with the given argument vector.intresultLength()Returns the length of the result vector, M.
-
-
-
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:
java.lang.NullPointerException- (unchecked exception) Thrown if data_series is null.java.lang.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:
java.lang.NullPointerException- (unchecked exception) Thrown if t_series is null or S_series is null.java.lang.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:
resultLengthin interfaceVectorFunction- Returns:
- M.
-
argumentLength
public int argumentLength()
Returns the length of the argument vector, N.- Specified by:
argumentLengthin interfaceVectorFunction- 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:
fin interfaceVectorFunction- 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:
dfin interfaceVectorFunction- 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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG