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       
00022 
00023 #define ST_SINFO                1       
00024 #define ST_SMEASURE             2       
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 
00033 typedef enum
00034 {
00035     E_SM_INVALID,                       
00036     E_SM_ANG_NORMS,                     
00037     E_SM_ANG_NS_A,                      
00038     E_SM_ANG_NS_B,                      
00039     E_SM_COORD_A,                       
00040     E_SM_COORD_B,                       
00041     E_SM_N_AREA_A,                      
00042     E_SM_N_AREA_B,                      
00043     E_SM_N_AVEAREA_A,                   
00044     E_SM_N_AVEAREA_B,                   
00045     E_SM_NTRI,                          
00046     E_SM_NODE_VOL,                      
00047     E_SM_NODES,                         
00048     E_SM_NORM_A,                        
00049     E_SM_NORM_B,                        
00050     E_SM_THICK,                         
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;         
00064     SUMA_SurfaceObject ** slist;        
00065     float               * narea[2];     
00066     float               * nvol;         
00067     float               * fvol;         
00068     int                   nsurf;        
00069     int                   salloc;       
00070     int                   nnodes;       
00071     int                   nfaces;       
00072 } surf_t;
00073 
00074 typedef struct
00075 {
00076     char ** names;                      
00077     int   * codes;                      
00078     int     nalloc;                     
00079     int     nused;                      
00080 } func_t;
00081 
00082 typedef struct
00083 {
00084     func_t   F;                         
00085     char   * spec_file;                 
00086     char   * sv_file;                   
00087     char   * out_1D_file;               
00088     char   * cmask_cmd;                 
00089     char   * nodes_1D_file;             
00090     char   * surf_names[ST_MAX_SURFS];  
00091     int      info;                      
00092     int      debug;                     
00093     int      dnode;                     
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;                    
00103     byte   * cmask;
00104     int      ncmask;                    
00105     int      ccount;                    
00106 } param_t;
00107 
00108 
00109 
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 
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