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

Linux Cross Reference
Tina6/tina-tools/tinatool/tlmedical/tlmedAnl_mouse.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: tlmedAnl_mouse.c $
 37  * Date    :  $Date: 2012/06/20 14:00 $
 38  * Version :  $Revision: 1.9 $
 39  *
 40  * Author  : Legacy TINA modified NAT/HR
 41  *
 42  * Notes : 
 43  *
 44  *********
 45 */
 46 
 47 
 48 #if HAVE_CONFIG_H
 49 #   include <config.h>
 50 #endif
 51 
 52 #include <stdio.h>
 53 #include <math.h>
 54 #include <float.h>
 55 
 56 #include <tina/sys/sysDef.h>
 57 #include <tina/sys/sysPro.h>
 58 #include <tina/math/mathDef.h>
 59 #include <tina/math/mathPro.h>
 60 #include <tina/image/imgDef.h>
 61 #include <tina/image/imgPro.h>
 62 #include <tina/medical/medDef.h>
 63 #include <tina/medical/medPro.h>
 64 #include <tina/geometry/geomImg_poly_crop.h>
 65 #include <tinatool/draw/drawDef.h>
 66 #include <tinatool/draw/drawPro.h>
 67 #include <tinatool/tlbase/tlbaseDef.h>
 68 #include <tinatool/tlbase/tlbasePro.h>
 69 #include <tina/medical/med_StimDef.h>       /* HR */
 70 #include <tina/medical/medStim_alloc.h>     /* HR */
 71 #include <tina/medical/medStim_gamma.h>     /* HR */
 72 #include <tinatool/tlmedical/tlmedAnl_mouse.h>
 73 
 74 
 75 
 76 static void ***imptrs = NULL;
 77 static Vec2 start_line;
 78 static Vec2 end_line;
 79 static Vec2 p1 = {Vec2_id};
 80 static Vec2 p2 = {Vec2_id};
 81 static List *roi_poly = NULL;
 82 
 83 static void  line_length_print()
 84 {
 85   Imrect  *im = NULL;
 86   Sequence *seq = NULL;
 87   /*List *store = get_seq_start_el(seq);*/
 88   Vec3    *scale = NULL;
 89   double   o, a, theta, length_p, length_s;
 90   
 91   /*if (store != NULL)
 92     im = (Imrect *)(store->to);
 93     if (im != NULL)*/
 94   if((seq = seq_get_current()) != NULL)
 95     {
 96       scale = seq_dim_to_vec3();
 97       /*store = get_seq_start_el(seq);*/
 98     }
 99   o = fabs(vec2_y(start_line) - vec2_y(end_line));
100   a = fabs(vec2_x(start_line) - vec2_x(end_line));
101 
102   if (o < 0.01)
103     length_p = a;
104   else if (a < 0.01)
105     length_p = o;
106   else
107     {
108       theta = atan2(o, a);
109       length_p = o/sin(theta);
110     }
111 
112 
113   if (scale != NULL)
114     {
115       o = (scale->el[1])*o;
116       a = (scale->el[0])*a;
117       if (o < 0.01)
118         length_s = a;
119       else if (a < 0.01)
120         length_s = o;
121       else
122       {
123         theta = atan2(o, a);
124         length_s = o/sin(theta);
125       }
126     }
127 
128   if (scale != NULL)
129     format("line length %4.2f pixels and %4.2f mm\n", length_p, length_s);
130   else
131     format("line length %4.2f pixels\n", length_p);
132 
133   return;
134 }
135 
136 
137 static void set_start_down(Tv * tv, Ipos pos)
138 {
139     start_line = tv_backproj2(tv, pos);
140     end_line = tv_backproj2(tv, pos);
141     tv_set_overlay(tv);
142 }
143 
144 
145 static void draw_line_drag(Tv * tv, Ipos pos)
146 {
147     tv_line2(tv, start_line, end_line);
148     end_line = tv_backproj2(tv, pos);
149     tv_line2(tv, start_line, end_line);
150 }
151 
152 
153 static void draw_line_up(Tv *tv, Ipos pos)
154 {
155     tv_line2(tv, start_line, end_line);
156     end_line = tv_backproj2(tv, pos);
157     tv_reset_draw(tv);
158     tv_set_overlay(tv);
159     tv_line2(tv, start_line, end_line);
160     tv_reset_draw(tv);
161     line_length_print();
162 }
163 
164 
165 
166 static  void   mask_size_start_d(Tv *tv, Ipos pos)
167 {
168   tv_set_overlay(tv);    
169   p1 = p2 = tv_backproj2(tv, pos);
170   tv_rect2(tv, p1, p2);
171 }
172 
173 
174 static  void   mask_size_start_u(Tv *tv, Ipos pos)
175 {
176   tv_rect2(tv, p1, p2);
177   if (vec2_x(p1) < vec2_x(p2))
178     {
179       vec2_x(tv->ul) = vec2_x(p1);
180       vec2_x(tv->lr) = vec2_x(p2);
181     } 
182   else
183     {
184       vec2_x(tv->ul) = vec2_x(p2);
185       vec2_x(tv->lr) = vec2_x(p1);
186     }
187   if (vec2_y(p1) < vec2_y(p2))
188     {
189       vec2_y(tv->ul) = vec2_y(p1);
190       vec2_y(tv->lr) = vec2_y(p2);
191     } 
192   else
193     {
194       vec2_y(tv->ul) = vec2_y(p2);
195       vec2_y(tv->lr) = vec2_y(p1);
196     }
197   tv_reset_draw(tv);
198   p1 = p2; 
199   if (roi_poly!=NULL) dd_list_rm(roi_poly,vec2_free);
200   roi_poly = NULL;
201 }
202 
203 static  void   mask_size_point_d(Tv *tv, Ipos pos)
204 {
205   tv_set_overlay(tv);    
206   p2 = tv_backproj2(tv, pos);
207   tv_line2(tv,p1,p2);
208 }
209 
210 static  void   mask_size_point_u(Tv *tv, Ipos pos)
211 {
212   if (roi_poly==NULL) 
213     roi_poly = dd_ref_addtostart(roi_poly,(void *)vec2_copy
214                               (&p1),VEC2);
215   roi_poly = dd_ref_addtostart(roi_poly,(void *)vec2_copy(&p2),VEC2);
216   tv_reset_draw(tv);
217   p1 = p2;
218   if (vec2_x(p1)<vec2_x(tv->ul)) vec2_x(tv->ul) = vec2_x(p1);
219   if (vec2_x(p1)>vec2_x(tv->lr)) vec2_x(tv->lr) = vec2_x(p1);
220   if (vec2_y(p1)<vec2_y(tv->ul)) vec2_y(tv->ul) = vec2_y(p1);
221   if (vec2_y(p1)>vec2_y(tv->lr)) vec2_y(tv->lr) = vec2_y(p1);
222 }
223 
224 int    calc_mask_size(Imrect *mask)
225 {
226   int      cs_area = 0;
227   int      i, j;
228 
229   if (mask == NULL || mask->vtype != uchar_v)
230     return (cs_area);
231 
232   for (i = mask->region->ly; i < mask->region->uy; i++)
233     for (j = mask->region->lx; j < mask->region->ux; j++)
234       {
235         if (IM_CHAR(mask, i, j) == 1)
236           cs_area++;
237       }
238 
239   return(cs_area);
240 }
241 
242 static void   mask_size_show(Tv *tv, Ipos pos)
243 {
244   Imrect  *im = NULL, *mask = NULL;
245   Imrect  *reg = NULL, *res = NULL;
246   Sequence *seq = seq_get_current();
247   /*List *store = get_seq_start_el(seq);*/
248   Vec3    *scale = NULL;
249   int      cs_area = 0;
250   int      i, j, type;
251 
252   if (stack_check_types(IMRECT, NULL) == false)
253     {
254       error("mask_size_show: wrong type on stack", warning);
255       return;
256     }
257 
258   mask = (Imrect *) stack_pop(&type);
259   reg = im_alloc(mask->height, mask->width, NULL, char_v);
260   for (i = mask->region->ly; i < mask->region->uy; i++)
261     for (j = mask->region->lx; j < mask->region->ux; j++)
262       IM_CHAR(reg, i, j) = 1;
263   im_poly_crop(reg, roi_poly);
264   res = im_prod(mask, reg);
265   cs_area = calc_mask_size(res);
266 
267   /*if (store != NULL)
268     im = (Imrect *)(store->to);
269     if (im != NULL)*/
270   if (seq != NULL)
271     {
272       scale = seq_dim_to_vec3();
273     }     
274 
275   if (scale != NULL)
276     format("mask area %d pixels and %4.2f mm^2\n", cs_area, 
277            (scale->el[0])*(scale->el[1])*(double)cs_area);
278   else
279     format("mask area %d pixels\n", cs_area);
280 
281   stack_push((void *)mask, IMRECT, im_free);
282 
283   im_free(reg);
284   im_free(res);
285   return;
286 }
287 
288 static void   region_size_show(Tv *tv, Ipos pos)
289 {
290   Imrect  *im = NULL, *mask = NULL, *sim = NULL;
291   Sequence *seq = seq_get_current();
292   /*List *store = get_seq_start_el(seq);*/
293   Vec3    *scale = NULL;
294   int      cs_area = 0;
295   int      i, j, type;
296 
297  if (stack_check_types(IMRECT, NULL) == false)
298     {
299       error("region_size_show: wrong type on stack", warning);
300       return;
301     }
302 
303   sim = (Imrect *) stack_pop(&type);
304 
305   mask = im_alloc(sim->height, sim->width, NULL, char_v);
306   for (i = mask->region->ly; i < mask->region->uy; i++)
307     for (j = mask->region->lx; j < mask->region->ux; j++)
308       IM_CHAR(mask, i, j) = 1;
309   im_poly_crop(mask, roi_poly);
310    
311   /*if (store != NULL)
312     im = (Imrect *)(store->to);
313     if (im != NULL)*/
314   if (seq != NULL)
315     {
316       scale = seq_dim_to_vec3();
317     }
318   for (i = mask->region->ly; i < mask->region->uy; i++)
319       for (j = mask->region->lx; j < mask->region->ux; j++)
320         {
321           if (IM_CHAR(mask, i, j) == 1)
322             cs_area++;
323         }
324 
325   stack_push((void *)sim, IMRECT, im_free);
326 
327   if (scale != NULL)
328     format("region area %4.2f mm^2\n", (scale->el[0])*(scale->el[1])*(double)cs_area);
329   else
330     format("region area %d pixels\n", cs_area);
331 
332   im_free(mask);
333 
334   return;
335 }
336 
337 static void   pixel_ft_plot(Tv *tv, Ipos pos)
338 { 
339   Pl_flow  *plot_data = pl_flow_alloc();
340   Vec2      v = {Vec2_id};
341   Vec3     *scale = NULL;
342   Sequence *seq = seq_get_current();
343   List   *store = get_seq_start_el(seq);
344   Imrect   *im;
345   Tv       *tv_graph = imcalc_graph_tv_get();
346   float    *flow, *time;
347   float    single_time;
348   int       imptrlx, imptrux, imptrly, imptruy, imptrlz, imptruz;
349   int       length, x, y, k;
350   float    *row;
351 
352 
353   if (tv == NULL || tv->tv_screen == NULL)
354     return;
355   if (tv_graph == NULL || tv_graph->tv_screen == NULL)
356     return;
357   if ((store == NULL) || (store->to == NULL))
358     return;
359 
360   seq = (Sequence *)seq_get_current();
361   im = (Imrect *)(store->to);
362 
363   if ((single_time = seq->dim[3]) == 1.0)
364     {
365       error("pixel_ft_plot: timing info may be missing, aborting", warning);
366       return;
367     }
368   scale = (Vec3 *)seq_dim_to_vec3();
369 
370 
371   seq_slice_init(seq);
372   imptrs = seq_limits(&imptrlz, &imptruz, &imptrly, &imptruy, &imptrlx, 
373                         &imptrux);
374   length = imptruz - imptrlz;    
375   flow = (float *)fvector_alloc(0, length);
376   time = (float *)fvector_alloc(0, length);
377 
378   v = tv_backproj2(tv, pos);
379   x = tina_int(vec2_x(v));
380   y = tina_int(vec2_y(v));
381 
382   for (k = 0; k < length; k++)
383     {
384       row = imptrs[k+imptrlz][y];
385       flow[k] = row[x];
386       flow[k] *= ((scale->el[0])*(scale->el[1])/100);
387       time[k] = k*single_time;
388     }
389 
390   tv_erase(tv_graph);
391   plot(PL_INIT, PL_TV, tv_graph,
392        PL_AXIS_COLOR, black,
393        PL_X_TEXT, true,
394        PL_Y_TEXT, true,
395        PL_TITLE, "Signal v Time",
396        PL_STYLE, PL_CROSS,
397        PL_COLOR, red,
398        PL_GRAPH_DATA, length, time, flow,
399        PL_PLOT,
400        NULL);
401 
402   plot_data->mask = NULL;
403   plot_data->y1 = flow;
404   plot_data->x = fvector_copy((void *)time, 0, length);
405   plot_data->y1_n2 = plot_data->x_n2 = length;
406   plot_data->y1_n1 = plot_data->x_n1 = 0;
407   set_pl_flow(plot_data);
408   
409   return;
410 }
411 
412 static void   pixel_gfit_plot(Tv *tv, Ipos pos)
413 {
414   Perfusion *p = NULL;
415   Vec2       loc = {Vec2_id};  
416   Sequence *seq = seq_get_current();
417   Tv        *tv_g = (Tv *)imcalc_graph_tv();
418   float     *time, *x, *y1, *y2;
419   void    ***imptrs;
420   int        length, i;
421   float      single_time;
422   
423   if ((tv_g == NULL) || (tv_g->tv_screen == NULL))
424     return;
425 
426   loc = tv_backproj2(tv, pos);
427   p = perfusion_alloc();
428   seq = (Sequence *)seq_get_current();
429 
430   if ((single_time = seq->dim[3]) == 1.0)
431     {
432       error("gamma_fit_proc: timing info may be missing", warning);
433       return;
434     }
435 
436   imptrs = seq_slice_init(seq);
437   gamma_fit_pixel(p, loc, imptrs);
438   length = (p->n2 -  p->n1);
439   time = (float *)fvector_alloc(0, length);
440   for (i = 0; i < length; i++)
441     {
442       time[i] = i * single_time;
443     }
444 
445   x = time;
446   if (p->r2 != NULL && p->r2_ther !=NULL)
447   {
448     y1 = &(p->r2[p->n1]);
449     y2 = &(p->r2_ther[p->n1]);
450       
451     tv_erase(tv_g);
452     plot(PL_INIT, PL_TV, tv_g,
453          PL_AXIS_COLOR, black,
454          PL_X_TEXT, true, 
455          PL_Y_TEXT, true, 
456          PL_TITLE, "Gamma Fit",
457          PL_STYLE, PL_CROSS,
458          PL_COLOR, red,
459          PL_GRAPH_DATA, length, x, y1,
460          PL_STYLE, PL_CROSS,
461          PL_COLOR, blue,
462          PL_GRAPH_DATA, length, x, y2,
463          PL_STYLE, PL_LINE, 
464          PL_GRAPH_DATA, length, x, y2,
465          PL_PLOT,
466          NULL);
467 
468   }
469   return;
470 }
471 
472 static void   pixel_dfit_plot(Tv *tv, Ipos pos)            /* HR: new */
473 {
474   Diffusion *d = NULL;
475   Vec2       loc = {Vec2_id};  
476   Sequence  *seq = seq_get_current();
477   Tv        *tv_g = (Tv *)imcalc_graph_tv();
478   float     *x, *y1, *y2;
479   void    ***imptrs;
480   int        length, i, error_code;
481   
482   if ((tv_g == NULL) || (tv_g->tv_screen == NULL))
483     return;
484 
485   loc = tv_backproj2(tv, pos);
486 
487   d = diffusion_alloc();
488   seq = (Sequence *)seq_get_current();
489 
490   imptrs = seq_slice_init(seq);
491 
492   error_code = diff_fit_pixel(d, loc, imptrs);
493 
494   length = d->no_b;
495   x = d->b_values;
496 
497   y2 = fvector_alloc(0, length);
498 
499   if (d->signals != NULL && d->signals !=NULL)
500   {
501     y1 = d->signals;
502 
503     for(i=0; i<length; i++)
504     {
505         y2[i] = mono_exp_func(d->fit_params[0], d->b_values[i], d->fit_params[1]);
506     }      
507 
508     tv_erase(tv_g);
509     plot(PL_INIT, PL_TV, tv_g,
510          PL_AXIS_COLOR, black,
511          PL_X_TEXT, true, 
512          PL_Y_TEXT, true, 
513          PL_TITLE, "Exponential Fit",
514          PL_STYLE, PL_CROSS,
515          PL_COLOR, red,
516          PL_GRAPH_DATA, length, x, y1,
517          PL_STYLE, PL_CROSS,
518          PL_COLOR, blue,
519          PL_GRAPH_DATA, length, x, y2,
520          PL_STYLE, PL_LINE, 
521          PL_GRAPH_DATA, length, x, y2,
522          PL_PLOT,
523          NULL);
524   }
525 /*
526   diffusion_free(d);
527 */
528   fvector_free(y2, 0);
529   return;
530 }
531 
532 static void   pixel_pfit_plot(Tv *tv, Ipos pos)
533 {
534   Permeability *p = NULL;
535   Vec2       loc = {Vec2_id};  
536   Sequence *seq = seq_get_current();
537   /*List *store = get_seq_start_el(seq);*/
538   Imrect    *im = NULL;
539   Imrect    *t1im = NULL;
540   Tv        *tv_g = imcalc_graph_tv();
541   float     *time, *x, *y1, *y2;
542   int        imptrlx, imptrux, imptrly, imptruy, imptrlz, imptruz;
543   void    ***imptrs;
544   int        length, i;
545   float     single_time; 
546 
547   if ((tv_g == NULL) || (tv_g->tv_screen == NULL))
548     return;
549 
550   loc = tv_backproj2(tv, pos);
551   p = permeability_alloc();
552 
553   /*im = (Imrect *)(store->to);*/
554 
555 
556 
557   if ((single_time = seq->dim[3]) == 1.0)
558     {
559       error("gamma_fit_proc: timing info may be missing", warning);
560       return;
561     }
562 
563   imptrs = seq_slice_init(seq);
564   if ((t1im = (Imrect *)mono_image_get()) == NULL) 
565                 return;
566                 
567   if (perm_fit_pixel(p, loc, imptrs, t1im) == -1)
568   {
569       permeability_free(p);
570       return;
571   }
572   if (p->ve!=FLT_MAX) format("vp = %4.3f ve = %4.3f k = %4.7f t = %3.1f \n",
573           p->vp, p->ve, p->kin, p->tt*p->tscale);
574   else format("vp = %4.3f ve = FLT_MAX k = %4.7f t = %3.1f \n",
575           p->vp, p->kin, p->tt*p->tscale);
576 
577   imptrs = seq_limits(&imptrlz, &imptruz, &imptrly, &imptruy, &imptrlx, 
578                         &imptrux);
579 /*  length = (p->st_r2_n2 -  p->st_r2_n1);
580 */
581   length =  imptruz - imptrlz;/* 61-1 = 60 */
582   time = fvector_alloc(0, length); /* 60-0 = 60 */
583   for (i=0; i<length; i++)
584     {
585       time[i] = i * single_time;
586     }
587   x = time;
588   if ((p->conc1 != NULL) && (p->conc1_ther !=NULL))
589   {
590    
591     y1 = &(p->conc1[imptrlz]);
592     y2 = &(p->conc1_ther[imptrlz]);
593     
594     tv_erase(tv_g);
595     pl_free_set(false);
596     plot(PL_INIT, PL_TV, tv_g,
597          PL_AXIS_COLOR, black,
598          PL_X_TEXT, true, 
599          PL_Y_TEXT, true, 
600          PL_TITLE, "Permeability Fit",
601          PL_STYLE, PL_CROSS,
602          PL_COLOR, red,
603          PL_GRAPH_DATA, length, x, y1,
604          PL_STYLE, PL_CROSS,
605          PL_COLOR, blue,
606          PL_GRAPH_DATA, length, x, y2,
607          PL_STYLE, PL_LINE, 
608          PL_GRAPH_DATA, length, x, y2,
609          PL_PLOT,
610          NULL);
611 
612   }
613   permeability_free(p);
614   return;
615 }
616 
617 /*
618  *   Altered to improve lib / tool separation - GAB 19 Feb 2003
619  *   Stack manipulation from gamma_fit_region moved here.
620  */
621 double   pixel_gfit_region(Tv *tv, Ipos pos)
622 {
623   Perfusion *p = NULL;
624   Vec2       loc = {Vec2_id};
625   Sequence  *seq = seq_get_current();
626   /*List      *store = get_seq_start_el(seq);*/
627   Imrect    *im = NULL, *mask = NULL;
628   Tv        *tv_g = imcalc_graph_tv();
629   float      single_time, *time, *x, *y1, *y2;
630   int        i;
631   void    ***imptrs;
632   int        length, type;
633   double     t0;
634  
635 
636   p = perfusion_alloc();
637 
638   /*im = (Imrect *)(store->to);*/
639     
640   if ((single_time = seq->dim[3]) == 1.0)
641     {
642       error("gamma_fit_proc: timing info may be missing", warning);
643       return(0.0);
644     }
645 /*
646   imptrs = coreg_slice_init(seq, (Vec3 *)NULL);
647 */
648   imptrs = seq_slice_init(seq);
649   
650 /* old call a.lacey 22.01.03 
651   t0 = gamma_fit_region(p, loc, imptrs);
652 */
653 
654 /*
655  *   Stack manipulation from gamma_fit_region - GAB 19 Feb 2003
656  */
657   if (stack_check_types(IMRECT, NULL) == false)
658   {
659      error("gamma_fit: wrong type on stack", warning);
660      t0 = 0.0;
661   }
662   else
663   {
664      mask = (Imrect *) stack_pop(&type);
665      t0 = gamma_fit_region(p, mask);
666      stack_push((void *)mask, IMRECT, im_free);
667   }
668 
669 /*
670   imptrs = seq_limits(&imptrlz, &imptruz, &imptrly, &imptruy, &imptrlx,
671                         &imptrux);
672 */
673   length = (p->n2 -  p->n1);
674   time = (float *)fvector_alloc(0, length);
675   for (i = 0; i < length; i++)
676     {
677       time[i] = i * single_time;
678     }
679 /*
680   length =  imptruz - imptrlz;
681 */
682   x = time;
683   if (p->r2 != NULL && p->r2_ther !=NULL)
684   {
685     y1 = &(p->r2[p->n1]);
686     y2 = &(p->r2_ther[p->n1]);
687 
688     tv_erase(tv_g);
689     plot(PL_INIT, PL_TV, tv_g,
690          PL_AXIS_COLOR, black,
691          PL_X_TEXT, true, 
692          PL_Y_TEXT, true,
693          PL_TITLE, "Gamma Fit",
694          PL_STYLE, PL_CROSS,
695          PL_COLOR, red,
696          PL_GRAPH_DATA, length, x, y1,
697          PL_STYLE, PL_CROSS,
698          PL_COLOR, blue,
699          PL_GRAPH_DATA, length, x, y2,
700          PL_STYLE, PL_LINE,
701          PL_GRAPH_DATA, length, x, y2,
702          PL_PLOT,
703          NULL);
704 
705   }
706   return(t0);
707 }
708 
709 Tv_mouse     nmr_dfit_mouse(void)                          /* HR: new */
710 {
711     return (mouse_define(MOUSE_NAME, "diff fit",
712                          LEFT_NAME, "pixel",
713                          LEFT_DOWN, pixel_dfit_plot,
714                          NULL));
715 }
716 
717 Tv_mouse     nmr_gfit_mouse(void)
718 {
719     return (mouse_define(MOUSE_NAME, "gamma fit",
720                          LEFT_NAME, "pixel",
721                          LEFT_DOWN, pixel_gfit_plot,
722                          NULL));
723 }
724 
725 Tv_mouse     nmr_permfit_mouse(void)
726 {
727     return (mouse_define(MOUSE_NAME, "permeability fit",
728                          LEFT_NAME, "pixel",
729                          LEFT_DOWN, pixel_pfit_plot,
730                          NULL));
731 }
732 
733 Tv_mouse     nmr_flow_mouse()
734 {
735     return (mouse_define(MOUSE_NAME, "F/T",
736                          LEFT_NAME, "pixel",
737                          LEFT_DOWN, pixel_ft_plot,
738                          NULL));
739 }
740 
741 Tv_mouse      nmr_masksize_mouse(void)
742 {
743   return (mouse_define(MOUSE_NAME,  "mask size",
744                        LEFT_NAME,   "start",
745                        LEFT_DOWN,    mask_size_start_d,
746                        LEFT_UP,      mask_size_start_u,
747                        RIGHT_NAME,  "next",
748                        RIGHT_DOWN,   mask_size_point_d,
749                        RIGHT_UP,     mask_size_point_u,
750                        MIDDLE_NAME, "size",
751                        MIDDLE_DOWN,  mask_size_show,
752                        NULL));
753 
754 }
755 
756 Tv_mouse      nmr_regsize_mouse(void)
757 {
758   return (mouse_define(MOUSE_NAME,  "region size",
759                        LEFT_NAME,   "start",
760                        LEFT_DOWN,    mask_size_start_d,
761                        LEFT_UP,      mask_size_start_u,
762                        RIGHT_NAME,  "next",
763                        RIGHT_DOWN,   mask_size_point_d,
764                        RIGHT_UP,     mask_size_point_u,
765                        MIDDLE_NAME, "size",
766                        MIDDLE_DOWN,  region_size_show,
767                        NULL));
768 
769 }
770 
771 Tv_mouse      nmr_linelen_mouse(void)
772 {
773     return (mouse_define(MOUSE_NAME, "line length",
774                          LEFT_NAME, "line",
775                          LEFT_DOWN, set_start_down,
776                          LEFT_DRAG, draw_line_drag,
777                          LEFT_UP,   draw_line_up,
778                          NULL));
779 }
780 
781 

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