CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
src/management/sAddonManager.cc
Go to the documentation of this file.
1 
9 #include "sAddonManager.hh"
10 
11 // =====================================================================
12 // ---------------------------------------------------------------------
13 // ---------------------------------------------------------------------
14 // =====================================================================
15 
18 
19 // =====================================================================
20 // ---------------------------------------------------------------------
21 // ---------------------------------------------------------------------
22 // =====================================================================
23 
25 {
26  // Return when using MPI and mpi_rank is not 0
27  #ifdef CASTOR_MPI
28  int mpi_rank = 0;
29  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
30  if (mpi_rank!=0) return;
31  #endif
32  // Get the list of projectors
33  std::map<string,maker_projector> list = sAddonManager::GetInstance()->mp_listOfProjectors;
34  std::map<string,maker_projector>::iterator iter;
35  cout << endl << "Here is the list of all implemented projectors along with their options:" << endl << endl;
36  for (iter = list.begin(); iter!=list.end(); iter++)
37  {
38  // Print out the name of this projector
39  cout << "------------------------------------------------------------------" << endl;
40  cout << "----- \"" << iter->first << "\"" << endl;
41  cout << "------------------------------------------------------------------" << endl;
42  // Proceed
43  if (iter->second)
44  {
45  // Create it
46  vProjector* projector = iter->second();
47  // Print specific help
48  projector->ShowHelp();
49  // Delete it
50  delete projector;
51  }
52  cout << endl;
53  }
54 }
55 
56 // =====================================================================
57 // ---------------------------------------------------------------------
58 // ---------------------------------------------------------------------
59 // =====================================================================
60 
62 {
63  // Return when using MPI and mpi_rank is not 0
64  #ifdef CASTOR_MPI
65  int mpi_rank = 0;
66  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
67  if (mpi_rank!=0) return;
68  #endif
69  // Get the list of optimizers
70  std::map<string,maker_optimizer> list = sAddonManager::GetInstance()->mp_listOfOptimizers;
71  std::map<string,maker_optimizer>::iterator iter;
72  cout << endl << "Here is the list of all implemented optimizers along with their options:" << endl << endl;
73  for (iter = list.begin(); iter!=list.end(); iter++)
74  {
75  // Print out the name of this optimizer
76  cout << "------------------------------------------------------------------" << endl;
77  cout << "----- \"" << iter->first << "\"" << endl;
78  cout << "------------------------------------------------------------------" << endl;
79  // Proceed
80  if (iter->second)
81  {
82  // Create it
83  vOptimizer* optimizer = iter->second();
84  // Print specific help
85  optimizer->ShowHelp();
86  // Delete it
87  delete optimizer;
88  }
89  cout << endl;
90  }
91 }
92 
93 // =====================================================================
94 // ---------------------------------------------------------------------
95 // ---------------------------------------------------------------------
96 // =====================================================================
97 
99 {
100  // Return when using MPI and mpi_rank is not 0
101  #ifdef CASTOR_MPI
102  int mpi_rank = 0;
103  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
104  if (mpi_rank!=0) return;
105  #endif
106  // Get the list of scanners
107  std::map<string,maker_scanner> list = sAddonManager::GetInstance()->mp_listOfScannerTypes;
108  std::map<string,maker_scanner>::iterator iter;
109  cout << endl << "Here is the list of all implemented systems along with their options:" << endl << endl;
110  for (iter = list.begin(); iter!=list.end(); iter++)
111  {
112  // Print out the name of this scanner
113  cout << "------------------------------------------------------------------" << endl;
114  cout << "----- \"" << iter->first << "\"" << endl;
115  cout << "------------------------------------------------------------------" << endl;
116  // Proceed
117  if (iter->second)
118  {
119  // Create it
120  vScanner* scanner = iter->second();
121  // Print specific help
122  scanner->ShowHelp();
123  // Delete it
124  delete scanner;
125  }
126  cout << endl;
127  }
128 }
129 
130 // =====================================================================
131 // ---------------------------------------------------------------------
132 // ---------------------------------------------------------------------
133 // =====================================================================
134 
136 {
137  // Return when using MPI and mpi_rank is not 0
138  #ifdef CASTOR_MPI
139  int mpi_rank = 0;
140  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
141  if (mpi_rank!=0) return;
142  #endif
143  // Get the list of image convolvers
144  std::map<string,maker_image_convolver> list = sAddonManager::GetInstance()->mp_listOfImageConvolvers;
145  std::map<string,maker_image_convolver>::iterator iter;
146  cout << endl << "Here is the list of all implemented image convolvers along with their options:" << endl << endl;
147  for (iter = list.begin(); iter!=list.end(); iter++)
148  {
149  // Print out the name of this convolver
150  cout << "------------------------------------------------------------------" << endl;
151  cout << "----- \"" << iter->first << "\"" << endl;
152  cout << "------------------------------------------------------------------" << endl;
153  // Proceed
154  if (iter->second)
155  {
156  // Create it
157  vImageConvolver* convolver = iter->second();
158  // Print specific help
159  convolver->ShowHelp();
160  // Delete it
161  delete convolver;
162  }
163  cout << endl;
164  }
165 }
166 
167 // =====================================================================
168 // ---------------------------------------------------------------------
169 // ---------------------------------------------------------------------
170 // =====================================================================
171 
173 {
174  // Return when using MPI and mpi_rank is not 0
175  #ifdef CASTOR_MPI
176  int mpi_rank = 0;
177  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
178  if (mpi_rank!=0) return;
179  #endif
180  // Get the list of image processing modules
181  std::map<string,maker_image_processing_module> list = sAddonManager::GetInstance()->mp_listOfImageProcessingModules;
182  std::map<string,maker_image_processing_module>::iterator iter;
183  cout << endl << "Here is the list of all implemented image processing modules along with their options:" << endl << endl;
184  for (iter = list.begin(); iter!=list.end(); iter++)
185  {
186  // Print out the name of this processing module
187  cout << "------------------------------------------------------------------" << endl;
188  cout << "----- \"" << iter->first << "\"" << endl;
189  cout << "------------------------------------------------------------------" << endl;
190  // Proceed
191  if (iter->second)
192  {
193  // Create it
194  vImageProcessingModule* module = iter->second();
195  // Print specific help
196  module->ShowHelp();
197  // Delete it
198  delete module;
199  }
200  cout << endl;
201  }
202 }
203 
204 // =====================================================================
205 // ---------------------------------------------------------------------
206 // ---------------------------------------------------------------------
207 // =====================================================================
208 
210 {
211  // Return when using MPI and mpi_rank is not 0
212  #ifdef CASTOR_MPI
213  int mpi_rank = 0;
214  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
215  if (mpi_rank!=0) return;
216  #endif
217  // Get the list of penalties
218  std::map<string,maker_penalty> list = sAddonManager::GetInstance()->mp_listOfPenalties;
219  std::map<string,maker_penalty>::iterator iter;
220  cout << endl << "Here is the list of all implemented penalties along with their options:" << endl << endl;
221  for (iter = list.begin(); iter!=list.end(); iter++)
222  {
223  // Print out the name of this penalty
224  cout << "------------------------------------------------------------------" << endl;
225  cout << "----- \"" << iter->first << "\"" << endl;
226  cout << "------------------------------------------------------------------" << endl;
227  // Proceed
228  if (iter->second)
229  {
230  // Create it
231  vPenalty* penalty = iter->second();
232  // Print specific help
233  penalty->ShowHelp();
234  // Delete it
235  delete penalty;
236  }
237  cout << endl;
238  }
239 }
240 
241 // =====================================================================
242 // ---------------------------------------------------------------------
243 // ---------------------------------------------------------------------
244 // =====================================================================
245 
247 {
248  // Return when using MPI and mpi_rank is not 0
249  #ifdef CASTOR_MPI
250  int mpi_rank = 0;
251  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
252  if (mpi_rank!=0) return;
253  #endif
254  // Get the list of dynamic models
255  std::map<string,maker_dynamic_model> list = sAddonManager::GetInstance()->mp_listOfDynamicModels;
256  std::map<string,maker_dynamic_model>::iterator iter;
257  cout << endl << "Here is the list of all implemented models along with their options:" << endl << endl;
258  for (iter = list.begin(); iter!=list.end(); iter++)
259  {
260  // Print out the name of this dynamic model
261  cout << "------------------------------------------------------------------" << endl;
262  cout << "----- \"" << iter->first << "\"" << endl;
263  cout << "------------------------------------------------------------------" << endl;
264  // Proceed
265  if (iter->second)
266  {
267  // Create it
268  vDynamicModel* dynamic_model = iter->second();
269  // Print specific help
270  dynamic_model->ShowHelpModelSpecific();
271  // Delete it
272  delete dynamic_model;
273  }
274  cout << endl;
275  }
276 }
277 
278 // =====================================================================
279 // ---------------------------------------------------------------------
280 // ---------------------------------------------------------------------
281 // =====================================================================
282 
284 {
285  // Return when using MPI and mpi_rank is not 0
286  #ifdef CASTOR_MPI
287  int mpi_rank = 0;
288  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
289  if (mpi_rank!=0) return;
290  #endif
291  // Get the list of deformations
292  std::map<string,maker_deformation> list = sAddonManager::GetInstance()->mp_listOfDeformations;
293  std::map<string,maker_deformation>::iterator iter;
294  cout << endl << "Here is the list of all implemented image deformation algorithms along with their options:" << endl << endl;
295  for (iter = list.begin(); iter!=list.end(); iter++)
296  {
297  // Print out the name of this deformation
298  cout << "------------------------------------------------------------------" << endl;
299  cout << "----- \"" << iter->first << "\"" << endl;
300  cout << "------------------------------------------------------------------" << endl;
301  // Proceed
302  if (iter->second)
303  {
304  // Create it
305  vDeformation* deformation = iter->second();
306  // Print specific help
307  deformation->ShowHelp();
308  // Delete it
309  delete deformation;
310  }
311  cout << endl;
312  }
313 }
314 
315 // =====================================================================
316 // ---------------------------------------------------------------------
317 // ---------------------------------------------------------------------
318 // =====================================================================
void ShowHelpDynamicModel()
Show help about all implemented dynamic models.
This class is designed to manage the automatic declaration of &#39;addon&#39; classes.
void ShowHelpDeformation()
Show help about all implemented deformations.
This class is designed to generically described any on-the-fly projector.
std::map< string, maker_scanner > mp_listOfScannerTypes
std::map< string, maker_dynamic_model > mp_listOfDynamicModels
virtual void ShowHelp()=0
This function is implemented in child classes Display help specific to the scanner class...
This is the mother class of dynamic model classes.
void ShowHelpImageProcessingModule()
Show help about all implemented image processing modules.
void ShowHelpPenalty()
Show help about all implemented penalties.
std::map< string, maker_deformation > mp_listOfDeformations
virtual void ShowHelpModelSpecific()=0
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.
void ShowHelp()
A function used to show help about the penalty.
static sAddonManager * GetInstance()
virtual void ShowHelp()=0
A function used to show help about the child module.
std::map< string, maker_optimizer > mp_listOfOptimizers
This abstract class is the generic image processing module class used by the oImageProcessingManager...
std::map< string, maker_penalty > mp_listOfPenalties
sAddonManager()
The constructor of sAddonManager.
std::map< string, maker_image_convolver > mp_listOfImageConvolvers
This class is designed to generically described any penalty applied to MAP algorithms.
virtual void ShowHelp()=0
A function used to show help about the child module.
std::map< string, maker_projector > mp_listOfProjectors
This is the mother class of image-based transformation class.
void ShowHelpProjector()
Show help about all implemented projectors.
This class is designed to generically described any iterative optimizer.
void ShowHelpScanner()
Show help about all implemented scanners.
virtual void ShowHelp()=0
This function is used to print out specific help about the deformation and its options. It is pure virtual so must be implemented by children.
void ShowHelpOptimizer()
Show help about all implemented optimizers.
void ShowHelp()
A function used to show help about the projector.
void ShowHelp()
A function used to show help about the optimizer.
Generic class for scanner objects.
This abstract class is the generic image convolver class used by the oImageConvolverManager.
void ShowHelpImageConvolver()
Show help about all implemented image convolvers.
std::map< string, maker_image_processing_module > mp_listOfImageProcessingModules