Răsfoiți Sursa

Output reconstruction parameters

Matthias Vogelgesang 9 ani în urmă
părinte
comite
1afa53a5d3
1 a modificat fișierele cu 34 adăugiri și 10 ștergeri
  1. 34 10
      lamino.c

+ 34 - 10
lamino.c

@@ -86,12 +86,28 @@ err (const gchar *fmt, ...)
     va_end (args);
 }
 
+static void
+info (const gchar *fmt, ...)
+{
+    va_list args;
+    gchar *s;
+
+    va_start (args,  fmt);
+    g_print ("%c[%d;%dm>%c[%dm ", 0x1B, 1, COLOR_GREEN, 0x1b, 0);
+
+    s = g_strdup_vprintf (fmt, args);
+    g_print ("%s", s);
+    va_end (args);
+    g_free (s);
+}
+
 static void
 run_reconstruction (Params *params)
 {
     guint xl, xr, yt, yb;
     guint padded_width;
     guint padded_height;
+    gdouble angle_step;
     UfoPluginManager *pm = NULL;
     UfoTaskGraph *graph = NULL;
     UfoBaseScheduler *sched = NULL;
@@ -127,7 +143,6 @@ run_reconstruction (Params *params)
                   "end", params->num_radios - 1,
                   NULL);
 
-    g_object_set (ffc, "num-darks", params->num_darks, NULL);
     g_object_set (fft1, "dimensions", 2, NULL);
     g_object_set (fft2, "dimensions", 2, NULL);
     g_object_set (ifft, "dimensions", 2, NULL);
@@ -139,12 +154,21 @@ run_reconstruction (Params *params)
     xr = xl;
     yt = (padded_height - params->height) / 2;
     yb = yt;
+    angle_step = (G_PI * 2.0) / params->num_radios;
+
+    info ("Padding: size=[%d %d]  (xl=%d xr=%d yt=%d yb=%d)\n",
+          padded_width, padded_height, xl, xr, yt, yb);
+
+    info ("Parameters: theta=%.3f  tau=%.3f  step=%.5f\n",
+          params->theta, params->tau, angle_step);
+
+    info ("Volume: origin=[%.1f %.1f %.1f]  size=[%d %d %d]\n",
+          params->v_origin[0], params->v_origin[1], params->v_origin[2],
+          params->v_size[0], params->v_size[1], params->v_size[2]);
 
     g_object_set (pad,
-                  "xl", xl,
-                  "xr", xr,
-                  "yt", yt,
-                  "yb", yb,
+                  "xl", xl, "xr", xr,
+                  "yt", yt, "yb", yb,
                   "mode", "brep",
                   NULL);
 
@@ -156,7 +180,7 @@ run_reconstruction (Params *params)
                   NULL);
 
     g_object_set (reco,
-                  "angle-step", (G_PI * 2.0) / params->num_radios,
+                  "angle-step", angle_step,
                   "theta", G_PI * 2 / params->theta,
                   "psi", params->psi,
                   "proj-ox", params->px + xl,
@@ -173,7 +197,7 @@ run_reconstruction (Params *params)
                   "filename", params->output,
                   NULL);
 
-    if (params->darks == NULL || params->flats == NULL) {
+    if (params->darks != NULL && params->flats != NULL) {
         flat_reader = make_task (pm, "reader");
         dark_reader = make_task (pm, "reader");
         ffc = make_task (pm, "flat-field-correction");
@@ -187,7 +211,7 @@ run_reconstruction (Params *params)
         ufo_task_graph_connect_nodes (graph, ffc, pad);
     }
     else {
-        warn ("Reconstructing without flat/dark field correction\n");
+        warn ("> No flat/dark field correction\n");
         ufo_task_graph_connect_nodes (graph, radio_reader, pad);
     }
 
@@ -208,15 +232,15 @@ run_reconstruction (Params *params)
     g_object_unref (sched);
 
     g_object_unref (radio_reader);
-    g_object_unref (ffc);
     g_object_unref (pad);
     g_object_unref (fft1);
     g_object_unref (fft2);
-    g_object_unref (conv);
+    /* g_object_unref (conv); */
     g_object_unref (reco);
     g_object_unref (writer);
 
     if (params->darks != NULL && params->flats != NULL) {
+        g_object_unref (ffc);
         g_object_unref (flat_reader);
         g_object_unref (dark_reader);
     }