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

Linux Cross Reference
Tina6/tina-tools/tinatool/tlbase/tlbaseSter_left.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/tlbaseSter_left.c,v $
 37  * Date    :  $Date: 2008/12/02 22:04:19 $
 38  * Version :  $Revision: 1.5 $
 39  * CVS Id  :  $Id: tlbaseSter_left.c,v 1.5 2008/12/02 22:04:19 paul Exp $
 40  *
 41  * Author  :  Legacy TINA
 42  *
 43  * Notes :
 44  *
 45  *********
 46 */
 47 
 48 #include "tlbaseSter_left.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 <tina/image/imgDef.h>
 60 #include <tina/image/imgPro.h>
 61 #include <tinatool/draw/drawDef.h>
 62 #include <tinatool/draw/drawPro.h>
 63 #include <tinatool/tlbase/tlbase_InfrPro.h>
 64 
 65 Tv     *tv_create();
 66 
 67 static Bool image_on = true;
 68 static Bool edges_on;
 69 static Bool corners_on;
 70 static Bool strings_on;
 71 static Bool poly_on;
 72 
 73 void    left_image_on(Bool on)
 74 {
 75     image_on = on;
 76 }
 77 
 78 void    left_edges_on(Bool on)
 79 {
 80     edges_on = on;
 81 }
 82 
 83 void    left_corners_on(Bool on)
 84 {
 85     corners_on = on;
 86 }
 87 
 88 void    left_strings_on(Bool on)
 89 {
 90     strings_on = on;
 91 }
 92 
 93 void    left_poly_on(Bool on)
 94 {
 95     poly_on = on;
 96 }
 97 
 98 void    left_backdraw(Tv * tv)
 99 {
100     Imrect *im = left_image();
101 
102     if (image_on && (im != NULL))
103     {
104         im = imf_scale(im, 0.0, 255.0);
105         tv_imrect2(tv, im);
106         im_free(im);
107     }
108 }
109 
110 void    left_fulldraw(Tv * tv)
111 {
112     Imrect *er = left_edges_get();
113     Imrect *cnr = left_corners_get();
114     List   *poly = left_geom_get();
115 
116     if (edges_on && (er != NULL))
117         tv_edges_conn(tv, er);
118     if (strings_on && (er != NULL))
119         tv_strings(tv, er);
120     if (corners_on && (cnr != NULL))
121         tv_edges_conn(tv, cnr);
122     if (poly_on && poly != NULL)
123         reclist_list_draw(tv, poly, 0, geom_col_draw, NULL);
124 }
125 
126 void    left_init(Tv * tv)
127 {
128     Imrect *im = left_image();
129     Imrect *er = left_edges();
130 
131     if (im != NULL)
132         tv_camera2_roi(tv, im->region);
133 /*
134         tv_camera2_image(tv, im->width, im->height);
135 */
136     else if (er != NULL)
137         tv_camera2_roi(tv, er->region);
138 /*
139         tv_camera2_image(tv, er->width, er->height);
140 */
141 }
142 
143 void    left_skeldraw(Tv * tv)
144 {
145     Imrect *im = left_image();
146     Imrect *er = left_edges();
147     List   *poly = left_geom_get();
148 
149     if (image_on && (im != NULL))
150         tv_imrect_skel(tv, im);
151     else if ((edges_on || strings_on) && (er != NULL))
152         tv_imrect_skel(tv, er);
153     if (poly_on && poly != NULL)
154         reclist_list_draw(tv, poly, 0, geom_draw, NULL);
155 }
156 
157 Tv     *left_tv_make(void)
158 {
159     Tv     *tvleft = NULL;
160 
161     tvleft = tv_create("left");
162     (void) tv_set_backdraw(tvleft, left_backdraw);
163     (void) tv_set_fulldraw(tvleft, left_fulldraw);
164     (void) tv_set_skeldraw(tvleft, left_skeldraw);
165     tv_set_init(tvleft, left_init);
166     (void) tv_set_zoomlevel(tvleft, IMZOOM);
167     return (tvleft);
168 }
169 
170 void    left_grey(Tv * tv, Ipos pos)
171 {
172     Vec2    v = {Vec2_id};
173     Vec2    tv_backproj2();
174     Imrect *im = left_image();
175     int     x, y, val;
176 
177     v = tv_backproj2(tv, pos);
178     x = vec2_x(v);
179     y = vec2_y(v);
180     val = im_get_pix(im, y, x);
181 
182     format("pos %10d %10d:     grey level = %10d\n", x, y, val);
183 }
184 
185 Tv_mouse left_grey_mouse(void)
186 {
187     return (mouse_define(MOUSE_NAME, "grey mouse",
188                          LEFT_NAME, "grey",
189                          LEFT_DOWN, left_grey, NULL));
190 }
191 

~ [ 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.