CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
code/toolkits/castor-datafilePosteriorBootstrap.cc
Go to the documentation of this file.
1 
9 #include "gVariables.hh"
10 #include "gOptions.hh"
11 #include "oImageDimensionsAndQuantification.hh"
12 #include "vDataFile.hh"
13 #include "iDataFilePET.hh"
14 #include "iDataFileSPECT.hh"
15 #include "iDataFileCT.hh"
16 #include "iEventHistoPET.hh"
17 #include "iEventHistoSPECT.hh"
18 #include "iEventHistoCT.hh"
19 #include "iEventListPET.hh"
20 #include "iEventListSPECT.hh"
21 #include "iEventListCT.hh"
22 #include "sOutputManager.hh"
23 #include "sRandomNumberGenerator.hh"
24 
25 // =============================================================================================================================================
26 // =============================================================================================================================================
27 // =============================================================================================================================================
28 // H E L P F U N C T I O N S
29 // =============================================================================================================================================
30 // =============================================================================================================================================
31 // =============================================================================================================================================
32 
33 
38 void ShowHelp()
39 {
40  // Show help
41  cout << endl;
42  cout << "Usage: castor-datafilePosteriorBootstrap -df datafile.cdh -(f/d)out output" << endl;
43  cout << endl;
44  cout << "This program can be used to create a resampled histogram datafile for the posterior bootstrap reconstruction." << endl;
45  cout << "See the related paper 'Reconstruction, analysis and interpretation of posterior probability distributions of PET images, using the posterior bootstrap' by Marina Filipovic et al., PMB 2021." << endl;
46  cout << endl;
47  cout << "[Mandatory parameters]:" << endl;
48  cout << " -df datafile.cdh : Give a CASToR histogram datafile." << endl;
49  cout << " -fout name : Give the root name for all output files (no default, alternative to -dout)" << endl;
50  cout << " -dout name : Give the name of the output directory where all output files will be written (no default, alternative to -fout)" << endl;
51  cout << endl;
52  cout << "[Options]:" << endl;
53  cout << " -rng : Give a seed for the random number generator (should be >=0)" << endl;
54  cout << " --norm-w : Set an additional normalization step to maintain the same number of counts: implies more RAM usage and forces the random weights to form a probability distribution" << endl;
55  cout << " -> by default set to false" << endl;
56  cout << " -vb value : Give the verbosity level, from 0 (no verbose) to 2 (default: 1)" << endl;
57  cout << " --help,-h,-help : Print out this help page." << endl; // managed by main
58  cout << endl;
59  #ifdef CASTOR_OMP
60  cout << endl;
61  #endif
62  #ifdef BUILD_DATE
63  cout << " Build date: " << BUILD_DATE << endl;
64  cout << endl;
65  #endif
66  #ifdef CASTOR_VERSION
67  cout << " This program is part of the CASToR release version " << CASTOR_VERSION << "." << endl;
68  cout << endl;
69  #endif
70 }
71 
72 // =============================================================================================================================================
73 // =============================================================================================================================================
74 // =============================================================================================================================================
75 // M A I N P R O G R A M
76 // =============================================================================================================================================
77 // =============================================================================================================================================
78 // =============================================================================================================================================
79 
80 int main(int argc, char** argv)
81 {
82  // ============================================================================================================
83  // MPI stuff (we make all instances except the first one returning 0 directly)
84  // ============================================================================================================
85  int mpi_rank = 0;
86  #ifdef CASTOR_MPI
87  int mpi_size = 1;
88  MPI_Init(&argc, &argv);
89  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
90  MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
91  if (mpi_rank!=0) return 0;
92  #endif
93 
94  // No argument, then show help
95  if (argc==1)
96  {
97  ShowHelp();
98  Exit(EXIT_SUCCESS);
99  }
100 
101  // ============================================================================================================
102  // Parameterized variables with their default values
103  // ============================================================================================================
104 
105  // --------------------------------------------------------------------------------
106  // Input settings
107  // --------------------------------------------------------------------------------
108 
109  // Input datafile
110  string datafile = "";
111 
112  // --------------------------------------------------------------------------------
113  // Output settings
114  // --------------------------------------------------------------------------------
115 
116  // Output directory name.
117  string path_dout = "";
118  // Or root name
119  string path_fout = "";
120 
121  // --------------------------------------------------------------------------------
122  // Miscellaneous settings
123  // --------------------------------------------------------------------------------
124 
125  // Verbose level
126  int verbose = 1;
127  // Initial seed for random number generator
128  int64_t random_generator_seed = -1;
129  // normalize the histogram after resampling so that the number of counts remains identical to the number of counts in the original histogram
130  // forces the random weights to form a probability distribution (sum to 1)
131  bool norm_w = false;
132 
133  // ============================================================================================================
134  // Read command-line parameters
135  // ============================================================================================================
136 
137  // Must manually increment the option index when an argument is needed after an option
138  for (int i=1; i<argc; i++)
139  {
140  // Get the option as a string
141  string option = (string)argv[i];
142 
143  // --------------------------------------------------------------------------------
144  // Miscellaneous settings
145  // --------------------------------------------------------------------------------
146 
147  // Show help
148  if (option=="-h" || option=="--help" || option=="-help")
149  {
150  ShowHelp();
151  Exit(EXIT_SUCCESS);
152  }
153  // RNG seed
154  else if (option=="-rng")
155  {
156  if (i>=argc-1)
157  {
158  Cerr("***** castor-datafileBootstrap() -> Argument missing for option: " << option << endl);
159  Exit(EXIT_FAILURE);
160  }
161  if (ConvertFromString(argv[i+1], &random_generator_seed))
162  {
163  Cerr("***** castor-datafileBootstrap() -> Exception when trying to read provided number '" << random_generator_seed << " for option: " << option << endl);
164  Exit(EXIT_FAILURE);
165  }
166  i++;
167  }
168  // normalize so that the number of counts remains the same
169  else if (option=="--norm-w")
170  {
171  norm_w = true;
172  i++;
173  }
174  // General verbosity level
175  else if (option=="-vb")
176  {
177  if (i>=argc-1)
178  {
179  Cerr("***** castor-datafileBootstrap() -> Argument missing for option: " << option << endl);
180  Exit(EXIT_FAILURE);
181  }
182  if (ConvertFromString(argv[i+1], &verbose))
183  {
184  Cerr("***** castor-datafileBootstrap() -> Exception when trying to read provided verbosity level '" << verbose << " for option: " << option << endl);
185  Exit(EXIT_FAILURE);
186  }
187  i++;
188  }
189 
190  // --------------------------------------------------------------------------------
191  // Input settings
192  // --------------------------------------------------------------------------------
193 
194  // Images
195  else if (option=="-df") // This is a mandatory option
196  {
197  if (i>=argc-1)
198  {
199  Cerr("***** castor-datafileBootstrap() -> Argument missing for option: " << option << endl);
200  Exit(EXIT_FAILURE);
201  }
202  datafile = (string)argv[i+1];
203  i++;
204  }
205 
206  // --------------------------------------------------------------------------------
207  // Output settings
208  // --------------------------------------------------------------------------------
209 
210  // Name of the output directory
211  else if (option=="-dout") // This is a mandatory option
212  {
213  if (i>=argc-1)
214  {
215  Cerr("***** castor-datafileBootstrap() -> Argument missing for option: " << option << endl);
216  Exit(EXIT_FAILURE);
217  }
218  path_dout = argv[i+1];
219  i++;
220  }
221  // Base name of the output files
222  else if (option=="-fout") // This is a mandatory option
223  {
224  if (i>=argc-1)
225  {
226  Cerr("***** castor-datafileBootstrap() -> Argument missing for option: " << option << endl);
227  Exit(EXIT_FAILURE);
228  }
229  path_fout = argv[i+1];
230  i++;
231  }
232  // --------------------------------------------------------------------------------
233  // Unknown option!
234  // --------------------------------------------------------------------------------
235 
236  else
237  {
238  Cerr("***** castor-datafileBootstrap() -> Unknown option '" << option << "' !" << endl);
239  Exit(EXIT_FAILURE);
240  }
241  }
242 
243  // ============================================================================================================
244  // Some checks
245  // ============================================================================================================
246 
247  // Data file
248  if (datafile=="")
249  {
250  Cerr("***** castor-datafileBootstrap() -> Please provide an input datafile !" << endl);
251  Exit(EXIT_FAILURE);
252  }
253  // Output files
254  if (path_fout.empty() && path_dout.empty())
255  {
256  Cerr("***** castor-datafileBootstrap() -> Please provide an output option for output files (-fout or -dout) !" << endl);
257  Exit(EXIT_FAILURE);
258  }
259  // Check that only one option has been provided
260  if (!path_fout.empty() && !path_dout.empty())
261  {
262  Cerr("***** castor-datafileBootstrap() -> Please provide either output option -fout or -dout but not both !" << endl);
263  Exit(EXIT_FAILURE);
264  }
265 
266  // ============================================================================================================
267  // Create sOutputManager
268  // ============================================================================================================
269  sOutputManager* p_OutputManager = sOutputManager::GetInstance();
270  // Set verbose level
271  p_OutputManager->SetVerbose(verbose);
272  // Set MPI rank
273  p_OutputManager->SetMPIRank(mpi_rank);
274  // Initialize output directory and base name
275  if (p_OutputManager->InitOutputDirectory(path_fout, path_dout))
276  {
277  Cerr("***** castor-datafileBootstrap() -> A problem occurred while initializing output directory !" << endl);
278  Exit(EXIT_FAILURE);
279  }
280  // Log command line
281  if (p_OutputManager->LogCommandLine(argc,argv))
282  {
283  Cerr("***** castor-datafileBootstrap() -> A problem occurred while logging command line arguments !" << endl);
284  Exit(EXIT_FAILURE);
285  }
286 
287  // ============================================================================================================
288  // Random number generator
289  // ============================================================================================================
290 
291  sRandomNumberGenerator* p_RandomNumberGenerator = sRandomNumberGenerator::GetInstance();
292  p_RandomNumberGenerator->SetVerbose(verbose);
293  // Use a user-provided seed to initialize the RNG if one has been provided. Use random number otherwise.
294  int extra_gen = 0;
295  int nb_threads = 1;
296  if (random_generator_seed>=0) p_RandomNumberGenerator->Initialize(random_generator_seed, nb_threads, extra_gen);
297  else p_RandomNumberGenerator->Initialize(nb_threads, extra_gen);
298 
299  // ============================================================================================================
300  // Create sScannerManager (in order to get the datafile type)
301  // ============================================================================================================
302  sScannerManager* p_ScannerManager = sScannerManager::GetInstance();
303  p_ScannerManager->SetVerbose(verbose);
304  // Get system name from the dataFile
305  string scanner_name = "";
306  if (ReadDataASCIIFile(datafile, "Scanner name", &scanner_name, 1, KEYWORD_MANDATORY))
307  {
308  Cerr("***** castor-datafileBootstrap() -> A problem occurred while trying to find the system name in the datafile header !" << endl);
309  Exit(EXIT_FAILURE);
310  }
311  if (p_ScannerManager->FindScannerSystem(scanner_name) )
312  {
313  Cerr("***** castor-datafileBootstrap() -> A problem occurred while searching for scanner system !" << endl);
314  Exit(EXIT_FAILURE);
315  }
316  if (p_ScannerManager->BuildScannerObject() )
317  {
318  Cerr("***** castor-datafileBootstrap() -> A problem occurred during scanner object construction ! !" << endl);
319  Exit(EXIT_FAILURE);
320  }
321  if (p_ScannerManager->InstantiateScanner() )
322  {
323  Cerr("***** castor-datafileBootstrap() -> A problem occurred while creating Scanner object !" << endl);
324  Exit(EXIT_FAILURE);
325  }
326  if (p_ScannerManager->GetGeometricInfoFromDataFile(datafile))
327  {
328  Cerr("***** castor-datafileBootstrap() -> A problem occurred while retrieving scanner fields from the datafile header !" << endl);
329  Exit(EXIT_FAILURE);
330  }
331  if (p_ScannerManager->BuildLUT() )
332  {
333  Cerr("***** castor-datafileBootstrap() -> A problem occurred while generating/reading the LUT !" << endl);
334  Exit(EXIT_FAILURE);
335  }
336 
337  // ============================================================================================================
338  // Create the input datafile
339  // ============================================================================================================
340 
341  // Create a default image dimensions and quantification object
343  p_ID->SetDefault();
344  p_ID->SetVerbose(verbose);
345  // Create the datafile based on the data type
346  vDataFile* p_DataFile = NULL;
347  if (p_ScannerManager->GetScannerType() == SCANNER_PET) p_DataFile = new iDataFilePET();
348  else if (p_ScannerManager->GetScannerType() == SCANNER_SPECT_CONVERGENT) p_DataFile = new iDataFileSPECT();
349  else if (p_ScannerManager->GetScannerType() == SCANNER_CT) p_DataFile = new iDataFileCT();
350  else
351  {
352  Cerr("***** castor-datafileBootstrap() -> Unknown scanner type (" << p_ScannerManager->GetScannerType() << ") for datafile construction ! Abort." << endl);
353  Exit(EXIT_FAILURE);
354  }
355  p_DataFile->SetImageDimensionsAndQuantification(p_ID);
356  p_DataFile->SetHeaderDataFileName(datafile);
357  p_DataFile->SetVerbose(verbose);
358  p_DataFile->SetBedIndex(0);
359  bool do_not_affect_quantification = false;
360  if (p_DataFile->ReadInfoInHeader(do_not_affect_quantification))
361  {
362  Cerr("***** castor-datafileBootstrap() -> A problem occurred during datafile header reading ! Abort." << endl);
363  Exit(EXIT_FAILURE);
364  }
365  if (p_DataFile->CheckParameters())
366  {
367  Cerr("***** castor-datafileBootstrap() -> A problem occurred while checking datafile parameters ! Abort." << endl);
368  Exit(EXIT_FAILURE);
369  }
370  if (p_DataFile->ComputeSizeEvent())
371  {
372  Cerr("***** castor-datafileBootstrap() -> A problem occurred in datafile initialization ! Abort." << endl);
373  Exit(EXIT_FAILURE);
374  }
375  if (p_DataFile->InitializeMappedFile())
376  {
377  Cerr("***** castor-datafileBootstrap() -> A problem occurred in datafile initialization ! Abort." << endl);
378  Exit(EXIT_FAILURE);
379  }
380  if (p_DataFile->PrepareDataFile())
381  {
382  Cerr("***** castor-datafileBootstrap() -> A problem occurred in datafile preparation ! Abort." << endl);
383  Exit(EXIT_FAILURE);
384  }
385  // Check if datafile is a histogram, otherwise, throw an error
386  if (p_DataFile->GetDataMode()!=MODE_HISTOGRAM)
387  {
388  Cerr("***** castor-datafileBootstrap() -> The input datafile is not a histogram, this program is only suitable to histogram files !" << endl);
389  Exit(EXIT_FAILURE);
390  }
391 
392  // ============================================================================================================
393  // Create the output datafile
394  // ============================================================================================================
395 
396  // Create output datafile object
397  vDataFile* p_OutputDataFile = NULL;
398  if (p_ScannerManager->GetScannerType() == SCANNER_PET) p_OutputDataFile = new iDataFilePET();
399  else if (p_ScannerManager->GetScannerType() == SCANNER_SPECT_CONVERGENT) p_OutputDataFile = new iDataFileSPECT();
400  else if (p_ScannerManager->GetScannerType() == SCANNER_CT) p_OutputDataFile = new iDataFileCT();
401  // Build output data file from the input one
402  if (p_OutputDataFile->SetParametersFrom(p_DataFile))
403  {
404  Cerr("***** castor-datafileBootstrap() -> An error occurred while setting parameters of output file from input file !" << endl);
405  Exit(EXIT_FAILURE);
406  }
407  // Open output file
408  if (p_OutputDataFile->OpenFileForWriting())
409  {
410  Cerr("***** castor-datafileBootstrap() -> An error occurred while opening file for writing !" << endl);
411  Exit(EXIT_FAILURE);
412  }
413 
414  // ============================================================================================================
415  // Compute posterior bootstrap values for each event bin
416  // ============================================================================================================
417 
418  // Get the number of events
419  int64_t nb_events = p_DataFile->GetSize();
420  // Verbose
421  if (verbose>=1) Cout("castor-datafileBootstrap() -> Draw posterior bootstrap values for all the " << nb_events << " events" << endl);
422 
424 
425  // number of counts for the original and the resampled histograms
426  HPFLTNB nb_counts_new = 0.;
427  HPFLTNB nb_counts_old = 0.;
428  // renormalization factor to ensure that the number of counts remains the same
429  HPFLTNB norm_factor = 1.;
430  // variable needed for the renormalization step, used only if renormalization required
431  HPFLTNB** vals = NULL;
432  // allocate memory if required
433  if (norm_w) vals = new HPFLTNB*[nb_events];
434  int64_t printing_index = 0;
435  int64_t i = 0;
436  for (i=0; i<nb_events; i++)
437  {
438  // Verbose
439  if (verbose>=1)
440  {
441  if (printing_index%5000==0)
442  {
443  int percent = ((int)( ((FLTNB)(i)) * 100. / ((FLTNB)(nb_events/nb_threads)) ));
444  cout << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b "
445  << percent << " % " << flush;
446  }
447  printing_index++;
448  }
449 
450  // get current event
451  vEvent* event = p_DataFile->GetEvent(i);
452  if (event==NULL)
453  {
454  Cerr("***** castor-datafileBootstrap() -> An error occurred while getting the event from index " << i << " !" << endl);
455  if (p_OutputDataFile->CloseFile())
456  Cerr("***** castor-datafileBootstrap() -> An error occurred while closing file during writing !" << endl);
457  Exit(EXIT_FAILURE);
458  }
459 
460  if (norm_w) vals[i] = new HPFLTNB[event->GetNbValueBins()];
461  // loop over bins
462  for (int b=0; b<event->GetNbValueBins(); b++)
463  {
464  // build a Gamma distribution of shape parameter equal to the observed bin value and of scale parameter equal to 1
465  // only if there are some detected counts, otherwise keep the 0.
466  FLTNB val = event->GetEventValue(b);
467  if (norm_w) vals[i][b] = val;
468  if (val>0.)
469  {
470  nb_counts_old += val;
471  // build the Gamma distribution for this bin
472  gamma_distribution<FLTNB> gamma_distrib(val, 1.);
473  // draw the new posterior bootstrap value
474  val = gamma_distrib(rgen);
475  nb_counts_new += val;
476  // save the randomized value or write it into the event
477  if (norm_w) vals[i][b] = val;
478  else event->SetEventValue(b, (FLTNBDATA)val);
479  }
480  }
481  // Write the event
482  if (!norm_w) p_OutputDataFile->WriteEvent(event);
483 
484  }
485 
486  // If required, normalize the randomized values and actually write the output file
487  if (norm_w)
488  {
489  printing_index = 0;
490  norm_factor = nb_counts_old/nb_counts_new;
491  nb_counts_new = 0.;
492  for (i=0; i<nb_events; i++)
493  {
494  // Verbose
495  if (verbose>=1)
496  {
497  if (printing_index%5000==0)
498  {
499  int percent = ((int)( ((FLTNB)(i)) * 100. / ((FLTNB)(nb_events/nb_threads)) ));
500  cout << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b "
501  << percent << " % " << flush;
502  }
503  printing_index++;
504  }
505 
506  // get current event
507  vEvent* event = p_DataFile->GetEvent(i);
508  if (event==NULL)
509  {
510  Cerr("***** castor-datafileBootstrap() -> An error occurred while getting the event from index " << i << " !" << endl);
511  if (p_OutputDataFile->CloseFile())
512  Cerr("***** castor-datafileBootstrap() -> An error occurred while closing file during writing !" << endl);
513  Exit(EXIT_FAILURE);
514  }
515 
516  // loop over bins
517  for (int b=0; b<event->GetNbValueBins(); b++)
518  {
519  if (vals[i][b]>0.)
520  {
521  // apply the renormalization factor
522  vals[i][b] *= norm_factor;
523  nb_counts_new += vals[i][b];
524  // modify the event bin accordingly
525  event->SetEventValue(b, (FLTNBDATA)(vals[i][b]));
526  }
527  }
528  // free memory
529  delete vals[i];
530 
531  // Write the event
532  p_OutputDataFile->WriteEvent(event);
533  }
534  // free memory
535  delete vals;
536  }
537 
538 
539  // Verbose
540  if (verbose>=2) cout << "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
541  << " --> 100 % " << endl;
542  cout<< "number of counts (original histogram) "<<nb_counts_old<<endl;
543  cout<< "number of counts (resampled histogram) "<<nb_counts_new<<endl;
544  if (norm_w) cout<< "renormalization factor "<<norm_factor<<endl;
545  // Close file
546  if (p_OutputDataFile->CloseFile())
547  {
548  Cerr("***** castor-datafileBootstrap() -> An error occurred while closing file after writing !" << endl);
549  Exit(EXIT_FAILURE);
550  }
551  // Set number of events
552  p_OutputDataFile->SetNbEvents(nb_events);
553  // Write header
554  if (p_OutputDataFile->WriteHeader())
555  {
556  Cerr("***** castor-datafileBootstrap() -> An error occurred while writing output header file !" << endl);
557  Exit(EXIT_FAILURE);
558  }
559 
560  // ============================================================================================================
561  // Exit
562  // ============================================================================================================
563 
564  // Ending
565  #ifdef CASTOR_MPI
566  MPI_Finalize();
567  #endif
568  return EXIT_SUCCESS;
569 }
This class is designed to be a mother virtual class for DataFile.
static sScannerManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
static sRandomNumberGenerator * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
#define MODE_HISTOGRAM
#define Cerr(MESSAGE)
int CheckParameters()
Check the initialization of member variables Call the CheckSpecificParameters() function implemente...
virtual int WriteHeader()=0
This function is implemented in child classes. Generate a header file according to the data output ...
int FindScannerSystem(string a_scannerName)
int BuildScannerObject()
Instantiate the specific scanner object related to the modality, and set verbosity of scanner object...
int SetParametersFrom(vDataFile *ap_DataFile)
virtual int WriteEvent(vEvent *ap_Event, int a_th=0)=0
int ReadInfoInHeader(bool a_affectQuantificationFlag=true)
void SetVerbose(int a_verboseLevel)
virtual int ComputeSizeEvent()=0
This function is implemented in child classes Computation of the size of each event according to th...
void Exit(int code)
void SetVerbose(int a_verboseLevel)
Set verbosity level.
static sOutputManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
int InitializeMappedFile()
Check the datafile existency, map it to memory and get the raw char* pointer. .
int InstantiateScanner()
Instantiate scanner using the related function in the scanner classes.
int LogCommandLine(int argc, char **argv)
vEvent * GetEvent(int64_t a_eventIndex, int a_th=0)
int CloseFile()
Close as many binary file stream for writing.
#define SCANNER_SPECT_CONVERGENT
int BuildLUT()
Call the eponym function of the scanner class.
Singleton class that manages output writing on disk (images, sinograms, etc). It also manages loggi...
Engine & GetGenerator()
Get the random generator for the current thread.
Singleton class that Instantiate and initialize the scanner object.
int Initialize(int a_nbThreads, int a_nbExtra)
Instantiate pseudo random number generators, one per thread by default, and additional extra ones if ...
virtual int PrepareDataFile()=0
This function is implemented in child classes Store different kind of information inside arrays (da...
Inherit from vDataFile. Class that manages the reading of a SPECT input file (header + data)...
void SetHeaderDataFileName(const string &a_headerFileName)
int OpenFileForWriting(string a_suffix="")
#define KEYWORD_MANDATORY
Singleton class that generate a thread-safe random generator number for openMP As singleton...
void SetNbEvents(int64_t a_value)
int main(int argc, char **argv)
void SetBedIndex(int a_bedIndex)
Mother class for the Event objects.
int InitOutputDirectory(const string &a_pathFout, const string &a_pathDout)
int ConvertFromString(const string &a_str, string *a_result)
Copy the &#39;a_str&#39; string in the position pointed by &#39;a_result&#39;.
Inherit from vDataFile. Class that manages the reading of a CT input file (header + data)...
This class is designed to manage all dimensions and quantification related stuff. ...
void SetVerbose(int a_verboseLevel)
void SetDefault()
A function used to set number of threads and MPI instances to 1 and bypass the CheckParameters() func...
int ReadDataASCIIFile(const string &a_file, const string &a_keyword, T *ap_return, int a_nbElts, bool a_mandatoryFlag)
Look for "a_nbElts" elts in the "a_file" file matching the "a_keyword" string passed as parameter a...
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Inherit from vDataFile. Class that manages the reading of a PET input file (header + data)...
int GetGeometricInfoFromDataFile(string a_pathToDataFilename)
#define Cout(MESSAGE)