83 Cerr(
"***** oImageProcessingManager::CheckParameters() -> No image dimensions provided !" << endl);
89 Cerr(
"***** oImageProcessingManager::CheckParameters() -> Wrong verbosity level provided !" << endl);
108 MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
109 if (mpi_rank!=0)
return;
112 cout <<
"------------------------------------------------------------------" << endl;
113 cout <<
"----- How to use an image processing module" << endl;
114 cout <<
"------------------------------------------------------------------" << endl;
116 cout <<
"An image processing module is called through the -proc option. The provided argument describes the processing module to be used," << endl;
117 cout <<
"its options, and when to include it within the algorithm. The syntax of the argument must obey one of the three following options:" << endl;
118 cout <<
" proc::when (in this case, the default configuration file of the processing module is used to set the options values)" << endl;
119 cout <<
" proc:file.conf::when (in this case, the provided configuration is used)" << endl;
120 cout <<
" proc,param1,param2,...::when (in this case, the options values are directly provided in the argument)" << endl;
121 cout <<
"In any case, the description of the options specific to each processing module, their order in the list and their configuration" << endl;
122 cout <<
"files syntax are provided in the specific help of each module." << endl;
123 cout <<
"The 'when' parameter is an argument describing when to include the processing module within the algorithm. It is a list of keywords" << endl;
124 cout <<
"separating by commas. The following keywords can be used:" << endl;
125 cout <<
" forward (include module into forward model; the processed current estimate is forward-projected)" << endl;
126 cout <<
" post (apply module before saving the image; the processed image is not put back as the estimate for the next update)" << endl;
127 cout <<
" intra (apply module to the updated image use it as the current estimate for the next update)" << endl;
141 Cerr(
"***** oImageProcessingManager::Initialize() -> Parameters have not been checked ! Please call CheckParameters() before." << endl);
151 if (
m_verbose>=1)
Cout(
"oImageProcessingManager::Initialize() -> Initialize image processing modules" << endl);
155 Cerr(
"***** oImageProcessingManager::Initialize() -> A problem occured while parsing image processing modules options and initializing them !" << endl);
204 size_t double_colon =
m_options[c].find_first_of(
"::");
207 if (double_colon==string::npos)
209 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Wrong syntax in the " << c+1 <<
"th image processing module !" << endl);
210 Cerr(
" No double-colon \"::\" found." << endl);
216 string proc_part_options =
m_options[c].substr(0,double_colon);
217 string when_part_options =
m_options[c].substr(double_colon+2);
224 string list_options =
"";
225 string file_options =
"";
228 size_t colon = proc_part_options.find_first_of(
":");
229 size_t comma = proc_part_options.find_first_of(
",");
232 if (colon!=string::npos)
235 module = proc_part_options.substr(0,colon);
237 file_options = proc_part_options.substr(colon+1);
242 else if (comma!=string::npos)
245 module = proc_part_options.substr(0,comma);
247 list_options = proc_part_options.substr(comma+1);
255 module = proc_part_options;
266 while ((comma=when_part_options.find_first_of(
",")) != string::npos)
269 string option = when_part_options.substr(0,comma);
271 when_part_options = when_part_options.substr(comma+1);
278 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Unknown keyword '" << option <<
"' provided in options list !" << endl);
285 else if (when_part_options==
"post") {
mp_applyPost[c] =
true;}
286 else if (when_part_options==
"intra") {
mp_applyIntra[c] =
true;}
289 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Unknown keyword '" << when_part_options <<
"' provided in options list !" << endl);
301 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Image processing module '" << module <<
"' does not exist !" << endl);
311 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occured while reading and checking configuration file for image processing module '" << module <<
"' !" << endl);
317 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occured while parsing and reading options list for image processing module '" << module <<
"' !" << endl);
323 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occured while checking parameters for image processing module '" << module <<
"' !" << endl);
329 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occured while initializing image processing module '" << module <<
"' !" << endl);
337 if (intra_reconstruction && (condition1 || condition2 || condition3))
339 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Cannot use dynamic image processing module '" << module <<
"' along with dynamic basis functions inside the reconstruction !" << endl);
359 Cerr(
"***** oImageProcessingManager::ApplyProcessingForward() -> Called while not initialized !" << endl);
370 if (
m_verbose>=2)
Cout(
"oImageProcessingrManager::ApplyProcessingForward() -> Apply image processing module " << c+1 <<
" to forward image" << endl);
392 Cerr(
"***** oImageProcessingManager::ApplyProcessingIntra() -> Called while not initialized !" << endl);
403 if (
m_verbose>=2)
Cout(
"oImageProcessingrManager::ApplyProcessingIntra() -> Apply image processing module " << c+1 <<
" to current image" << endl);
425 Cerr(
"***** oImageProcessingManager::ApplyProcessingPost() -> Called while not initialized !" << endl);
436 if (
m_verbose>=2)
Cout(
"oImageProcessingManager::ApplyProcessingPost() -> Apply image processing module " << c+1 <<
" to output image" << endl);
int ApplyProcessingForward(oImageSpace *ap_ImageSpace)
FLTNB **** m4p_forwardImage
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the member mp_ImageDimensionsAndQuantification to the provided value.
static void ShowCommonHelp()
This function does not take any parameter and is used to display some help about the syntax of the op...
bool GetAffectCardDimensionFlag()
Return the boolean value of m_affectCardDimensionFlag member.
bool GetAffectTimeDimensionFlag()
Return the boolean value of m_affectTimeDimensionFlag member.
void ShowHelpImageProcessingModule()
Show help about all implemented image processing modules.
int Initialize()
A function used to initialize the manager and all image processing modules it manages.
static sOutputManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
~oImageProcessingManager()
The destructor of oImageProcessingManager.
int ApplyProcessingPost(oImageSpace *ap_ImageSpace)
bool GetRespStaticFlag()
Get the respiratory static flag that says if the reconstruction has only one respiratory gate or not...
static sAddonManager * GetInstance()
int m_nbImageProcessingModules
bool GetCardStaticFlag()
Get the cardiac static flag that says if the reconstruction has only one cardiac gate or not...
const string & GetPathToConfigDir()
Return the path to the CASTOR config directory.
This abstract class is the generic image processing module class used by the oImageProcessingManager...
int CheckParameters()
A function used to check the parameters settings.
FLTNB **** m4p_outputImage
oImageProcessingManager()
The constructor of oImageProcessingManager.
bool GetTimeStaticFlag()
Get the time static flag that says if the reconstruction has only one frame or not.
bool GetAffectRespDimensionFlag()
Return the boolean value of m_affectRespDimensionFlag member.
int ApplyProcessingIntra(oImageSpace *ap_ImageSpace)
vector< string > m_options
std::map< string, maker_image_processing_module > mp_listOfImageProcessingModules
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
Declaration of class oImageProcessingManager.
This class holds all the matrices in the image domain that can be used in the algorithm: image...
void SetVerbose(int a_verbose)
Set the member m_verboseLevel to the provided value.
vImageProcessingModule ** m2p_ImageProcessingModules
virtual int Process(FLTNB ****a4p_image)=0
A function used to actually perform the processing.
Declaration of class sAddonManager.
int ParseOptionsAndInitializeImageProcessingModules()
A function used to parse options and initialize image processing modules.