Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

SUMA_SurfMeasures.c File Reference

#include "mrilib.h"
#include "SUMA_suma.h"
#include "SUMA_SurfMeasures.h"

Go to the source code of this file.


Defines

#define VERSION   "version 1.11 (October 6, 2004)"
#define CHECK_ARG_COUNT(ac, str)
#define SM_2SURF_TEST(code)

Functions

void machdep (void)
int main (int argc, char *argv[])
int write_output (opts_t *opts, param_t *p)
float norm2seg_angle (THD_fvec3 *p0, THD_fvec3 *p1, float *norm)
float fvec_magnitude (float *v, int length)
float vector_angle (float *v0, float *v1)
int print_column_headers (opts_t *opts, param_t *p)
int verify_surf_t (opts_t *opts, param_t *p)
int get_surf_data (opts_t *opts, param_t *p)
int get_surf_measures (opts_t *opts, param_t *p)
int surf_triangle_match (opts_t *opts, param_t *p)
int cross_product (double *res, double *u, double *v)
double dot_product (double *u, double *v)
int compute_node_areas (opts_t *opts, param_t *p, int sindex)
int compute_node_vols (opts_t *opts, param_t *p)
int compute_face_vols (opts_t *opts, param_t *p)
int all_mappable_surfs (opts_t *opts, param_t *p)
int spec2SUMA (SUMA_SurfSpecFile *spec, opts_t *opts)
int add_to_flist (func_t *F, char *fname)
int init_opts_t (opts_t *opts)
int init_options (opts_t *opts, int argc, char *argv[])
int validate_options (opts_t *opts, param_t *p)
int get_cmask (opts_t *opts, param_t *p)
int read_nodes_file (opts_t *opts, param_t *p)
int validate_option_lists (opts_t *opts, param_t *p)
int usage (char *prog, int use_type)
int check_func_name (char *func)
int final_cleanup (opts_t *opts, param_t *p)
double tetra_volume (float *p0, float *p1, float *p2, float *p3)
double dist_fn (int len, float *p1, float *p2)
int disp_surf_t (char *info, surf_t *d)
int disp_func_t (char *info, func_t *d)
int disp_opts_t (char *info, opts_t *d)
int disp_param_t (char *info, param_t *d)
int disp_f3_point (char *info, float *d)
double lazy_det (int width, double *data)

Variables

char g_history []
SUMA_SurfaceViewerSUMAg_SVv = NULL
int SUMAg_N_SVv = 0
SUMA_DOSUMAg_DOv = NULL
int SUMAg_N_DOv = 0
SUMA_CommonFieldsSUMAg_CF = NULL
char * g_sm_names []
char * g_sm_desc []

Define Documentation

#define CHECK_ARG_COUNT ac,
str   
 

Value:

do {                        \
            if ((ac+1) >= argc) {   \
                fputs(str,stderr);  \
                RETURN(-1);         \
            }                       \
        } while (0)

Definition at line 1375 of file SUMA_SurfMeasures.c.

#define SM_2SURF_TEST code   
 

Value:

do{ if (p->S.nsurf<2) {                                     \
                    fprintf(stderr,"** function %s requires 2 surfaces\n",  \
                            g_sm_names[fcodes[code]]);                      \
                    errs++;                                                 \
                }                                                           \
            } while (0);

Definition at line 1702 of file SUMA_SurfMeasures.c.

Referenced by validate_option_lists().

#define VERSION   "version 1.11 (October 6, 2004)"
 

Definition at line 2 of file SUMA_SurfMeasures.c.

Referenced by usage().


Function Documentation

int add_to_flist func_t   F,
char *    fname
 

Definition at line 1297 of file SUMA_SurfMeasures.c.

References check_func_name(), CHECK_NULL_STR, func_t::codes, E_SM_INVALID, ENTRY, func_t::nalloc, func_t::names, func_t::nused, realloc, RETURN, and ST_DEFAULT_FALLOC.

Referenced by init_options(), and init_opts_t().

01298 {
01299 ENTRY("add_to_flist");
01300 
01301     if ( F->nused >= F->nalloc )
01302     {
01303         F->nalloc += ST_DEFAULT_FALLOC;
01304         F->names   = (char **)realloc(F->names, F->nalloc*sizeof(char *));
01305         F->codes   = (int   *)realloc(F->codes, F->nalloc*sizeof(int   ));
01306 
01307         if ( !F->names || !F->codes )
01308         {
01309             fprintf(stderr,"** failed to allocate for %d functs (%p,%p)\n",
01310                     F->nalloc, F->names, F->codes);
01311             RETURN(-1);
01312         }
01313     }
01314 
01315     F->names[F->nused] = fname;
01316     F->codes[F->nused] = check_func_name(fname);
01317 
01318     if ( F->codes[F->nused] == E_SM_INVALID )
01319     {
01320         fprintf(stderr,"** function '%s' is not valid\n",
01321                 CHECK_NULL_STR(fname));
01322         RETURN(-1);
01323     }
01324 
01325     F->nused++;                 /* we've got another good one */
01326 
01327     RETURN(0);
01328 }

int all_mappable_surfs opts_t   opts,
param_t   p
 

Definition at line 1153 of file SUMA_SurfMeasures.c.

References ALLOC_CHECK, SUMA_SurfaceObject::AnatCorrect, opts_t::debug, ENTRY, SUMA_SurfaceObject::Label, malloc, SUMA_SurfaceObject::N_FaceSet, SUMA_SurfaceObject::N_Node, surf_t::nfaces, surf_t::nnodes, surf_t::nsurf, SUMA_DO::OP, p, RETURN, param_t::S, surf_t::salloc, surf_t::slist, SUMA_isSO(), SUMA_Print_Surface_Object(), and SUMAg_N_DOv.

Referenced by get_surf_data().

01154 {
01155     SUMA_SurfaceObject * so;
01156     int                  count;
01157 
01158 ENTRY("all_mappable_surfs");
01159 
01160     p->S.slist = (SUMA_SurfaceObject **)malloc(SUMAg_N_DOv *
01161                                                sizeof(SUMA_SurfaceObject *));
01162     ALLOC_CHECK(p->S.slist,"SUMA_SurfaceObject *",SUMAg_N_DOv);
01163 
01164     p->S.salloc = SUMAg_N_DOv;          /* number allocated for              */
01165     p->S.nsurf  = 0;                    /* number of mappable surfaces found */
01166 
01167     for ( count = 0; count < SUMAg_N_DOv; count++ )
01168     {
01169         if ( ! SUMA_isSO(SUMAg_DOv[count]) )
01170             continue;
01171 
01172         so = (SUMA_SurfaceObject *)SUMAg_DOv[count].OP;
01173 
01174 /*      if ( ! SUMA_isINHmappable(so) )       -  deprecated  [v1.5] */
01175 
01176 #if 0   /* do not require this [v1.9] */
01177 
01178         if ( ! so->AnatCorrect )
01179         {
01180             if ( opts->debug )
01181                 fprintf(stderr,"** warning: surface '%s' is not mappable, "
01182                         "skipping...\n", so->Label ? so->Label : "<unnamed>");
01183             if ( opts->debug > 1 )
01184                 fprintf(stderr,"** consider adding the following to the "
01185                                "surface definition in the spec file:\n"
01186                                "       Anatomical = Y\n");
01187             continue;
01188         }
01189 #endif
01190 
01191         if ( opts->debug > 1 )
01192         {
01193             fprintf(stderr,"-------- surface #%d (%s) --------\n",
01194                     p->S.nsurf, so->Label ? so->Label : "<unnamed>");
01195             if ( opts->debug > 3 )
01196                 SUMA_Print_Surface_Object(so, stderr);
01197         }
01198 
01199         p->S.slist[p->S.nsurf] = so;
01200         p->S.nsurf++;
01201     }
01202 
01203     if ( p->S.nsurf > 0 )
01204     {
01205         p->S.nnodes = p->S.slist[0]->N_Node;
01206         p->S.nfaces = p->S.slist[0]->N_FaceSet;
01207     }
01208 
01209     if ( opts->debug )
01210         fprintf(stderr, "++ found %d mappable surfaces\n", p->S.nsurf);
01211 
01212     RETURN(0);
01213 }

int check_func_name char *    func
 

Definition at line 2179 of file SUMA_SurfMeasures.c.

References E_SM_FINAL, E_SM_INVALID, ENTRY, fnum, g_sm_names, and RETURN.

Referenced by add_to_flist().

02180 {
02181     int fnum;
02182 
02183 ENTRY("check_func_name");
02184 
02185     if ( !func )
02186         RETURN(E_SM_INVALID);
02187 
02188     /* just to be safe, let's verify the names and enum */
02189 
02190     if ( sizeof(g_sm_names)/sizeof(char *) != (int)E_SM_FINAL )
02191     {
02192         fprintf(stderr,"** error: g_sm_names mis-match\n");
02193         RETURN(E_SM_INVALID);
02194     }
02195 
02196     if ( sizeof(g_sm_desc)/sizeof(char *) != (int)E_SM_FINAL )
02197     {
02198         fprintf(stderr,"** error: g_sm_desc mis-match\n");
02199         RETURN(E_SM_INVALID);
02200     }
02201 
02202     for ( fnum = E_SM_INVALID; fnum < E_SM_FINAL; fnum++ )
02203         if ( !strcmp(func, g_sm_names[fnum]) )
02204             RETURN(fnum);
02205 
02206     RETURN(E_SM_INVALID);
02207 }

int compute_face_vols opts_t   opts,
param_t   p
 

Definition at line 1053 of file SUMA_SurfMeasures.c.

References ALLOC_CHECK, opts_t::debug, opts_t::dnode, ENTRY, SUMA_SurfaceObject::FaceSetList, surf_t::fvol, i1, i2, malloc, surf_t::nfaces, surf_t::nnodes, SUMA_SurfaceObject::NodeList, p, RETURN, param_t::S, surf_t::slist, tetra_volume(), and v1.

Referenced by get_surf_measures().

01054 {
01055     SUMA_SurfaceObject    * so0, *so1;
01056     double                  totalv;
01057     double                  v0, v1, v2;
01058     float                 * fvlist, * xyzn0, * xyzn1;
01059     float                   vmin, vmax;
01060     int                   * fp;
01061     int                     i0, i1, i2;
01062     int                     face, nnodes, test;
01063 
01064 ENTRY("compute_face_vols");
01065 
01066     so0 = p->S.slist[0];
01067     so1 = p->S.slist[1];
01068 
01069     if ( !so0 || !so1 )
01070     {
01071         fprintf(stderr,"** cfv: missing SurfaceObject (%p, %p)\n", so0, so1 );
01072         RETURN(-1);
01073     }
01074 
01075     fp    = so0->FaceSetList;  /* we need only 1, as they are the same */
01076     xyzn0 = so0->NodeList;
01077     xyzn1 = so1->NodeList;
01078     
01079     if ( !fp || !xyzn0 || !xyzn1 )
01080     {
01081         fprintf(stderr,"** cfv: missing face set list data (%p,%p,%p)\n",
01082                 fp, xyzn0, xyzn1);
01083         RETURN(-1);
01084     }
01085 
01086     fvlist = (float *)malloc(p->S.nfaces*sizeof(float));
01087     ALLOC_CHECK(fvlist, "float", p->S.nfaces);
01088     p->S.fvol = fvlist;
01089     
01090     vmin = 10000.0;  vmax = -1.0;
01091     nnodes = p->S.nnodes;
01092     totalv = 0.0;
01093     for ( face = 0; face < p->S.nfaces; face++ )
01094     {
01095         i0 = fp[0];  i1 = fp[1];  i2 = fp[2];
01096 
01097         if ( i0 < 0 || i1 < 0 || i2 < 0 ||
01098              i0 >= nnodes || i1 >= nnodes || i2 >= nnodes )
01099         {
01100             fprintf(stderr,"** cfv: face %d, index out of range [0,%d]\n"
01101                            "        indices are (%d,%d,%d)\n",
01102                            face, nnodes-1, i0, i1, i2);
01103             RETURN(-1);
01104         }
01105 
01106         test = (i0 == opts->dnode || i1 == opts->dnode || i2 == opts->dnode);
01107 
01108         i0 *= 3;  i1 *= 3;  i2 *= 3;    /* node index -> (float*) index */
01109 
01110         v0 = tetra_volume( xyzn0+i0, xyzn0+i1, xyzn0+i2, xyzn1+i0 );
01111         v1 = tetra_volume( xyzn0+i1, xyzn0+i2, xyzn1+i0, xyzn1+i1 );
01112         v2 = tetra_volume( xyzn0+i2, xyzn1+i0, xyzn1+i1, xyzn1+i2 );
01113 
01114         if ( v0 < 0.0 || v1 < 0.0 || v2 < 0.0 ||
01115              (opts->debug > 2 && test) )
01116         {
01117             fprintf(stderr,"** cfv: check volume: %f = %f + %f + %f, face %d\n",
01118                            v0+v1+v2, v0, v1, v2, face );
01119             fprintf(stderr,"        nodes %d, %d, %d\n", i0/3, i1/3, i2/3);
01120 
01121             if ( v0 < 0.0 || v1 < 0.0 || v2 < 0.0 )
01122                 RETURN(-1);
01123         }
01124 
01125         fvlist[face] = v0 + v1 + v2;
01126         totalv += fvlist[face];
01127         if ( fvlist[face] < vmin )  vmin = fvlist[face];
01128         if ( fvlist[face] > vmax )  vmax = fvlist[face];
01129 
01130         fp += 3;
01131     }
01132 
01133     if ( opts->debug > 0 )
01134     {
01135         fprintf(stderr,"++ total face volume = %f\n", totalv);
01136         if ( opts->debug > 1 )
01137         {
01138             fprintf(stderr,"++ volumes: faces 0, 1 (of %d), vols = %f, %f\n",
01139                     p->S.nfaces, fvlist[0], fvlist[1]);
01140             fprintf(stderr,"-- faces: vmin, vmax = %f, %f\n", vmin, vmax);
01141         }
01142     }
01143 
01144     RETURN(0);
01145 }

int compute_node_areas opts_t   opts,
param_t   p,
int    sindex
 

Definition at line 931 of file SUMA_SurfMeasures.c.

References ALLOC_CHECK, c, opts_t::dnode, ENTRY, free, SUMA_SurfaceObject::Label, malloc, SUMA_SurfaceObject::MF, MV_format_fval(), SUMA_SurfaceObject::N_FaceSet, SUMA_MEMBER_FACE_SETS::N_Memb, surf_t::narea, surf_t::nnodes, SUMA_MEMBER_FACE_SETS::NodeMemberOfFaceSet, surf_t::nsurf, p, SUMA_SurfaceObject::PolyArea, RETURN, param_t::S, and surf_t::slist.

Referenced by get_surf_measures().

00932 {
00933     SUMA_SurfaceObject    * so;
00934     double                  sum;
00935     float                 * alist;
00936     int                   * flist;
00937     int                     node, c;
00938 
00939 ENTRY("compute_node_areas");
00940 
00941     if ( sindex < 0 || sindex >= p->S.nsurf || sindex >= 2 )
00942     {
00943         fprintf(stderr,"** cna: surf index <%d> is out of range\n",sindex);
00944         RETURN(-1);
00945     }
00946 
00947     so = p->S.slist[sindex];            /* just for ease of typing */
00948 
00949     if ( ! so->PolyArea )
00950     {
00951         fprintf(stderr,"** cna: no PolyArea to compute from\n");
00952         RETURN(-1);
00953     }
00954 
00955     alist = (float *)malloc(p->S.nnodes*sizeof(float));
00956     ALLOC_CHECK(alist, "float", p->S.nnodes);
00957     p->S.narea[sindex] = alist;
00958 
00959     for ( node = 0; node < p->S.nnodes; node++ )
00960     {
00961         flist = so->MF->NodeMemberOfFaceSet[node];
00962         sum = 0.0;
00963         for (c = 0; c < so->MF->N_Memb[node]; c++)
00964         {
00965             if ( flist[c] < 0 || flist[c] >= so->N_FaceSet )
00966             {
00967                 fprintf(stderr,"** cna: FaceSet mis-match flist,max = %d,%d\n",
00968                         flist[c], so->N_FaceSet);
00969                 free(p->S.narea[sindex]);
00970                 RETURN(-1);
00971             }
00972 
00973             sum += so->PolyArea[flist[c]];
00974         }
00975 
00976         alist[node] = sum/3.0;
00977 
00978         if ( node == opts->dnode )
00979             fprintf(stderr, "-- dnode %d: area = %s (%d faces, surf %s)\n",
00980                     node, MV_format_fval(alist[node]),
00981                     so->MF->N_Memb[node], CHECK_NULL_STR(so->Label));
00982     }
00983 
00984     RETURN(0);
00985 }

int compute_node_vols opts_t   opts,
param_t   p
 

Definition at line 995 of file SUMA_SurfMeasures.c.

References ALLOC_CHECK, c, opts_t::debug, opts_t::dnode, ENTRY, free, surf_t::fvol, malloc, SUMA_SurfaceObject::MF, SUMA_SurfaceObject::N_FaceSet, SUMA_MEMBER_FACE_SETS::N_Memb, surf_t::nnodes, SUMA_MEMBER_FACE_SETS::NodeMemberOfFaceSet, surf_t::nvol, p, RETURN, param_t::S, and surf_t::slist.

Referenced by get_surf_measures().

00996 {
00997     SUMA_SurfaceObject    * so;
00998     double                  sum;
00999     float                 * nvols;
01000     int                   * flist;
01001     int                     node, c;
01002 
01003 ENTRY("compute_node_vols");
01004 
01005     so = p->S.slist[0];                 /* just for ease of typing */
01006 
01007     nvols = (float *)malloc(p->S.nnodes*sizeof(float));
01008     ALLOC_CHECK(nvols, "float", p->S.nnodes);
01009     p->S.nvol = nvols;
01010 
01011     for ( node = 0; node < p->S.nnodes; node++ )
01012     {
01013         if ( node == opts->dnode && opts->debug > 1 )
01014             fprintf(stderr,"-- dnode %d, facelist (%d) :\n        ",
01015                     node, so->MF->N_Memb[node]);
01016         flist = so->MF->NodeMemberOfFaceSet[node];
01017         sum = 0.0;
01018         for (c = 0; c < so->MF->N_Memb[node]; c++)
01019         {
01020             if ( flist[c] < 0 || flist[c] >= so->N_FaceSet )
01021             {
01022                 fprintf(stderr,"** cnv: FaceSet mis-match flist,max = %d,%d\n",
01023                         flist[c], so->N_FaceSet);
01024                 free(p->S.nvol);
01025                 RETURN(-1);
01026             }
01027             if ( node == opts->dnode && opts->debug > 1 )
01028                 fprintf(stderr,"  %d", flist[c]);
01029 
01030             sum += p->S.fvol[flist[c]];
01031         }
01032 
01033         nvols[node] = sum/3.0;
01034 
01035         if ( node == opts->dnode && opts->debug > 0 )
01036             fprintf(stderr,"\n-- volume = %f\n", sum);
01037     }
01038 
01039     RETURN(0);
01040 }

int cross_product double *    res,
double *    u,
double *    v
 

Definition at line 898 of file SUMA_SurfMeasures.c.

References v.

Referenced by tetra_volume().

00899 {
00900     res[0] = u[1]*v[2] - u[2]*v[1];
00901     res[1] = u[2]*v[0] - u[0]*v[2];
00902     res[2] = u[0]*v[1] - u[1]*v[0];
00903 
00904     return 0;
00905 }

int disp_f3_point char *    info,
float *    d
 

Definition at line 2445 of file SUMA_SurfMeasures.c.

References MV_format_fval().

Referenced by write_output().

02446 {
02447     if ( info )
02448         fputs( info, stderr );
02449 
02450     if ( ! d )
02451     {
02452         fprintf(stderr,"** disp_f3_point: d == NULL\n");
02453         return -1;
02454     }
02455 
02456     fprintf(stderr,"(%6s, ", MV_format_fval(d[0]));
02457     fprintf(stderr,"%6s, ",  MV_format_fval(d[1]));
02458     fprintf(stderr,"%6s)\n", MV_format_fval(d[2]));
02459 
02460     return 0;
02461 }

int disp_func_t char *    info,
func_t   d
 

Definition at line 2351 of file SUMA_SurfMeasures.c.

References func_t::codes, func_t::nalloc, func_t::names, and func_t::nused.

Referenced by validate_options().

02352 {
02353     if ( info )
02354         fputs( info, stderr );
02355 
02356     if ( ! d )
02357     {
02358         fprintf(stderr,"** disp_func_t: d == NULL\n");
02359         return -1;
02360     }
02361 
02362     fprintf(stderr,
02363             "func_t struct at %p:\n"
02364             "    names, codes   = %p, %p\n"
02365             "    nalloc, nused  = %d, %d\n",
02366             d,
02367             d->names, d->codes, d->nalloc, d->nused);
02368 
02369     return 0;
02370 }

int disp_opts_t char *    info,
opts_t   d
 

Definition at line 2377 of file SUMA_SurfMeasures.c.

References CHECK_NULL_STR, opts_t::cmask_cmd, opts_t::data_expr, opts_t::datum_str, opts_t::debug, opts_t::dnode, opts_t::dvox, ENTRY, opts_t::f_index_str, opts_t::f_p1_fr, opts_t::f_p1_mm, opts_t::f_pn_fr, opts_t::f_pn_mm, opts_t::f_steps, opts_t::gpar_file, opts_t::info, opts_t::map_str, opts_t::nodes_1D_file, opts_t::noscale, opts_t::oset_file, opts_t::out_1D_file, RETURN, opts_t::sdata_file_1D, opts_t::sdata_file_niml, opts_t::spec_file, opts_t::surf_names, opts_t::surf_xyz_1D_file, opts_t::sv_file, and opts_t::sxyz_ori_gpar.

Referenced by init_options(), and validate_options().

02378 {
02379     if ( info )
02380         fputs( info, stderr );
02381 
02382     if ( ! d )
02383     {
02384         fprintf(stderr,"** disp_opts_t: d == NULL\n");
02385         return -1;
02386     }
02387 
02388     fprintf(stderr,
02389             "opts_t struct at %p:\n"
02390             "    spec_file       = %s\n"
02391             "    sv_file         = %s\n"
02392             "    out_1D_file     = %s\n"
02393             "    cmask_cmd       = %s\n"
02394             "    nodes_1D_file   = %s\n"
02395             "    surf_names[0,1] = %s, %s\n"
02396             "    info            = %0x\n"
02397             "    debug, dnode    = %d, %d\n",
02398             d,
02399             CHECK_NULL_STR(d->spec_file),
02400             CHECK_NULL_STR(d->sv_file),
02401             CHECK_NULL_STR(d->out_1D_file),
02402             CHECK_NULL_STR(d->cmask_cmd),
02403             CHECK_NULL_STR(d->nodes_1D_file),
02404             CHECK_NULL_STR(d->surf_names[0]),
02405             CHECK_NULL_STR(d->surf_names[1]),
02406             d->info, d->debug, d->dnode);
02407 
02408     return 0;
02409 }

int disp_param_t char *    info,
param_t   d
 

Definition at line 2416 of file SUMA_SurfMeasures.c.

References param_t::ccount, param_t::cmask, ENTRY, param_t::F, param_t::f3mm_max, param_t::f3mm_min, param_t::gpar, ISVALID_DSET, param_t::ncmask, param_t::nnodes, param_t::nodes, param_t::nsubs, param_t::nvox, param_t::oset, param_t::outfp, p, RETURN, param_t::sdata_im, param_t::sxyz_im, and THD_fvec3::xyz.

Referenced by validate_options(), and verify_surf_t().

02417 {
02418     if ( info )
02419         fputs( info, stderr );
02420 
02421     if ( ! d )
02422     {
02423         fprintf(stderr,"** disp_param_t: d == NULL\n");
02424         return -1;
02425     }
02426 
02427     fprintf(stderr,
02428             "param_t struct at %p:\n"
02429             "    F, outfp       = %p, %p\n"
02430             "    nodes, nnodes  = %p, %d\n"
02431             "    cmask          = %p\n"
02432             "    ncmask, ccount = %d, %d\n",
02433             d,
02434             d->F, d->outfp, d->nodes, d->nnodes,
02435             d->cmask, d->ncmask, d->ccount );
02436 
02437     return 0;
02438 }

int disp_surf_t char *    info,
surf_t   d
 

Definition at line 2318 of file SUMA_SurfMeasures.c.

References surf_t::fvol, SUMA_SurfSpecFile::N_Groups, SUMA_SurfSpecFile::N_Surfs, surf_t::narea, surf_t::nfaces, surf_t::nnodes, surf_t::nsurf, surf_t::nvol, surf_t::salloc, surf_t::slist, and surf_t::spec.

Referenced by verify_surf_t().

02319 {
02320     if ( info )
02321         fputs( info, stderr );
02322 
02323     if ( ! d )
02324     {
02325         fprintf(stderr,"** disp_surf_t: d == NULL\n");
02326         return -1;
02327     }
02328 
02329     fprintf(stderr,
02330             "surf_t struct at %p:\n"
02331             "    spec N_Surfs   = %d\n"
02332             "    spec N_Groups  = %d\n"
02333             "    slist          = %p\n"
02334             "    narea[0,1]     = %p, %p\n"
02335             "    nvol, fvol     = %p, %p\n"
02336             "    nsurf, salloc  = %d, %d\n"
02337             "    nnodes, nfaces = %d, %d\n",
02338             d,
02339             d->spec.N_Surfs, d->spec.N_Groups, d->slist,
02340             d->narea[0], d->narea[1], d->nvol, d->fvol,
02341             d->nsurf, d->salloc, d->nnodes, d->nfaces);
02342 
02343     return 0;
02344 }

double dist_fn int    len,
float *    p1,
float *    p2
 

Definition at line 2291 of file SUMA_SurfMeasures.c.

References c.

Referenced by write_output().

02292 {
02293     double diff, sum;
02294     int    c;
02295 
02296     if ( len < 1 || p1 == NULL || p2 == NULL )
02297     {
02298         fprintf(stderr, "** dist_fn: invalid params (%d,%p,%p)\n",
02299                 len, p1, p2);
02300         return 0.0;
02301     }
02302 
02303     sum = 0.0;
02304     for ( c = 0; c < len; c++ )
02305     {
02306         diff = p1[c] - p2[c];
02307         sum += diff * diff;
02308     }
02309 
02310     return sqrt(sum);
02311 }

double dot_product double *    u,
double *    v
 

Definition at line 912 of file SUMA_SurfMeasures.c.

References v.

Referenced by tetra_volume().

00913 {
00914     double res;
00915 
00916     res  = u[0]*v[0];
00917     res += u[1]*v[1];
00918     res += u[2]*v[2];
00919 
00920     return res;
00921 }

int final_cleanup opts_t   opts,
param_t   p
 

Definition at line 2214 of file SUMA_SurfMeasures.c.

References param_t::cmask, func_t::codes, opts_t::debug, ENTRY, param_t::F, free, surf_t::fvol, func_t::nalloc, func_t::names, surf_t::narea, param_t::nodes, surf_t::nvol, param_t::outfp, p, RETURN, param_t::S, surf_t::slist, SUMA_Free_CommonFields(), SUMA_Free_Displayable_Object_Vect(), SUMA_Free_SurfaceViewer_Struct_Vect(), SUMAg_N_DOv, and SUMAg_N_SVv.

Referenced by main().

02215 {
02216 
02217 ENTRY("final_cleanup");
02218 
02219     /* first, close the output file, the rest are in order */
02220     if ( p->outfp != stdout )
02221         fclose(p->outfp);
02222 
02223     if ( p->S.narea[0] )  free(p->S.narea[0]);
02224     if ( p->S.narea[1] )  free(p->S.narea[1]);
02225     if ( p->S.slist    )  free(p->S.slist);
02226     if ( p->S.nvol     )  free(p->S.nvol);
02227     if ( p->S.fvol     )  free(p->S.fvol);
02228 
02229     if ( p->F->nalloc > 0 )
02230     {
02231         free(p->F->names);
02232         free(p->F->codes);
02233     }
02234 
02235     if ( p->nodes )
02236         free(p->nodes);
02237 
02238     if ( p->cmask )
02239         free(p->cmask);
02240 
02241     if ( opts->debug > 2 )
02242         fprintf(stderr,"-- freeing SUMA data...\n");
02243 
02244     if ( ( SUMAg_DOv != NULL ) &&
02245          ( SUMA_Free_Displayable_Object_Vect(SUMAg_DOv, SUMAg_N_DOv) == 0 ) )
02246         fprintf(stderr, "** failed SUMA_Free_Displayable_Object_Vect()\n" );
02247 
02248     if ( ( SUMAg_SVv != NULL ) &&
02249          ( SUMA_Free_SurfaceViewer_Struct_Vect(SUMAg_SVv, SUMAg_N_SVv) == 0 ) )
02250         fprintf( stderr, "** failed SUMA_Free_SurfaceViewer_Struct_Vect()\n" );
02251 
02252     if ( ( SUMAg_CF != NULL ) && ( SUMA_Free_CommonFields(SUMAg_CF) == 0 ) )
02253         fprintf( stderr, "** failed SUMA_Free_CommonFields()\n" );
02254 
02255     RETURN(0);
02256 }

float fvec_magnitude float *    v,
int    length
 

Definition at line 445 of file SUMA_SurfMeasures.c.

References c, ENTRY, RETURN, and v.

Referenced by vector_angle().

00446 {
00447     double sums;
00448     int    c;
00449 
00450 ENTRY("fvec_magnitude");
00451 
00452     sums = 0.0;
00453     for ( c = 0; c < length; c++ )
00454         sums += v[c] * v[c];
00455 
00456     RETURN(sqrt(sums));
00457 }

int get_cmask opts_t   opts,
param_t   p
 

Definition at line 1604 of file SUMA_SurfMeasures.c.

References ALLOC_CHECK, param_t::ccount, param_t::cmask, opts_t::cmask_cmd, opts_t::debug, EDT_calcmask(), ENTRY, free, malloc, param_t::ncmask, p, RETURN, and THD_countmask().

Referenced by validate_options().

01605 {
01606     char * cmd;
01607     int    clen;
01608 
01609 ENTRY("get_cmask");
01610 
01611     if ( ! opts->cmask_cmd )
01612         RETURN(0);
01613 
01614     clen = strlen(opts->cmask_cmd);
01615     cmd  = (char *)malloc((clen + 1)*sizeof(char));
01616     ALLOC_CHECK(cmd, "char", clen);
01617 
01618     strcpy(cmd, opts->cmask_cmd);
01619 
01620     p->cmask = EDT_calcmask(cmd, &p->ncmask);
01621 
01622     free(cmd);          /* we are done with the now corrupted command */
01623 
01624     if ( ! p->cmask || p->ncmask < 1 )
01625     {
01626         fprintf(stderr,"** failure: cannot compute cmask from option:\n"
01627                 "   -cmask '%s'\n", opts->cmask_cmd);
01628         RETURN(-1);
01629     }
01630 
01631     p->ccount = THD_countmask( p->ncmask, p->cmask );
01632 
01633     if ( p->ccount < 1 )                /* do not quit */
01634         fprintf(stderr,"** warning: cmask is empty from option\n"
01635                 "   -cmask '%s'\n", opts->cmask_cmd);
01636 
01637     if ( opts->debug > 0 )
01638         fprintf(stderr,"++ have cmask with %d of %d set entries\n",
01639                 p->ccount, p->ncmask);
01640 
01641     RETURN(0);
01642 }

int get_surf_data opts_t   opts,
param_t   p
 

Definition at line 621 of file SUMA_SurfMeasures.c.

References all_mappable_surfs(), COX_clock_time(), opts_t::debug, ENTRY, get_surf_measures(), p, RETURN, param_t::S, surf_t::spec, spec2SUMA(), and verify_surf_t().

Referenced by main().

00622 {
00623     int rv;
00624 
00625 ENTRY("get_surf_data");
00626 
00627     rv = spec2SUMA(&p->S.spec, opts);
00628     if ( rv != 0 )
00629         RETURN(rv);
00630 
00631     if ( opts->debug > 1 )
00632         fprintf(stderr,"-- timing: Surf (spec2SUMA)  : time = %.3f\n",
00633                 COX_clock_time());
00634 
00635     if ( (rv = all_mappable_surfs(opts, p)) != 0 )
00636         RETURN(rv);
00637 
00638     if ( opts->debug > 1 )
00639         fprintf(stderr,"-- timing: Surf (all_map)    : time = %.3f\n",
00640                 COX_clock_time());
00641 
00642     if ( (rv = verify_surf_t(opts, p)) != 0)
00643         RETURN(rv);
00644 
00645     if ( opts->debug > 1 )
00646         fprintf(stderr,"-- timing: Surf (verify surf): time = %.3f\n",
00647                 COX_clock_time());
00648 
00649     if ( (rv = get_surf_measures(opts, p)) != 0)
00650         RETURN(rv);
00651 
00652     if ( opts->debug > 1 )
00653         fprintf(stderr,"-- timing: Surf (get measure): time = %.3f\n",
00654                 COX_clock_time());
00655 
00656     RETURN(0);
00657 }

int get_surf_measures opts_t   opts,
param_t   p
 

Definition at line 664 of file SUMA_SurfMeasures.c.

References c, func_t::codes, compute_face_vols(), compute_node_areas(), compute_node_vols(), opts_t::debug, SUMA_CommonFields::DsetList, E_SM_N_AREA_A, E_SM_N_AREA_B, E_SM_N_AVEAREA_A, E_SM_N_AVEAREA_B, E_SM_NODE_VOL, ENTRY, param_t::F, opts_t::info, surf_t::nsurf, func_t::nused, p, RETURN, param_t::S, surf_t::slist, ST_INFO_VOL, SUMA_SurfaceMetrics_eng(), and surf_triangle_match().

Referenced by get_surf_data().

00665 {
00666     int * fcodes;
00667     int   c, debug;
00668     int   geta, getb;
00669 
00670 ENTRY("get_surf_measures");
00671 
00672     geta = getb = 0;
00673     debug = opts->debug > 2;
00674 
00675     if ( opts->info & ST_INFO_VOL )
00676     {
00677         geta = getb = 1;
00678     }
00679     else                /* maybe there are functions that need them */
00680     {
00681         fcodes = p->F->codes;
00682         for ( c = 0; c < p->F->nused; c++ )
00683         {
00684             if ( fcodes[c] == E_SM_N_AREA_A )
00685                 geta = 1;
00686             else if ( fcodes[c] == E_SM_N_AREA_B )
00687                 getb = 1;
00688             else if ( fcodes[c] == E_SM_N_AVEAREA_A )
00689                 geta = 1;
00690             else if ( fcodes[c] == E_SM_N_AVEAREA_B )
00691                 getb = 1;
00692             else if ( fcodes[c] == E_SM_NODE_VOL )
00693             {
00694                 geta = getb = 1;
00695             }
00696         }
00697     }
00698 
00699     if ( geta ) 
00700     {
00701         if ( !SUMA_SurfaceMetrics_eng(p->S.slist[0], "PolyArea", NULL, debug,
00702                                       SUMAg_CF->DsetList) )
00703         {
00704             fprintf(stderr,"** gsf: surface metrics A failure\n");
00705             RETURN(-1);
00706         }
00707 
00708         if ( compute_node_areas(opts, p, 0) != 0 )      /* index 0 */
00709             RETURN(-1);
00710     }
00711 
00712     if ( getb )
00713     {
00714         if ( p->S.nsurf < 2 )
00715         {
00716             fprintf(stderr,"** gsf: functions requre 2 surfaces, failing...\n");
00717             RETURN(-1);
00718         }
00719 
00720         if ( !SUMA_SurfaceMetrics_eng(p->S.slist[1], "PolyArea", NULL, debug,
00721                                       SUMAg_CF->DsetList) )
00722         {
00723             fprintf(stderr,"** gsf: surface metrics B failure\n");
00724             RETURN(-1);
00725         }
00726 
00727         if ( compute_node_areas(opts, p, 1) != 0 )  /* index 1 */
00728             RETURN(-1);
00729     }
00730 
00731     if( geta && getb )
00732     {
00733         if ( surf_triangle_match(opts, p) != 0 )
00734             RETURN(-1);
00735         if ( compute_face_vols(opts, p) != 0 )
00736             RETURN(-1);
00737         if ( compute_node_vols(opts, p) != 0 )
00738             RETURN(-1);
00739     }
00740 
00741     RETURN(0);
00742 }

int init_options opts_t   opts,
int    argc,
char *    argv[]
 

Definition at line 1387 of file SUMA_SurfMeasures.c.

References add_to_flist(), argc, CHECK_ARG_COUNT, opts_t::cmask_cmd, opts_t::data_expr, opts_t::datum_str, opts_t::debug, disp_opts_t(), opts_t::dnode, opts_t::dvox, ENTRY, opts_t::F, opts_t::f_index_str, opts_t::f_p1_fr, opts_t::f_p1_mm, opts_t::f_pn_fr, opts_t::f_pn_mm, opts_t::f_steps, opts_t::gpar_file, ind, opts_t::info, init_opts_t(), opts_t::map_str, opts_t::nodes_1D_file, opts_t::noscale, opts_t::oset_file, opts_t::out_1D_file, RETURN, S2V_DEBUG_MAX_LEV, S2V_MAX_SURFS, S2V_USE_HIST, S2V_USE_LONG, S2V_USE_SHORT, S2V_USE_VERSION, opts_t::sdata_file_1D, opts_t::sdata_file_niml, opts_t::snames, opts_t::spec_file, ST_DEBUG_MAX_LEVEL, ST_INFO_ALL, ST_INFO_AREA, ST_INFO_NORMS, ST_INFO_THICK, ST_INFO_VOL, ST_MAX_SURFS, ST_USE_HIST, ST_USE_LONG, ST_USE_SHORT, ST_USE_VERSION, opts_t::surf_names, opts_t::surf_xyz_1D_file, opts_t::sv_file, opts_t::sxyz_ori_gpar, and usage().

Referenced by main().

01388 {
01389     int ac, ind;
01390 
01391 ENTRY("init_options");
01392 
01393     if ( argc < 2 )
01394         RETURN( usage(PROG_NAME, ST_USE_LONG) );
01395 
01396     /* init the structure to empty */
01397     if ( init_opts_t(opts) != 0 )
01398         RETURN(-1);
01399 
01400     for ( ac = 1; ac < argc; ac++ )
01401     {
01402         if ( ! strncmp(argv[ac], "-debug", 6) )
01403         {
01404             CHECK_ARG_COUNT(ac,"option usage: -debug LEVEL\n");
01405 
01406             opts->debug = atoi(argv[++ac]);
01407             if ( opts->debug < 0 || opts->debug > ST_DEBUG_MAX_LEVEL )
01408             {
01409                 fprintf(stderr,"** bad debug level %d, should be in [0,%d]\n",
01410                         opts->debug, ST_DEBUG_MAX_LEVEL);
01411                 RETURN(-1);
01412             }
01413         }
01414         else if ( ! strncmp(argv[ac], "-cmask", 6) )
01415         {
01416             CHECK_ARG_COUNT(ac,"option usage: -cmask COMMAND\n");
01417             opts->cmask_cmd = argv[++ac];
01418         }
01419         else if ( ! strncmp(argv[ac], "-dnode", 6) )
01420         {
01421             CHECK_ARG_COUNT(ac,"option usage: -dnode NODE_NUM\n");
01422             opts->dnode = atoi(argv[++ac]);
01423         }
01424         else if ( ! strncmp(argv[ac], "-func", 5) )
01425         {
01426             CHECK_ARG_COUNT(ac,"option usage: -func FUNCTION\n");
01427             ++ac;
01428             if ( add_to_flist(&opts->F, argv[ac]) != 0 )
01429                 RETURN(-1);
01430         }
01431         else if ( ! strncmp(argv[ac], "-help", 5) )
01432             RETURN(usage(PROG_NAME, ST_USE_LONG));
01433         else if ( ! strncmp(argv[ac], "-hist", 5) )
01434             RETURN(usage(PROG_NAME, ST_USE_HIST));
01435         else if ( ! strncmp(argv[ac], "-info_all",9) )
01436         {
01437             opts->info |= ST_INFO_ALL;
01438         }
01439         else if ( ! strncmp(argv[ac], "-info_area",10) )
01440         {
01441             opts->info |= ST_INFO_AREA;
01442         }
01443         else if ( ! strncmp(argv[ac], "-info_norms",10) )
01444         {
01445             opts->info |= ST_INFO_NORMS;
01446         }
01447         else if ( ! strncmp(argv[ac], "-info_thick",11) )
01448         {
01449             opts->info |= ST_INFO_THICK;
01450         }
01451         else if ( ! strncmp(argv[ac], "-info_vol",9) )
01452         {
01453             opts->info |= ST_INFO_VOL;
01454         }
01455         else if ( ! strncmp(argv[ac], "-nodes_1D", 9) )
01456         {
01457             CHECK_ARG_COUNT(ac,"option usage: -nodes_1D NODE_LIST_FILE\n");
01458             opts->nodes_1D_file = argv[++ac];
01459         }
01460         else if ( ! strncmp(argv[ac], "-out_1D", 7) )
01461         {
01462             CHECK_ARG_COUNT(ac,"option usage: -out_1D OUTPUT_FILE\n");
01463             opts->out_1D_file = argv[++ac];
01464         }
01465         else if ( ! strncmp(argv[ac], "-spec", 5) )
01466         {
01467             CHECK_ARG_COUNT(ac,"option usage: -spec SPEC_FILE\n");
01468             opts->spec_file = argv[++ac];
01469         }
01470         else if ( ! strncmp(argv[ac], "-surf_", 6) )
01471         {
01472             CHECK_ARG_COUNT(ac,"option usage: -surf_X SURF_NAME\n");
01473             ind = argv[ac][6] - 'A';
01474             if ( (ind < 0) || (ind >= ST_MAX_SURFS) )
01475             {
01476                 fprintf(stderr,"** -surf_X option '%s' out of range,\n"
01477                         "   use one of '-surf_A' through '-surf_%c'\n",
01478                         argv[ac], 'A'+ST_MAX_SURFS-1);
01479                 RETURN(-1);
01480             }
01481             opts->surf_names[ind] = argv[++ac];
01482         }
01483         else if ( ! strncmp(argv[ac], "-sv", 3) )
01484         {
01485             CHECK_ARG_COUNT(ac,"option usage: -sv SURF_VOLUME\n");
01486             opts->sv_file = argv[++ac];
01487         }
01488         else if ( ! strncmp(argv[ac], "-ver",4) )
01489         {
01490             RETURN( usage(PROG_NAME, ST_USE_VERSION) );
01491         }
01492         else
01493         {
01494             fprintf(stderr,"invalid option <%s>\n",argv[ac]);
01495             RETURN( usage(PROG_NAME, ST_USE_SHORT) );
01496         }
01497     }
01498 
01499     RETURN(0);
01500 }

int init_opts_t opts_t   opts
 

Definition at line 1335 of file SUMA_SurfMeasures.c.

References add_to_flist(), c, opts_t::cmask_cmd, func_t::codes, opts_t::dnode, E_SM_NODES, ENTRY, opts_t::F, g_sm_names, func_t::nalloc, func_t::names, opts_t::nodes_1D_file, func_t::nused, opts_t::out_1D_file, RETURN, opts_t::spec_file, ST_MAX_SURFS, opts_t::surf_names, and opts_t::sv_file.

Referenced by init_options().

01336 {
01337     int c;
01338 
01339 ENTRY("init_opts_t");
01340 
01341     memset(opts, 0, sizeof(opts_t));
01342 
01343     /* init the function list func_t struct */
01344     opts->F.names  = NULL;
01345     opts->F.codes  = NULL;
01346     opts->F.nalloc = 0;
01347     opts->F.nused  = 0;
01348 
01349     /* just to try this out, init the info list */
01350     if ( add_to_flist(&opts->F, g_sm_names[E_SM_NODES]) != 0 )
01351     {
01352         fprintf(stderr,"** failed to init func_t list with '%s'\n",
01353                 g_sm_names[E_SM_NODES]);
01354         RETURN(-1);
01355     }
01356 
01357     opts->spec_file     = NULL;
01358     opts->sv_file       = NULL;
01359     opts->out_1D_file   = NULL;
01360     opts->cmask_cmd     = NULL;
01361     opts->nodes_1D_file = NULL;
01362 
01363     for ( c = 0; c < ST_MAX_SURFS; c++ )
01364         opts->surf_names[c] = NULL;
01365 
01366     opts->dnode         = -1;           /* init to something invalid */
01367 
01368     RETURN(0);
01369 }

double lazy_det int    width,
double *    data
 

Definition at line 2469 of file SUMA_SurfMeasures.c.

References c, free, and malloc.

02470 {
02471     static int   total_size = 0;
02472     double     * newm, * rowp, * cur, rv;
02473     int          c, row, col, w2, sign;
02474 
02475     if ( width < 2 )
02476         return *data;
02477 
02478     if ( width == 2 )
02479         return( data[0]*data[3] - data[1]*data[2] );
02480 
02481     /* otherwise, we need more space */
02482     w2 = width - 1;
02483     total_size += w2*w2;
02484     newm = malloc(w2*w2 * sizeof(double));
02485     if ( !newm )
02486     {
02487         fprintf(stderr,"** failed to allocate %d doubles for mat (%d ttl)\n",
02488                 w2*w2, total_size);
02489         return 0.0;
02490     }
02491 
02492     rv   = 0.0;
02493     sign = -1;
02494     for ( c = 0; c < width; c++ )
02495     {
02496         sign = -sign;                           /* catch the continue */
02497 
02498         if ( data[c] == 0.0 )                   /* skip any zeros */
02499             continue;
02500 
02501         /* start by copying new data */
02502         for ( row = 1; row < width; row++ )     /* always skip row 0 */
02503         {
02504             rowp = data + row     * width;      /* point to source column */
02505             cur  = newm + (row-1) * w2;         /* init dest pointer */
02506 
02507             for ( col = 0; col < width; col++ )
02508             {
02509                 if ( col == c )
02510                     continue;
02511 
02512                 *cur++ = rowp[col];
02513             }
02514         }
02515 
02516         rv += sign * data[c] * lazy_det( w2, newm );
02517     }
02518 
02519     free(newm);
02520 
02521     return rv;
02522 }

void machdep void   
 

Definition at line 14 of file machdep.c.

References AFNI_yesenv(), and enable_mcw_malloc().

Referenced by F3D_initialize_user_data(), get_options(), initialize_program(), and main().

00015 {
00016    /*-- force use of mcw_malloc.c functions - 05 Nov 2001 --*/
00017 
00018 #ifdef USING_MCW_MALLOC
00019    if( AFNI_yesenv("AFNI_FORCE_MCW_MALLOC") ) enable_mcw_malloc();
00020 #endif
00021 
00022    /*-- disable mmap() in malloc() [21 Aug 2002: mostly] --*/
00023 
00024 #if defined(LINUX) && defined(M_MMAP_MAX)
00025    mallopt( M_MMAP_MAX , 1 ) ;
00026 #endif
00027 
00028 }

int main int    argc,
char *    argv[]
 

find asymmetry measures in 1/2 spaces perp to L-R *

Definition at line 140 of file SUMA_SurfMeasures.c.

References AFNI_logger(), argc, COX_clock_time(), opts_t::debug, final_cleanup(), get_surf_data(), init_options(), machdep(), mainENTRY, p, validate_options(), and write_output().

00141 {
00142     param_t p;
00143     opts_t  opts;
00144     int     rv;
00145 
00146     /* note initial time */
00147     (void) COX_clock_time();
00148 
00149     mainENTRY("SurfMeasures main");
00150     machdep();
00151     AFNI_logger(PROG_NAME,argc,argv);
00152 
00153     if ( (rv = init_options(&opts, argc, argv)) != 0 )
00154         return rv;
00155 
00156     if ( opts.debug > 1 )
00157         fprintf(stderr,"-- timing: init opts         : time = %.3f\n",
00158                 COX_clock_time());
00159 
00160     if ( (rv = validate_options(&opts, &p)) != 0 )
00161         return rv;
00162 
00163     if ( opts.debug > 1 )
00164         fprintf(stderr,"-- timing: validate opts     : time = %.3f\n",
00165                 COX_clock_time());
00166 
00167     if ( (rv = get_surf_data(&opts, &p)) != 0 )
00168         return rv;
00169 
00170     if ( opts.debug > 1 )
00171         fprintf(stderr,"-- timing: get surf data     : time = %.3f\n",
00172                 COX_clock_time());
00173 
00174     if ( (rv = write_output(&opts, &p)) != 0 )
00175         return rv;
00176 
00177     if ( opts.debug > 1 )
00178         fprintf(stderr,"-- timing: write outfile     : time = %.3f\n",
00179                 COX_clock_time());
00180 
00181     final_cleanup(&opts, &p);
00182 
00183     if ( opts.debug > 1 )
00184         fprintf(stderr,"-- timing: final clean up    : time = %.3f\n",
00185                 COX_clock_time());
00186 
00187     return 0;
00188 }

float norm2seg_angle THD_fvec3   p0,
THD_fvec3   p1,
float *    norm
 

Definition at line 427 of file SUMA_SurfMeasures.c.

References c, ENTRY, RETURN, vector_angle(), and THD_fvec3::xyz.

Referenced by write_output().

00428 {
00429     float seg[3];
00430     int   c;
00431 
00432 ENTRY("norm2seg_angle");
00433 
00434     for ( c = 0; c < 3; c++ )
00435         seg[c] = p1->xyz[c] - p0->xyz[c];
00436 
00437     RETURN(vector_angle(seg, norm));
00438 }

int print_column_headers opts_t   opts,
param_t   p
 

Definition at line 497 of file SUMA_SurfMeasures.c.

References c, func_t::codes, E_SM_COORD_A, E_SM_COORD_B, E_SM_NORM_A, E_SM_NORM_B, ENTRY, param_t::F, func_t::names, func_t::nused, param_t::outfp, p, and RETURN.

Referenced by write_output().

00498 {
00499     int c, c2, num2print;
00500 
00501 ENTRY("print_column_headers");
00502 
00503     fputc('#', p->outfp);
00504     for (c = 0; c < p->F->nused; c++ )
00505     {
00506         if ( ( p->F->codes[c] == E_SM_COORD_A ) ||
00507              ( p->F->codes[c] == E_SM_COORD_B ) ||
00508              ( p->F->codes[c] == E_SM_NORM_A  ) ||
00509              ( p->F->codes[c] == E_SM_NORM_B  ) )
00510             num2print = 3;
00511         else
00512             num2print = 1;
00513 
00514         for (c2 = 0; c2 < num2print; c2++)
00515             if ( num2print > 1 )
00516                 fprintf(p->outfp, " %8s[%d]", p->F->names[c],c2);
00517             else
00518                 fprintf(p->outfp, "  %10s", p->F->names[c]);
00519     }
00520     fputc('\n', p->outfp);
00521 
00522     fputc('#', p->outfp);
00523     for (c = 0; c < p->F->nused; c++ )
00524     {
00525         if ( ( p->F->codes[c] == E_SM_COORD_A ) ||
00526              ( p->F->codes[c] == E_SM_COORD_B ) ||
00527              ( p->F->codes[c] == E_SM_NORM_A  ) ||
00528              ( p->F->codes[c] == E_SM_NORM_B  ) )
00529             num2print = 3;
00530         else
00531             num2print = 1;
00532 
00533         for (c2 = 0; c2 < num2print; c2++)
00534             fprintf(p->outfp, "  ----------");
00535     }
00536     fputc('\n', p->outfp);
00537 
00538     RETURN(0);
00539 }

int read_nodes_file opts_t   opts,
param_t   p
 

Definition at line 1649 of file SUMA_SurfMeasures.c.

References ALLOC_CHECK, opts_t::debug, ENTRY, fim, malloc, MRI_FLOAT_PTR, mri_free(), mri_read_1D(), param_t::nnodes, param_t::nodes, opts_t::nodes_1D_file, MRI_IMAGE::nx, MRI_IMAGE::ny, p, and RETURN.

Referenced by validate_options().

01650 {
01651     MRI_IMAGE * im;
01652     float     * fim;
01653     char      * nfile;
01654     int         index;
01655 
01656 ENTRY("read_nodes_file");
01657 
01658     nfile = opts->nodes_1D_file;                /* for ease of typing */
01659 
01660     if ( !nfile )
01661         RETURN(0);
01662 
01663     if ( (im = mri_read_1D(nfile)) == NULL )
01664     {
01665         fprintf(stderr,"** failed to read 1D nodes file '%s'\n", nfile);
01666         RETURN(-1);
01667     }
01668     
01669     if ( im->nx < 1 )
01670     {
01671         fprintf(stderr,"** node list file '%s' appears empty\n", nfile);
01672         RETURN(-1);
01673     }
01674 
01675     if ( im->ny > 1 )
01676     {
01677         fprintf(stderr,"** please specify only one column of node file '%s'\n"
01678                        "   e.g.  -nodes_1D 'surf_data.1D[0]'\n", nfile);
01679         RETURN(-1);
01680     }
01681 
01682     p->nnodes = im->nx;
01683     p->nodes  = (int *)malloc(im->nx * sizeof(int));
01684     ALLOC_CHECK(p->nodes, "int", im->nx);
01685 
01686     /* now get values */
01687     fim = MRI_FLOAT_PTR(im);
01688     for ( index = 0; index < p->nnodes; index++ )
01689         p->nodes[index] = (int)fim[index];
01690 
01691     if ( opts->debug > 0 )
01692         fprintf(stderr,"++ read %d node indices from '%s'\n", p->nnodes, nfile);
01693 
01694     mri_free(im);               /* we're done with image */
01695 
01696     RETURN(0);
01697 }

int spec2SUMA SUMA_SurfSpecFile   spec,
opts_t   opts
 

Definition at line 1221 of file SUMA_SurfMeasures.c.

References opts_t::debug, SUMA_CommonFields::DsetList, ENTRY, SUMA_CommonFields::InOut_Notify, SUMA_CommonFields::MemTrace, SUMA_SurfSpecFile::N_Groups, RETURN, opts_t::spec_file, ST_MAX_SURFS, SUMA_Alloc_DisplayObject_Struct(), SUMA_Create_CommonFields(), SUMA_LoadSpec_eng(), SUMA_MAX_DISPLAYABLE_OBJECTS, SUMA_Read_SpecFile(), SUMA_ShowSpecStruct(), SUMA_spec_select_surfs(), SUMA_spec_set_map_refs(), SUMAg_N_DOv, opts_t::surf_names, and opts_t::sv_file.

Referenced by get_surf_data().

01222 {
01223     int rv;
01224 
01225 ENTRY("spec2SUMA");
01226 
01227     /* initialize common fields struct */
01228     SUMAg_CF = SUMA_Create_CommonFields();
01229 
01230     if ( SUMAg_CF == NULL )
01231     {
01232         fprintf( stderr, "** failed SUMA_Create_CommonFields(), exiting...\n" );
01233         RETURN(-1);
01234     }
01235 
01236     /* for SUMA type notifications */
01237     if ( opts->debug > 3 )
01238     {
01239         SUMAg_CF->MemTrace = 1;
01240 
01241         if ( opts->debug > 4 )
01242             SUMAg_CF->InOut_Notify = 1;
01243     }
01244 
01245     SUMAg_DOv = SUMA_Alloc_DisplayObject_Struct(SUMA_MAX_DISPLAYABLE_OBJECTS);
01246 
01247     if ( SUMA_Read_SpecFile( opts->spec_file, spec) == 0 )
01248     {
01249         fprintf( stderr, "** failed SUMA_Read_SpecFile(), exiting...\n" );
01250         RETURN(-1);
01251     }
01252 
01253     if ( opts->debug > 2 )
01254         SUMA_ShowSpecStruct(spec, stderr, 3);
01255 
01256     rv = SUMA_spec_select_surfs(spec,opts->surf_names,ST_MAX_SURFS,opts->debug);
01257     if ( rv < 1 )
01258     {
01259         if ( rv == 0 )
01260             fprintf(stderr,"** no given surfaces found in spec file\n");
01261         RETURN(-1);
01262     }
01263 
01264     if ( opts->debug > 1 )
01265         SUMA_ShowSpecStruct(spec, stderr, opts->debug > 2 ? 3 : 1);
01266 
01267     if ( SUMA_spec_set_map_refs(spec, opts->debug) != 0 )
01268         RETURN(-1);
01269 
01270     /* make sure only group was read from spec file */
01271     if ( spec->N_Groups != 1 )
01272     {
01273         fprintf( stderr,"** error: N_Groups <%d> must be 1 in spec file <%s>\n",
01274                  spec->N_Groups, opts->spec_file );
01275         RETURN(-1);
01276     }
01277 
01278     /* actually load the surface(s) from the spec file */
01279     if (SUMA_LoadSpec_eng(spec, SUMAg_DOv, &SUMAg_N_DOv, opts->sv_file,
01280                           opts->debug>3, SUMAg_CF->DsetList) == 0)
01281     {
01282         fprintf( stderr, "** error: failed SUMA_LoadSpec(), exiting...\n" );
01283         RETURN(-1);
01284     }
01285 
01286     if ( opts->debug > 0 )
01287         fputs( "++ surfaces loaded.\n", stderr );
01288 
01289     RETURN(0);
01290 }

int surf_triangle_match opts_t   opts,
param_t   p
 

Definition at line 749 of file SUMA_SurfMeasures.c.

References opts_t::debug, ENTRY, SUMA_SurfaceObject::FaceSetList, SUMA_SurfaceObject::N_FaceSet, p, RETURN, param_t::S, and surf_t::slist.

Referenced by get_surf_measures().

00750 {
00751     int   face, maxf;
00752     int * f0, * f1;
00753 
00754 ENTRY("surf_triangle_match");
00755 
00756     f0 = p->S.slist[0]->FaceSetList;
00757     f1 = p->S.slist[1]->FaceSetList;
00758 
00759     maxf = p->S.slist[0]->N_FaceSet * 3;
00760 
00761     if ( !f0 || !f1 || maxf <= 0 )
00762     {
00763         fprintf(stderr,"** stm: bad face data (%p, %p, %d)\n", f0, f1, maxf);
00764         RETURN(-1);
00765     }
00766 
00767     for ( face = 0; face < maxf; face++ )
00768     {
00769         if (*f0 != *f1 )
00770         {
00771             fprintf(stderr,"** face diff @ f3 = %d, *f0,*f1 = (%d,%d)\n",
00772                     face, *f0, *f1);
00773             RETURN(-1);
00774         }
00775         f0++;  f1++;
00776     }
00777 
00778     if ( opts->debug > 1 )
00779         fprintf(stderr,"-- faces okay, woohoo!\n");
00780 
00781     RETURN(0);
00782 }

double tetra_volume float *    p0,
float *    p1,
float *    p2,
float *    p3
 

Definition at line 2265 of file SUMA_SurfMeasures.c.

References cross_product(), dot_product(), and v1.

Referenced by compute_face_vols().

02266 {
02267     double v0[3], v1[3], v2[3], xp[3];
02268 
02269     v0[0] = p1[0] - p0[0];
02270     v0[1] = p1[1] - p0[1];
02271     v0[2] = p1[2] - p0[2];
02272 
02273     v1[0] = p2[0] - p0[0];
02274     v1[1] = p2[1] - p0[1];
02275     v1[2] = p2[2] - p0[2];
02276 
02277     v2[0] = p3[0] - p0[0];
02278     v2[1] = p3[1] - p0[1];
02279     v2[2] = p3[2] - p0[2];
02280 
02281     cross_product(xp, v1, v2);
02282 
02283     return(fabs(dot_product(v0,xp))/6.0);
02284 }

int usage char *    prog,
int    use_type
 

Definition at line 1824 of file SUMA_SurfMeasures.c.

References c, E_SM_FINAL, E_SM_INVALID, ENTRY, g_history, g_sm_desc, g_sm_names, help_full(), help_ge_structs(), RETURN, ST_USE_HIST, ST_USE_LONG, ST_USE_SHORT, ST_USE_VERSION, USE_GE, and VERSION.

01825 {
01826     int c;
01827 
01828 ENTRY("usage");
01829 
01830     if ( use_type == ST_USE_SHORT )
01831     {
01832         fprintf(stderr,"usage: %s [options] -spec SPEC_FILE -func FUNC_NAME\\\n"
01833                        "                    -out_1D OUTFILE\n", prog);
01834     }
01835     else if ( use_type == ST_USE_LONG )
01836     {
01837         printf(
01838             "\n"
01839             "%s - compute measures from the surface dataset(s)\n"
01840             "\n"
01841             "  usage: %s [options] -spec SPEC_FILE -out_1D OUTFILE.1D\n"
01842             "\n"
01843             "    This program is meant to read in a surface or surface pair,\n"
01844             "    and to output and user-requested measures over the surfaces.\n"
01845             "    The surfaces must be specified in the SPEC_FILE.\n"
01846             "\n"
01847             " ** Use the 'inspec' command for getting information about the\n"
01848             "    surfaces in a spec file.\n"
01849             "\n"
01850             "    The output will be a 1D format text file, with one column\n"
01851             "    (or possibly 3) per user-specified measure function.  Some\n"
01852             "    functions require only 1 surface, some require 2.\n"
01853             "\n"
01854             "    Current functions (applied with '-func') include:\n"
01855             "\n",
01856             prog, prog );
01857 
01858         /* display current list of measures */
01859         for ( c = E_SM_INVALID + 1; c < E_SM_FINAL; c++ )
01860             printf( "        %-12s : %s\n", g_sm_names[c], g_sm_desc[c]);
01861 
01862         printf(
01863             "\n"
01864             "------------------------------------------------------------\n"
01865             "\n"
01866             "  examples:\n"
01867             "\n"
01868             "    1. For each node on the surface smoothwm in the spec file,\n"
01869             "       fred.spec, output the node number (the default action),\n"
01870             "       the xyz coordinates, and the area associated with the\n"
01871             "       node (1/3 of the total area of triangles having that node\n"
01872             "       as a vertex).\n"
01873             "\n"
01874             "        %s                                   \\\n"
01875             "            -spec       fred1.spec                     \\\n"
01876             "            -sv         fred_anat+orig                 \\\n"
01877             "            -surf_A     smoothwm                       \\\n"
01878             "            -func       coord_A                        \\\n"
01879             "            -func       n_area_A                       \\\n"
01880             "            -out_1D     fred1_areas.1D                   \n"
01881             "\n"
01882             "    2. For each node of the surface pair smoothwm and pial,\n"
01883             "       display the:\n"
01884             "         o  node index\n"
01885             "         o  node's area from the first surface\n"
01886             "         o  node's area from the second surface\n"
01887             "         o  node's (approximate) resulting volume\n"
01888             "         o  thickness at that node (segment distance)\n"
01889             "         o  coordinates of the first segment node\n"
01890             "         o  coordinates of the second segment node\n"
01891             "\n"
01892             "         Additionally, display total surface areas, minimum and\n"
01893             "         maximum thicknesses, and the total volume for the\n"
01894             "         cortical ribbon (the sum of node volumes).\n"
01895             "\n"
01896             "        %s                                   \\\n"
01897             "            -spec       fred2.spec                     \\\n"
01898             "            -sv         fred_anat+orig                 \\\n"
01899             "            -surf_A     smoothwm                       \\\n"
01900             "            -surf_B     pial                           \\\n"
01901             "            -func       n_area_A                       \\\n"
01902             "            -func       n_area_B                       \\\n"
01903             "            -func       node_vol                       \\\n"
01904             "            -func       thick                          \\\n"
01905             "            -func       coord_A                        \\\n"
01906             "            -func       coord_B                        \\\n"
01907             "            -info_area                                 \\\n"
01908             "            -info_thick                                \\\n"
01909             "            -info_vol                                  \\\n"
01910             "            -out_1D     fred2_vol.1D                     \n"
01911             "\n"
01912             "    3. For each node of the surface pair, display the:\n"
01913             "         o  node index\n"
01914             "         o  angular diff between the first and second norms\n"
01915             "         o  angular diff between the segment and first norm\n"
01916             "         o  angular diff between the segment and second norm\n"
01917             "         o  the normal vectors for the first surface nodes\n"
01918             "         o  the normal vectors for the second surface nodes\n"
01919             "         o  angular diff between the segment and second norm\n"
01920             "\n"
01921             "        %s                                   \\\n"
01922             "            -spec       fred2.spec                     \\\n"
01923             "            -surf_A     smoothwm                       \\\n"
01924             "            -surf_B     pial                           \\\n"
01925             "            -func       ang_norms                      \\\n"
01926             "            -func       ang_ns_A                       \\\n"
01927             "            -func       ang_ns_B                       \\\n"
01928             "            -func       norm_A                         \\\n"
01929             "            -func       norm_B                         \\\n"
01930             "            -out_1D     fred2_norm_angles.1D             \n"
01931             "\n"
01932             "    4. Similar to #3, but output extra debug info, and in\n"
01933             "       particular, info regarding node 5000.\n"
01934             "\n"
01935             "        %s                                   \\\n"
01936             "            -spec       fred2.spec                     \\\n"
01937             "            -sv         fred_anat+orig                 \\\n"
01938             "            -surf_A     smoothwm                       \\\n"
01939             "            -surf_B     pial                           \\\n"
01940             "            -func       ang_norms                      \\\n"
01941             "            -func       ang_ns_A                       \\\n"
01942             "            -func       ang_ns_B                       \\\n"
01943             "            -debug      2                              \\\n"
01944             "            -dnode      5000                           \\\n"
01945             "            -out_1D     fred2_norm_angles.1D             \n"
01946             "\n"
01947             "    5. For each node, output the volume, thickness and areas,\n"
01948             "       but restrict the nodes to the list contained in column 0\n"
01949             "       of file sdata.1D.  Furthermore, restrict those nodes to\n"
01950             "       the mask inferred by the given '-cmask' option.\n"
01951             "\n"
01952             "        %s                                                   \\\n"
01953             "            -spec       fred2.spec                           \\\n"
01954             "            -sv         fred_anat+orig                       \\\n"
01955             "            -surf_A     smoothwm                             \\\n"
01956             "            -surf_B     pial                                 \\\n"
01957             "            -func       node_vol                             \\\n"
01958             "            -func       thick                                \\\n"
01959             "            -func       n_area_A                             \\\n"
01960             "            -func       n_area_B                             \\\n"
01961             "            -nodes_1D   'sdata.1D[0]'                        \\\n"
01962             "            -cmask      '-a sdata.1D[2] -expr step(a-1000)'  \\\n"
01963             "            -out_1D     fred2_masked.1D                  \n"
01964             "\n"
01965             "------------------------------------------------------------\n"
01966             "\n"
01967             "  REQUIRED COMMAND ARGUMENTS:\n"
01968             "\n"
01969             "    -spec SPEC_FILE       : SUMA spec file\n"
01970             "\n"
01971             "        e.g. -spec fred2.spec\n"
01972             "\n"
01973             "        The surface specification file contains a list of\n"
01974             "        related surfaces.  In order for a surface to be\n"
01975             "        processed by this program, it must exist in the spec\n"
01976             "        file.\n"
01977             "\n"
01978             "    -surf_A SURF_NAME     : surface name (in spec file)\n"
01979             "    -surf_B SURF_NAME     : surface name (in spec file)\n"
01980             "\n"
01981             "        e.g. -surf_A smoothwm\n"
01982             "        e.g. -surf_A lh.smoothwm\n"
01983             "        e.g. -surf_B lh.pial\n"
01984             "\n"
01985             "        This is used to specify which surface(s) will be used\n"
01986             "        by the program.  The 'A' and 'B' correspond to other\n"
01987             "        program options (e.g. the 'A' in n_area_A).\n"
01988             "\n"
01989             "        The '-surf_B' parameter is required only when the user\n"
01990             "        wishes to input two surfaces.\n"
01991             "\n"
01992             "        Any surface name provided must be unique in the spec\n"
01993             "        file, and must match the name of the surface data file\n"
01994             "        (e.g. lh.smoothwm.asc).\n"
01995             "\n"
01996             "    -out_1D OUT_FILE.1D   : 1D output filename\n"
01997             "\n"
01998             "        e.g. -out_1D pickle_norm_info.1D\n"
01999             "\n"
02000             "        This option is used to specify the name of the output\n"
02001             "        file.  The output file will be in the 1D ascii format,\n"
02002             "        with 2 rows of comments for column headers, and 1 row\n"
02003             "        for each node index.\n"
02004             "\n"
02005             "        There will be 1 or 3 columns per '-func' option, with\n"
02006             "        a default of 1 for \"nodes\".\n"
02007             "\n"
02008             "------------------------------------------------------------\n"
02009             "\n"
02010             "  ALPHABETICAL LISTING OF OPTIONS:\n"
02011             "\n"
02012             "    -cmask COMMAND        : restrict nodes with a mask\n"
02013             "\n"
02014             "        e.g.     -cmask '-a sdata.1D[2] -expr step(a-1000)'\n"
02015             "\n"
02016             "        This option will produce a mask to be applied to the\n"
02017             "        list of surface nodes.  The total mask size, including\n"
02018             "        zero entries, must match the number of nodes.  If a\n"
02019             "        specific node list is provided via the '-nodes_1D'\n"
02020             "        option, then the mask size should match the length of\n"
02021             "        the provided node list.\n"
02022             "        \n"
02023             "        Consider the provided example using the file sdata.1D.\n"
02024             "        If a surface has 100000 nodes (and no '-nodes_1D' option\n"
02025             "        is used), then there must be 100000 values in column 2\n"
02026             "        of the file sdata.1D.\n"
02027             "\n"
02028             "        Alternately, if the '-nodes_1D' option is used, giving\n"
02029             "        a list of 42 nodes, then the mask length should also be\n"
02030             "        42 (regardless of 0 entries).\n"
02031             "\n"
02032             "        See '-nodes_1D' for more information.\n"
02033             "\n"
02034             "    -debug LEVEL          : display extra run-time info\n"
02035             "\n"
02036             "        e.g.     -debug 2\n"
02037             "        default: -debug 0\n"
02038             "\n"
02039             "        Valid debug levels are from 0 to 5.\n"
02040             "\n"
02041             "    -dnode NODE           : display extra info for node NODE\n"
02042             "\n"
02043             "        e.g. -dnode 5000\n"
02044             "\n"
02045             "        This option can be used to display extra information\n"
02046             "        about node NODE during surface evaluation.\n"
02047             "\n"
02048             "    -func FUNCTION        : request output for FUNCTION\n"
02049             "\n"
02050             "        e.g. -func thick\n"
02051             "\n"
02052             "        This option is used to request output for the given\n"
02053             "        FUNCTION (measure).  Some measures produce one column\n"
02054             "        of output (e.g. thick or ang_norms), and some produce\n"
02055             "        three (e.g. coord_A).  These options, in the order they\n"
02056             "        are given, determine the structure of the output file.\n"
02057             "\n"
02058             "        Current functions include:\n"
02059             "\n",
02060             prog, prog, prog, prog, prog );
02061 
02062         /* display current list of measures */
02063         for ( c = E_SM_INVALID + 1; c < E_SM_FINAL; c++ )
02064             printf( "            %-12s : %s\n", g_sm_names[c], g_sm_desc[c]);
02065 
02066         printf(
02067             "\n"
02068             "          Note that the node volumes are approximations.  Places\n"
02069             "          where either normal points in the 'wrong' direction\n"
02070             "          will be incorrect, as will be the parts of the surface\n"
02071             "          that 'encompass' this region.  Maybe we could refer\n"
02072             "          to this as a mushroom effect...\n"
02073             "\n"
02074             "          Basically, expect the total volume to be around 10%%\n"
02075             "          too large.\n"
02076             "\n"
02077             "          ** for more accuracy, try 'SurfPatch -vol' **\n"
02078             "\n"
02079             "    -help                 : show this help menu\n"
02080             "\n"
02081             "    -hist                 : display program revision history\n"
02082             "\n"
02083             "        This option is used to provide a history of changes\n"
02084             "        to the program, along with version numbers.\n"
02085             "\n"
02086             "  NOTE: the following '-info_XXXX' options are used to display\n"
02087             "        pieces of 'aggregate' information about the surface(s).\n"
02088             "\n"
02089             "    -info_all             : display all final info\n"
02090             "\n"
02091             "        This is a short-cut to get all '-info_XXXX' options.\n"
02092             "\n"
02093             "    -info_area            : display info on surface area(s)\n"
02094             "\n"
02095             "        Display the total area of each triangulated surface.\n"
02096             "\n"
02097             "    -info_norms           : display info about the normals\n"
02098             "\n"
02099             "        For 1 or 2 surfaces, this will give (if possible) the\n"
02100             "        average angular difference between:\n"
02101             "\n"
02102             "            o the normals of the surfaces\n"
02103             "            o the connecting segment and the first normal\n"
02104             "            o the connecting segment and the second normal\n"
02105             "\n"
02106             "    -info_thick           : display min and max thickness\n"
02107             "\n"
02108             "        For 2 surfaces, this is used to display the minimum and\n"
02109             "        maximum distances between the surfaces, along each of\n"
02110             "        the connecting segments.\n"
02111             "\n"
02112             "    -info_vol             : display info about the volume\n"
02113             "\n"
02114             "        For 2 surfaces, display the total computed volume.\n"
02115             "        Note that this node-wise volume computation is an\n"
02116             "        approximation, and tends to run ~10 %% high.\n"
02117             "\n"
02118             "        ** for more accuracy, try 'SurfPatch -vol' **\n"
02119             "\n"
02120             "    -nodes_1D NODELIST.1D : request output for only these nodes\n"
02121             "\n"
02122             "        e.g.  -nodes_1D node_index_list.1D\n"
02123             "        e.g.  -nodes_1D sdata.1D'[0]'\n"
02124             "\n"
02125             "        The NODELIST file should contain a list of node indices.\n"
02126             "        Output from the program would then be restricted to the\n"
02127             "        nodes in the list.\n"
02128             "        \n"
02129             "        For instance, suppose that the file BA_04.1D contains\n"
02130             "        a list of surface nodes that are located in Broadman's\n"
02131             "        Area 4.  To get output from the nodes in that area, use:\n"
02132             "        \n"
02133             "            -nodes_1D BA_04.1D\n"
02134             "        \n"
02135             "        For another example, suppose that the file sdata.1D has\n"
02136             "        node indices in column 0, and Broadman's Area indices in\n"
02137             "        column 3.  To restrict output to the nodes in Broadman's\n"
02138             "        area 4, use the pair of options:\n"
02139             "        \n"
02140             "            -nodes_1D 'sdata.1D[0]'                     \\\n"
02141             "            -cmask '-a sdata.1D[3] -expr (1-bool(a-4))' \n"
02142             "\n"
02143             "    -sv SURF_VOLUME       : specify an associated AFNI volume\n"
02144             "\n"
02145             "        e.g. -sv fred_anat+orig\n"
02146             "\n"
02147             "        If there is any need to know the orientation of the\n"
02148             "        surface, a surface volume dataset may be provided.\n"
02149             "\n"
02150             "    -ver                  : show version information\n"
02151             "\n"
02152             "        Show version and compile date.\n"
02153             "\n"
02154             "------------------------------------------------------------\n"
02155             "\n"
02156             "  Author: R. Reynolds  - %s\n"
02157             "\n",
02158             VERSION );
02159     }
02160     else if ( use_type == ST_USE_HIST )
02161     {
02162         fputs (g_history, stdout);
02163     }
02164     else if ( use_type == ST_USE_VERSION )
02165     {
02166         printf("%s: %s, compile date: %s\n", prog, VERSION, __DATE__);
02167     }
02168     else
02169         fprintf(stderr,"** error: usage - invalid use_type %d\n", use_type); 
02170 
02171     RETURN(-1);
02172 }

int validate_option_lists opts_t   opts,
param_t   p
 

Definition at line 1714 of file SUMA_SurfMeasures.c.

References c, func_t::codes, opts_t::debug, E_SM_ANG_NORMS, E_SM_ANG_NS_A, E_SM_ANG_NS_B, E_SM_COORD_A, E_SM_COORD_B, E_SM_N_AREA_A, E_SM_N_AREA_B, E_SM_N_AVEAREA_A, E_SM_N_AVEAREA_B, E_SM_NODE_VOL, E_SM_NODES, E_SM_NORM_A, E_SM_NORM_B, E_SM_NTRI, E_SM_THICK, ENTRY, param_t::F, g_sm_names, opts_t::info, SUMA_SurfaceObject::MF, SUMA_MEMBER_FACE_SETS::N_Memb, SUMA_SurfaceObject::NodeNormList, surf_t::nsurf, func_t::nused, p, RETURN, param_t::S, surf_t::slist, SM_2SURF_TEST, ST_INFO_THICK, and ST_INFO_VOL.

Referenced by verify_surf_t().

01715 {
01716     int * fcodes, c, errs;
01717 
01718 ENTRY("validate_option_lists");
01719 
01720     errs = 0;
01721 
01722     if ( (opts->info & ST_INFO_THICK) && p->S.nsurf < 2 )
01723     {
01724         fprintf(stderr,"** -info_thick option requiers 2 surfaces\n");
01725         errs++;
01726     }
01727 
01728     if ( (opts->info & ST_INFO_VOL) && p->S.nsurf < 2 )
01729     {
01730         fprintf(stderr,"** -info_vol option requiers 2 surfaces\n");
01731         errs++;
01732     }
01733 
01734     /* verify all the functions in our list */
01735     fcodes = p->F->codes;       /* just for less typing */
01736     for ( c = 0; c < p->F->nused; c++ )
01737     {
01738         switch (fcodes[c])
01739         {
01740             default:
01741                 fprintf(stderr, "** vol: invalid function code %d\n",fcodes[c]);
01742                 errs++;
01743                 break;
01744 
01745             case E_SM_COORD_A:
01746             case E_SM_N_AREA_A:
01747             case E_SM_N_AVEAREA_A:
01748             case E_SM_NODES:
01749             case E_SM_NORM_A:
01750                 break;
01751 
01752             case E_SM_ANG_NS_A:
01753                 if ( !p->S.slist[0]->NodeNormList )
01754                 {
01755                     fprintf(stderr,"** missing node normals for func '%s'\n",
01756                             g_sm_names[fcodes[c]]);
01757                     errs++;
01758                 }
01759                 break;
01760 
01761             case E_SM_ANG_NORMS:
01762             case E_SM_ANG_NS_B:
01763             case E_SM_NORM_B:
01764                 if ( !p->S.slist[0]->NodeNormList ||
01765                      !p->S.slist[1]->NodeNormList )
01766                 {
01767                     fprintf(stderr,"** missing node normals for func '%s'\n",
01768                             g_sm_names[fcodes[c]]);
01769                     errs++;
01770                 }
01771 
01772                 SM_2SURF_TEST(c);
01773                 break;
01774                 
01775             case E_SM_COORD_B:
01776             case E_SM_N_AREA_B:
01777             case E_SM_N_AVEAREA_B:
01778             case E_SM_NODE_VOL:
01779             case E_SM_THICK:
01780 
01781                 SM_2SURF_TEST(c);
01782                 break;
01783 
01784             case E_SM_NTRI:
01785                 if ( ! p->S.slist[0]->MF->N_Memb )
01786                 {
01787                     fprintf(stderr,"** missing Face Member list, func '%s'\n",
01788                             g_sm_names[fcodes[c]]);
01789                     errs++;
01790                 }
01791 
01792                 break;
01793         }
01794 
01795         if ( opts->debug > 1 && errs == 0 )
01796             fprintf(stderr,"++ have valid function name '%s'\n",
01797                     g_sm_names[fcodes[c]]);
01798     }
01799 
01800     if ( opts->debug > 0 && errs > 0 )
01801         fprintf(stderr,"** validate_option_lists: %d errors found\n", errs);
01802 
01803     if ( errs > 0 )
01804         RETURN(-1);
01805 
01806     if ( opts->debug > 0 )
01807         fprintf(stderr,"-- found %d output functions\n", p->F->nused);
01808 
01809     RETURN(0);
01810 }

int validate_options opts_t   opts,
param_t   p
 

Definition at line 1507 of file SUMA_SurfMeasures.c.

References check_map_func(), param_t::cmask, opts_t::cmask_cmd, opts_t::data_expr, opts_t::debug, disp_func_t(), disp_opts_t(), disp_param_t(), disp_parser_t(), ENTRY, param_t::F, opts_t::F, surf_t::fvol, get_cmask(), param_t::gpar, parser_t::has_sym, opts_t::map_str, surf_t::narea, param_t::ncmask, param_t::nnodes, param_t::nodes, opts_t::nodes_1D_file, func_t::nused, surf_t::nvol, param_t::oset, opts_t::out_1D_file, param_t::outfp, p, param_t::parser, PARSER_generate_code(), PARSER_mark_symbols(), PARSER_set_printout(), parser_t::pcode, read_nodes_file(), RETURN, param_t::S, param_t::sdata_im, surf_t::slist, opts_t::spec_file, opts_t::surf_names, param_t::sxyz_im, THD_is_file(), validate_datasets(), and validate_surface().

Referenced by main().

01508 {
01509     int errs = 0;
01510 
01511 ENTRY("validate_options");    
01512 
01513     if ( !opts || !p )
01514     {
01515         fprintf(stderr,"** vo: bad params (%p,%p)\n", opts, p);
01516         RETURN(-1);
01517     }
01518 
01519     if ( opts->F.nused <= 0 )
01520     {
01521         fprintf(stderr,"** must specify at least one '-func' option\n");
01522         errs++;
01523     }
01524 
01525     if ( ! opts->spec_file )
01526     {
01527         fprintf(stderr,"** missing argument: -spec\n");
01528         errs++;
01529     }
01530 
01531     if ( ! opts->surf_names[0] )
01532     {
01533         fprintf(stderr,"** missing argument -surf_A\n");
01534         errs++;
01535     }
01536 
01537     /* we don't necessarily need an sv_file ... do not check */
01538 
01539     /* verify output file, and open for writing */
01540     if ( ! opts->out_1D_file )
01541     {
01542         fprintf(stderr,"** missing argument: -out_1D\n");
01543         errs++;
01544     }
01545     else if ( THD_is_file(opts->out_1D_file) )
01546     {
01547         fprintf(stderr,"** output file already exists: %s\n",opts->out_1D_file);
01548         errs++;
01549     }
01550 
01551     if ( errs > 0 )
01552         RETURN(-1);
01553 
01554     if ( opts->debug > 1 )
01555     {
01556         disp_opts_t( "-- opts okay: ", opts );
01557         disp_func_t( "-- opts okay: ", &opts->F );
01558     }
01559 
01560 
01561     /* options look good, now fill the param_t struct */
01562     memset(p, 0, sizeof(param_t));      /* clear params    */
01563 
01564     p->S.slist    = NULL;                       /* to be safe...   */
01565     p->S.narea[0] = NULL;
01566     p->S.narea[1] = NULL;
01567     p->S.nvol     = NULL;
01568     p->S.fvol     = NULL;
01569 
01570     p->F          = &opts->F;                   /* point to struct */
01571 
01572     if ( (p->outfp = fopen(opts->out_1D_file, "w")) == NULL )
01573     {
01574         fprintf(stderr,"** cannot open output file '%s'\n",opts->out_1D_file);
01575         RETURN(-1);
01576     }
01577 
01578     /* init before filling */
01579     p->nodes  = NULL;
01580     p->nnodes = 0;
01581     p->cmask  = NULL;
01582     p->ncmask = 0;
01583 
01584     if ( opts->nodes_1D_file )
01585     {
01586         if ( read_nodes_file(opts, p) != 0 )
01587             RETURN(-1);
01588     }
01589 
01590     if ( opts->cmask_cmd )
01591     {
01592         if ( get_cmask(opts, p) != 0 )
01593             RETURN(-1);
01594     }
01595 
01596     RETURN(0);
01597 }

float vector_angle float *    v0,
float *    v1
 

Definition at line 467 of file SUMA_SurfMeasures.c.

References ENTRY, fvec_magnitude(), RANGE, RETURN, ST_PI, and v1.

Referenced by norm2seg_angle(), and write_output().

00468 {
00469     double mag0, mag1, dot, ratio, angle;
00470 
00471 ENTRY("vector_angle");
00472 
00473     mag0 = fvec_magnitude(v0, 3);
00474     mag1 = fvec_magnitude(v1, 3);
00475     dot  = v0[0]*v1[0] + v0[1]*v1[1] + v0[2]*v1[2];
00476 
00477     if ( mag0 == 0.0 || mag1 == 0.0 )
00478         RETURN(0.0);
00479 
00480     ratio = dot / (mag0 * mag1);
00481     RANGE(-1.0, ratio, 1.0);
00482 
00483     angle = acos(ratio);
00484 
00485     /* keep angle in [0,PI/2] */
00486     if ( 2 * angle > ST_PI )
00487         angle = PI - angle;
00488 
00489     RETURN(angle);
00490 }

int verify_surf_t opts_t   opts,
param_t   p
 

Definition at line 547 of file SUMA_SurfMeasures.c.

References ALLOC_CHECK, c, param_t::cmask, opts_t::debug, disp_param_t(), disp_surf_t(), ENTRY, malloc, param_t::ncmask, surf_t::nnodes, param_t::nnodes, param_t::nodes, surf_t::nsurf, p, RETURN, param_t::S, surf_t::slist, and validate_option_lists().

Referenced by get_surf_data().

00548 {
00549     int c;
00550 
00551 ENTRY("verify_surf_t");
00552 
00553     if ( p->S.nsurf < 1 )
00554     {
00555         fprintf(stderr,"** no surfaces found\n");
00556         if ( opts->debug > 0 )
00557             disp_surf_t("-- empty? ", &p->S);
00558         RETURN(-1);
00559     }
00560 
00561     if ( p->S.nsurf > 1 )
00562     {
00563         for ( c = 1; c < p->S.nsurf; c++ )
00564             if ( p->S.slist[c]->N_Node != p->S.nnodes )
00565             {
00566                 fprintf(stderr,"** surface %d has %d nodes (should be %d)\n",
00567                         c, p->S.slist[c]->N_Node, p->S.nnodes);
00568                 RETURN(-1);
00569             }
00570     }
00571 
00572     /* verify nodes and cmask */
00573     if ( ! p->nodes )                   /* if empty, create the trivial list */
00574     {
00575         p->nnodes = p->S.nnodes;
00576         p->nodes  = (int *)malloc(p->nnodes * sizeof(int));
00577         ALLOC_CHECK(p->nodes, "int", p->S.nnodes);
00578 
00579         /* now fill the list with trivial indices */
00580         for ( c = 0; c < p->nnodes; c++ )
00581             p->nodes[c] = c;
00582     }
00583     else                                /* verify that the indices are valid */
00584     {
00585         for ( c = 0; c < p->nnodes; c++ )
00586             if ( (p->nodes[c] < 0) || (p->nodes[c] >= p->S.nnodes) )
00587             {
00588                 fprintf(stderr,"** error: node list index %d (value = %d):"
00589                                "          outside valid range [0,%d]\n",
00590                         c, p->nodes[c], p->S.nnodes-1);
00591                 RETURN(-1);
00592             }
00593     }
00594 
00595     /* in any case, if there is a mask, the length should match nnodes */
00596     if ( p->cmask && (p->ncmask != p->nnodes) )
00597     {
00598         fprintf(stderr,"** cmask and node list lengths differ (%d, %d)\n",
00599                 p->ncmask, p->nnodes);
00600         RETURN(-1);
00601     }
00602 
00603     if ( opts->debug > 1 )
00604     {
00605         disp_param_t("-- surf params verified: ", p);
00606         disp_surf_t ("-- surf params verified: ", &p->S);
00607     }
00608 
00609     if ( validate_option_lists(opts, p) != 0 )
00610         RETURN(-1);
00611 
00612     RETURN(0);
00613 }

int write_output opts_t   opts,
param_t   p
 

Definition at line 196 of file SUMA_SurfMeasures.c.

References c, param_t::cmask, func_t::codes, opts_t::debug, disp_f3_point(), dist_fn(), opts_t::dnode, E_SM_ANG_NORMS, E_SM_ANG_NS_A, E_SM_ANG_NS_B, E_SM_COORD_A, E_SM_COORD_B, E_SM_N_AREA_A, E_SM_N_AREA_B, E_SM_N_AVEAREA_A, E_SM_N_AVEAREA_B, E_SM_NODE_VOL, E_SM_NODES, E_SM_NORM_A, E_SM_NORM_B, E_SM_NTRI, E_SM_THICK, ENTRY, param_t::F, fnum, opts_t::info, SUMA_SurfaceObject::MF, SUMA_MEMBER_FACE_SETS::N_Memb, surf_t::narea, param_t::nnodes, SUMA_SurfaceObject::NodeList, SUMA_SurfaceObject::NodeNormList, param_t::nodes, norm2seg_angle(), surf_t::nsurf, func_t::nused, surf_t::nvol, param_t::outfp, p, print_column_headers(), RETURN, param_t::S, surf_t::slist, ST_INFO_AREA, ST_INFO_NORMS, ST_INFO_THICK, ST_INFO_VOL, vector_angle(), and THD_fvec3::xyz.

Referenced by main().

00197 {
00198     SUMA_SurfaceObject * so0, * so1;
00199 
00200     THD_fvec3   p0, p1;
00201     double      tarea0, tarea1, tvolume;
00202     double      dist, min_dist, max_dist, tdist;
00203     double      atn = 0.0, atna = 0.0, atnb = 0.0;  /* angle totals */
00204     float       fvn, fva, fvb;
00205     float     * fp0, * fp1;
00206     float     * norms0, * norms1;
00207     float       ave_dist, fval;
00208     int         c, fnum, node, nindex;
00209     int       * fcodes;
00210     int         skipped = 0;
00211 
00212 ENTRY("write_output");
00213 
00214     so0 = p->S.slist[0];
00215     so1 = p->S.slist[1];
00216 
00217     /* just a simple case for now */
00218 
00219     print_column_headers(opts, p);
00220 
00221     /* initialize some pointers */
00222     fp0    = so0->NodeList;
00223     norms0 = so0->NodeNormList;
00224 
00225     /* if we have only one surface, just init fp1 to that */
00226     if ( p->S.nsurf > 1 )
00227     {
00228         fp1    = so1->NodeList;
00229         norms1 = so1->NodeNormList;
00230     }
00231     else
00232     {
00233         fp1    = fp0;
00234         norms1 = norms0;
00235     }
00236 
00237     fcodes = p->F->codes;       /* for convenience */
00238 
00239     tdist   = 0.0;              /* for total distance over nodes */
00240     tarea0  = 0.0;              /* for total area computation   */
00241     tarea1  = 0.0;              /* for total area computation  */
00242     tvolume = 0.0;              /* for total volume           */
00243 
00244     min_dist = 9999.0;
00245     max_dist = 0.0;
00246     for (nindex = 0; nindex < p->nnodes; nindex++)
00247     {
00248         if ( p->cmask && !p->cmask[nindex] )
00249         {
00250             skipped++;
00251             continue;
00252         }
00253 
00254         node = p->nodes[nindex];
00255 
00256         memcpy(p0.xyz, fp0+3*node, 3*sizeof(float));
00257         memcpy(p1.xyz, fp1+3*node, 3*sizeof(float));
00258 
00259         dist = dist_fn(3, p0.xyz, p1.xyz);
00260         if ( dist < min_dist ) min_dist = dist;
00261         if ( dist > max_dist ) max_dist = dist;
00262         tdist += dist;
00263 
00264         /* keep track of the total areas and volume */
00265         if ( p->S.narea[0] )
00266             tarea0  += p->S.narea[0][node];
00267 
00268         if ( p->S.narea[1] )
00269             tarea1  += p->S.narea[1][node];
00270 
00271         if ( p->S.nvol )
00272             tvolume += p->S.nvol[node];
00273 
00274         fputc(' ', p->outfp);
00275 
00276         for (fnum = 0; fnum < p->F->nused; fnum++)
00277         {
00278             switch(fcodes[fnum])
00279             {
00280                 default:
00281                     fprintf(stderr,"** bad output Info code %d\n",fcodes[fnum]);
00282                     break;
00283 
00284                 case E_SM_ANG_NORMS:
00285                     fvn = vector_angle(norms0 + 3*node, norms1 + 3*node);
00286                     fprintf(p->outfp,"  %10s", MV_format_fval(fvn));
00287                     atn += fvn;
00288                     break;
00289 
00290                 case E_SM_ANG_NS_A:
00291                     fva = norm2seg_angle(&p0, &p1, norms0 + 3*node);
00292                     fprintf(p->outfp,"  %10s", MV_format_fval(fva));
00293                     atna += fva;
00294                     break;
00295 
00296                 case E_SM_ANG_NS_B:
00297                     fvb = norm2seg_angle(&p0, &p1, norms1 + 3*node);
00298                     fprintf(p->outfp,"  %10s", MV_format_fval(fvb));
00299                     atnb += fvb;
00300                     break;
00301 
00302                 case E_SM_COORD_A:
00303                     for (c = 0; c < 3; c++)
00304                         fprintf(p->outfp,"  %10s",
00305                                 MV_format_fval(fp0[3*node+c]));
00306                     break;
00307 
00308                 case E_SM_COORD_B:
00309                     for (c = 0; c < 3; c++)
00310                         fprintf(p->outfp,"  %10s",
00311                                 MV_format_fval(fp1[3*node+c]));
00312                     break;
00313 
00314                 case E_SM_N_AREA_A:
00315                     fprintf(p->outfp,"  %10s",
00316                             MV_format_fval(p->S.narea[0][node]));
00317                     break;
00318 
00319                 case E_SM_N_AREA_B:
00320                     fprintf(p->outfp,"  %10s",
00321                             MV_format_fval(p->S.narea[1][node]));
00322                     break;
00323 
00324                 case E_SM_N_AVEAREA_A:
00325                     fval = 3 * p->S.narea[0][node] / so0->MF->N_Memb[node];
00326                     fprintf(p->outfp,"  %10s", MV_format_fval(fval));
00327                     break;
00328 
00329                 case E_SM_N_AVEAREA_B:
00330                     fval = 3 * p->S.narea[1][node] / so1->MF->N_Memb[node];
00331                     fprintf(p->outfp,"  %10s", MV_format_fval(fval));
00332                     break;
00333 
00334                 case E_SM_NTRI:
00335                     fprintf(p->outfp,"  %10d", so0->MF->N_Memb[node]);
00336                     break;
00337 
00338                 case E_SM_NODES:
00339                     fprintf(p->outfp,"  %10d", node);
00340                     break;
00341 
00342                 case E_SM_NODE_VOL:
00343                     fprintf(p->outfp,"  %10s", MV_format_fval(p->S.nvol[node]));
00344                     break;
00345 
00346                 case E_SM_NORM_A:
00347                     if ( norms0 )
00348                         for (c = 0; c < 3; c++)
00349                             fprintf(p->outfp,"  %10s",
00350                                     MV_format_fval(norms0[3*node+c]));
00351                     break;
00352 
00353                 case E_SM_NORM_B:
00354                     if ( norms1 )
00355                         for (c = 0; c < 3; c++)
00356                             fprintf(p->outfp,"  %10s",
00357                                     MV_format_fval(norms1[3*node+c]));
00358                     break;
00359 
00360                 case E_SM_THICK:
00361                     fprintf(p->outfp,"  %10s", MV_format_fval(dist));
00362                     break;
00363             }
00364         }
00365 
00366         fputc('\n', p->outfp);
00367 
00368         if ( node == opts->dnode && opts->debug > 0 )
00369         {
00370             fprintf(stderr,"-- dnode %d:\n", node);
00371             disp_f3_point("-- p0    = ", fp0+3*node);
00372             disp_f3_point("-- p1    = ", fp1+3*node);
00373 
00374             if ( atn > 0.0 || atna > 0.0 || atnb > 0.0 )
00375             {
00376                 disp_f3_point("-- normA = ", norms0 + 3*node);
00377                 disp_f3_point("-- normB = ", norms1 + 3*node);
00378             }
00379         }
00380     }
00381 
00382     ave_dist = tdist/p->nnodes;
00383 
00384     if ( opts->info )
00385         printf("----------------------------------------------------------\n");
00386 
00387     if ( opts->info & ST_INFO_AREA )
00388     {
00389         if ( p->S.narea[0] )
00390             printf("-- total area 0 = %.1f\n", tarea0);
00391 
00392         if ( p->S.nsurf > 1 )
00393             printf("-- total area 1 = %.1f\n", tarea1);
00394     }
00395 
00396     if ( (opts->info & ST_INFO_NORMS) &&
00397          (atn > 0.0 || atna > 0.0 || atnb > 0.0) )
00398     {
00399         printf( "-- ave. angles to normals: (nA_nB, sA, sB) = "
00400                 "(%.4f, %.4f, %.4f)\n",
00401                 atn/p->nnodes, atna/p->nnodes, atnb/p->nnodes);
00402     }
00403 
00404     if ( (opts->info & ST_INFO_THICK) && (p->S.nsurf > 1) )
00405         printf( "-- thickness: (min, ave, max) = (%.5f, %.5f, %.5f)\n",
00406                 min_dist, ave_dist, max_dist);
00407 
00408     if ( (opts->info & ST_INFO_VOL) && p->S.nvol )
00409     {
00410         printf("-- total volume = %.1f\n", tvolume);
00411         if ( opts->debug > 1 )
00412             printf("-- ave dist * (area0, ave, area1) = (%.1f, %.1f, %.1f)\n",
00413                 ave_dist*tarea0, ave_dist*(tarea0+tarea1)/2, ave_dist*tarea1);
00414     }
00415 
00416     if ( p->cmask )
00417         printf("-- from cmask, nodes skipped = %d\n", skipped);
00418 
00419     RETURN(0);
00420 }

Variable Documentation

char g_history[] [static]
 

Definition at line 45 of file SUMA_SurfMeasures.c.

Referenced by usage().

char* g_sm_desc[]
 

Initial value:

 { "invalid function",
                       "angular difference between normals",
                       "angular diff between segment and first norm",
                       "angular diff between segment and second norm",
                       "xyz coordinates of node on first surface",
                       "xyz coordinates of node on second surface",
                       "associated node area on first surface",
                       "associated node area on second surface",
                       "for each node, average area of triangles (surf A)",
                       "for each node, average area of triangles (surf B)",
                       "for each node, number of associated triangles",
                       "associated node volume between surfaces",
                       "node number",
                       "vector of normal at node on first surface",
                       "vector of normal at node on second surface",
                       "distance between surfaces along segment" }

Definition at line 121 of file SUMA_SurfMeasures.c.

Referenced by usage().

char* g_sm_names[]
 

Initial value:

 { "none", "ang_norms", "ang_ns_A", "ang_ns_B",
                        "coord_A", "coord_B", "n_area_A", "n_area_B",
                        "n_avearea_A", "n_avearea_B", "n_ntri",
                        "node_vol", "nodes", "norm_A", "norm_B", "thick" }

Definition at line 116 of file SUMA_SurfMeasures.c.

Referenced by check_func_name(), init_opts_t(), usage(), and validate_option_lists().

SUMA_CommonFields* SUMAg_CF = NULL
 

Definition at line 113 of file SUMA_SurfMeasures.c.

SUMA_DO* SUMAg_DOv = NULL
 

Definition at line 111 of file SUMA_SurfMeasures.c.

int SUMAg_N_DOv = 0
 

Definition at line 112 of file SUMA_SurfMeasures.c.

Referenced by all_mappable_surfs(), final_cleanup(), and spec2SUMA().

int SUMAg_N_SVv = 0
 

Definition at line 110 of file SUMA_SurfMeasures.c.

Referenced by final_cleanup().

SUMA_SurfaceViewer* SUMAg_SVv = NULL
 

Definition at line 109 of file SUMA_SurfMeasures.c.

 

Powered by Plone

This site conforms to the following standards: