Browse Source

Port Lukas' variation changes

Matthias Vogelgesang 9 years ago
parent
commit
cfe21417e5
2 changed files with 25 additions and 5 deletions
  1. 11 3
      src/lamino_bp_generic.cl
  2. 14 2
      src/ufo-lamino-bp-task.c

+ 11 - 3
src/lamino_bp_generic.cl

@@ -16,15 +16,22 @@ interpolate (global float *proj,
              float oldx,
              float oldy)
 {
+    /* Check if vertically out of projection plane boundaries */
+    if (oldy < 0)
+        oldy = 0.5;;
+
+    if (oldy > param->proj_sy)
+        oldy = param->proj_sy - 0.5;
+
     /* bilinear interpolation */
     const float yf_1 = oldy - floor(oldy);
     const float yf_0 = 1.0f - yf_1;
     const float xf_1 = oldx - floor(oldx);
     const float xf_0 = 1.0f  - xf_1;
+
     const int base = ((int) floor(oldx)) + ((int) floor(oldy)) * param->proj_sx;
     float result;
 
-    /* TODO: check that out of proj plain */
     result  = proj[base    ] * xf_0 * yf_0;
     result += proj[base + 1] * xf_1 * yf_0;
     result += proj[base + param->proj_sx    ] * xf_0 * yf_1;
@@ -87,8 +94,9 @@ lamino_bp_varied (global float *proj,
     const float mat_4 = -sg * sf + cg * st * cf;
     const float mat_5 =  cg * ct;
 
-    const float oldx = newx * mat_0 + newy * mat_1 + newz * mat_2 + param->proj_ox + newz / param->vol_sz * param->proj_ox_variation;
-    const float oldy = newx * mat_3 + newy * mat_4 + newz * mat_5 + param->proj_oy;
+    /* Force newz values to be equal to 0 */
+    const float oldx = newx * mat_0 + newy * mat_1 /* + newz * mat_2 */ + param->proj_ox + newz / param->vol_sz * param->proj_ox_variation;
+    const float oldy = newx * mat_3 + newy * mat_4 /* + newz * mat_5 */ + param->proj_oy;
 
     volume[idx] += interpolate (proj, param, oldx, oldy);
 }

+ 14 - 2
src/ufo-lamino-bp-task.c

@@ -246,10 +246,22 @@ ufo_lamino_bp_task_process (UfoTask *task,
         priv->cleaned = TRUE;
     }
 
-    if (priv->params.proj_ox_variation == 0.0f)
+    if (priv->params.proj_ox_variation == 0.0f ||
+        priv->params.vol_sx < 2 ||
+        priv->params.vol_sy < 2 ||
+        priv->params.vol_sz < 2 ||
+        priv->params.z_spacing > 1.0f) {
+        if (priv->proj_idx == 0)
+            g_print ("INFO: Using regular backprojection");
+
         backproject_regularly (priv, requisition, cmd_queue, in_mem, out_mem);
-    else
+    }
+    else {
+        if (priv->proj_idx == 0)
+            g_print ("INFO: Using backprojection with parameter variation");
+
         backproject_varied (priv, requisition, cmd_queue, in_mem, out_mem);
+    }
 
     priv->proj_idx++;
     return TRUE;