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

Linux Cross Reference
Tina6/tina-libs/tina/medical/medSroi_alloc.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: /home/tina/cvs/tina-libs/tina/medical/medSroi_alloc.c,v $
 27  * Date    :  $Date: 2004/03/10 14:56:22 $
 28  * Version :  $Revision: 1.7 $
 29  * CVS Id  :  $Id: medSroi_alloc.c,v 1.7 2004/03/10 14:56:22 neil Exp $
 30  *
 31  * Author  : Legacy TINA
 32  *
 33 */
 34 /**
 35  *  @file
 36  *  @brief Model allocation functions for sroi functionality
 37  *
 38  *********
 39  */
 40 
 41 #if HAVE_CONFIG_H
 42 #   include <config.h>
 43 #endif
 44 
 45 #include "medSroi_alloc.h"
 46 
 47 #include <tina/sys/sysDef.h>
 48 #include <tina/sys/sysPro.h>
 49 #include <tina/math/mathPro.h>
 50 #include <tina/image/imgDef.h>
 51 #include <tina/image/imgPro.h>
 52 #include <tina/medical/med_SroiDef.h>
 53 
 54 
 55 
 56 Model *model_alloc(int nRows, int nPoints, int nOuter, int nProf)
 57 {
 58   Model         *mdl = NULL;
 59   unsigned int  i, ng;
 60 
 61   ng = nPoints * (2 * nProf - 1);
 62 
 63   if ((mdl = (Model *) ralloc(sizeof(Model))) == NULL)
 64   {
 65     error(" memory allocation failure ", non_fatal);
 66     return (NULL);
 67   }
 68   mdl->P_Evec = (Matrix **) pvector_alloc(0, nPoints);
 69   mdl->P_Eval = (Vector **) pvector_alloc(0, nPoints);
 70 
 71   mdl->m = matrix_alloc(nRows, nPoints, matrix_full, double_v);
 72   mdl->profile = matrix_alloc(nPoints, 2 * nProf - 1, matrix_full, float_v);
 73   mdl->g_profile = matrix_alloc(nPoints, 2 * nProf - 1, matrix_full, double_v);
 74   mdl->alpha = vector_alloc(nPoints, double_v);
 75   mdl->maxgrad = vector_alloc(nPoints, int_v);
 76   mdl->M_Evec = matrix_alloc(2 * nPoints, 2 * nPoints, matrix_full, double_v);
 77   mdl->M_Eval = vector_alloc(2 * nPoints, double_v);
 78   mdl->G_Evec = matrix_alloc(ng, nPoints, matrix_full, double_v);
 79   mdl->G_Eval = vector_alloc(nPoints, double_v);
 80 
 81   for (i = 0; i < nPoints; i++)
 82   {
 83     mdl->P_Evec[i] = matrix_alloc(2 * nProf - 1, 2 * nProf - 1, matrix_full, double_v);
 84     mdl->P_Eval[i] = vector_alloc(2 * nProf - 1, double_v);
 85   }
 86 
 87   mdl->m_weight = vector_alloc(2 * nPoints, double_v);
 88   mdl->p_weight = matrix_alloc(nPoints, 2 * nProf - 1, matrix_full, double_v);
 89 
 90   mdl->c = nPoints;
 91   mdl->r = nRows;
 92   mdl->o = nOuter;
 93   mdl->vsize = nProf;
 94 
 95   return (mdl);
 96 }
 97 
 98 void model_free(Model * mdl)
 99 {
100   int i;
101 
102   if (mdl == NULL)
103     return;
104 
105   matrix_free(mdl->m);
106   matrix_free(mdl->profile);
107   matrix_free(mdl->g_profile);
108   vector_free(mdl->alpha);
109   vector_free(mdl->maxgrad);
110   matrix_free(mdl->M_Evec);
111   vector_free(mdl->M_Eval);
112   matrix_free(mdl->G_Evec);
113   vector_free(mdl->G_Eval);
114   for (i = 0; i < mdl->c; i++)
115   {
116     matrix_free(mdl->P_Evec[i]);
117     vector_free(mdl->P_Eval[i]);
118   }
119   vector_free(mdl->m_weight);
120   matrix_free(mdl->p_weight);
121   rfree(mdl);
122 }
123 

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