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

Linux Cross Reference
Tina6/tina-libs/tina/medical/medStim_tdata.c

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

  1 /**********
  2  *
  3  * This file is part of the TINA Open Source Image Analysis Environment
  4  * henceforth known as TINA
  5  *
  6  * TINA is free software; you can redistribute it and/or modify
  7  * it under the terms of the GNU General Public License as
  8  * published by the Free Software Foundation.
  9  *
 10  * TINA is distributed in the hope that it will be useful,
 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  * GNU General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU General Public License
 16  * along with TINA; if not, write to the Free Software Foundation, Inc.,
 17  * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 18  *
 19  * ANY users of TINA who require exemption from the existing licence must
 20  * negotiate a new licence with Dr. Neil.A.Thacker, the sole agent for
 21  * the University of Manchester.
 22  *
 23  **********
 24  *
 25  * Program :    TINA
 26  * File    :  $Source: medStim_tdata.c $
 27  * Date    :  $Date: 2012/06/20 12:00 $
 28  * Version :  $Revision: 1.5 $
 29  *
 30  * Author  : Legacy TINA modified NAT/HR
 31  *
 32  * Notes:
 33  *
 34  *********
 35 */
 36 
 37 
 38 #if HAVE_CONFIG_H
 39 #   include <config.h>
 40 #endif
 41 
 42 #include <stdio.h>
 43 #include <math.h>
 44 #include <tina/sys/sysDef.h>
 45 #include <tina/sys/sysPro.h>
 46 #include <tina/math/mathDef.h>
 47 #include <tina/math/mathPro.h>
 48 #include <tina/image/imgDef.h>
 49 #include <tina/image/imgPro.h>
 50 #include <tina/medical/med_StimDef.h>
 51 #include <tina/medical/medStim_tdata.h>  /* HR */
 52 
 53 
 54 float  *s_2d_mask_mean(void ***imptrs, Imrect *mask, Perfusion *p)
 55 {
 56   float   *mean, area_sum;
 57   int      i, j, k, total;
 58   double val;
 59   Imregion roi;
 60   if (mask!=NULL) roi = *(Imregion*)mask->region;
 61   else return(NULL);
 62 
 63 
 64   if ((mean = fvector_alloc(p->n1, p->n2)) == NULL)
 65     return(NULL);
 66 
 67   for (k = p->n1; k < p->n2; k++)
 68   {
 69     area_sum = 0.0;
 70     total = 0;
 71 
 72     for (i = roi.ly; i < roi.uy; i++)
 73     {
 74       for (j = roi.lx; j < roi.ux; j++)
 75       {
 76          IM_PIX_GET(mask, i, j, val);
 77         if (val == 1)
 78         {
 79           area_sum += this_pixel(imptrs, k, i, j);
 80           total++;
 81         }
 82       }
 83     }
 84     mean[k] = area_sum/(float)total;
 85   }
 86 
 87  return(mean);
 88 }
 89 
 90 float  *s_2d_pixel_get(void ***imptrs, Vec2 v, Perfusion *p)
 91 {
 92   float   *data;
 93   int      i, j, k;
 94 
 95 
 96   if ((data = fvector_alloc(p->n1, p->n2)) == NULL)
 97     return(NULL);
 98 
 99   j = tina_int(vec2_x(v));
100   i = tina_int(vec2_y(v));
101 
102   for (k = p->n1; k < p->n2-1; k++)
103   {
104        data[k] = 0.5*(this_pixel(imptrs, k, i, j)
105                   +this_pixel(imptrs, k+1, i, j));
106   }
107   data[k] = this_pixel(imptrs, k, i, j);
108 
109   return(data);
110 }
111 
112 
113 float  *diff_2d_pixel_get(void ***imptrs, Vec2 v, Diffusion *d)      /* HR: new */
114 {
115   float   *data;
116   int      i, j, k;
117 
118   if ((data = fvector_alloc(0, d->no_b)) == NULL)
119     return(NULL);
120 
121   j = tina_int(vec2_x(v));
122   i = tina_int(vec2_y(v));
123 
124   for (k = 1; k <= d->no_b; k++)
125   {
126        data[k-1] = this_pixel(imptrs, k, i, j);
127   }
128 
129   return(data);
130 }
131 

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