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

Linux Cross Reference
Tina6/tina-tools/tinatool/tlmedical/tlmedSroi_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    :  
 37  * Date    :  
 38  * Version : 
 39  * CVS Id  : 
 40  *
 41  *********
 42 */
 43 
 44 #include "tlmedSroi_view.h"
 45 
 46 #if HAVE_CONFIG_H
 47 #   include <config.h>
 48 #endif
 49 
 50 
 51 #include <math.h>
 52 #include <stdio.h>
 53 #include <string.h>
 54 
 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 #include <tina/geometry/geomDef.h>
 64 #include <tina/geometry/geomPro.h>
 65 #include <tinatool/draw/drawDef.h>
 66 #include <tinatool/draw/drawPro.h>
 67 #include <tinatool/wdgts/wdgtsDef.h>
 68 #include <tinatool/wdgts/wdgtsPro.h>
 69 #include <tinatool/tlbase/tlbase_InfrDef.h>
 70 #include <tinatool/tlbase/tlbase_InfrPro.h>
 71 
 72 #include <tina/medical/med_SroiDef.h>
 73 #include <tinatool/tlmedical/tlmedSroi_tool.h>
 74 
 75 Imrect *tv_get_imrect(Tv *tv)
 76 {
 77   if (tv == NULL)
 78     return(NULL);
 79 
 80   if (!strcmp(tv->label, "mono"))
 81     return(mono_image_get());
 82   if (!strcmp(tv->label, "right"))
 83     return(right_image_get());
 84   if (!strcmp(tv->label, "left"))
 85     return(left_image_get());
 86   if (!strcmp(tv->label, "sequence"))
 87     return((Imrect *)seq_image_get());
 88  
 89   return(NULL);
 90 }
 91 
 92 
 93 void draw_sample_outer(Tv *tv, Model *model)
 94 {
 95   Vec2    v;
 96   double *a, **el, x, y;
 97   int     i, j;
 98 
 99   if ((tv == NULL) || (model == NULL))
100     return;
101 
102   el = model->m->el.double_v;
103   a = (double *) model->alpha->data;
104 
105 /*
106  * mark centre and endpoints in blue
107  */
108 
109   tv_set_color(tv, blue);
110   v = vec2(model->tx, model->ty);
111   tv_cross(tv, tv_proj2(tv, v), 4);
112 
113   for (i = 0; i < model->o; i++)
114   {
115     if (i == 0)
116       tv_set_color(tv, blue);
117     else if (!(model->o%2) && (i == (model->o/2)))
118       tv_set_color(tv, blue);
119     else if ((model->o%2) && (i == model->o/2))
120       tv_set_color(tv, blue);
121     else
122       tv_set_color(tv, red);
123       
124     v = vec2(el[0][i], el[1][i]);
125     tv_cross(tv, tv_proj2(tv, v), 4);
126 
127     tv_set_color(tv, green);
128     for (j = 1; j < model->vsize; j++)
129     {
130       x = cos(a[i]) * (double) j;
131       y = sin(a[i]) * (double) j;
132       tv_point2(tv, vec2(el[0][i] + x, el[1][i] + y));
133       tv_point2(tv, vec2(el[0][i] - x, el[1][i] - y));
134     }
135   }
136 
137   tv_flush(tv);
138 }
139 
140 
141 void  draw_sample_inner(Tv *tv, Model *model)
142 {
143   Vec2    v;
144   double *a, **el, x, y;
145   int     i, j;
146 
147   if ((tv == NULL) || (model == NULL))
148     return;
149   
150   el = model->m->el.double_v;
151   a = (double *) model->alpha->data;
152   
153   for (i = model->o; i < model->c; i++)
154   {
155     tv_set_color(tv, yellow);
156       
157     v = vec2(el[0][i], el[1][i]);
158     tv_cross(tv, tv_proj2(tv, v), 4);
159 
160     tv_set_color(tv, green);
161     for (j = 1; j < model->vsize; j++)
162     {
163       x = cos(a[i]) * (double) j;
164       y = sin(a[i]) * (double) j;
165       tv_point2(tv, vec2(el[0][i] + x, el[1][i] + y));
166       tv_point2(tv, vec2(el[0][i] - x, el[1][i] - y));
167     }
168   }
169 
170   tv_flush(tv);
171 }
172 
173 

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