70 Cerr(
"***** oImageProcessingManager::CheckParameters() -> No image dimensions provided !" << endl);
76 Cerr(
"***** oImageProcessingManager::CheckParameters() -> Wrong verbosity level provided !" << endl);
95 MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
96 if (mpi_rank!=0)
return;
99 cout <<
"------------------------------------------------------------------" << endl;
100 cout <<
"----- How to use an image processing module" << endl;
101 cout <<
"------------------------------------------------------------------" << endl;
103 cout <<
"An image processing module is called through the -proc option. The provided argument describes the processing module to be used," << endl;
104 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;
105 cout <<
" proc::when (in this case, the default configuration file of the processing module is used to set the options values)" << endl;
106 cout <<
" proc:file.conf::when (in this case, the provided configuration is used)" << endl;
107 cout <<
" proc,param1,param2,...::when (in this case, the options values are directly provided in the argument)" << endl;
108 cout <<
"In any case, the description of the options specific to each processing module, their order in the list and their configuration" << endl;
109 cout <<
"files syntax are provided in the specific help of each module." << endl;
110 cout <<
"The 'when' parameter is an argument describing when to include the processing module within the algorithm. It is a list of keywords" << endl;
111 cout <<
"separating by commas. The following keywords can be used:" << endl;
112 cout <<
" forward (include module into forward model; the processed current estimate is forward-projected)" << endl;
113 cout <<
" post (apply module before saving the image; the processed image is not put back as the estimate for the next update)" << endl;
114 cout <<
" intra (apply module to the updated image use it as the current estimate for the next update)" << endl;
128 Cerr(
"***** oImageProcessingManager::Initialize() -> Parameters have not been checked ! Please call CheckParameters() before." << endl);
138 if (
m_verbose>=1)
Cout(
"oImageProcessingManager::Initialize() -> Initialize image processing modules" << endl);
142 Cerr(
"***** oImageProcessingManager::Initialize() -> A problem occured while parsing image processing modules options and initializing them !" << endl);
191 size_t double_colon =
m_options[c].find_first_of(
"::");
194 if (double_colon==string::npos)
196 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Wrong syntax in the " << c+1 <<
"th image processing module !" << endl);
197 Cerr(
" No double-colon \"::\" found." << endl);
203 string proc_part_options =
m_options[c].substr(0,double_colon);
204 string when_part_options =
m_options[c].substr(double_colon+2);
211 string list_options =
"";
212 string file_options =
"";
215 size_t colon = proc_part_options.find_first_of(
":");
216 size_t comma = proc_part_options.find_first_of(
",");
219 if (colon!=string::npos)
222 module = proc_part_options.substr(0,colon);
224 file_options = proc_part_options.substr(colon+1);
229 else if (comma!=string::npos)
232 module = proc_part_options.substr(0,comma);
234 list_options = proc_part_options.substr(comma+1);
242 module = proc_part_options;
253 while ((comma=when_part_options.find_first_of(
",")) != string::npos)
256 string option = when_part_options.substr(0,comma);
258 when_part_options = when_part_options.substr(comma+1);
265 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Unknown keyword '" << option <<
"' provided in options list !" << endl);
272 else if (when_part_options==
"post") {
mp_applyPost[c] =
true;}
273 else if (when_part_options==
"intra") {
mp_applyIntra[c] =
true;}
276 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Unknown keyword '" << when_part_options <<
"' provided in options list !" << endl);
288 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Image processing module '" << module <<
"' does not exist !" << endl);
298 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occured while reading and checking configuration file for image processing module '" << module <<
"' !" << endl);
304 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occured while parsing and reading options list for image processing module '" << module <<
"' !" << endl);
310 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occured while checking parameters for image processing module '" << module <<
"' !" << endl);
316 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> A problem occured while initializing image processing module '" << module <<
"' !" << endl);
324 if (intra_reconstruction && (condition1 || condition2 || condition3))
326 Cerr(
"***** oImageProcessingManager::ParseOptionsAndInitializeImageProcessingModules() -> Cannot use dynamic image processing module '" << module <<
"' along with dynamic basis functions inside the reconstruction !" << endl);
346 Cerr(
"***** oImageProcessingManager::ApplyProcessingForward() -> Called while not initialized !" << endl);
357 if (
m_verbose>=2)
Cout(
"oImageProcessingrManager::ApplyProcessingForward() -> Apply image processing module " << c+1 <<
" to forward image" << endl);
379 Cerr(
"***** oImageProcessingManager::ApplyProcessingIntra() -> Called while not initialized !" << endl);
390 if (
m_verbose>=2)
Cout(
"oImageProcessingrManager::ApplyProcessingIntra() -> Apply image processing module " << c+1 <<
" to current image" << endl);
412 Cerr(
"***** oImageProcessingManager::ApplyProcessingPost() -> Called while not initialized !" << endl);
423 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.