From 39904689f4dfbea5f5e00917959f720244f407bd Mon Sep 17 00:00:00 2001 From: AnderBiguri Date: Tue, 7 Feb 2017 17:58:45 +0000 Subject: [PATCH] Fix bug in voxel_backprojection2 CGLS was behaving weirdly as there was a weight missing. --- Algorithms/CGLS.m | 4 +++- Demos/d09_Algorithms04.m | 2 +- Source/voxel_backprojection2.cu | 18 ++++++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Algorithms/CGLS.m b/Algorithms/CGLS.m index 0e7e3a98..f1f5742b 100644 --- a/Algorithms/CGLS.m +++ b/Algorithms/CGLS.m @@ -141,7 +141,9 @@ if ii>1 && errorL2(ii)>errorL2(ii-1) % OUT! x=x-alpha*p; - + if verbose + disp(['CGLS stoped in iteration N', num2str(ii),' due to divergence.']) + end return; end % If step is adecuatem, then continue withg CGLS diff --git a/Demos/d09_Algorithms04.m b/Demos/d09_Algorithms04.m index 10b4a978..4762f685 100644 --- a/Demos/d09_Algorithms04.m +++ b/Demos/d09_Algorithms04.m @@ -108,7 +108,7 @@ % 'alpha_red': Defines the reduction rate of the TV hyperparameter -alpha_red=0.95; +alpha_red=0.noise_projections95; % 'Ratio': The maximum allowed image/TV update ration. If the TV % update changes the image more than this, the parameter diff --git a/Source/voxel_backprojection2.cu b/Source/voxel_backprojection2.cu index b5f82b7d..664d4347 100644 --- a/Source/voxel_backprojection2.cu +++ b/Source/voxel_backprojection2.cu @@ -90,7 +90,13 @@ do { \ * **/ texture tex; - +__global__ void matrixConstantMultiply(const Geometry geo,float* image,float constant){ + size_t idx = threadIdx.x + blockIdx.x * blockDim.x; + for(; idx>>(geo,dimage,i,nalpha); + cudaCheckErrors("Kernel fail"); } // END for - + matrixConstantMultiply<<<60,MAXTREADS>>>( geo,dimage,geo.dVoxelX*geo.dVoxelY*geo.dVoxelZ/(geo.dDetecU*geo.dDetecV)); + ////////////////////////////////////////////////////////////////////////////////////// // END Main reconstruction loop: go through projections (rotation angles) and backproject //////////////////////////////////////////////////////////////////////////////////////