CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
src/dynamic/iLinearModelTemplate.cc
Go to the documentation of this file.
1 
8 #include "iLinearModelTemplate.hh"
9 
10 
11 
12 // =====================================================================
13 // ---------------------------------------------------------------------
14 // ---------------------------------------------------------------------
15 // =====================================================================
16 /*
17  \fn iLinearModelTemplate
18  \brief Constructor of iLinearModelTemplate. Simply set all data members to default values.
19 */
21 {
22  // --- Parameters inherited from vDynamicModel class --- //
23 
24  m_nbTimeBF = 1; // Number of basis functions in the model
25  m_nbModelParam = 1; // Number of model parameters
26  m_nnlsN = 2; // Number of parameters for NNLS optimisation
27  // Set default Card and Resp gating parameters to 1 as this is only a dynamic model
30 
31 }
32 
33 // =====================================================================
34 // ---------------------------------------------------------------------
35 // ---------------------------------------------------------------------
36 // =====================================================================
37 /*
38  \fn ~iLinearPatlakModel
39  \brief Destructor of iLinearPatlakModel
40 */
42 {
43  if(m_initialized)
44  {
45  // Free variables
46  }
47 }
48 
49 // =====================================================================
50 // ---------------------------------------------------------------------
51 // ---------------------------------------------------------------------
52 // =====================================================================
53 /*
54  \fn ShowHelpModelSpecific
55  \brief Print out specific help about the implementation of this linear dynamic
56  model and its initialization
57 */
58 
60 {
61  // ===================================================================
62  // Here, display some help and guidance to how to use this linear dynamic model and what it does
63  // ===================================================================
64  cout << "This class is a template class dedicated to add your own linear dynamic model." << endl;
65 }
66 
67 
68 
69 
70 
71 // =====================================================================
72 // ---------------------------------------------------------------------
73 // ---------------------------------------------------------------------
74 // =====================================================================
75 /*
76  \fn ReadAndCheckConfigurationFileSpecific
77  \param const string& a_configurationFile : ASCII file containing information about the linear dynamic model
78  \brief This function is used to read options from a configuration file.
79  \return 0 if success, other value otherwise.
80 */
81 
83 {
84 
85  if(m_verbose >=3) Cout("iLinearModelTemplate::ReadAndCheckConfigurationFileSpecific ..."<< endl);
86 
87  // Apply the generic linear parameter for all Linear Models
89  {
90  Cerr("***** iLinearModelTemplate::ReadAndCheckConfigurationFileSpecific -> Error while trying to read configuration file for generic options of all linear models" << endl);
91  return 1;
92  }
93 
94  // ===================================================================
95  // Implement here the reading of any options specific to this linear dynamic model
96  // Generic parameters that apply to genera linear models will be read by the
97  // function ReadAndCheckConfigurationFileSpecificToAllLinearModels()
98  // The ReadDataASCIIFile() functions could be helpful to recover data from a file
99  // (check other linear dynamicModels for examples)
100  // ===================================================================
101 
102 
103  // Normal End
104  return 0;
105 }
106 
107 
108 // =====================================================================
109 // ---------------------------------------------------------------------
110 // ---------------------------------------------------------------------
111 // =====================================================================
112 /*
113  \fn ReadAndCheckOptionsList
114  \brief This function is used to read parameters from a string.
115  \return 0 if success, other value otherwise.
116 */
117 
118 int iLinearModelTemplate::ReadAndCheckOptionsList(string a_listOptions)
119 {
120  if(m_verbose >=3) Cout("iLinearModelTemplate::ReadAndCheckOptionsList ..."<< endl);
121 
122  // ===================================================================
123  // Implement here the reading of any options specific to this linear dynamic model,
124  // through a list of options separated by commas
125  // The ReadStringOption() function could be helpful to parse the list of parameters in an array
126  // ===================================================================
127 
128  // Normal end
129  return 0;
130 }
131 
132 // =====================================================================
133 // ---------------------------------------------------------------------
134 // ---------------------------------------------------------------------
135 // =====================================================================
136 /*
137  \fn CheckSpecificParameters
138  \brief This function is used to check whether all member variables
139  have been correctly initialized or not.
140  \return 0 if success, positive value otherwise.
141 */
142 
144 {
145  if(m_verbose >=3) Cout("iLinearModelTemplate::CheckSpecificParameters ..."<< endl);
146 
147  // Perform generic checks that apply for the Linear Models
149  {
150  Cerr("***** iLinearModelTemplate::CheckSpecificParameters -> A problem occurred while checking specific parameters ! " << endl);
151  return 1;
152  }
153 
154  // ===================================================================
155  // Implement here checks over parameters for this specific linear
156  // dynamic model which should be read using either ReadAndCheckConfigurationFile()
157  // or ReadAndCheckOptionsList() functions.
158  // Generic parameters applying to all linear models will be checked
159  // using the function CheckSpecificParametersForAllLinearModels()
160  // ===================================================================
161 
162 
163  // Normal end
164  return 0;
165 }
166 
167 // =====================================================================
168 // ---------------------------------------------------------------------
169 // ---------------------------------------------------------------------
170 // =====================================================================
171 /*
172  \fn InitializeSpecific
173  \brief This function is used to initialize the linear model parametric images and basis functions
174  \return 0 if success, other value otherwise.
175 */
177 {
178  if(m_verbose >=3) Cout("iLinearModelTemplate::InitializeSpecific ..."<< endl);
179 
180  // Forbid initialization without check
181  if (!m_checked)
182  {
183  Cerr("***** iLinearModelTemplate::InitializeSpecific() -> Must call CheckParameters functions before Initialize() !" << endl);
184  return 1;
185  }
186 
187  // Run generic Initialization for all Linear Models
189  {
190  Cerr("***** iLinearPatlakModel::InitializeSpecific() -> Error while performing generic initialisations for linear models !" << endl);
191  return 1;
192  }
193 
194  // ===================================================================
195  // Implement here the allocation/initialization of whatever member
196  // variables specifically used by this linear dynamic model.
197  // The generic variables will be initialised by the
198  // InitializeSpecificToAllLinearModels() function.
199  // ===================================================================
200 
201  // ===================================================================
202  // if your model makes use of an Input function curve, implement here
203  // specific calculations to be applied on the interpolated input curve;
204  // Input and interpolation of the curve is handled by oArterialInputCurve
205  // See other implemented linear models for specific examples.
206  // ===================================================================
207 
208  // --- Default Initialization of time basis functions --- //
209  // The basis function imaging ( parametric images ) can be initialised here
210  // By default the InitializeSpecificToAllLinearModels() function
211  // will initialise them with 1
212 
213  // Normal end
214  m_initialized = true;
215  return 0;
216 }
#define Cerr(MESSAGE)
iLinearModelTemplate()
Constructor of iLinearModelTemplate. Simply set all data members to default values.
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...
~iLinearModelTemplate()
Destructor of iLinearModelTemplate.
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. .
int InitializeSpecific()
This function is used to initialize the model parametric images and basis functions.
void ShowHelpModelSpecific()
This function is used to print out specific help about the dynamic model and its options. It is pure virtual so must be implemented by children.
int ReadAndCheckConfigurationFileSpecific()
This function is used to read options from a configuration file, specific to this model...
int ReadAndCheckConfigurationFileSpecificToAllLinearModels()
This function is used to read parameters that are generic for all Linear Models. ...
int ReadAndCheckOptionsList(string a_listOptions)
#define Cout(MESSAGE)