8 #include "oImageProcessingManager.hh" 9 #include "sAddonManager.hh" 60 Cerr(
"***** oImageProcessingManager::CheckParameters() -> No image dimensions provided !" << endl);
66 Cerr(
"***** oImageProcessingManager::CheckParameters() -> Wrong verbosity level provided !" << endl);
85 MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
86 if (mpi_rank!=0)
return;
89 cout <<
"------------------------------------------------------------------" << endl;
90 cout <<
"----- How to use an image processing module" << endl;
91 cout <<
"------------------------------------------------------------------" << endl;
93 cout <<
"An image processing module is called through the -proc option. The provided argument describes the processing module to be used," << endl;
94 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;
95 cout <<
" proc::when (in this case, the default configuration file of the processing module is used to set the options values)" << endl;
96 cout <<
" proc:file.conf::when (in this case, the provided configuration is used)" << endl;
97 cout <<
" proc,param1,param2,...::when (in this case, the options values are directly provided in the argument)" << endl;
98 cout <<
"In any case, the description of the options specific to each processing module, their order in the list and their configuration" << endl;
99 cout <<
"files syntax are provided in the specific help of each module." << endl;
100 cout <<
"The 'when' parameter is an argument describing when to include the processing module within the algorithm. It is a list of keywords" << endl;
101 cout <<
"separating by commas. The following keywords can be used:" << endl;
102 cout <<
" forward (include module into forward model; the processed current estimate is forward-projected)" << endl;
103 cout <<
" post (apply module before saving the image; the processed image is not put back as the estimate for the next update)" << endl;
104 cout <<
" intra (apply module to the updated image use it as the current estimate for the next update)" << endl;
118 Cerr(
"***** oImageProcessingManager::Initialize() -> Parameters have not been checked ! Please call CheckParameters() before." << endl);
128 if (
m_verbose>=1)
Cout(
"oImageProcessingManager::Initialize() -> Initialize image processing modules" << endl);
132 Cerr(
"***** oImageProcessingManager::Initialize() -> A problem occurred while parsing image processing modules options and initializing them !" << endl);
181 size_t double_colon =
m_options[c].find(
"::");
184 if (double_colon==string::npos)
186 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Wrong syntax in the " << c+1 <<
"th image processing module !" << endl);
187 Cerr(
" No double-colon \"::\" found." << endl);
193 string proc_part_options =
m_options[c].substr(0,double_colon);
194 string when_part_options =
m_options[c].substr(double_colon+2);
201 string list_options =
"";
202 string file_options =
"";
205 size_t colon = proc_part_options.find_first_of(
":");
206 size_t comma = proc_part_options.find_first_of(
",");
209 if (colon!=string::npos)
212 module = proc_part_options.substr(0,colon);
214 file_options = proc_part_options.substr(colon+1);
219 else if (comma!=string::npos)
222 module = proc_part_options.substr(0,comma);
224 list_options = proc_part_options.substr(comma+1);
232 module = proc_part_options;
243 while ((comma=when_part_options.find_first_of(
",")) != string::npos)
246 string option = when_part_options.substr(0,comma);
248 when_part_options = when_part_options.substr(comma+1);
255 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Unknown keyword '" << option <<
"' provided in options list !" << endl);
262 else if (when_part_options==
"post") {
mp_applyPost[c] =
true;}
263 else if (when_part_options==
"intra") {
mp_applyIntra[c] =
true;}
266 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Unknown keyword '" << when_part_options <<
"' provided in options list !" << endl);
278 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Image processing module '" << module <<
"' does not exist !" << endl);
288 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occurred while reading and checking configuration file for image processing module '" << module <<
"' !" << endl);
294 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occurred while parsing and reading options list for image processing module '" << module <<
"' !" << endl);
300 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occurred while checking parameters for image processing module '" << module <<
"' !" << endl);
306 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occurred while initializing image processing module '" << module <<
"' !" << endl);
314 if (intra_reconstruction && (condition1 || condition2 || condition3))
316 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Cannot use dynamic image processing module '" << module <<
"' along with dynamic basis functions inside the reconstruction !" << endl);
336 Cerr(
"***** oImageProcessingManager::ApplyProcessingForward() -> Called while not initialized !" << endl);
347 if (
m_verbose>=2)
Cout(
"oImageProcessingrManager::ApplyProcessingForward() -> Apply image processing module " << c+1 <<
" to forward image" << endl);
369 Cerr(
"***** oImageProcessingManager::ApplyProcessingIntra() -> Called while not initialized !" << endl);
380 if (
m_verbose>=2)
Cout(
"oImageProcessingrManager::ApplyProcessingIntra() -> Apply image processing module " << c+1 <<
" to current image" << endl);
402 Cerr(
"***** oImageProcessingManager::ApplyProcessingPost() -> Called while not initialized !" << endl);
413 if (
m_verbose>=2)
Cout(
"oImageProcessingManager::ApplyProcessingPost() -> Apply image processing module " << c+1 <<
" to output image" << endl);
int ApplyProcessingForward(oImageSpace *ap_ImageSpace)
vector< string > m_options
static void ShowCommonHelp()
This function does not take any parameter and is used to display some help about the syntax of the op...
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
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...
void SetVerbose(int a_verbose)
int CheckParameters()
A function used to check the parameters settings.
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)
FLTNB **** m4p_forwardImage
This class holds all the matrices in the image domain that can be used in the algorithm: image...
vImageProcessingModule ** m2p_ImageProcessingModules
virtual int Process(FLTNB ****a4p_image)=0
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
int ParseOptionsAndInitializeImageProcessingModules()
A function used to parse options and initialize image processing modules.
std::map< string, maker_image_processing_module > mp_listOfImageProcessingModules