141 cout <<
"-- This class implements a general linear dynamic model applied between the images of a dynamic acquisition." << endl;
142 cout <<
"-- The model is applied on a voxel-by-voxel basis between the images of the frames and/or respiratory/cardiac gates. " << endl;
143 cout <<
"-- The main keywords 'DYNAMIC FRAMING', 'RESPIRATORY GATING' and 'CARDIAC GATING' ahead of the parameters allow to define at which level the model parameters must be applied. " << endl;
144 cout <<
"-- Main parameters to define are:" << endl;
145 cout <<
" -> The number of basis functions / parametric images defined in the model" << endl;
146 cout <<
" -> Basis function initial values" << endl;
147 cout <<
" -> Parametric images initialization (optional)" << endl;
148 cout <<
" -> Optimisation_method : x (mandatory) optimization method for voxelwise parameters estimation." << endl;
150 cout <<
" It can be initialized using a configuration text file with the following keywords and information :" << endl;
151 cout <<
" - Mandatory keywords :" << endl;
152 cout <<
" The following keywords are mandatory for at least one dynamic image level (Dynamic frame, Respiratory gating or Cardiac gating) :" << endl;
153 cout <<
" 'Number_basis_functions:' Enter the number of basis function for each image of time frame or respiratory/cardiac gate " << endl;
154 cout <<
" 'Basis_functions:' Enter the basis function (bf) coefficients for each image (im) of time frame or respiratory/cardiac gate " << endl;
155 cout <<
" on successive lines, separated by ',' :" << endl;
156 cout <<
" -> basis_functions: " << endl;
157 cout <<
" -> coeff_bf1_im1,coeff_bf1_im2,...,coeff_bf1_imn" << endl;
158 cout <<
" -> coeff_bf2_im1,coeff_bf2_im2,...,coeff_bf2_imn" << endl;
159 cout <<
" -> etc..." << endl;
160 cout <<
" Optimisation_method : x (mandatory) optimization method available options: " << endl;
161 cout <<
" x=0: Direct ( Implementation of basis functions side by system matrix in each tomographic iterative loop " << endl;
162 cout <<
" (! Currently not compatible with motion correction)" << endl;
163 cout <<
" x=1: Nested EM " << endl;
164 cout <<
" x=2: Iterative non-negative Least-Square " << endl;
165 cout <<
" (C.L. Lawson and R.J. Hanson, Solving Least Squares Problems)" << endl;
167 cout <<
" - Optional keywords :" << endl;
168 cout <<
" 'Parametric_image_init: image_file' Set an image file to initialize the parametric images of each dynamic model. Default initialization: '1.0 for each voxel." << endl;
170 cout <<
" 'Number_weight_values:' Enter the number of weights to be applied for each dynamic frame for performing WLS optimisation (Optimisation method=2) " << endl;
171 cout <<
" 'Weight_values:' Enter the weight values to be applied for each dynamic frame ( within DYNAMIC FRAMING/ENDDF) " << endl;
172 cout <<
" on one single line, separated by ',' " << endl;
173 cout <<
" The previous parameters must be declared inside the couple of the following specific tags: " << endl;
174 cout <<
" - DYNAMIC FRAMING/ENDDF for chronological frame model (dynamic model applied to chronological frames of a dynamic aquisition)" << endl;
175 cout <<
" - RESPIRATORY GATING/ENDRG for respiratory model (dynamic model applied to respiratory gates of a dynamic aquisition)" << endl;
176 cout <<
" - CARDIAC GATING/ENDCG for cardiac model (dynamic model applied to cardiac gates of a dynamic aquisition)" << endl;
177 cout <<
" Different levels of dynamic model can be enabled simultaneously (i.e a dynamic frame model can be used simultaneously with respiratory and/or cardiac gating model) " << endl;
180 cout <<
" The following keywords are optional and common to each dynamic model (Dynamic frame, Respiratory gating or Cardiac gating) :" << endl;
181 cout <<
" 'Number_model_iterations: x' Number of iterations of the model parameters and basis functions updates in one cycle of Nested EM" << endl;
182 cout <<
" (Default x == 1) (one cycle consists in x iterations in which either the parametric images or the basis functions are updated) " << endl;
183 cout <<
" The ratio of parametric images / basis functions updates depends on the following parameter:" << endl;
184 cout <<
" 'Basis_function_update_ratio: x' Ratio of update between parametric images and basis functions updates cycle " << endl;
185 cout <<
" (Default x == 0) Cycles consist in x iterations of the parametric images, following by x iterations of the basis functions" << endl;
186 cout <<
" If x == 0, only the parametric images are updated" << endl;
187 cout <<
" 'Basis_function_start_ite : x' Starting iteration for the update of basis functions " << endl;
188 cout <<
" (Default x == -1) If negative, no update of the basis functions is performed (only parametric images are updated) " << endl;
191 cout <<
" ---------------------------" << endl;
192 cout <<
" Example of initialization: " << endl;
193 cout <<
" DYNAMIC FRAMING" << endl;
194 cout <<
" Number_basis_functions : 2" << endl;
195 cout <<
" Basis_functions :" << endl;
196 cout <<
" 23682.79, 25228.74, 26636.99, 27923.61, 29101.16" << endl;
197 cout <<
" 5.4, 4.91, 4.48, 4.1, 3.75" << endl;
198 cout <<
" ENDDF" << endl;
200 cout <<
" RESPIRATORY GATING" << endl;
201 cout <<
" Number_basis_functions : 6" << endl;
202 cout <<
" Basis_functions :" << endl;
203 cout <<
" 1, 0.8, 0.6, 0.4, 0.2, 0.01" << endl;
204 cout <<
" 0.7, 0.9, 0.7, 0.5, 0.3, 0.1" << endl;
205 cout <<
" 0.4, 0.6, 0.8, 0.6, 0.4, 0.2" << endl;
206 cout <<
" 0.2, 0.4, 0.6, 0.8, 0.6, 0.4" << endl;
207 cout <<
" 0.1, 0.3, 0.5, 0.7, 0.9, 0.7" << endl;
208 cout <<
" 0.01, 0.2, 0.4, 0.6, 0.8, 1" << endl;
209 cout <<
" ENDRG" << endl;
211 cout <<
" Number_model_iterations : 1" << endl;
212 cout <<
" Basis_function_start_ite : -1" << endl;
213 cout <<
" Basis_function_update_ratio : 0" << endl;
214 cout <<
" ---------------------------" << endl;
216 cout <<
" The following keywords are common to all dynamic models :" << endl;
218 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;
219 cout <<
" Provide text file with the Arterial Input Curve data points and time points, in two different horizontal lines starting with " << endl;
220 cout <<
" 'AIC_time_points:'" << endl;
221 cout <<
" and " << endl;
222 cout <<
" 'AIC_data_points:' " << endl;
223 cout <<
" to indicate which dataset corresponds to each line. Values must be separated by commas." << endl;
224 cout <<
" Also provide a value of the total number of data points, on a new line starting with " << endl;
225 cout <<
" 'AIC_number_of_points:'" << endl;
226 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;
227 cout <<
" (Default x == 0) " << endl;
228 cout <<
" 'No image update: x' If set to 1, the reconstructed images for the next iteration/subset are not reestimated using the model" << endl;
229 cout <<
" (Default x == 0) (the code just performs standard independent reconstruction of each frames/gates) " << endl;
230 cout <<
" 'No parameters update: x' If set to 1, the parameters / functions of the model are not estimated with the image" << endl;
231 cout <<
" (Default x == 0) (this could be used to test The EstimateImageWithModel() function with specific user-provided parametric images) " << endl;
232 cout <<
" 'Save parametric images : x' Enable (1)/Disable(0) saving parametric images on disk" << endl;
233 cout <<
" (Default x == 1) " << endl;
234 cout <<
" 'Save blacklisted voxels images : x' Enable (1)/Disable(0) saving blacklisted voxels images on disk" << endl;
235 cout <<
" (Default x == 0) " << endl;
254 if(
m_verbose >=3)
Cout(
"iLinearModel::ReadAndCheckConfigurationFileSpecific ..."<< endl);
259 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecific -> Error while trying to read and check specific configuration " <<
m_fileOptions << endl);
278 if(
m_verbose >=3)
Cout(
"iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels ..."<< endl);
286 bool file_is_good =
false;
288 string line=
"", kword_to_search=
"";
289 while(!in_file.eof())
291 getline(in_file, line);
294 if (line.find(
"#") != string::npos) line = line.substr(0, line.find_first_of(
"#")) ;
296 if (line.find(
"DYNAMIC FRAMING") != string::npos)
298 if(kword_to_search !=
"")
300 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error, found an end tag 'END**' before 'DYNAMIC FRAMING' in configuration file: " <<
m_fileOptions << endl);
304 kword_to_search =
"ENDDF";
307 else if (line.find(
"RESPIRATORY GATING") != string::npos)
309 if(kword_to_search !=
"")
311 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error, found an end tag 'END**' before 'RESPIRATORY GATING' in configuration file: " <<
m_fileOptions << endl);
315 kword_to_search =
"ENDRG";
318 else if (line.find(
"CARDIAC GATING") != string::npos)
320 if(kword_to_search !=
"")
322 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error, found an end tag 'END**' before 'CARDIAC GATING' in configuration file: " <<
m_fileOptions << endl);
326 kword_to_search =
"ENDCG";
329 else if (kword_to_search !=
"" 330 && line.find(kword_to_search) != string::npos)
332 kword_to_search =
"";
339 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error, no mandatory tags ('DYNAMIC FRAMING'/'ENDDF', 'RESPIRATORY GATING'/'ENDRG', 'CARDIAC GATING'/'ENDCG' detected in configuration file: " 346 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error while trying to read 'Number_basis_functions' flag in " <<
m_fileOptions << endl);
352 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error while trying to read 'Number_basis_functions' flag in " <<
m_fileOptions << endl);
358 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error while trying to read 'Number_basis_functions' flag in " <<
m_fileOptions << endl);
364 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error while trying to read 'Number_basis_functions' flag in " <<
m_fileOptions << endl);
370 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error while trying to read 'Number_model_iterations' flag in " <<
m_fileOptions << endl);
376 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error while trying to read 'Basis_function_start_ite' flag in " <<
m_fileOptions << endl);
382 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error while trying to read 'Basis_function_update_ratio' flag in " <<
m_fileOptions << endl);
388 Cerr(
"***** ***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error while trying to read 'Optimisation_method' keyword in " <<
m_fileOptions << endl);
396 Cout(
"iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels() -> Selected optimization method : NNLS (2)" << endl);
398 Cout(
"iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels() -> Selected optimization method : Nested-EM (1)" << endl);
400 Cout(
"iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels() -> Selected optimization method : Direct Dynamic (0)" << endl);
405 Cerr(
"***** iLinearModel::ReadAndCheckConfigurationFileSpecificToAllLinearModels -> Error while trying to read configuration file at: " <<
m_fileOptions << endl);
433 if(
m_verbose >=3)
Cout(
"iLinearModel::ReadAndCheckOptionsList ..."<< endl);
440 Cerr(
"***** iLinearModel::ReadAndCheckOptionsList() -> Initialization with command line options is not implemented for this class. Please use a configuration file instead" << endl);
466 Cerr(
"***** iLinearModel::CheckSpecificParameters -> A problem occurred while checking specific parameters ! " << endl);
490 if(
m_verbose >=2)
Cout(
"iLinearModel::CheckSpecificParametersForAllLinearModels ..."<< endl);
495 Cerr(
"***** iLinearModel::CheckSpecificParametersForAllLinearModels() -> Error, the variables corresponding to the number of basis function has not been initialized. There might be an error in the configuration process/file !" << endl);
511 Cerr(
"***** iLinearModel::CheckSpecificParametersForAllLinearModels() -> Error, the number of weight factors doesn't match the number of input frames. There might be an error in the configuration process/file !" << endl);
520 Cerr(
"***** iLinearModel::CheckSpecificParametersForAllLinearModels -> Either a file or a list of options have to be selected to initialize the model, but not both ! " << endl);
527 Cerr(
"***** iLinearModel::CheckSpecificParametersForAllLinearModels -> Either a file or a list of options should have been provided at this point ! " << endl);
534 Cerr(
"***** iLinearModel::CheckSpecificParametersForAllLinearModels -> Optimization method Linear Regression (=3) only available when using two time basis functions ! " << endl);
554 if(
m_verbose >=2)
Cout(
"iLinearModel::InitializeSpecificToAllLinearModels ..."<< endl);
559 Cerr(
"***** iLinearModel::InitializeSpecificToAllLinearModels() -> Must call CheckParameters functions before Initialize() !" << endl);
703 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read frame basis functions coefficients !" << endl);
704 Cerr(
" 'Basis_functions' keyword inside DYNAMIC FRAMING / ENDDF paragraph in " <<
m_fileOptions << endl);
716 "RESPIRATORY GATING",
719 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read respiratory gates basis functions coefficients !" << endl);
720 Cerr(
" 'Basis_functions' keyword inside RESPIRATORY GATING / ENDRG paragraph in " <<
m_fileOptions << endl);
735 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read cardiac gates basis functions coefficients !" << endl);
736 Cerr(
" 'Basis_functions' keyword inside CARDIAC GATING / ENDCG paragraph in " <<
m_fileOptions << endl);
742 "Optimisation_method",
747 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read 'Optimisation_method' keyword in " <<
m_fileOptions << endl);
762 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read frame weight factor coefficients !" << endl);
763 Cerr(
" 'Weight_values' keyword inside DYNAMIC FRAMING / ENDDF paragraph in " <<
m_fileOptions << endl);
771 string input_image =
"";
772 int return_value = 0;
775 "Parametric_images_init",
782 if( return_value == 0)
792 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read the provided initialization parametric images : " << input_image << endl);
796 else if( return_value == 1)
798 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read dynamic frame model parametric images !" << endl);
816 "Parametric_images_init",
820 "RESPIRATORY GATING",
823 if( return_value == 0)
833 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read the provided initialization parametric images : " << input_image << endl);
837 else if( return_value == 1)
839 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read respiratory gate model parametric images !" << endl);
858 "Parametric_images_init",
865 if( return_value == 0)
875 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read the provided initialization parametric images : " << input_image << endl);
879 else if( return_value == 1)
881 Cerr(
"***** iLinearModel::Initialize -> Error while trying to read cardiac gate model parametric images !" << endl);
896 Cerr(
"***** iLinearModel::Initialize() -> Error while trying to read configuration file at: " <<
m_fileOptions << endl);
907 Cerr(
"***** iLinearModel::CheckSpecificParametersForAllLinearModels() -> Error, negative weight factors found. Only positive non-zero factors allowed !" << endl);
910 if(
m_verbose >=4)
Cout(
"iLinearModel::NNLS optimisation weight for frame: "<< t <<
" set at "<<
mp_w[t]<< endl);
957 Cout(
"***** iLinearModel::InitializeSpecificToAllLinearModels() -> Time Basis Function coefficients :" << endl);
961 Cout(
"Basis function["<<b+1<<
"] : ");
985 if(
m_verbose >=2)
Cout(
"iLinearModel::InitializeSpecific ..."<< endl);
990 Cerr(
"***** oDynamicModelManager::InitializeSpecific() -> Must call CheckParameters functions before Initialize() !" << endl);
997 Cerr(
"***** iLinearModel::InitializeSpecific() -> Error while performing generic initialisations for linear models !" << endl);
1028 Cerr(
"***** iLinearModel::EstimateModelParameters() -> Called while not initialized !" << endl);
1040 Cerr(
"***** iLinearModel::EstimateModelParameters() -> An error occured while using the nested EM parametric image estimation method !" << endl);
1047 Cout(
"iLinearModel::EstimateModelParameters() -> Skipping nested calculation, not required for direct method " << endl);
1055 Cerr(
"***** iLinearModel::EstimateModelParameters() -> An error occured while using the Patlak LS Estimation Method !" << endl);
1064 Cerr(
"***** iLinearModel::EstimateModelParameters() -> An error occured while using the Least-Squares linear regression Estimation Method !" << endl);
1071 Cerr(
"***** iLinearModel::EstimateModelParameters() -> Error : unknown method to estimate images ! !" << endl);
1085 Cout(
"iLinearModel::EstimateModelParameters() -> Frame parametric image["<<fb<<
"] avg value:" << avg << endl);
1106 if(
m_verbose >=3)
Cout(
"iLinearModel::NestedEM() ..." <<endl);
1110 if(
m_verbose >=3)
Cout(
"iLinearModel::NestedEM() cycle "<< it+1 <<
"/" << m_nbLinearModelCycles <<endl);
1116 #pragma omp parallel for private(v) schedule(static, 1) 1166 FLTNB parametric_image_norm = 0;
1170 if(
m_verbose >=3)
Cout(
"iLinearModel::NestedEM() -> Estimate Basis Functions - Frame basis functions estimation step" <<endl);
1175 parametric_image_norm = 0;
1201 #pragma omp parallel for private(v) schedule(static, 1) 1210 th = omp_get_thread_num();
1216 * m2p_CGParametricImages[cb][v];
1234 if(
m_verbose >=3)
Cout(
"iLinearModel::NestedEM() -> Estimate Basis Functions - Respiratory gate basis functions estimation step" <<endl);
1239 parametric_image_norm = 0;
1264 #pragma omp parallel for private(v) schedule(static, 1) 1273 th = omp_get_thread_num();
1278 * m2p_CGParametricImages[cb][v];
1297 if(
m_verbose >=3)
Cout(
"iLinearModel::NestedEM() -> Estimate Basis Functions - Cardiac gate basis functions estimation step" <<endl);
1302 parametric_image_norm = 0;
1327 #pragma omp parallel for private(v) schedule(static, 1) 1336 th = omp_get_thread_num();
1341 * m2p_CGParametricImages[cb][v];
1368 Cout(
"iLinearModel::NestedEM() -> Basis function ["<<rb<<
"] coefficients for resp gate ["<<rg<<
"] :" <<
m2p_respBasisFunctions[rb][rg] << endl);
1372 Cout(
"iLinearModel::NestedEM() -> Basis function ["<<cb<<
"] coefficients for card gate ["<<cg<<
"] :" <<
m2p_cardBasisFunctions[cb][cg] << endl);
1382 FLTNB basis_functions_norm = 0.;
1387 if(
m_verbose >=3)
Cout(
"iLinearModel::NestedEM() -> Estimate Coefficients - Frame coeffs estimation step" <<endl);
1395 basis_functions_norm = 0.;
1409 #pragma omp parallel for private(v) schedule(static, 1) 1439 if(
m_verbose >=3)
Cout(
"iLinearModel::NestedEM() -> Estimate Coefficients - Respiratory Gate coeffs estimation step" <<endl);
1447 basis_functions_norm = 0.;
1460 #pragma omp parallel for private(v) schedule(static, 1) 1490 if(
m_verbose >=3)
Cout(
"iLinearModel::NestedEM() -> Estimate Coefficients - Cardiac Gate coeffs estimation step" <<endl);
1498 basis_functions_norm = 0.;
1511 #pragma omp parallel for private(v) schedule(static, 1) 1551 Cout(
"iLinearModel::NestedEM() -> Frame parametric image["<<fb<<
"] avg value:" << avg << endl);
1564 Cout(
"iLinearModel::NestedEM() -> Resp gate parametric image["<<rb<<
"] avg value:" << avg << endl);
1577 Cout(
"iLinearModel::NestedEM() -> Card gate parametric image["<<cb<<
"] avg value:" << avg << endl);
1603 if(
m_verbose >=3)
Cout(
"iLinearModel::EstimateParametersWithNNLS() ..." <<endl);
1608 if(
m_verbose >=3)
Cout(
"iLinearModel::EstimateParametersWithNNLS() -> Estimate Coefficients - Frame coeffs estimation step" <<endl);
1614 #pragma omp parallel for private(v) schedule(guided) 1623 th = omp_get_thread_num();
1629 FLTNB *p_nnls_zz=NULL;
1639 p_nnls_B[ t ]=ap_ImageS->
m4p_image[ t ][ rg ][ cg ][ v ] *
mp_w[ t ];
1667 if(
m_verbose >=3)
Cout(
"iLinearModel::EstimateParametersWithNNLS() -> Estimate Coefficients - Respiratory Gate coeffs estimation step" <<endl);
1673 #pragma omp parallel for private(v) schedule(guided) 1682 th = omp_get_thread_num();
1688 FLTNB *p_nnls_zz=NULL;
1698 p_nnls_B[ rg ]=ap_ImageS->
m4p_image[ fr ][ rg ][ cg ][ v ];
1726 if(
m_verbose >=3)
Cout(
"iLinearModel::EstimateParametersWithNNLS() -> Estimate Coefficients - Cardiac Gate coeffs estimation step" <<endl);
1732 #pragma omp parallel for private(v) schedule(guided) 1741 th = omp_get_thread_num();
1747 FLTNB *p_nnls_zz=NULL;
1757 p_nnls_B[ cg ]=ap_ImageS->
m4p_image[ fr ][ rg ][ cg ][ v ];
1794 Cout(
"iLinearModel::EstimateParametersWithNNLS() -> Frame parametric image["<<fb<<
"] avg value:" << avg << endl);
1807 Cout(
"iLinearModel::EstimateParametersWithNNLS() -> Resp gate parametric image["<<rb<<
"] avg value:" << avg << endl);
1820 Cout(
"iLinearModel::EstimateParametersWithNNLS() -> Card gate parametric image["<<cb<<
"] avg value:" << avg << endl);
1842 if(
m_verbose >=3)
Cout(
"iLinearPatlakModel::Patlak_LS ..." <<endl);
1845 #pragma omp parallel for private(v) schedule(guided) 1877 Cov += (Xt-xmean) * (Yt-ymean);
1878 Var += (Xt-xmean) * (Xt-xmean);
1882 K = (Var != 0) ? Cov/Var : 0.;
1888 Vd = ymean - K*xmean;
1915 if(
m_verbose >= 3)
Cout(
"iLinearModel::EstimateImageWithModel ... " <<endl);
1920 Cerr(
"***** iLinearModel::EstimateImageWithModel() -> Called while not initialized !" << endl);
1926 #pragma omp parallel for private(v) schedule(static, 1) 1937 ap_ImageS->
m4p_image[fr][rg][cg][v] = 0.;
#define INTF_LERP_DISABLED
int NNLS(FLTNB **A, int m, int n, FLTNB *B, FLTNB *X, FLTNB *rnorm, FLTNB *wp, FLTNB *zzp, int *indexp)
Implementation of NNLS (non-negative least squares) algorithm Derived from Turku PET center libraries...
Declaration of class iLinearModel.
int EstimateImageWithModel(oImageSpace *ap_Image, int a_ite, int a_sset)
Re-estimate image using the linear parametric images and basis functions.
oImageDimensionsAndQuantification * mp_ID
This is the mother class of dynamic model classes.
FLTNB * mp_corrBasisCoeffs
#define OPTIMISATION_METHOD_DR
int InitializeSpecificToAllLinearModels()
This function is used to initialize the parametric images and basis functions for all Linear Models...
FLTNB ** m2p_RGParametricImages
int ReadAndCheckOptionsList(string a_listOptions)
This function is used to read parameters from a string.
iLinearModel()
Constructor of iLinearModel. Simply set all data members to default values.
void ShowBasisFunctions()
This function is used to print the basis functions.
FLTNB ****** m6p_backwardImage
FLTNB * mp_corrBasisFunctions
FLTNB ** m2p_outputParImages
int CheckSpecificParametersForAllLinearModels()
This function is used to check parameters for all Linear Models. .
FLTNB ** m2p_CGParametricImages
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...
virtual int ReadAndCheckConfigurationFileSpecific()
This function is used to read options from a configuration file.
int EstimateParametersWithNNLS(oImageSpace *ap_ImageS, int a_ite)
Estimate parametric images using the NNLS method.
bool m_ModelSpecificBasisFunctionsRequired
FLTNB ** m2p_nestedModelTimeBasisFunctions
#define KEYWORD_MANDATORY
uint32_t m_nbLinearModelCycles
#define OPTIMISATION_METHOD_LS
int InitializeSpecific()
This function is used to initialize the parametric images and basis functions for all Linear Models...
FLTNB ** m2p_cardBasisFunctions
int m_basisFunctionsUpdIdx
int GetNbCardGates()
Get the number of cardiac gates.
FLTNB ** m2p_parametricImages
This class holds all the matrices in the image domain that can be used in the algorithm: image...
int CheckSpecificParameters()
This function is used to check whether all member variables have been correctly initialized or not...
int GetNbThreadsForImageComputation()
Get the number of threads used for image operations.
int GetNbTimeFrames()
Get the number of time frames.
INTNB GetNbVoxXYZ()
Get the total number of voxels.
~iLinearModel()
Destructor of iLinearModel.
int Patlak_LS(oImageSpace *ap_ImageS, int a_ite)
Estimate parametric images using linear regression.
#define OPTIMISATION_METHOD_NNLS
int GetNbThreadsForProjection()
Get the number of threads used for projections.
#define OPTIMISATION_METHOD_NESTEM
int m_basisFunctionsUpdRatio
int GetNbRespGates()
Get the number of respiratory gates.
FLTNB ** m2p_respBasisFunctions
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 NestedEM(oImageSpace *ap_ImageS, int a_ite)
Estimate parametric images and basis functions (if enabled) using the nested EM method.
int m_basisFunctionsUpdStartIte
int ReadAndCheckConfigurationFileSpecificToAllLinearModels()
This function is used to read parameters that are generic for all Linear Models. ...
FLTNB * mp_blackListedvoxelsImage
int EstimateModelParameters(oImageSpace *ap_Image, int a_ite, int a_sset)
Estimate model parameters (parametric images and basis functions)
void ShowHelp()
Print out specific help about the implementation of this model and its initialization.