/code/paramsCal.m
http://ne-proj.googlecode.com/ · Objective C · 37 lines · 33 code · 4 blank · 0 comment · 2 complexity · 570d9308bdb4d517de8dd2652ed7f0c4 MD5 · raw file
- %********************************************************************************************************
- % "paramsCal.m" calculates Tconst(ADC or T2) and M0.
- % inputs:
- % M- The 3D image which was acquired or a set of points.
- % x- vector with the 'x' value of the signal (b value or TE, respectively).
- % Tconst- The name of the time constant that the user wishs to find: ADC or T2.
- % data_type- 3D matrix (=3D) or set of points (=simple).
- % outputs:
- % M0 - The signal in t=0.
- % M0_err- The error in M0.
- % TconstVal- The value of the time constant (ADC or T2).
- % TconstVal_err- The error in TconstVal.
- % R- The R square measurement.
- % xval- A matrix which describes how mush points were used to compute
- % the T. const in each voxel.
- %*********************************************************************************************************
-
- function [M0, M0_err, TconstVal, TconstVal_err, R, xval]=paramsCal (M, x, Tconst, data_type, noise)
-
- if strcmp(data_type, 'simple')
- [b,a,b_err,a_err,R]=simple_WLS(M, x, noise);
- xval=0;
- else
- [b,a,b_err,a_err,R, xval]=WLS(M, x, noise);
- end
-
- if strcmp(Tconst,'ADC')
- TconstVal=-a;
- TconstVal_err=a_err;
- elseif strcmp(Tconst,'T2')
- TconstVal=-1./a;
- TconstVal_err=a_err./a.^2;
- end
-
- M0=exp(b);
- M0_err=M0.*b_err;
- end