84 cout <<
"-- This class implements the Patlak Reference Tissue Model : " << endl;
85 cout <<
"-- Patlak CS, Blasberg RG: Graphical evaluation of blood-to-brain transfer constants from multiple-time uptake data" << endl;
86 cout <<
"-- J Cereb Blood Flow Metab 1985, 5(4):5 84-590." << endl;
87 cout <<
"-- DOI http://dx.doi.org/10.1038/jcbfm.1985.87" << endl;
88 cout <<
"-- It is used to model radiotracers which follows as 2-tissue compartment model with irreversible trapping " << endl;
89 cout <<
"-- The Patlak temporal basis functions are composed of the Patlak slope (integral of the reference TAC from the injection time " << endl;
90 cout <<
" divided by the instantaneous reference activity), and intercept (reference tissue TAC) " << endl;
92 cout <<
" It can be initialized using either an ASCII file or a list of option with the following keywords and information :" << endl;
93 cout <<
" As this class inherits from the iLinearModel class, the following parameters must be declared inside the couple of the following specific tags: " << endl;
94 cout <<
" - DYNAMIC FRAMING/ENDDF " << endl;
95 cout <<
" - The ASCII file must contain the following keywords :" << endl;
96 cout <<
" 'Basis_functions:' (mandatory) Enter the coefficients of Patlak plot and intercept for each time frame (tf) " << endl;
97 cout <<
" on two successive lines, separated by ',' :" << endl;
98 cout <<
" -> Patlak_functions: " << endl;
99 cout <<
" -> coeff_Pplot_tf1,coeff_Pplot_tf2,...,coeff_Pplot_tfn" << endl;
100 cout <<
" -> coeff_Pintc_tf1,coeff_Pintc_tf2,...,coeff_Pintc_tfn" << endl;
101 cout <<
" 'Parametric_image_init: path ' (optional) path to an interfile image to be used as initialization for the parametric images." << endl;
102 cout <<
" -> Optimisation_method : x (mandatory) optimization method available options: " << endl;
103 cout <<
" x=0: Direct ( Implementation of basis functions side by system matrix in each tomographic iterative loop " << endl;
104 cout <<
" x=1: Nested EM " << endl;
105 cout <<
" x=2: Iterative non-negative Least-Square " << endl;
106 cout <<
" (C.L. Lawson and R.J. Hanson, Solving Least Squares Problems)" << endl;
107 cout <<
" x=3: Least-Squares linear regression " << endl;
109 cout <<
" - The list of options must contain the coefficients of both Patlak functions separated by commas, with the following template :" << endl;
110 cout <<
" coeff_Pplot_tf1,coeff_Pplot_tf2,...,coeff_Pplot_tfn,";
111 cout <<
" coeff_Pintc_tf1,coeff_Pintc_tf2,...,coeff_Pintc_tfn "<< endl;
112 cout <<
" Default optimization method is Nested EM "<< endl;
113 cout <<
" Parametric images will be uniformly initialized with 0.001 and 1. for Patlak slope and intercept by default " << endl;
114 cout <<
" The parametric images estimations will be written on disk for each iteration" << endl;
116 cout <<
" The following keywords are common to all dynamic models :" << endl;
117 cout <<
" 'AIC_input_file: path/to/file' : This option will enable the Creation of Patlak Basis functions for direct Patlak Reconstruction ( For nested recon look in -help-dynamic-model ) . " << endl;
118 cout <<
" Provide text file with the Arterial Input Curve data points and time points, in two different horizontal lines starting with " << endl;
119 cout <<
" 'AIC_time_points:'" << endl;
120 cout <<
" and " << endl;
121 cout <<
" 'AIC_data_points:' " << endl;
122 cout <<
" to indicate which dataset corresponds to each line. Values must be separated by commas." << endl;
123 cout <<
" Also provide a value of the total number of data points, on a new line starting with " << endl;
124 cout <<
" 'AIC_number_of_points:'" << endl;
125 cout <<
" 'Number of iterations before image update: x' Set a number 'x' of iteration to reach before using the model to generate the images at each frames/gates" << endl;
126 cout <<
" (Default x == 0) " << endl;
127 cout <<
" 'No image update: x' If set to 1, the reconstructed images for the next iteration/subset are not reestimated using the model" << endl;
128 cout <<
" (Default x == 0) (the code just performs standard independent reconstruction of each frames/gates) " << endl;
129 cout <<
" 'No parameters update: x' If set to 1, the parameters / functions of the model are not estimated with the image" << endl;
130 cout <<
" (Default x == 0) (this could be used to test The EstimateImageWithModel() function with specific user-provided parametric images) " << endl;
131 cout <<
" 'Save parametric images : x' Enable (1)/Disable(0) saving parametric images on disk" << endl;
132 cout <<
" (Default x == 1) " << endl;
133 cout <<
" 'Save blacklisted voxels images : x' Enable (1)/Disable(0) saving blacklisted voxels images on disk" << endl;
134 cout <<
" (Default x == 0) " << endl;
154 if(
m_verbose >=3)
Cout(
"iLinearPatlakModel::ReadAndCheckConfigurationFileSpecific ..."<< endl);
159 Cerr(
"***** iLinearPatlakModel::ReadAndCheckConfigurationFileSpecific -> Error while trying to read configuration file for generic options of all linear models" << endl);
180 if(
m_verbose >=3)
Cout(
"iLinearPatlakModel::ReadAndCheckOptionsList ..."<< endl);
206 Cerr(
"***** iLinearPatlakModel::CheckSpecificParameters -> A problem occurred while checking specific parameters ! " << endl);
226 if(
m_verbose >=2)
Cout(
"iLinearPatlakModel::InitializeSpecific ..."<< endl);
231 Cerr(
"***** iLinearPatlakModel::InitializeSpecific() -> Error while performing generic initialisations for linear models !" << endl);
252 "Patlak model configuration"))
254 Cerr(
"***** iPatlakModel::Initialize() -> Failed to correctly read the list of parameters in command-line options !" << endl);
273 if(
m_verbose >=2)
Cout(
"iLinearPatlakModel::Estimating Patlak basis functions ..."<< endl);
285 HPFLTNB halfDeltaT = (0.001/2);
287 a_PatlakTAC[0] = a_AICIntrpY[0] * 0.001;
289 for (uint32_t i=1 ;i<(a_frameTimeStopInMs[a_nbTimeFrames - 1]);i++)
291 RunningSum += a_AICIntrpY[i-1] ;
292 a_PatlakTAC[i] = (a_AICIntrpY[0] + 2 * RunningSum + a_AICIntrpY[i])*halfDeltaT ;
301 for (
int fr = 0; fr < a_nbTimeFrames; fr++)
305 for (uint32_t i = a_frameTimeStartInMs[fr]+1 ;i <(a_frameTimeStopInMs[fr]);i++)
307 RunningSum+=a_PatlakTAC[i];
310 2 * RunningSum + a_PatlakTAC[a_frameTimeStopInMs[fr]])*halfDeltaT) ;
315 for (
int fr = 0; fr < a_nbTimeFrames; fr++)
319 for (uint32_t i = a_frameTimeStartInMs[fr]+1; i < (a_frameTimeStopInMs[fr]); i++)
321 RunningSum += a_AICIntrpY[i];
324 2 * RunningSum + a_AICIntrpY[a_frameTimeStopInMs[fr]]) * halfDeltaT);
328 if ( a_PatlakTAC )
delete a_PatlakTAC;
oArterialInputCurve * mp_ArterialInputCurve
oImageDimensionsAndQuantification * mp_ID
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...
Declaration of class iLinearPatlakModel.
void ShowBasisFunctions()
This function is used to print the basis functions.
uint32_t * GetFramesTimeStopArray(int a_bed)
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.
FLTNB ** m2p_nestedModelTimeBasisFunctions
uint32_t * GetFramesTimeStartsArray(int a_bed)
Get the array of frame start times for a bed in Ms at uint32_t.
FLTNB ** m2p_parametricImages
~iLinearPatlakModel()
Destructor of iLinearPatlakModel.
void ShowHelp()
Print out specific help about the implementation of the Patlak model and its initialization.
int GetNbTimeFrames()
Get the number of time frames.
INTNB GetNbVoxXYZ()
Get the total number of voxels.
int ReadAndCheckOptionsList(string a_listOptions)
This function is used to read parameters from a string.
#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. ...
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.