83 Cerr(
"***** oImageConvolverManager::CheckParameters() -> No image dimensions provided !" << endl);
89 Cerr(
"***** oImageConvolverManager::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 convolver" << endl;
114 cout <<
"------------------------------------------------------------------" << endl;
116 cout <<
"An image convolver is called through the -conv option. The provided argument describes the convolver to be used, its options," << endl;
117 cout <<
"and when to include it within the algorithm. The syntax of the argument must obey one of the three following options:" << endl;
118 cout <<
" conv::when (in this case, the default configuration file of the convolver is used to set the options values)" << endl;
119 cout <<
" conv:file.conf::when (in this case, the provided configuration is used)" << endl;
120 cout <<
" conv,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 convolver, their order in the list and their configuration" << endl;
122 cout <<
"files syntax are provided in the specific help of each convolver." << endl;
123 cout <<
"The 'when' parameter is an argument describing when to include the convolver 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 convolver into forward model; a convolution of the current estimate is forward-projected)" << endl;
126 cout <<
" backward (include convolver into backward model; a convolution of the correction terms is used for the update)" << endl;
127 cout <<
" post (apply convolver before saving the image; the convolved image is not put back as the estimate for the next update)" << endl;
128 cout <<
" psf (include both 'forward' and 'backward'; the standard image-based PSF modelling)" << endl;
129 cout <<
" sieve (include both 'psf' and 'post'; the standard method of sieve)" << endl;
130 cout <<
" intra (apply convolver to the updated image and use it as the current estimate for the next update)" << endl;
144 Cerr(
"***** oImageConvolverManager::Initialize() -> Parameters have not been checked ! Please call CheckParameters() before." << endl);
154 if (
m_verbose>=1)
Cout(
"oImageConvolverManager::Initialize() -> Initialize image convolvers" << endl);
158 Cerr(
"***** oImageConvolverManager::Initialize() -> A problem occurred while parsing image convolvers options and initializing them !" << endl);
210 size_t double_colon =
m_options[c].find(
"::");
213 if (double_colon==string::npos)
215 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> Wrong syntax in the " << c+1 <<
"th image convolver !" << endl);
216 Cerr(
" No double-colon \"::\" found." << endl);
222 string conv_part_options =
m_options[c].substr(0,double_colon);
223 string when_part_options =
m_options[c].substr(double_colon+2);
229 string convolver =
"";
230 string list_options =
"";
231 string file_options =
"";
234 size_t colon = conv_part_options.find_first_of(
":");
235 size_t comma = conv_part_options.find_first_of(
",");
238 if (colon!=string::npos)
241 convolver = conv_part_options.substr(0,colon);
243 file_options = conv_part_options.substr(colon+1);
248 else if (comma!=string::npos)
251 convolver = conv_part_options.substr(0,comma);
253 list_options = conv_part_options.substr(comma+1);
261 convolver = conv_part_options;
272 while ((comma=when_part_options.find_first_of(
",")) != string::npos)
275 string option = when_part_options.substr(0,comma);
277 when_part_options = when_part_options.substr(comma+1);
287 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> Unknown keyword '" << option <<
"' provided in options list !" << endl);
295 else if (when_part_options==
"post") {
mp_applyPost[c] =
true;}
298 else if (when_part_options==
"intra") {
mp_applyIntra[c] =
true;}
301 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> Unknown keyword '" << when_part_options <<
"' provided in options list !" << endl);
313 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> Image convolver '" << convolver <<
"' does not exist !" << endl);
323 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> A problem occurred while reading and checking configuration file for image convolver '" << convolver <<
"' !" << endl);
329 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> A problem occurred while parsing and reading options list for image convolver '" << convolver <<
"' !" << endl);
335 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> A problem occurred while checking parameters for image convolver '" << convolver <<
"' !" << endl);
341 Cerr(
"***** oImageConvolverManager::ParseOptionsAndInitializeImageConvolvers() -> A problem occurred while initializing image convolver '" << convolver <<
"' !" << endl);
361 Cerr(
"***** oImageConvolverManager::ConvolveForward() -> Called while not initialized !" << endl);
374 if (m_nbImageConvolvers>1)
Cout(
"oImageConvolverManager::ConvolveForward() -> Apply convolution " << c+1 <<
" to forward image" << endl);
375 else Cout(
"oImageConvolverManager::ConvolveForward() -> Apply convolution to forward image" << endl);
408 Cerr(
"***** oImageConvolverManager::ConvolveBackward() -> Called while not initialized !" << endl);
421 if (m_nbImageConvolvers>1)
423 if (ap_ImageSpace->
IsLoadedSensitivity())
Cout(
"oImageConvolverManager::ConvolveBackward() -> Apply convolution " << c+1 <<
" to backward image" << endl);
424 else Cout(
"oImageConvolverManager::ConvolveBackward() -> Apply convolution " << c+1 <<
" to backward and sensitivity images" << endl);
428 if (ap_ImageSpace->
IsLoadedSensitivity())
Cout(
"oImageConvolverManager::ConvolveBackward() -> Apply convolution to backward image" << endl);
429 else Cout(
"oImageConvolverManager::ConvolveBackward() -> Apply convolution to backward and sensitivity images" << endl);
487 Cerr(
"***** oImageConvolverManager::ConvolveIntra() -> Called while not initialized !" << endl);
500 if (m_nbImageConvolvers>1)
Cout(
"oImageConvolverManager::ConvolveIntra() -> Apply convolution " << c+1 <<
" to current image" << endl);
501 else Cout(
"oImageConvolverManager::ConvolveIntra() -> Apply convolution to current image" << endl);
534 Cerr(
"***** oImageConvolverManager::ConvolveSensitivity() -> Called while not initialized !" << endl);
547 if (m_nbImageConvolvers>1)
Cout(
"oImageConvolverManager::ConvolveSensitivity() -> Apply convolution " << c+1 <<
" to sensitivity image" << endl);
548 else Cout(
"oImageConvolverManager::ConvolveSensitivity() -> Apply convolution to sensitivity image" << endl);
582 Cerr(
"***** oImageConvolverManager::ConvolvePost() -> Called while not initialized !" << endl);
595 if (m_nbImageConvolvers>1)
Cout(
"oImageConvolverManager::ConvolvePost() -> Apply convolution " << c+1 <<
" to output image" << endl);
596 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.
int GetNb1stMotImgsForLMS(int a_fr)
call the eponym function from the oDynamicDataManager object
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 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.
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.
int GetNb2ndMotImgsForLMS()
call the eponym function from the oDynamicDataManager object
void SetVerbose(int a_verbose)
Set the member m_verboseLevel to the provided value.
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.