82 cout <<
"-- This class implements the Patlak Reference Tissue Model : " << endl;
83 cout <<
"-- Patlak CS, Blasberg RG: Graphical evaluation of blood-to-brain transfer constants from multiple-time uptake data" << endl;
84 cout <<
"-- J Cereb Blood Flow Metab 1985, 5(4):5 84-590." << endl;
85 cout <<
"-- DOI http://dx.doi.org/10.1038/jcbfm.1985.87" << endl;
86 cout <<
"-- It is used to model radiotracers which follows as 2-tissue compartment model with irreversible trapping " << endl;
87 cout <<
"-- The Patlak temporal basis functions are composed of the Patlak slope (integral of the reference TAC from the injection time " << endl;
88 cout <<
" divided by the instantaneous reference activity), and intercept (reference tissue TAC) " << endl;
90 cout <<
" It can be initialized using either an ASCII file or a list of option with the following keywords and information :" << endl;
91 cout <<
" - The ASCII file must contain the following keywords :" << endl;
92 cout <<
" 'Patlak_functions:' (mandatory) Enter the coefficients of Patlak plot and intercept for each time frame (tf) ";
93 cout <<
" on two successive lines, separated by ',' :" << endl;
94 cout <<
" -> Patlak_functions: " << endl;
95 cout <<
" -> coeff_Pplot_tf1,coeff_Pplot_tf2,...,coeff_Pplot_tfn" << endl;
96 cout <<
" -> coeff_Pintc_tf1,coeff_Pintc_tf2,...,coeff_Pintc_tfn" << endl;
97 cout <<
" 'Parametric_image_init:' (optional) path to an interfile image to be used as initialization for the parametric images" << endl;
98 cout <<
" 'Patlak_save_images:' (optional) boolean indicating if the parametric images should be saved (1) or not (0)" << 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 <<
" Parametric images will be initialized with 1.0 by default " << endl;
104 cout <<
" The parametric images estimations will be written on disk for each iteration" << endl;
123 if(
m_verbose >=2)
Cout(
"iPatlakModel::ReadAndCheckConfigurationFile ..."<< endl);
128 ifstream in_file(a_fileOptions.c_str(), ios::in);
134 Cerr(
"***** iPatlakModel::ReadAndCheckConfigurationFile -> Error while trying to read 'Patlak_save_images' flag in " << a_fileOptions << endl);
140 Cerr(
"***** iPatlakModel::ReadAndCheckConfigurationFile -> Error while trying to read configuration file at: " << a_fileOptions << endl);
162 if(
m_verbose >=2)
Cout(
"iPatlakModel::ReadAndCheckOptionsList ..."<< endl);
186 if(
m_verbose >=2)
Cout(
"iPatlakModel::CheckSpecificParameters ..."<< endl);
191 Cerr(
"***** iPatlakModel::CheckParameters() -> ImageDimensions object has not been provided !" << endl);
198 Cerr(
"***** iPatlakModel::CheckParameters() -> Wrong number of time frame basis functions !" << endl);
205 Cerr(
"***** iPatlakModel::Initialize -> Either a file or a list of options have to be selected to initialize the model, but not both ! " << endl);
212 Cerr(
"***** iPatlakModel::Initialize -> Either a file or a list of options should have been provided at this point ! " << endl);
219 Cerr(
"***** iPatlakModel::Initialize -> WARNING : the implemented Patlak model should not be used with gated reconstruction (parametric images will be the same for each gate)! " << endl);
242 if(
m_verbose >=2)
Cout(
"iPatlakModel::Initialize ..."<< endl);
247 Cerr(
"***** oDynamicModelManager::Initialize() -> Must call CheckParameters functions before Initialize() !" << endl);
280 Cerr(
"***** iPatlakModel::Initialize -> Error while trying to read Patlak functions coefficients !" << endl);
286 string input_image =
"";
287 int return_value = 0;
290 "Parametric_images_init",
295 if( return_value == 0)
305 Cerr(
"***** iPatlakModel::Initialize -> Error while trying to read the provided initialization parametric images : " << input_image << endl);
312 else if( return_value == 1)
314 Cerr(
"***** iPatlakModel::Initialize -> Error while trying to read Patlak functions coefficients !" << endl);
330 Cerr(
"***** iPatlakModel::Initialize() -> Error while trying to read configuration file at: " <<
m_fileOptions << endl);
351 "Patlak model configuration"))
353 Cerr(
"***** iPatlakModel::Initialize() -> Failed to correctly read the list of parameters in command-line options !" << endl);
378 Cout(
"iPatlakModel::Initialize() -> Patlak Normalized Time TAC coefficients :" << endl);
383 Cout(
"iPatlakModel::Initialize() -> Patlak Reference Time TAC coefficients :" << endl);
412 if(
m_verbose >=2)
Cout(
"iPatlakModel::EstimateModelParameters ..." <<endl);
417 Cerr(
"***** iPatlakModel::EstimateModelParameters() -> Called while not initialized !" << endl);
453 double temporal_basis_functions_norm = 0;
461 #pragma omp parallel for private(v) schedule(guided)
464 double corr_factor = 0.;
474 if (corr_factor > 0.)
498 if(
m_verbose >= 2)
Cout(
"iPatlakModel::FitModel ... " <<endl);
503 Cerr(
"***** iPatlakModel::FitModel() -> Called while not initialized !" << endl);
543 if(
m_verbose >=2)
Cout(
"iPatlakModel::SaveParametricImages ..." <<endl);
586 stringstream ss; ss << a_ite + 1;
587 path_to_image.append(
"patlak_it").append(ss.str());
597 Cerr(
"***** iPatlakModel::SaveParametricImages()-> Error writing Interfile of output image !" << endl);
#define INTF_LERP_DISABLED
Declaration of class iPatlakModel.
int ReadAndCheckOptionsList(string a_listOptions)
This function is used to read parameters from a string.
void ShowHelp()
Print out specific help about the implementation of the Patlak model and its initialization.
int EstimateModelParameters(oImageSpace *ap_Image, int a_ite, int a_sset)
Estimate Patlak parametric images.
int FitModel(oImageSpace *ap_Image, int a_ite, int a_sset)
Estimate image using Patlak parametric images and basis functions.
oImageDimensionsAndQuantification * mp_ID
This is the mother class of dynamic model classes.
int Initialize()
This function is used to initialize Patlak parametric images and basis functions. ...
int CheckSpecificParameters()
This function is used to check whether all member variables have been correctly initialized or not...
iPatlakModel()
Constructor of iPatlakModel. Simply set all data members to default values.
static sOutputManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
const string & GetPathName()
FLTNB ****** m6p_backwardImage
Singleton class that manages output writing on disk (images, sinograms, etc). It also manages loggi...
int ReadDataASCIIFile(const string &a_file, const string &a_keyword, T *ap_return, int a_nbElts, bool a_mandatoryFlag)
Look for "a_nbElts" elts in the "a_file" file matching the "a_keyword" string passed as parameter a...
int ReadAndCheckConfigurationFile(string a_fileOptions)
This function is used to read options from a configuration file.
#define KEYWORD_MANDATORY
int SaveParametricImages(int a_iteration)
Write parametric images on disk if 'm_savePImgFlag' is enabled.
const string & GetBaseName()
int GetNbCardGates()
Get the number of cardiac gates.
int IntfWriteImgDynCoeffFile(const string &a_pathToImg, FLTNB **a2p_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, int a_nbParImgs, int vb)
Function dedicated to Interfile image writing for dynamic coefficients images.
This class holds all the matrices in the image domain that can be used in the algorithm: image...
int GetNbTimeFrames()
Get the number of time frames.
INTNB GetNbVoxXYZ()
Get the total number of voxels.
FLTNB ** m2p_parametricImages
~iPatlakModel()
Destructor of iPatlakModel.
int GetNbRespGates()
Get the number of respiratory gates.
int IntfReadImgDynCoeffFile(const string &a_pathToHeaderFile, FLTNB **a2p_ImgMatrix, oImageDimensionsAndQuantification *ap_ID, int a_nbFbases, int vb, bool a_lerpFlag)
Function dedicated to Interfile image reading for dynamic coefficients images.
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.