71 Cerr(
"***** oImageConvolverManager::CheckParameters() -> No image dimensions provided !" << endl);
77 Cerr(
"***** oImageConvolverManager::CheckParameters() -> Wrong verbosity level provided !" << endl);
96 MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
97 if (mpi_rank!=0)
return;
100 cout <<
"------------------------------------------------------------------" << endl;
101 cout <<
"----- How to use an image convolver" << endl;
102 cout <<
"------------------------------------------------------------------" << endl;
104 cout <<
"An image convolver is called through the -conv option. The provided argument describes the convolver to be used, its options," << endl;
105 cout <<
"and when to include it within the algorithm. The syntax of the argument must obey one of the three following options:" << endl;
106 cout <<
" conv::when (in this case, the default configuration file of the convolver is used to set the options values)" << endl;
107 cout <<
" conv:file.conf::when (in this case, the provided configuration is used)" << endl;
108 cout <<
" conv,param1,param2,...::when (in this case, the options values are directly provided in the argument)" << endl;
109 cout <<
"In any case, the description of the options specific to each convolver, their order in the list and their configuration" << endl;
110 cout <<
"files syntax are provided in the specific help of each convolver." << endl;
111 cout <<
"The 'when' parameter is an argument describing when to include the convolver within the algorithm. It is a list of keywords" << endl;
112 cout <<
"separating by commas. The following keywords can be used:" << endl;
113 cout <<
" forward (include convolver into forward model; a convolution of the current estimate is forward-projected)" << endl;
114 cout <<
" backward (include convolver into backward model; a convolution of the correction terms is used for the update)" << endl;
115 cout <<
" post (apply convolver before saving the image; the convolved image is not put back as the estimate for the next update)" << endl;
116 cout <<
" psf (include both 'forward' and 'backward'; the standard image-based PSF modelling)" << endl;
117 cout <<
" sieve (include both 'psf' and 'post'; the standard method of sieve)" << endl;
118 cout <<
" intra (apply convolver to the updated image and use it as the current estimate for the next update)" << endl;
132 Cerr(
"***** oImageConvolverManager::Initialize() -> Parameters have not been checked ! Please call CheckParameters() before." << endl);
142 if (
m_verbose>=1)
Cout(
"oImageConvolverManager::Initialize() -> Initialize image convolvers" << endl);
146 Cerr(
"***** oImageConvolverManager::Initialize() -> A problem occured while parsing image convolvers options and initializing them !" << endl);
197 size_t double_colon =
m_options[c].find_first_of(
"::");
200 if (double_colon==string::npos)
202 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> Wrong syntax in the " << c+1 <<
"th image convolver !" << endl);
203 Cerr(
" No double-colon \"::\" found." << endl);
209 string conv_part_options =
m_options[c].substr(0,double_colon);
210 string when_part_options =
m_options[c].substr(double_colon+2);
216 string convolver =
"";
217 string list_options =
"";
218 string file_options =
"";
221 size_t colon = conv_part_options.find_first_of(
":");
222 size_t comma = conv_part_options.find_first_of(
",");
225 if (colon!=string::npos)
228 convolver = conv_part_options.substr(0,colon);
230 file_options = conv_part_options.substr(colon+1);
235 else if (comma!=string::npos)
238 convolver = conv_part_options.substr(0,comma);
240 list_options = conv_part_options.substr(comma+1);
248 convolver = conv_part_options;
259 while ((comma=when_part_options.find_first_of(
",")) != string::npos)
262 string option = when_part_options.substr(0,comma);
264 when_part_options = when_part_options.substr(comma+1);
274 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> Unknown keyword '" << option <<
"' provided in options list !" << endl);
282 else if (when_part_options==
"post") {
mp_applyPost[c] =
true;}
285 else if (when_part_options==
"intra") {
mp_applyIntra[c] =
true;}
288 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> Unknown keyword '" << when_part_options <<
"' provided in options list !" << endl);
300 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> Image convolver '" << convolver <<
"' does not exist !" << endl);
310 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> A problem occured while reading and checking configuration file for image convolver '" << convolver <<
"' !" << endl);
316 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> A problem occured while parsing and reading options list for image convolver '" << convolver <<
"' !" << endl);
322 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> A problem occured while checking parameters for image convolver '" << convolver <<
"' !" << endl);
328 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> A problem occured while initializing image convolver '" << convolver <<
"' !" << endl);
348 Cerr(
"***** oImageConvolverManager::ConvolveForward() -> Called while not initialized !" << endl);
361 if (m_nbImageConvolvers>1)
Cout(
"oImageConvolverManager::ConvolveForward() -> Apply convolution " << c+1 <<
" to forward image" << endl);
362 else Cout(
"oImageConvolverManager::ConvolveForward() -> Apply convolution to forward image" << endl);
395 Cerr(
"***** oImageConvolverManager::ConvolveBackward() -> Called while not initialized !" << endl);
408 if (m_nbImageConvolvers>1)
410 if (ap_ImageSpace->
IsLoadedSensitivity())
Cout(
"oImageConvolverManager::ConvolveBackward() -> Apply convolution " << c+1 <<
" to backward image" << endl);
411 else Cout(
"oImageConvolverManager::ConvolveBackward() -> Apply convolution " << c+1 <<
" to backward and sensitivity images" << endl);
415 if (ap_ImageSpace->
IsLoadedSensitivity())
Cout(
"oImageConvolverManager::ConvolveBackward() -> Apply convolution to backward image" << endl);
416 else Cout(
"oImageConvolverManager::ConvolveBackward() -> Apply convolution to backward and sensitivity images" << endl);
474 Cerr(
"***** oImageConvolverManager::ConvolveIntra() -> Called while not initialized !" << endl);
487 if (m_nbImageConvolvers>1)
Cout(
"oImageConvolverManager::ConvolveIntra() -> Apply convolution " << c+1 <<
" to current image" << endl);
488 else Cout(
"oImageConvolverManager::ConvolveIntra() -> Apply convolution to current image" << endl);
521 Cerr(
"***** oImageConvolverManager::ConvolveSensitivity() -> Called while not initialized !" << endl);
534 if (m_nbImageConvolvers>1)
Cout(
"oImageConvolverManager::ConvolveSensitivity() -> Apply convolution " << c+1 <<
" to sensitivity image" << endl);
535 else Cout(
"oImageConvolverManager::ConvolveSensitivity() -> Apply convolution to sensitivity image" << endl);
569 Cerr(
"***** oImageConvolverManager::ConvolvePost() -> Called while not initialized !" << endl);
582 if (m_nbImageConvolvers>1)
Cout(
"oImageConvolverManager::ConvolvePost() -> Apply convolution " << c+1 <<
" to output image" << endl);
583 else Cout(
"oImageConvolverManager::ConvolvePost() -> Apply convolution to output image" << endl);
int ParseOptionsAndInitializeImageConvolvers()
A function used to parse options and initialize image convolvers.
FLTNB **** m4p_forwardImage
vector< string > m_options
int GetNbCardBasisFunctions()
Get the number of cardiac basis functions.
bool IsLoadedSensitivity()
int ConvolveForward(oImageSpace *ap_ImageSpace)
A function used to apply convolvers onto the forward image of the oImageSpace.
int CheckParameters()
A function used to check the parameters settings.
oImageConvolverManager()
The constructor of oImageConvolverManager.
int GetNbTimeBasisFunctions()
Get the number of time basis functions.
static sOutputManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
int ConvolvePost(oImageSpace *ap_ImageSpace)
A function used to apply convolvers onto the output image of the oImageSpace.
int ConvolveIntra(oImageSpace *ap_ImageSpace)
A function used to apply convolvers onto the current image of the oImageSpace.
static sAddonManager * GetInstance()
Declaration of class oImageConvolverManager.
FLTNB ****** m6p_backwardImage
const string & GetPathToConfigDir()
Return the path to the CASTOR config directory.
int GetSensNbRespGates()
call the eponym function from the oDynamicDataManager object
FLTNB **** m4p_outputImage
int GetNbBackwardImages()
int ConvolveBackward(oImageSpace *ap_ImageSpace)
A function used to apply convolvers onto the backward images of the oImageSpace.
int ApplyConvolutionTranspose(FLTNB *ap_image)
A public function used to apply the transpose convolution module on the provided image.
static void ShowCommonHelp()
This function does not take any parameter and is used to display some help about the syntax of the op...
~oImageConvolverManager()
The destructor of oImageConvolverManager.
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
int ApplyConvolution(FLTNB *ap_image)
A public function used to apply the convolution module on the provided image.
int GetNbCardGates()
Get the number of cardiac gates.
This class holds all the matrices in the image domain that can be used in the algorithm: image...
std::map< string, maker_image_convolver > mp_listOfImageConvolvers
int GetNbTimeFrames()
Get the number of time frames.
void SetVerbose(int a_verbose)
Set the member m_verboseLevel to the provided value.
int GetNbRespGates()
Get the number of respiratory gates.
int ConvolveSensitivity(oImageSpace *ap_ImageSpace)
A function used to apply convolvers onto the sensitivity image of the oImageSpace.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the member mp_ImageDimensionsAndQuantification to the provided value.
vImageConvolver ** m2p_ImageConvolvers
int GetNbRespBasisFunctions()
Get the number of respiratory basis functions.
FLTNB ***** m5p_sensitivity
Declaration of class sAddonManager.
This abstract class is the generic image convolver class used by the oImageConvolverManager.
int Initialize()
A function used to initialize the manager and all image convolvers it manages.
void ShowHelpImageConvolver()
Show help about all implemented image convolvers.