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

Linux Cross Reference
Tina4/src/tools/nmr-segment/nmr_alloc.c

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

  1 /*
  2   nmr_alloc.c
  3 
  4   a.lacey   13.5.98
  5 */
  6 
  7 #include <stdio.h>
  8 #include <math.h>
  9 #include <tina/sys.h>
 10 #include <tina/sysfuncs.h>
 11 #include <tina/math.h>
 12 #include <tina/mathfuncs.h>
 13 #include <tina/vision.h>
 14 #include <tina/visionfuncs.h>
 15 #include <tina/tv.h>
 16 #include <tina/tvfuncs.h>
 17 #include <tina/draw.h>
 18 #include <tina/drawfuncs.h>
 19 #include <tina/seqoral.h>
 20 #include <tina/seqpro.h>
 21 #include <tina/stimdef.h>
 22 
 23 
 24 static Perfusion *perf_data = NULL;
 25 static Pl_flow   *plflow    = NULL;
 26 
 27 
 28 
 29 Perfusion  *perfusion_alloc(void)
 30 {
 31   Perfusion *p = NULL;
 32 
 33   if ((p = (Perfusion *)ralloc(sizeof(Perfusion))) == NULL)
 34     {
 35       error("perfusion_alloc: memory allocation error", warning);
 36       return (NULL);
 37     }
 38   
 39   p->st_1d = NULL;
 40   p->r2 = NULL;
 41   p->r2_ther = NULL;
 42   p->te = 0.0;
 43   p->s0_av = 0.0;
 44   p->qq = 0.0; 
 45   p->rr = 0.0; 
 46   p->bb = 0.0; 
 47   p->tt = 0.0; 
 48   p->refit = 0;
 49 
 50   return (p);
 51 }
 52 
 53 
 54 
 55 void     perfusion_free(Perfusion *p)
 56 {
 57   if (p == NULL)
 58     return;
 59 
 60   if (p->st_1d) fvector_free(p->st_1d, p->n1);
 61   if (p->r2) fvector_free(p->r2, p->n1);
 62   if(p->r2_ther) fvector_free(p->r2_ther, p->n1);
 63   p->st_1d = NULL;
 64   p->r2 = NULL;
 65   p->r2_ther = NULL;
 66 
 67   rfree(p);
 68  
 69   return;
 70 }
 71   
 72 
 73 Pl_flow  *pl_flow_alloc(void)
 74 {
 75   Pl_flow   *p = NULL;
 76 
 77   if ((p = (Pl_flow *)ralloc(sizeof(Pl_flow))) == NULL)
 78     {
 79       error("pl_flow_alloc: memory allocation error", warning);
 80       return (NULL);
 81     }
 82   
 83   p->mask = NULL;
 84 
 85   p->x = NULL;
 86   p->y1 = NULL;
 87   p->y1_area = 0.0;
 88   p->y1_max = 0.0;
 89   p->y1_min = 0.0;
 90   p->y1_diff_max = 0.0;
 91   p->y1_max_t = 0.0;
 92   p->y1_min_t = 0.0;
 93   p->y1_diff_max_t = 0.0;
 94   
 95   return (p);
 96 }
 97 
 98 
 99 
100 void     pl_flow_free(Pl_flow *p)
101 {
102   if (p == NULL)
103     return;
104 
105   fvector_free(p->x, p->x_n1);
106   fvector_free(p->y1, p->y1_n1);
107   im_free(p->mask);
108   
109   p->mask = NULL;
110   p->x = NULL;
111   p->y1 = NULL;
112 
113   rfree(p);
114  
115   return;
116 }
117 
118 
119 Pl_flow   *get_pl_flow(void)
120 {
121   return(plflow);
122 }
123 
124 
125 void       set_pl_flow(Pl_flow *p)
126 {
127   pl_flow_free(plflow);
128   plflow = p;
129 }
130 

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