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