9 #include "iLinearPatlakModel.hh" 62 cout <<
"-- This class implements the Patlak Reference Tissue Model : " << endl;
63 cout <<
"-- Patlak CS, Blasberg RG: Graphical evaluation of blood-to-brain transfer constants from multiple-time uptake data" << endl;
64 cout <<
"-- J Cereb Blood Flow Metab 1985, 5(4):5 84-590." << endl;
65 cout <<
"-- DOI http://dx.doi.org/10.1038/jcbfm.1985.87" << endl;
66 cout <<
"-- It is used to model radiotracers which follows as 2-tissue compartment model with irreversible trapping " << endl;
67 cout <<
"-- The Patlak temporal basis functions are composed of the Patlak slope (integral of the reference TAC from the injection time " << endl;
68 cout <<
" divided by the instantaneous reference activity), and intercept (reference tissue TAC) " << endl;
70 cout <<
" It can be initialized using either an ASCII file or a list of option with the following keywords and information :" << endl;
72 cout <<
" For ASCII file options: " << endl;
73 cout <<
" As this class inherits from the iLinearModel class, the following parameters must be declared inside the couple of the following specific tags: " << endl;
74 cout <<
" - DYNAMIC FRAMING/ENDDF " << endl;
75 cout <<
" - The ASCII file must contain the following keywords :" << endl;
76 cout <<
" 'Basis_functions:' (optional) Enter the coefficients of the Patlak basis functions for each time frame (tf) " << endl;
77 cout <<
" on two successive lines, separated by ',' :" << endl;
78 cout <<
" -> Patlak_functions: " << endl;
79 cout <<
" -> coeff_Pplot_tf1,coeff_Pplot_tf2,...,coeff_Pplot_tfn" << endl;
80 cout <<
" -> coeff_Pintc_tf1,coeff_Pintc_tf2,...,coeff_Pintc_tfn" << endl;
82 cout <<
" 'AIC_input_file: path/to/file' (optional) As an alternative to direct input of the basis functions, the sampled Arterial Input Function can be given for " << endl;
83 cout <<
" estimation of the Patlak basis " << endl;
84 cout <<
" The file must contain the following information in successive lines, separated by ',' " << endl;
85 cout <<
" -> AIC_number_of_points: " << endl;
86 cout <<
" -> AIC_time_points: " << endl;
87 cout <<
" -> AIC_data_points: " << endl;
88 cout <<
" -> AIC_units: 'seconds' or 'minutes' " << endl;
90 cout <<
" 'Parametric_image_init: path' (optional) path to an interfile image to be used as initialization for the parametric images." << endl;
92 cout <<
" 'Optimisation_method:' x (mandatory) optimization method available options: " << endl;
93 cout <<
" x=0: Direct ( Implementation of basis functions side by system matrix within each tomographic iterative loop ) " << endl;
94 cout <<
" x=1: Nested EM " << endl;
95 cout <<
" x=2: Iterative non-negative Least-Square " << endl;
96 cout <<
" (C.L. Lawson and R.J. Hanson, Solving Least Squares Problems)" << endl;
97 cout <<
" x=3: Least-Squares linear regression " << endl;
99 cout <<
" For command line list of options: " << endl;
100 cout <<
" The list of options must contain the coefficients of both Patlak functions separated by commas, with the following template :" << endl;
101 cout <<
" coeff_Pplot_tf1,coeff_Pplot_tf2,...,coeff_Pplot_tfn,";
102 cout <<
" coeff_Pintc_tf1,coeff_Pintc_tf2,...,coeff_Pintc_tfn "<< endl;
103 cout <<
" Default optimization method is Nested EM "<< endl;
104 cout <<
" Parametric images will be uniformly initialized with 0.001 and 1. for Patlak slope and intercept by default " << endl;
105 cout <<
" The parametric images estimations will be written on disk for each iteration" << endl;
128 if(
m_verbose >=3)
Cout(
"iLinearPatlakModel::ReadAndCheckConfigurationFileSpecific ..."<< endl);
133 Cerr(
"***** iLinearPatlakModel::ReadAndCheckConfigurationFileSpecific -> Error while trying to read configuration file for generic options of all linear models" << endl);
154 if(
m_verbose >=3)
Cout(
"iLinearPatlakModel::ReadAndCheckOptionsList ..."<< endl);
180 Cerr(
"***** iLinearPatlakModel::CheckSpecificParameters -> A problem occurred while checking specific parameters ! " << endl);
200 if(
m_verbose >=2)
Cout(
"iLinearPatlakModel::InitializeSpecific ..."<< endl);
205 Cerr(
"***** iLinearPatlakModel::InitializeSpecific() -> Error while performing generic initialisations for linear models !" << endl);
226 "Patlak model configuration"))
228 Cerr(
"***** iPatlakModel::Initialize() -> Failed to correctly read the list of parameters in command-line options !" << endl);
253 if(
m_verbose >=2)
Cout(
"iLinearPatlakModel::Estimating Patlak basis functions ..."<< endl);
263 HPFLTNB* a_PatlakTAC =
new HPFLTNB[(a_frameTimeStopInMs[a_nbTimeFrames-1])];
265 HPFLTNB halfDeltaT = (0.001/2);
267 a_PatlakTAC[0] = a_AICIntrpY[0] * 0.001;
269 for (uint32_t i=1 ;i<(a_frameTimeStopInMs[a_nbTimeFrames - 1]);i++)
271 RunningSum += a_AICIntrpY[i-1] ;
272 a_PatlakTAC[i] = (a_AICIntrpY[0] + 2 * RunningSum + a_AICIntrpY[i])*halfDeltaT ;
281 for (
int fr = 0; fr < a_nbTimeFrames; fr++)
285 for (uint32_t i = a_frameTimeStartInMs[fr]+1 ;i <(a_frameTimeStopInMs[fr]);i++)
287 RunningSum+=a_PatlakTAC[i];
290 2 * RunningSum + a_PatlakTAC[a_frameTimeStopInMs[fr]])*halfDeltaT) ;
295 for (
int fr = 0; fr < a_nbTimeFrames; fr++)
299 for (uint32_t i = a_frameTimeStartInMs[fr]+1; i < (a_frameTimeStopInMs[fr]); i++)
301 RunningSum += a_AICIntrpY[i];
304 2 * RunningSum + a_AICIntrpY[a_frameTimeStopInMs[fr]]) * halfDeltaT);
309 if ( a_PatlakTAC )
delete[] a_PatlakTAC;
int ReadStringOption(const string &a_input, T *ap_return, int a_nbElts, const string &sep, const string &a_option)
Parse the 'a_input' string corresponding to the 'a_option' into 'a_nbElts' elements, using the 'sep' separator. The results are returned in the templated 'ap_return' dynamic templated array. Call "ConvertFromString()" to perform the correct conversion depending on the type of the data to convert.
oImageDimensionsAndQuantification * mp_ID
void ShowHelp()
This function is used to print out general help about dynamic models.
FLTNB ** m2p_parametricImages
int InitializeSpecificToAllLinearModels()
This function is used to initialize the parametric images and basis functions for all Linear Models...
int InitializeSpecific()
This function is used to initialize Patlak parametric images and basis functions. ...
This class implements a general linear dynamic model applied between the images of a dynamic acquisit...
void ShowBasisFunctions()
This function is used to print the basis functions.
uint32_t * GetFramesTimeStopArray(int a_bed)
FLTNB ** m2p_nestedModelTimeBasisFunctions
int CheckSpecificParametersForAllLinearModels()
This function is used to check parameters for all Linear Models. .
int ReadAndCheckConfigurationFileSpecific()
This function is used to read options from a configuration file.
uint32_t * GetFramesTimeStartsArray(int a_bed)
oArterialInputCurve * mp_ArterialInputCurve
~iLinearPatlakModel()
Destructor of iLinearPatlakModel.
int GetNbTimeFrames()
Get the number of time frames.
INTNB GetNbVoxXYZ()
Get the total number of voxels.
int ReadAndCheckOptionsList(string a_listOptions)
void ShowHelpModelSpecific()
Print out specific help about the implementation of the Patlak model and its initialization.
#define OPTIMISATION_METHOD_NESTEM
int CheckSpecificParameters()
This function is used to check whether all member variables have been correctly initialized or not...
iLinearPatlakModel()
Constructor of iLinearPatlakModel. Simply set all data members to default values. ...
int ReadAndCheckConfigurationFileSpecificToAllLinearModels()
This function is used to read parameters that are generic for all Linear Models. ...