d2::align: Cast with lrint() for lod count, as plain (unsigned int) seems to be broke...
[Ale.git] / ui / ui_log.h
blob33bed53865e3477a2c6f35418804f6e9e362c9c8
1 // Copyright 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __ui_log_h__
22 #define __ui_log_h__
24 #include "ui.h"
27 * Logging user interface.
30 class ui_log : public ui {
31 private:
32 void printf(const char *format, ...) {
34 fprintf(ui_stream, "ale: %u: ", (unsigned int) time(NULL));
36 va_list ap;
37 va_start(ap, format);
38 vfprintf(ui_stream, format, ap);
39 va_end(ap);
41 if (format[strlen(format) - 1] != '\n')
42 fprintf(ui_stream, "\n");
45 void update() {
48 public:
49 ui_log() {
50 ui_stream = stdout;
53 void exp_multiplier(double m0, double m1, double m2) {
54 ui::exp_multiplier(m0, m1, m2);
55 printf("Exposure multiplier: %g, %g, %g\n", m0, m1, m2);
58 void set_steps(int count) {
59 printf("%d steps to complete\n", count);
62 void set_steps_completed(int count) {
63 printf("%d steps completed\n", count);
66 void set_match(double match) {
67 printf("match %g / mismatch %g\n", (1 - match), match);
70 void set_offset(d2::transformation);
72 void gs_mo(ale_pos gs_mo) {
73 printf("Global search minimum overlap is %f pixels\n", gs_mo);
76 void loading_file() {
77 printf("Loading file.\n");
80 void exposure_1() {
81 printf("Exposure pass 1.\n");
84 void exposure_2() {
85 printf("Exposure pass 2.\n");
88 void prematching() {
89 printf("Prematching.\n");
92 void postmatching() {
93 printf("Postmatching.\n");
96 void constructing_lod_clusters(ale_pos lod) {
97 printf("Constructing LOD cluster (%f)\n", lod);
100 void global_alignment(ale_pos perturb, ale_pos lod) {
101 status.perturb_size = perturb;
102 printf("Global alignment (perturb=%f, lod=%f).\n", perturb, lod);
105 void aligning(ale_pos perturb, ale_pos lod) {
106 perturb_timers[perturb].start();
107 status.perturb_size = perturb;
108 printf("Aligning (perturb=%f, lod=%f).\n", perturb, lod);
111 void following() {
112 printf("Applying initial-final following logic.\n");
115 void set_orender_current(int num) {
116 printf("Preparing to render output (index %d)\n", num);
120 void set_arender_current() {
121 printf("Preparing to render alignment reference image.\n");
124 void rendering() {
125 printf("Rendering.\n");
128 void writing_output(int num) {
129 printf("Writing output (index %d)\n", num);
132 void ip_frame_start(unsigned int num) {
133 printf("Starting Irani-Peleg frame %d.\n", num);
136 void ip_frame_simulate_start() {
137 printf("Simulating frame.");
140 void ip_frame_correct_start() {
141 printf("Correcting frame.\n");
144 void ip_write() {
145 printf("Writing.\n");
148 void ip_step_done() {
149 printf("Finished pass.");
152 void ip_done() {
153 printf("Irani-Peleg done.\n");
156 void original_frame_start(const char *name) {
157 printf("Starting original frame (%s)\n", name);
160 void original_frame_done() {
161 printf("Finished original frame\n");
164 void supplemental_frame_start(const char *name) {
165 printf("Starting supplemental frame (%s)\n", name);
168 void supplemental_frame_done() {
169 printf("Supplemental frame done.\n");
172 void alignment_perturbation_level(ale_pos perturb, ale_pos lod) {
173 perturb_timers[status.perturb_size].stop();
174 status.perturb_size = perturb;
175 perturb_timers[perturb].start();
176 printf("Perturbation set to %g; LOD set to %g.\n", perturb, lod);
179 void alignment_match_ok() {
180 printf("Alignment match OK.\n");
183 void alignment_no_match() {
184 printf("Alignment failed to match.\n");
187 void cache(double usage, double max) {
188 printf("Cache usage is %.1f%% of %.0fMB.\n", 100 * usage / max, max);
191 void cache_status(unsigned int i) {
192 printf("Cache is full.\n");
195 void log_message(const char *message) {
196 printf(message);
201 #endif