|
@@ -362,16 +362,45 @@ run_cached_reconstruction (Params *params, gchar **argv)
|
|
|
UfoTaskNode *radio_reader;
|
|
|
UfoBaseScheduler *sched;
|
|
|
GError *error = NULL;
|
|
|
+ UfoTaskNode *dark_reader = NULL;
|
|
|
+ UfoTaskNode *flat_reader = NULL;
|
|
|
+ UfoTaskNode *flat_avg = NULL;
|
|
|
+ UfoTaskNode *ffc = NULL;
|
|
|
|
|
|
params->cache = g_malloc (((gsize) params->num_radios) * ((gsize) params->width) * ((gsize) params->height) * sizeof (gfloat));
|
|
|
|
|
|
/* fill the cache and reconstruct simultaneously */
|
|
|
+ read_graph = UFO_TASK_GRAPH (ufo_task_graph_new ());
|
|
|
+
|
|
|
radio_reader = make_task (data->pm, "reader");
|
|
|
update_reader (radio_reader, params);
|
|
|
data->output = UFO_TASK_NODE (ufo_output_task_new (2));
|
|
|
|
|
|
- read_graph = UFO_TASK_GRAPH (ufo_task_graph_new ());
|
|
|
- ufo_task_graph_connect_nodes (read_graph, radio_reader, data->output);
|
|
|
+ if (with_flat_field_correction (params)) {
|
|
|
+ flat_avg = make_task (data->pm, "averager");
|
|
|
+ flat_reader = make_task (data->pm, "reader");
|
|
|
+ dark_reader = make_task (data->pm, "reader");
|
|
|
+ ffc = make_task (data->pm, "flat-field-correction");
|
|
|
+
|
|
|
+ g_object_set (ffc,
|
|
|
+ "dark-scale", params->dark_scale,
|
|
|
+ "absorption-correction", TRUE,
|
|
|
+ NULL);
|
|
|
+
|
|
|
+ g_object_set (flat_reader, "path", params->flats, NULL);
|
|
|
+ g_object_set (dark_reader, "path", params->darks, NULL);
|
|
|
+
|
|
|
+ ufo_task_graph_connect_nodes (read_graph, flat_reader, flat_avg);
|
|
|
+ ufo_task_graph_connect_nodes_full (read_graph, radio_reader, ffc, 0);
|
|
|
+ ufo_task_graph_connect_nodes_full (read_graph, dark_reader, ffc, 1);
|
|
|
+ ufo_task_graph_connect_nodes_full (read_graph, flat_avg, ffc, 2);
|
|
|
+ ufo_task_graph_connect_nodes (read_graph, ffc, data->output);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ warn ("> No flat/dark field correction\n");
|
|
|
+ ufo_task_graph_connect_nodes (read_graph, radio_reader, data->output);
|
|
|
+ }
|
|
|
+
|
|
|
g_signal_connect (radio_reader, "generated", G_CALLBACK (move_data), data);
|
|
|
data->current = 0;
|
|
|
|
|
@@ -384,6 +413,13 @@ run_cached_reconstruction (Params *params, gchar **argv)
|
|
|
g_object_unref (radio_reader);
|
|
|
g_object_unref (read_graph);
|
|
|
g_object_unref (data->output);
|
|
|
+
|
|
|
+ if (with_flat_field_correction (params)) {
|
|
|
+ g_object_unref (ffc);
|
|
|
+ g_object_unref (flat_avg);
|
|
|
+ g_object_unref (flat_reader);
|
|
|
+ g_object_unref (dark_reader);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
data->current = 0;
|