8 #include "vImageConvolver.hh" 9 #include "oImageDimensionsAndQuantification.hh" 10 #include "oImageSpace.hh" 11 #include "iImageConvolverStationaryGaussian.hh" 43 cout <<
"This convolver is based on a classic stationary Gaussian kernel." << endl;
44 cout <<
"It can be anisotropic so that the transaxial and axial FWHM can be different." << endl;
45 cout <<
"One also have to choose the number of sigmas of the Gaussian distribution that will be included in the kernel." << endl;
46 cout <<
"The following options can be used (in this particular order when provided as a list, separated by commas):" << endl;
47 cout <<
" trans FWHM: to set the transaxial FWHM (in mm)" << endl;
48 cout <<
" axial FWHM: to set the axial FWHM (in mm)" << endl;
49 cout <<
" number of sigmas: to set the number of sigmas included in the kernel (recommendations: at least 3. and maximum 5.)" << endl;
61 key_word =
"trans FWHM";
64 Cerr(
"***** iImageConvolverStationaryGaussian::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
68 key_word =
"axial FWHM";
71 Cerr(
"***** iImageConvolverStationaryGaussian::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
75 key_word =
"number of sigmas";
78 Cerr(
"***** iImageConvolverStationaryGaussian::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
95 if (
ReadStringOption(a_optionsList, options, 3,
",",
"Stationary Gaussian convolver configuration"))
97 Cerr(
"***** iImageConvolverStationaryGaussian::ReadConfigurationFile() -> Failed to correctly read the list of options !" << endl);
118 Cerr(
"***** iImageConvolverStationaryGaussian::CheckSpecificParameters() -> Number of sigmas included in the kernel must be strictly positive !" << endl);
124 Cerr(
"***** iImageConvolverStationaryGaussian::CheckSpecificParameters() -> Transaxial FWHM is negative !" << endl);
130 Cerr(
"***** iImageConvolverStationaryGaussian::CheckSpecificParameters() -> Axial FWHM is negative !" << endl);
147 Cout(
"iImageConvolverStationaryGaussian::BuildConvolutionKernel() -> Compute convolution kernel" << endl);
162 FLTNB two_sqrt_two_ln_two = 2.*sqrt(2.*log(2.));
168 INTNB half_kern_dimX = ((
INTNB)(half_kern_floatX));
169 if (half_kern_floatX-((
FLTNB)half_kern_dimX)>0.5) half_kern_dimX++;
170 INTNB half_kern_dimY = ((
INTNB)(half_kern_floatY));
171 if (half_kern_floatY-((
FLTNB)half_kern_dimY)>0.5) half_kern_dimY++;
172 INTNB half_kern_dimZ = ((
INTNB)(half_kern_floatZ));
173 if (half_kern_floatZ-((
FLTNB)half_kern_dimZ)>0.5) half_kern_dimZ++;
185 if (
m_verbose>=2)
Cout (
" --> Kernel dimensions: [" <<
mp_dimKernelX[0] <<
";" << mp_dimKernelY[0] <<
";" << mp_dimKernelZ[0] <<
"]" << endl);
202 FLTNB sum_kernel = 0.;
203 for (
int z=0, index=0; z<mp_dimKernelZ[0]; z++)
207 for (
int y=0; y<mp_dimKernelY[0]; y++)
int ReadStringOption(const string &a_input, T *ap_return, int a_nbElts, const string &sep, const string &a_option)
Parse the 'a_input' string corresponding to the 'a_option' into 'a_nbElts' elements, using the 'sep' separator. The results are returned in the templated 'ap_return' dynamic templated array. Call "ConvertFromString()" to perform the correct conversion depending on the type of the data to convert.
FLTNB GetVoxSizeX()
Get the voxel's size along the X axis, in mm.
int BuildConvolutionKernel()
A private function used to build the convolution kernel specific to the child convolver.
FLTNB GetVoxSizeZ()
Get the voxel's size along the Z axis, in mm.
int ReadConfigurationFile(const string &a_fileOptions)
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
int CheckSpecificParameters()
A private function used to check the parameters settings specific to the child module.
FLTNB GetVoxSizeY()
Get the voxel's size along the Y axis, in mm.
iImageConvolverStationaryGaussian()
The constructor of iImageConvolverStationaryGaussian.
#define KEYWORD_MANDATORY
int ReadOptionsList(const string &a_listOptions)
~iImageConvolverStationaryGaussian()
The destructor of iImageConvolverStationaryGaussian.
int ReadDataASCIIFile(const string &a_file, const string &a_keyword, T *ap_return, int a_nbElts, bool a_mandatoryFlag)
Look for "a_nbElts" elts in the "a_file" file matching the "a_keyword" string passed as parameter a...
void ShowHelp()
A function used to show help about the child module.
This abstract class is the generic image convolver class used by the oImageConvolverManager.