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.h

Go to the documentation of this file.
00001 #ifndef _SUMA_SURFMEASURES_H_
00002 #define _SUMA_SURFMEASURES_H_
00003 
00004 #define PROG_NAME               "SurfMeasures"
00005 
00006 #define ST_USE_LONG             1
00007 #define ST_USE_SHORT            2
00008 #define ST_USE_HIST             3
00009 #define ST_USE_VERSION          4
00010 
00011 #define ST_INFO_NONE            0
00012 #define ST_INFO_AREA            1
00013 #define ST_INFO_NORMS           2
00014 #define ST_INFO_THICK           4
00015 #define ST_INFO_VOL             8
00016 #define ST_INFO_ALL        0xffff
00017 
00018 #define ST_MAX_SURFS            2
00019 
00020 #define ST_DEBUG_MAX_LEVEL      5
00021 #define ST_DEFAULT_FALLOC      10       /* init alloc for num functions  */
00022 
00023 #define ST_SINFO                1       /* infomation type */
00024 #define ST_SMEASURE             2       /* measure type    */
00025 
00026 #define ST_PI                   3.141592653589793
00027 
00028 #define RANGE(a,b,c) do {if ((b)<(a)) (b)=(a); if ((b)>(c)) (b)=(c);} while (0)
00029 
00030 #define CHECK_NULL_STR(str) ( str ? str : "(NULL)" )
00031 
00032 /* measure codes, to match g_smeasure_names */
00033 typedef enum
00034 {
00035     E_SM_INVALID,                       /* do not change INVALID or FINAL     */
00036     E_SM_ANG_NORMS,                     /* give angle diff between normals    */
00037     E_SM_ANG_NS_A,                      /* give norm A angle to segment       */
00038     E_SM_ANG_NS_B,                      /* give norm B angle to segment       */
00039     E_SM_COORD_A,                       /* give coordinates of first node     */
00040     E_SM_COORD_B,                       /* give coordinates of second node    */
00041     E_SM_N_AREA_A,                      /* give node area of first node       */
00042     E_SM_N_AREA_B,                      /* give node area of second node      */
00043     E_SM_N_AVEAREA_A,                   /* average area of included triangles */
00044     E_SM_N_AVEAREA_B,                   /* average area of included triangles */
00045     E_SM_NTRI,                          /* give number of included triangles  */
00046     E_SM_NODE_VOL,                      /* give volume for each node          */
00047     E_SM_NODES,                         /* print out node indices             */
00048     E_SM_NORM_A,                        /* give normal vector for first node  */
00049     E_SM_NORM_B,                        /* give normal vector for second node */
00050     E_SM_THICK,                         /* display between surface thickness  */
00051     E_SM_FINAL
00052 } smeasure_codes_e;
00053 
00054 #define ALLOC_CHECK(ptr,name,nel)                                         \
00055         do { if (!(ptr))                                                  \
00056              { fprintf(stderr,"** failed to allocate %d '%s' elements\n", \
00057                         nel, name);                                       \
00058                exit(1);                                                   \
00059              } } while (0)
00060 
00061 typedef struct
00062 {
00063     SUMA_SurfSpecFile     spec;         /* spec file structure           */
00064     SUMA_SurfaceObject ** slist;        /* list of SO pointers           */
00065     float               * narea[2];     /* list of computed node areas   */
00066     float               * nvol;         /* list of computed node volumes */
00067     float               * fvol;         /* list of computed face volumes */
00068     int                   nsurf;        /* number in list                */
00069     int                   salloc;       /* number allocated for          */
00070     int                   nnodes;       /* N_Nodes for each surf         */
00071     int                   nfaces;       /* N_FaceSet for each surf       */
00072 } surf_t;
00073 
00074 typedef struct
00075 {
00076     char ** names;                      /* list of function names      */
00077     int   * codes;                      /* list of function codes      */
00078     int     nalloc;                     /* number allocated for        */
00079     int     nused;                      /* number actually used        */
00080 } func_t;
00081 
00082 typedef struct
00083 {
00084     func_t   F;                         /* funtion list struct         */
00085     char   * spec_file;                 /* surface specification file  */
00086     char   * sv_file;                   /* AFNI surface volume dataset */
00087     char   * out_1D_file;               /* surface output filename     */
00088     char   * cmask_cmd;                 /* 3dcalc style cmask command  */
00089     char   * nodes_1D_file;             /* node list to apply cmask to */
00090     char   * surf_names[ST_MAX_SURFS];  /* list of surfaces to be used */
00091     int      info;                      /* display final information   */
00092     int      debug;                     /* level of debug output       */
00093     int      dnode;                     /* node watched for debug      */
00094 } opts_t;
00095 
00096 typedef struct
00097 {
00098     surf_t   S;
00099     func_t * F;
00100     FILE   * outfp;
00101     int    * nodes;
00102     int      nnodes;                    /* length of node_list         */
00103     byte   * cmask;
00104     int      ncmask;                    /* length of cmask             */
00105     int      ccount;                    /* number of set entries       */
00106 } param_t;
00107 
00108 
00109 /* protos */
00110 
00111 int     add_to_flist         ( func_t * F, char * fname );
00112 int     all_mappable_surfs   ( opts_t * opts, param_t * p );
00113 int     check_func_name      ( char * func );
00114 int     compute_face_vols    ( opts_t * opts, param_t * p );
00115 int     compute_node_areas   ( opts_t * opts, param_t * p, int sindex );
00116 int     compute_node_vols    ( opts_t * opts, param_t * p );
00117 int     disp_f3_point        ( char * info, float * d );
00118 int     disp_func_t          ( char * info, func_t * d );
00119 int     disp_opts_t          ( char * info, opts_t * d );
00120 int     disp_param_t         ( char * info, param_t * d );
00121 int     disp_surf_t          ( char * info, surf_t * d );
00122 int     final_cleanup        ( opts_t * opts, param_t * p );
00123 int     get_cmask            ( opts_t * opts, param_t * p );
00124 int     get_surf_data        ( opts_t * opts, param_t * p );
00125 int     get_surf_measures    ( opts_t * opts, param_t * p );
00126 int     init_options         ( opts_t * opts, int argc, char * argv[] );
00127 int     init_opts_t          ( opts_t * opts );
00128 int     print_column_headers ( opts_t * opts, param_t * p );
00129 int     read_nodes_file      ( opts_t * opts, param_t * p );
00130 int     spec2SUMA            ( SUMA_SurfSpecFile * spec, opts_t * opts );
00131 int     usage                ( char * prog, int use_type );
00132 int     validate_option_lists( opts_t * opts, param_t * p );
00133 int     validate_options     ( opts_t * opts, param_t * p );
00134 int     verify_surf_t        ( opts_t * opts, param_t * p );
00135 int     write_output         ( opts_t * opts, param_t * p );
00136 
00137 /* geometric routines */
00138 int     cross_product        ( double * res, double * u, double * v );
00139 double  dist_fn              ( int len, float * p1, float * p2 );
00140 double  dot_product          ( double * u, double * v );
00141 float   fvec_magnitude       ( float * vec, int length );
00142 float   magnitude_vec_N      ( float * vec, int length );
00143 float   norm2seg_angle       ( THD_fvec3 * p0, THD_fvec3 * p1, float * norm );
00144 int     surf_triangle_match  ( opts_t * opts, param_t * p);
00145 double  tetra_volume         ( float * p0, float * p1, float * p2, float * p3 );
00146 float   vector_angle         ( float * v0, float * v1 );
00147 
00148 double  lazy_det             ( int width, double * data );
00149 
00150 #endif     /* #define _SUMA_SURFMEASURES_H_ */
 

Powered by Plone

This site conforms to the following standards: