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