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

Linux Cross Reference
Tina4/src/tools/sequence/seq_voi.c

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

  1 /*
  2  *
  3  * voi.c
  4  *
  5  * volume of interest handling functions
  6  *
  7  */
  8 /** Modified to remove all snake stuff MLJS 29/11/00 **/
  9 #include <math.h>
 10 #include <tina/sys.h>
 11 #include <tina/sysfuncs.h>
 12 #include <tina/math.h>
 13 #include <tina/mathfuncs.h>
 14 #include <tina/vision.h>
 15 #include <tina/visionfuncs.h>
 16 #include <tina/splinefuncs.h>
 17 #include <tina/seqvoi.h>
 18 
 19 Seqvoi *svoi_alloc(void)
 20 {
 21     Seqvoi *voi = (Seqvoi *) ralloc(sizeof(Seqvoi));
 22 
 23     voi->string = NULL;
 24     voi->spline = NULL;
 25     return (voi);
 26 }
 27 
 28 void svoi_free(Seqvoi * voi)
 29 {
 30     if (voi == NULL)
 31         return;
 32     str_free(voi->string, rfree);
 33     spline2_free(voi->spline);
 34     rfree(voi);
 35 }
 36 
 37 void svoi_empty(Seqvoi * voi)
 38 {
 39     if (voi == NULL)
 40         return;
 41     spline2_free(voi->spline);
 42     voi->spline = NULL;
 43     str_free(voi->string, rfree);
 44     voi->string = NULL;
 45 }
 46 
 47 void svoi_string_changed(Seqvoi * voi)
 48 {
 49     if (voi == NULL)
 50         return;
 51     spline2_free(voi->spline);
 52     voi->spline = NULL;
 53     voi->n = 0;
 54 }
 55 
 56 /*
 57 void svoi_spline_changed(Seqvoi * voi)
 58 {
 59     if (voi == NULL)
 60         return;
 61     str_free(voi->string, rfree);
 62     voi->string = NULL;
 63 }
 64 */
 65 
 66 
 67 Tstring *svoi_string_get(Seqvoi * voi)
 68 {
 69     if (voi == NULL)
 70         return (NULL);
 71 
 72     if (voi->string != NULL)
 73         return (voi->string);
 74 
 75     if (voi->spline != NULL)
 76     {
 77         voi->string = str2_of_spline2(voi->spline);
 78         return (voi->string);
 79     }
 80     return (NULL);
 81 }
 82 
 83 Seqvoi *svoi_copy(Seqvoi * oldvoi)
 84 {
 85     Seqvoi *voi = (Seqvoi *) ralloc(sizeof(Seqvoi));
 86     voi->string = str2_copy(svoi_string_get(oldvoi));
 87     voi->spline = NULL;
 88     voi->nspline = oldvoi->nspline;
 89     voi->n = oldvoi->n;
 90     return (voi);
 91 }
 92 
 93 
 94 void svoi_string_set(Seqvoi * voi, Tstring * str)
 95 {
 96     svoi_empty(voi);
 97     if(str2_area(str) < 0.0)
 98         str_reverse(str);
 99     voi->string = str;
100 }
101 
102 Spline2 *svoi_spline_get(Seqvoi * voi)
103 {
104     Tstring *string;
105 
106     if (voi == NULL)
107         return (NULL);
108     if (voi->spline != NULL)
109         return (voi->spline);
110 
111     string = svoi_string_get(voi);
112     if (string == NULL)
113         return (NULL);
114     else
115     {
116       /*int n = 8;
117         voi->spline = spline2_approx_str2(string, &n, 1.0);
118         return (voi->spline);*/
119     }
120 }
121 
122 void svoi_spline_set(Seqvoi * voi, Spline2 * spline)
123 {
124     svoi_empty(voi);
125     voi->spline = spline;
126 }
127 
128 void svoi_shift(Seqvoi * voi, Vec2 dp)
129 {
130     Tstring *string = svoi_string_get(voi);
131     str2_translate(string, dp);
132     svoi_string_changed(voi);
133 }
134 

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