8 #include "vImageConvolver.hh" 9 #include "oImageDimensionsAndQuantification.hh" 10 #include "oImageSpace.hh" 74 Cerr(
"***** vImageConvolver::CheckParameters() -> The verbose level must be set positive !" << endl);
80 Cerr(
"***** vImageConvolver::CheckParameters() -> The image dimensions must be set through a oImageDimensionsAndQuantification !" << endl);
86 Cerr(
"***** vImageConvolver::CheckParameters() -> A problem occurred while checking specific parameters of the child convolver !" << endl);
106 Cerr(
"***** vImageConvolver::Initialize() -> Parameters have not been checked ! Please call CheckParameters() before." << endl);
113 Cerr(
"***** vImageConvolver::Initialize() -> A problem occurred while building the convolution kernel !" << endl);
124 Cerr(
"***** vImageConvolver::Initialize() -> The number of kernels is negative or null !" << endl);
130 Cerr(
"***** vImageConvolver::Initialize() -> The kernel dimensions are not allocated !" << endl);
136 Cerr(
"***** vImageConvolver::Initialize() -> The kernel is not allocated !" << endl);
143 INTNB max_kern_size_Z = 0;
144 INTNB max_kern_size_Y = 0;
145 INTNB max_kern_size_X = 0;
153 Cerr(
"***** vImageConvolver::Initialize() -> Dimension of " << k <<
"th convolution kernel along Z (" <<
mp_dimKernelZ[k] <<
") is not odd !" << endl);
159 Cerr(
"***** vImageConvolver::Initialize() -> Dimension of " << k <<
"th convolution kernel along Y (" <<
mp_dimKernelY[k] <<
") is not odd !" << endl);
165 Cerr(
"***** vImageConvolver::Initialize() -> Dimension of " << k <<
"th convolution kernel along X (" <<
mp_dimKernelX[k] <<
") is not odd !" << endl);
186 Cerr(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl);
187 Cerr(
"!!!!! vImageConvolver::Initialize() -> The maximum half size of the convolution kernels is higher or equal to the number of slices of the image." << endl);
188 Cerr(
"!!!!! This won't affect the results, but a convolution running time factor of " << over_computation_factor <<
" will be lost for nothing." << endl);
189 Cerr(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl);
222 Cerr(
"***** vImageConvolver::ApplyConvolution() -> Called while not initialized !" << endl);
232 Cerr(
"***** vImageConvolver::ApplyConvolution() -> A problem occurred while actually convolving !" << endl);
249 Cerr(
"***** vImageConvolver::ApplyConvolutionTranspose() -> Called while not initialized !" << endl);
259 Cerr(
"***** vImageConvolver::ApplyConvolutionTranspose() -> A problem occurred while actually convolving !" << endl);
276 Cerr(
"***** vImageConvolver::CopyToPaddedImage() -> Called while not initialized !" << endl);
283 #pragma omp parallel for private(z) schedule(guided) 303 ap_inputImage[coord_orig] = 0.;
319 Cerr(
"***** vImageConvolver::Convolve() -> Called while not initialized !" << endl);
333 INTNB stationary_kernel = 0;
336 #pragma omp parallel for private(z) schedule(guided) 342 FLTNB kernel_integral = 0.;
351 for (
INTNB xyk=0; xyk<
mp_dimKernelX[stationary_kernel]*mp_dimKernelY[stationary_kernel]; xyk++)
352 kernel_integral +=
m2p_kernel[stationary_kernel][kernZ_base+xyk];
363 INTNB index_img = indexZY_base + x;
367 for (
INTNB zk=0, index_kern=0; zk<mp_dimKernelZ[stationary_kernel]; zk++)
378 INTNB index_pad = indexZY_pad + x + xk;
380 ap_outputImage[index_img] +=
mp_paddedImage[index_pad] *
m2p_kernel[stationary_kernel][index_kern] / kernel_integral;
393 Cerr(
"***** vImageConvolver::Convolve() -> To use a non-stationary kernel, you should overload this function to implement your own in your child convolver !" << endl);
408 Cerr(
"***** vImageConvolver::ConvolveTranspose() -> Called while not initialized !" << endl);
422 Cerr(
"***** vImageConvolver::ConvolveTranspose() -> To use a non-stationary kernel, you should overload this function to implement your own in your child convolver !" << endl);
virtual int ConvolveTranspose(FLTNB *ap_outputImage)
int Initialize()
A public function used to initialize the module.
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
virtual int BuildConvolutionKernel()=0
A private function used to build the convolution kernel specific to the child convolver.
int CheckParameters()
A public function used to check the parameters settings.
INTNB GetNbVoxXY()
Get the number of voxels in a slice.
int ApplyConvolutionTranspose(FLTNB *ap_image)
virtual ~vImageConvolver()
The destructor of vImageConvolver.
vImageConvolver()
The constructor of vImageConvolver.
int ApplyConvolution(FLTNB *ap_image)
virtual int CheckSpecificParameters()=0
A private function used to check the parameters settings specific to the child convolver.
virtual int Convolve(FLTNB *ap_outputImage)
INTNB GetNbVoxX()
Get the number of voxels along the X axis.
INTNB GetNbVoxZ()
Get the number of voxels along the Z axis.
void CopyToPaddedImage(FLTNB *ap_inputImage)
bool IsVoxelMasked(INTNB a_voxIndex)
INTNB GetNbVoxY()
Get the number of voxels along the Y axis.