~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina6/tina-tools/tinatool/tlbase/tlbaseMono_view.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**********
  2  * 
  3  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  4  * University of Manchester, UK.  All rights reserved.
  5  * 
  6  * Redistribution and use in source and binary forms, with or without modification, 
  7  * are permitted provided that the following conditions are met:
  8  * 
  9  *   . Redistributions of source code must retain the above copyright notice, 
 10  *     this list of conditions and the following disclaimer.
 11  *    
 12  *   . Redistributions in binary form must reproduce the above copyright notice,
 13  *     this list of conditions and the following disclaimer in the documentation 
 14  *     and/or other materials provided with the distribution.
 15  * 
 16  *   . Neither the name of the University of Manchester nor the names of its
 17  *     contributors may be used to endorse or promote products derived from this 
 18  *     software without specific prior written permission.
 19  * 
 20  * 
 21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 31  * POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  **********
 34  * 
 35  * Program :    TINA
 36  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/tlbase/tlbaseMono_view.c,v $
 37  * Date    :  $Date: 2008/12/02 22:04:19 $
 38  * Version :  $Revision: 1.4 $
 39  * CVS Id  :  $Id: tlbaseMono_view.c,v 1.4 2008/12/02 22:04:19 paul Exp $
 40  *
 41  * Author  :  Legacy TINA
 42  *
 43  * Notes :
 44  *
 45  *********
 46 */
 47 
 48 #include "tlbaseMono_view.h"
 49 
 50 #if HAVE_CONFIG_H
 51 #include <config.h>
 52 #endif
 53 
 54 #include <stdio.h>
 55 #include <tina/sys/sysDef.h>
 56 #include <tina/sys/sysPro.h>
 57 #include <tina/math/mathDef.h>
 58 #include <tina/math/mathPro.h>
 59 #include <tinatool/draw/drawDef.h>
 60 #include <tinatool/draw/drawPro.h>
 61 #include <tina/image/imgDef.h>
 62 #include <tina/image/imgPro.h>
 63 
 64 #include <tinatool/tlbase/tlbase_InfrDef.h>
 65 #include <tinatool/tlbase/tlbase_InfrPro.h>
 66 
 67 Tv     *tv_create();
 68 
 69 static Bool image_on;
 70 static Bool edges_on;
 71 static Bool corners_on;
 72 static Bool strings_on;
 73 static Bool poly_on;
 74 
 75 void    mono_image_on(Bool on)
 76 {
 77     image_on = on;
 78 }
 79 
 80 void    mono_edges_on(Bool on)
 81 {
 82     edges_on = on;
 83 }
 84 
 85 void    mono_corners_on(Bool on)
 86 {
 87     corners_on = on;
 88 }
 89 
 90 void    mono_strings_on(Bool on)
 91 {
 92     strings_on = on;
 93 }
 94 
 95 void    mono_poly_on(Bool on)
 96 {
 97     poly_on = on;
 98 }
 99 
100 void    mono_backdraw(Tv * tv)
101 {
102     Imrect *im = mono_image();
103 
104     if (image_on && (im != NULL))
105     {
106         im = imf_scale(im, 0.0, 255.0); 
107         tv_imrect2(tv, im);
108         im_free(im);
109     }
110 }
111 
112 void    mono_fulldraw(Tv * tv)
113 {
114     Imrect *er = mono_edges();
115     Imrect *cnr = mono_corners_get();
116     List   *poly = mono_geom();
117 
118     if (edges_on && (er != NULL))
119         tv_edges_conn(tv, er);
120     if (corners_on && (cnr != NULL))
121         tv_edges_conn(tv, cnr);
122     if (strings_on && (er != NULL))
123         tv_strings(tv, er);
124     if (poly_on && poly != NULL)
125         reclist_list_draw(tv, poly, 0, geom_col_draw, NULL);
126 }
127 
128 void    mono_init(Tv * tv)
129 {
130     Imrect *im = mono_image();
131     Imrect *er = mono_edges();
132 
133     if (im != NULL)
134         tv_camera2_image(tv, im->width, im->height);
135     else if (er != NULL)
136         tv_camera2_image(tv, er->width, er->height);
137 }
138 
139 void    mono_skeldraw(Tv * tv)
140 {
141     Imrect *im = mono_image();
142     Imrect *er = mono_edges();
143     List   *poly = mono_geom();
144 
145     if (image_on && (im != NULL))
146         tv_imrect_skel(tv, im);
147     else if ((edges_on || strings_on) && (er != NULL))
148         tv_imrect_skel(tv, er);
149     if (poly_on && poly != NULL)
150         reclist_list_draw(tv, poly, 0, geom_draw, NULL);
151 }
152 
153 Tv     *mono_tv_make(void)
154 {
155     Tv     *tvmono = NULL;
156 
157     tvmono = tv_create("mono");
158     (void) tv_set_backdraw(tvmono, mono_backdraw);
159     (void) tv_set_fulldraw(tvmono, mono_fulldraw);
160     (void) tv_set_skeldraw(tvmono, mono_skeldraw);
161     (void) tv_set_zoomlevel(tvmono, IMZOOM);
162     tv_set_init(tvmono, mono_init);
163     return (tvmono);
164 }
165 
166 void    mono_grey(Tv * tv, Ipos pos)
167 {
168     Vec2    v = {Vec2_id};
169     Vec2    tv_backproj2();
170     Imrect *im = mono_image();
171     int     x, y, val;
172 
173     v = tv_backproj2(tv, pos);
174     x = vec2_x(v);
175     y = vec2_y(v);
176     val = im_get_pix(im, y, x);
177 
178     format("pos %10d %10d:     grey level = %10d\n", x, y, val);
179 }
180 
181 Tv_mouse mono_grey_mouse(void)
182 {
183     return (mouse_define(MOUSE_NAME, "grey mouse",
184                          LEFT_NAME, "grey",
185                          LEFT_DOWN, mono_grey, NULL));
186 }
187 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.