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
27 * Logging user interface.
30 class ui_log
: public ui
{
32 void printf(const char *format
, ...) {
34 fprintf(ui_stream
, "ale: %u: ", (unsigned int) time(NULL
));
38 vfprintf(ui_stream
, format
, ap
);
41 if (format
[strlen(format
) - 1] != '\n')
42 fprintf(ui_stream
, "\n");
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
);
71 void set_offset(d2::trans_single
);
72 void start_multi_alignment_element(d2::trans_multi
&);
73 void set_offset(d2::trans_single
, int marker
);
75 void gs_mo(ale_pos gs_mo
) {
76 printf("Global search minimum overlap is %f pixels\n", (double) gs_mo
);
80 printf("Loading file.\n");
84 printf("Exposure pass 1.\n");
88 printf("Exposure pass 2.\n");
92 printf("Prematching.\n");
96 printf("Postmatching.\n");
99 void constructing_lod_clusters(ale_pos lod
) {
100 printf("Constructing LOD cluster (%f)\n", (double) lod
);
103 void global_alignment(ale_pos perturb
, ale_pos lod
) {
104 status
.perturb_size
= perturb
;
105 printf("Global alignment (perturb=%f, lod=%f).\n", (double) perturb
, (double) lod
);
108 void aligning(ale_pos perturb
, ale_pos lod
) {
109 perturb_timers
[perturb
].start();
110 status
.perturb_size
= perturb
;
111 printf("Aligning (perturb=%f, lod=%f).\n", (double) perturb
, (double) lod
);
115 printf("Assigning multi-alignment pixels.");
119 printf("Applying initial-final following logic.\n");
122 void set_orender_current(int num
) {
123 printf("Preparing to render output (index %d)\n", num
);
127 void set_arender_current() {
128 printf("Preparing to render alignment reference image.\n");
132 printf("Rendering.\n");
135 void writing_output(int num
) {
136 printf("Writing output (index %d)\n", num
);
139 void ip_frame_start(unsigned int num
) {
140 printf("Starting Irani-Peleg frame %d.\n", num
);
143 void ip_frame_simulate_start() {
144 printf("Simulating frame.");
147 void ip_frame_correct_start() {
148 printf("Correcting frame.\n");
152 printf("Writing.\n");
155 void ip_step_done() {
156 printf("Finished pass.");
160 printf("Irani-Peleg done.\n");
163 void original_frame_start(const char *name
) {
164 printf("Starting original frame (%s)\n", name
);
167 void original_frame_done() {
168 printf("Finished original frame\n");
171 void supplemental_frame_start(const char *name
) {
172 printf("Starting supplemental frame (%s)\n", name
);
175 void supplemental_frame_done() {
176 printf("Supplemental frame done.\n");
179 void alignment_perturbation_level(ale_pos perturb
, ale_pos lod
) {
180 perturb_timers
[status
.perturb_size
].stop();
181 status
.perturb_size
= perturb
;
182 perturb_timers
[perturb
].start();
183 printf("Perturbation set to %g; LOD set to %g.\n", (double) perturb
, (double) lod
);
186 void alignment_dims(unsigned int hr
, unsigned int wr
, unsigned int hi
, unsigned int wi
) {
187 printf("Aligning against reference (%u x %u), input (%u x %u).\n", wr
, hr
, wi
, hi
);
190 void alignment_match_ok() {
191 printf("Alignment match OK.\n");
194 void alignment_no_match() {
195 printf("Alignment failed to match.\n");
198 void cache(double usage
, double max
) {
199 printf("Cache usage is %.1f%% of %.0fMB.\n", 100 * usage
/ max
, max
);
202 void cache_status(unsigned int i
) {
203 printf("Cache is full.\n");
206 void log_message(const char *message
) {