libeblearngui
|
00001 /*************************************************************************** 00002 * Copyright (C) 2009 by Pierre Sermanet * 00003 * pierre.sermanet@gmail.com * 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Redistribution under a license not approved by the Open Source 00014 * Initiative (http://www.opensource.org) must display the 00015 * following acknowledgement in all advertising material: 00016 * This product includes software developed at the Courant 00017 * Institute of Mathematical Sciences (http://cims.nyu.edu). 00018 * * The names of the authors may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00023 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00024 * DISCLAIMED. IN NO EVENT SHALL ThE AUTHORS BE LIABLE FOR ANY 00025 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00026 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00027 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00028 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00030 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 ***************************************************************************/ 00032 00033 #define MAXWIDTH 1000 00034 00035 using namespace std; 00036 00037 namespace ebl { 00038 00040 00041 #define CONTRAST_NORM_MODULE_GUI(name, T, op) \ 00042 template <typename T, class Tstate> \ 00043 void contrast_norm_module_gui::name(contrast_norm_module<T,Tstate> &wsm, \ 00044 Tstate &in, Tstate &out, \ 00045 unsigned int &h0, \ 00046 unsigned int &w0, \ 00047 double zoom, T vmin, T vmax, \ 00048 bool show_out, bool run) { \ 00049 /* run it */ \ 00050 if (run) \ 00051 wsm.op(in, out); \ 00052 uint h = h0, w = w0; \ 00053 /* display text */ \ 00054 gui << gui_only() << at(h, w) << "inmean out:" << wsm.subnorm.inmean.T \ 00055 << at(h + 15, w) << "min:" << idx_min(wsm.subnorm.inmean.T) \ 00056 << at(h + 30, w) << "max:" << idx_max(wsm.subnorm.inmean.T); \ 00057 w += 150; \ 00058 /* display image */ \ 00059 {idx_bloop1(m, wsm.subnorm.inmean.T, T) { \ 00060 if (w - w0 < MAXWIDTH) { \ 00061 draw_matrix(m, h, w, zoom, zoom, vmin, vmax); \ 00062 w += (uint) (m.dim(1) * zoom + 1); \ 00063 } \ 00064 } \ 00065 h0 += (uint) (m.dim(0) * zoom + 1); \ 00066 } \ 00067 w = w0; \ 00068 h = h0; \ 00069 /* display text */ \ 00070 gui << gui_only() << at(h, w) << "insq out:" << wsm.divnorm.insq.T \ 00071 << at(h + 15, w) << "min:" << idx_min(wsm.divnorm.insq.T) \ 00072 << at(h + 30, w) << "max:" << idx_max(wsm.divnorm.insq.T); \ 00073 w += 150; \ 00074 /* display image */ \ 00075 {idx_bloop1(m, wsm.divnorm.insq.T, T) { \ 00076 if (w - w0 < MAXWIDTH) { \ 00077 draw_matrix(m, h, w, zoom, zoom, vmin, vmax); \ 00078 w += (uint) (m.dim(1) * zoom + 1); \ 00079 } \ 00080 } \ 00081 h0 += (uint) (m.dim(0) * zoom + 1); \ 00082 } \ 00083 w = w0; \ 00084 h = h0; \ 00085 /* display text */ \ 00086 gui << gui_only() << at(h, w) << "invar out:" << wsm.divnorm.invar.T \ 00087 << at(h + 15, w) << "min:" << idx_min(wsm.divnorm.invar.T) \ 00088 << at(h + 30, w) << "max:" << idx_max(wsm.divnorm.invar.T); \ 00089 w += 150; \ 00090 /* display image */ \ 00091 {idx_bloop1(m, wsm.divnorm.invar.T, T) { \ 00092 if (w - w0 < MAXWIDTH) { \ 00093 draw_matrix(m, h, w, zoom, zoom, vmin, vmax); \ 00094 w += (uint) (m.dim(1) * zoom + 1); \ 00095 } \ 00096 } \ 00097 h0 += (uint) (m.dim(0) * zoom + 1); \ 00098 } \ 00099 w = w0; \ 00100 h = h0; \ 00101 /* display text */ \ 00102 gui << gui_only() << at(h, w) << "instd out:" << wsm.divnorm.instd.T \ 00103 << at(h + 15, w) << "min:" << idx_min(wsm.divnorm.instd.T) \ 00104 << at(h + 30, w) << "max:" << idx_max(wsm.divnorm.instd.T); \ 00105 w += 150; \ 00106 /* display image */ \ 00107 {idx_bloop1(m, wsm.divnorm.instd.T, T) { \ 00108 if (w - w0 < MAXWIDTH) { \ 00109 draw_matrix(m, h, w, zoom, zoom, vmin, vmax); \ 00110 w += (uint) (m.dim(1) * zoom + 1); \ 00111 } \ 00112 } \ 00113 h0 += (uint) (m.dim(0) * zoom + 1); \ 00114 } \ 00115 w = w0; \ 00116 h = h0; \ 00117 /* display text */ \ 00118 gui << gui_only() << at(h, w) << "thstd out:" << wsm.divnorm.thstd.T \ 00119 << at(h + 15, w) << "min:" << idx_min(wsm.divnorm.thstd.T) \ 00120 << at(h + 30, w) << "max:" << idx_max(wsm.divnorm.thstd.T); \ 00121 w += 150; \ 00122 /* display image */ \ 00123 {idx_bloop1(m, wsm.divnorm.thstd.T, T) { \ 00124 if (w - w0 < MAXWIDTH) { \ 00125 draw_matrix(m, h, w, zoom, zoom, vmin, vmax); \ 00126 w += (uint) (m.dim(1) * zoom + 1); \ 00127 } \ 00128 } \ 00129 h0 += (uint) (m.dim(0) * zoom + 1); \ 00130 } \ 00131 w = w0; \ 00132 h = h0; \ 00133 /* display text */ \ 00134 gui << gui_only() << at(h, w) << "invstd out:" << wsm.divnorm.invstd.T \ 00135 << at(h + 15, w) << "min:" << idx_min(wsm.divnorm.invstd.T) \ 00136 << at(h + 30, w) << "max:" << idx_max(wsm.divnorm.invstd.T); \ 00137 w += 150; \ 00138 /* display image */ \ 00139 {idx_bloop1(m, wsm.divnorm.invstd.T, T) { \ 00140 if (w - w0 < MAXWIDTH) { \ 00141 draw_matrix(m, h, w, zoom, zoom, vmin, vmax); \ 00142 w += (uint) (m.dim(1) * zoom + 1); \ 00143 } \ 00144 } \ 00145 h0 += (uint) (m.dim(0) * zoom + 1); \ 00146 } \ 00147 w = w0; \ 00148 h = h0; \ 00149 } 00150 00151 CONTRAST_NORM_MODULE_GUI(display_fprop, x, fprop) 00152 CONTRAST_NORM_MODULE_GUI(display_bprop, dx, bprop) 00153 CONTRAST_NORM_MODULE_GUI(display_bbprop, ddx, bbprop) 00154 00155 } // end namespace ebl