82 Cerr(
"***** oImageProcessingManager::CheckParameters() -> No image dimensions provided !" << endl);
88 Cerr(
"***** oImageProcessingManager::CheckParameters() -> Wrong verbosity level provided !" << endl);
107 MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
108 if (mpi_rank!=0)
return;
111 cout <<
"------------------------------------------------------------------" << endl;
112 cout <<
"----- How to use an image processing module" << endl;
113 cout <<
"------------------------------------------------------------------" << endl;
115 cout <<
"An image processing module is called through the -proc option. The provided argument describes the processing module to be used," << endl;
116 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;
117 cout <<
" proc::when (in this case, the default configuration file of the processing module is used to set the options values)" << endl;
118 cout <<
" proc:file.conf::when (in this case, the provided configuration is used)" << endl;
119 cout <<
" proc,param1,param2,...::when (in this case, the options values are directly provided in the argument)" << endl;
120 cout <<
"In any case, the description of the options specific to each processing module, their order in the list and their configuration" << endl;
121 cout <<
"files syntax are provided in the specific help of each module." << endl;
122 cout <<
"The 'when' parameter is an argument describing when to include the processing module within the algorithm. It is a list of keywords" << endl;
123 cout <<
"separating by commas. The following keywords can be used:" << endl;
124 cout <<
" forward (include module into forward model; the processed current estimate is forward-projected)" << endl;
125 cout <<
" post (apply module before saving the image; the processed image is not put back as the estimate for the next update)" << endl;
126 cout <<
" intra (apply module to the updated image use it as the current estimate for the next update)" << endl;
140 Cerr(
"***** oImageProcessingManager::Initialize() -> Parameters have not been checked ! Please call CheckParameters() before." << endl);
150 if (
m_verbose>=1)
Cout(
"oImageProcessingManager::Initialize() -> Initialize image processing modules" << endl);
154 Cerr(
"***** oImageProcessingManager::Initialize() -> A problem occurred while parsing image processing modules options and initializing them !" << endl);
203 size_t double_colon =
m_options[c].find(
"::");
206 if (double_colon==string::npos)
208 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Wrong syntax in the " << c+1 <<
"th image processing module !" << endl);
209 Cerr(
" No double-colon \"::\" found." << endl);
215 string proc_part_options =
m_options[c].substr(0,double_colon);
216 string when_part_options =
m_options[c].substr(double_colon+2);
223 string list_options =
"";
224 string file_options =
"";
227 size_t colon = proc_part_options.find_first_of(
":");
228 size_t comma = proc_part_options.find_first_of(
",");
231 if (colon!=string::npos)
234 module = proc_part_options.substr(0,colon);
236 file_options = proc_part_options.substr(colon+1);
241 else if (comma!=string::npos)
244 module = proc_part_options.substr(0,comma);
246 list_options = proc_part_options.substr(comma+1);
254 module = proc_part_options;
265 while ((comma=when_part_options.find_first_of(
",")) != string::npos)
268 string option = when_part_options.substr(0,comma);
270 when_part_options = when_part_options.substr(comma+1);
277 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Unknown keyword '" << option <<
"' provided in options list !" << endl);
284 else if (when_part_options==
"post") {
mp_applyPost[c] =
true;}
285 else if (when_part_options==
"intra") {
mp_applyIntra[c] =
true;}
288 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Unknown keyword '" << when_part_options <<
"' provided in options list !" << endl);
300 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Image processing module '" << module <<
"' does not exist !" << endl);
310 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occurred while reading and checking configuration file for image processing module '" << module <<
"' !" << endl);
316 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occurred while parsing and reading options list for image processing module '" << module <<
"' !" << endl);
322 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occurred while checking parameters for image processing module '" << module <<
"' !" << endl);
328 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occurred while initializing image processing module '" << module <<
"' !" << endl);
336 if (intra_reconstruction && (condition1 || condition2 || condition3))
338 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Cannot use dynamic image processing module '" << module <<
"' along with dynamic basis functions inside the reconstruction !" << endl);
358 Cerr(
"***** oImageProcessingManager::ApplyProcessingForward() -> Called while not initialized !" << endl);
369 if (
m_verbose>=2)
Cout(
"oImageProcessingrManager::ApplyProcessingForward() -> Apply image processing module " << c+1 <<
" to forward image" << endl);
391 Cerr(
"***** oImageProcessingManager::ApplyProcessingIntra() -> Called while not initialized !" << endl);
402 if (
m_verbose>=2)
Cout(
"oImageProcessingrManager::ApplyProcessingIntra() -> Apply image processing module " << c+1 <<
" to current image" << endl);
424 Cerr(
"***** oImageProcessingManager::ApplyProcessingPost() -> Called while not initialized !" << endl);
435 if (
m_verbose>=2)
Cout(
"oImageProcessingManager::ApplyProcessingPost() -> Apply image processing module " << c+1 <<
" to output image" << endl);
int ApplyProcessingForward(oImageSpace *ap_ImageSpace)
A function used to apply image processing modules onto the forward image of the oImageSpace.
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)
A function used to apply convolvers onto the output image of the oImageSpace.
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.
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)
A function used to apply image processing modules onto the current image of the oImageSpace.
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.