CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
iLinearModelTemplate.cc
Go to the documentation of this file.
1 /*
2 This file is part of CASToR.
3 
4  CASToR is free software: you can redistribute it and/or modify it under the
5  terms of the GNU General Public License as published by the Free Software
6  Foundation, either version 3 of the License, or (at your option) any later
7  version.
8 
9  CASToR is distributed in the hope that it will be useful, but WITHOUT ANY
10  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  details.
13 
14  You should have received a copy of the GNU General Public License along with
15  CASToR (in file GNU_GPL.TXT). If not, see <http://www.gnu.org/licenses/>.
16 
17 Copyright 2017-2019 all CASToR contributors listed below:
18 
19  --> Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Thibaut MERLIN, Mael MILLARDET, Simon STUTE, Valentin VIELZEUF
20 
21 This is CASToR version 3.0.
22 */
23 
30 #include "iLinearModelTemplate.hh"
31 
32 
33 
34 // =====================================================================
35 // ---------------------------------------------------------------------
36 // ---------------------------------------------------------------------
37 // =====================================================================
38 /*
39  \fn iLinearModelTemplate
40  \brief Constructor of iLinearModelTemplate. Simply set all data members to default values.
41 */
43 {
44  // --- Parameters inherited from vDynamicModel class --- //
45 
46  m_nbTimeBF = 1; // Number of basis functions in the model
47  m_nbModelParam = 1; // Number of model parameters
48  m_nnlsN = 2; // Number of parameters for NNLS optimisation
49  // Set default Card and Resp gating parameters to 1 as this is only a dynamic model
52 
53 }
54 
55 // =====================================================================
56 // ---------------------------------------------------------------------
57 // ---------------------------------------------------------------------
58 // =====================================================================
59 /*
60  \fn ~iLinearPatlakModel
61  \brief Destructor of iLinearPatlakModel
62 */
64 {
65  if(m_initialized)
66  {
67  // Free variables
68  }
69 }
70 
71 // =====================================================================
72 // ---------------------------------------------------------------------
73 // ---------------------------------------------------------------------
74 // =====================================================================
75 /*
76  \fn ShowHelp
77  \brief Print out specific help about the implementation of this linear dynamic
78  model and its initialization
79 */
80 
82 {
83  // ===================================================================
84  // Here, display some help and guidance to how to use this linear dynamic model and what it does
85  // ===================================================================
86  cout << "This class is a template class dedicated to add your own linear dynamic model." << endl;
87 }
88 
89 
90 
91 
92 
93 // =====================================================================
94 // ---------------------------------------------------------------------
95 // ---------------------------------------------------------------------
96 // =====================================================================
97 /*
98  \fn ReadAndCheckConfigurationFileSpecific
99  \param const string& a_configurationFile : ASCII file containing information about the linear dynamic model
100  \brief This function is used to read options from a configuration file.
101  \return 0 if success, other value otherwise.
102 */
103 
105 {
106 
107  if(m_verbose >=3) Cout("iLinearModelTemplate::ReadAndCheckConfigurationFileSpecific ..."<< endl);
108 
109  // Apply the generic linear parameter for all Linear Models
111  {
112  Cerr("***** iLinearModelTemplate::ReadAndCheckConfigurationFileSpecific -> Error while trying to read configuration file for generic options of all linear models" << endl);
113  return 1;
114  }
115 
116  // ===================================================================
117  // Implement here the reading of any options specific to this linear dynamic model
118  // Generic parameters that apply to genera linear models will be read by the
119  // function ReadAndCheckConfigurationFileSpecificToAllLinearModels()
120  // The ReadDataASCIIFile() functions could be helpful to recover data from a file
121  // (check other linear dynamicModels for examples)
122  // ===================================================================
123 
124 
125  // Normal End
126  return 0;
127 }
128 
129 
130 // =====================================================================
131 // ---------------------------------------------------------------------
132 // ---------------------------------------------------------------------
133 // =====================================================================
134 /*
135  \fn ReadAndCheckOptionsList
136  \brief This function is used to read parameters from a string.
137  \return 0 if success, other value otherwise.
138 */
139 
141 {
142  if(m_verbose >=3) Cout("iLinearModelTemplate::ReadAndCheckOptionsList ..."<< endl);
143 
144  // ===================================================================
145  // Implement here the reading of any options specific to this linear dynamic model,
146  // through a list of options separated by commas
147  // The ReadStringOption() function could be helpful to parse the list of parameters in an array
148  // ===================================================================
149 
150  // Normal end
151  return 0;
152 }
153 
154 // =====================================================================
155 // ---------------------------------------------------------------------
156 // ---------------------------------------------------------------------
157 // =====================================================================
158 /*
159  \fn CheckSpecificParameters
160  \brief This function is used to check whether all member variables
161  have been correctly initialized or not.
162  \return 0 if success, positive value otherwise.
163 */
164 
166 {
167  if(m_verbose >=3) Cout("iLinearModelTemplate::CheckSpecificParameters ..."<< endl);
168 
169  // Perform generic checks that apply for the Linear Models
171  {
172  Cerr("***** iLinearModelTemplate::CheckSpecificParameters -> A problem occurred while checking specific parameters ! " << endl);
173  return 1;
174  }
175 
176  // ===================================================================
177  // Implement here checks over parameters for this specific linear
178  // dynamic model which should be read using either ReadAndCheckConfigurationFile()
179  // or ReadAndCheckOptionsList() functions.
180  // Generic parameters applying to all linear models will be checked
181  // using the function CheckSpecificParametersForAllLinearModels()
182  // ===================================================================
183 
184 
185  // Normal end
186  return 0;
187 }
188 
189 // =====================================================================
190 // ---------------------------------------------------------------------
191 // ---------------------------------------------------------------------
192 // =====================================================================
193 /*
194  \fn InitializeSpecific
195  \brief This function is used to initialize the linear model parametric images and basis functions
196  \return 0 if success, other value otherwise.
197 */
199 {
200  if(m_verbose >=3) Cout("iLinearModelTemplate::InitializeSpecific ..."<< endl);
201 
202  // Forbid initialization without check
203  if (!m_checked)
204  {
205  Cerr("***** iLinearModelTemplate::InitializeSpecific() -> Must call CheckParameters functions before Initialize() !" << endl);
206  return 1;
207  }
208 
209  // Run generic Initialization for all Linear Models
211  {
212  Cerr("***** iLinearPatlakModel::InitializeSpecific() -> Error while performing generic initialisations for linear models !" << endl);
213  return 1;
214  }
215 
216  // ===================================================================
217  // Implement here the allocation/initialization of whatever member
218  // variables specifically used by this linear dynamic model.
219  // The generic variables will be initialised by the
220  // InitializeSpecificToAllLinearModels() function.
221  // ===================================================================
222 
223  // ===================================================================
224  // if your model makes use of an Input function curve, implement here
225  // specific calculations to be applied on the interpolated input curve;
226  // Input and interpolation of the curve is handled by oArterialInputCurve
227  // See other implemented linear models for specific examples.
228  // ===================================================================
229 
230  // --- Default Initialization of time basis functions --- //
231  // The basis function imaging ( parametric images ) can be initialised here
232  // By default the InitializeSpecificToAllLinearModels() function
233  // will initialise them with 1
234 
235  // Normal end
236  m_initialized = true;
237  return 0;
238 }
iLinearModelTemplate()
Constructor of iLinearModelTemplate. Simply set all data members to default values.
uint16_t m_nnlsN
int InitializeSpecificToAllLinearModels()
This function is used to initialize the parametric images and basis functions for all Linear Models...
This class implements a general linear dynamic model applied between the images of a dynamic acquisit...
Definition: iLinearModel.hh:62
~iLinearModelTemplate()
Destructor of iLinearModelTemplate.
#define Cerr(MESSAGE)
Declaration of class iDynamicModelTemplate.
int CheckSpecificParameters()
This function is used to check whether all member variables have been correctly initialized or not...
int CheckSpecificParametersForAllLinearModels()
This function is used to check parameters for all Linear Models. .
void ShowHelp()
This function is used to print out specific help about the model and its options. ...
int InitializeSpecific()
This function is used to initialize the model parametric images and basis functions.
int ReadAndCheckConfigurationFileSpecific()
This function is used to read options from a configuration file, specific to this model...
#define Cout(MESSAGE)
int ReadAndCheckConfigurationFileSpecificToAllLinearModels()
This function is used to read parameters that are generic for all Linear Models. ...
int ReadAndCheckOptionsList(string a_listOptions)
This function is used to read parameters from a string.