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