CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
sOutputManager Class Reference

Singleton class that manages output writing on disk (images, sinograms, etc).
It also manages logging and printing on screen. More...

#include <sOutputManager.hh>

Collaboration diagram for sOutputManager:
Collaboration graph

Public Member Functions

void SetVerbose (int a_verbose)
 set verbosity More...
 
void SetDataFileName (vector< string > ap_dataFileName)
 
ofstream & GetLogFile ()
 
const string & GetBaseName ()
 
const string & GetPathName ()
 
vector< string > GetDataFileName ()
 
void SetMPIRank (int a_mpiRank)
 Initialize the machine index for MPI. More...
 
void SetMergeDynImagesFlag (bool a_flag)
 Set to on the flag indicating that a dynamic serie of 3D images should be written on disk in one file instead of one file for each 3D image associated with a metaheader, or not. More...
 
bool MergeDynImages ()
 Indicate if a dynamic serie of 3D images should be merged in one file (true) or written on disk as one file for each 3D image, associated with an Interfile metaheader. More...
 
int SetOutNbPrec (string a_format)
 Set the output format and precision used for numeric display. More...
 
int CheckConfigDir (const string &a_path)
 Set the path to the CASTOR config directory from the given path if not empty or through the existence of the environment variable CASTOR_CONFIG. More...
 
const string & GetPathToConfigDir ()
 Return the path to the CASTOR config directory. More...
 
int InitOutputDirectory (const string &a_pathFout, const string &a_pathDout)
 Create the output directory if any, extract the base name and create the log file. More...
 
int LogCommandLine (int argc, char **argv)
 Write log file header with the provided command line options and different informations. More...
 

Static Public Member Functions

static sOutputManagerGetInstance ()
 Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise. More...
 

Private Member Functions

 sOutputManager ()
 sOutputManager constructor. More...
 
 ~sOutputManager ()
 sOutputManager destructor. More...
 
 sOutputManager (sOutputManager const &)
 
void operator= (sOutputManager const &)
 

Private Attributes

int m_verbose
 
int m_mpiRank
 
string m_baseName
 
string m_pathName
 
string m_pathToConfigDir
 
vector< string > mp_dataFileName
 
ofstream m_logFile
 
bool m_mergeOutputDynImgFlag
 

Static Private Attributes

static sOutputManagermp_Instance = NULL
 

Detailed Description

Singleton class that manages output writing on disk (images, sinograms, etc).
It also manages logging and printing on screen.

Definition at line 193 of file sOutputManager.hh.

Constructor & Destructor Documentation

◆ sOutputManager() [1/2]

sOutputManager::sOutputManager ( )
private

sOutputManager constructor.

It is private at this class is singleton. It should be instanciated using the GetInstance() function Initialize the member variables to their default values.

Definition at line 68 of file sOutputManager.cc.

Here is the caller graph for this function:

◆ ~sOutputManager()

sOutputManager::~sOutputManager ( )
private

sOutputManager destructor.

Definition at line 92 of file sOutputManager.cc.

Here is the caller graph for this function:

◆ sOutputManager() [2/2]

sOutputManager::sOutputManager ( sOutputManager const &  )
inlineprivate

Definition at line 339 of file sOutputManager.hh.

Member Function Documentation

◆ CheckConfigDir()

int sOutputManager::CheckConfigDir ( const string &  a_path)

Set the path to the CASTOR config directory from the given path if not empty or through the existence of the environment variable CASTOR_CONFIG.

Parameters
a_path
Returns
0 if success, positive value otherwise

Definition at line 112 of file sOutputManager.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBaseName()

const string & sOutputManager::GetBaseName ( )
inline
Returns
the string containing the output image base name

Definition at line 237 of file sOutputManager.hh.

Here is the caller graph for this function:

◆ GetDataFileName()

vector< string > sOutputManager::GetDataFileName ( )
inline
Returns
recover datafile names

Definition at line 249 of file sOutputManager.hh.

Here is the caller graph for this function:

◆ GetInstance()

static sOutputManager * sOutputManager::GetInstance ( )
inlinestatic

Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.

Returns
instance of the sOutputManager singleton

Definition at line 204 of file sOutputManager.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLogFile()

ofstream & sOutputManager::GetLogFile ( )
inline
Returns
the ofstream object for the log file

Definition at line 231 of file sOutputManager.hh.

◆ GetPathName()

const string & sOutputManager::GetPathName ( )
inline
Returns
the string containing the path to the output directory

Definition at line 243 of file sOutputManager.hh.

Here is the caller graph for this function:

◆ GetPathToConfigDir()

const string & sOutputManager::GetPathToConfigDir ( )

Return the path to the CASTOR config directory.

Just return the path if it has already been initialized Otherwise, the function recovers the path from environnement variables If any error, the working directory is returned instead

Returns
astring containing path to the CASToR configuration directory

Definition at line 166 of file sOutputManager.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitOutputDirectory()

int sOutputManager::InitOutputDirectory ( const string &  a_pathFout,
const string &  a_pathDout 
)

Create the output directory if any, extract the base name and create the log file.

Parameters
a_pathFout: path to an output file as provided by the user
a_pathDout: path to an output directory as provided by the user
Returns
0 if success, and positive value otherwise.

Definition at line 221 of file sOutputManager.cc.

Here is the caller graph for this function:

◆ LogCommandLine()

int sOutputManager::LogCommandLine ( int  argc,
char **  argv 
)

Write log file header with the provided command line options and different informations.

Parameters
argc
argv
Returns
0 if success, positive value otherwise.

Definition at line 339 of file sOutputManager.cc.

Here is the caller graph for this function:

◆ MergeDynImages()

bool sOutputManager::MergeDynImages ( )
inline

Indicate if a dynamic serie of 3D images should be merged in one file (true) or written on disk as one file for each 3D image, associated with an Interfile metaheader.

Returns
true if images should be merged in one file, false otherwise.

Definition at line 273 of file sOutputManager.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

void sOutputManager::operator= ( sOutputManager const &  )
inlineprivate

Definition at line 340 of file sOutputManager.hh.

◆ SetDataFileName()

void sOutputManager::SetDataFileName ( vector< string >  ap_dataFileName)
inline
Returns
set the datafile names

Definition at line 225 of file sOutputManager.hh.

Here is the caller graph for this function:

◆ SetMergeDynImagesFlag()

void sOutputManager::SetMergeDynImagesFlag ( bool  a_flag)
inline

Set to on the flag indicating that a dynamic serie of 3D images should be written on disk in one file instead of one file for each 3D image associated with a metaheader, or not.

Parameters
a_flag

Definition at line 265 of file sOutputManager.hh.

Here is the caller graph for this function:

◆ SetMPIRank()

void sOutputManager::SetMPIRank ( int  a_mpiRank)
inline

Initialize the machine index for MPI.

Parameters
a_mpiRank

Definition at line 256 of file sOutputManager.hh.

Here is the caller graph for this function:

◆ SetOutNbPrec()

int sOutputManager::SetOutNbPrec ( string  a_format)
inline

Set the output format and precision used for numeric display.

Parameters
a_format: string containing output format and precision
Returns
0 if success, positive value otherwise

Definition at line 391 of file sOutputManager.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetVerbose()

void sOutputManager::SetVerbose ( int  a_verbose)
inline

set verbosity

Parameters
a_verbose

Definition at line 219 of file sOutputManager.hh.

Here is the caller graph for this function:

Member Data Documentation

◆ m_baseName

string sOutputManager::m_baseName
private

String containing the image base name

Definition at line 349 of file sOutputManager.hh.

◆ m_logFile

ofstream sOutputManager::m_logFile
private

File object for the output log file

Definition at line 353 of file sOutputManager.hh.

◆ m_mergeOutputDynImgFlag

bool sOutputManager::m_mergeOutputDynImgFlag
private

Flag indicating if dynamic image should be written on disk as one file (true), or a serie of 3D image associated with a metaheader (false). Default: false

Definition at line 354 of file sOutputManager.hh.

◆ m_mpiRank

int sOutputManager::m_mpiRank
private

Machine index for MPI

Definition at line 348 of file sOutputManager.hh.

◆ m_pathName

string sOutputManager::m_pathName
private

String containing the path to the output directory

Definition at line 350 of file sOutputManager.hh.

◆ m_pathToConfigDir

string sOutputManager::m_pathToConfigDir
private

String containing the path to the CASToR configuration directory

Definition at line 351 of file sOutputManager.hh.

◆ m_verbose

int sOutputManager::m_verbose
private

Verbosity

Definition at line 347 of file sOutputManager.hh.

◆ mp_dataFileName

vector<string> sOutputManager::mp_dataFileName
private

String containing the datafile name(s)

Definition at line 352 of file sOutputManager.hh.

◆ mp_Instance

sOutputManager * sOutputManager::mp_Instance = NULL
staticprivate

Pointer to this singleton object

Definition at line 340 of file sOutputManager.hh.


The documentation for this class was generated from the following files: