1 #ifndef _VOL2SURF_H_ 2 #define _VOL2SURF_H_ 3 4 #ifdef __cplusplus 5 extern "C" { /* care of Greg Balls 7 Aug 2006 [rickr] */ 6 #endif 7 8 #define V2S_MAX_SURFS 2 9 10 #define V2S_INDEX_VOXEL 0 11 #define V2S_INDEX_NODE 1 12 13 #define V2S_STEPS_TOOOOO_BIG 10000 14 15 #define V2S_NORM_DEFAULT 0 16 #define V2S_NORM_KEEP 1 17 #define V2S_NORM_REVERSE 2 18 19 #define V2S_EPSILON 0.0001 20 21 #define V2S_SKIP_NONE 0 22 #define V2S_SKIP_NODES 1 23 #define V2S_SKIP_VOLIND 2 24 #define V2S_SKIP_I 4 25 #define V2S_SKIP_J 8 26 #define V2S_SKIP_K 16 27 #define V2S_SKIP_NVALS 32 28 #define V2S_SKIP_VALS 64 /* never skip first result value */ 29 #define V2S_SKIP_ALL 127 30 31 #undef CHECK_NULL_STR 32 #define CHECK_NULL_STR(str) ( str ? str : "<NULL>" ) 33 #undef CHECK_EMPTY_STR 34 #define CHECK_EMPTY_STR(str) ( str[0] ? str : "<empty>" ) 35 36 /* surface to voxel mapping codes, along with command-line strings */ 37 typedef enum 38 { 39 E_SMAP_INVALID = 0, /* do not change INVALID (from 0) */ 40 E_SMAP_MASK, E_SMAP_MIDPT, 41 E_SMAP_MASK2, 42 E_SMAP_AVE, E_SMAP_COUNT, 43 E_SMAP_MIN, E_SMAP_MAX, 44 E_SMAP_MAX_ABS, E_SMAP_SEG_VALS, 45 /* sorted ones: */ 46 E_SMAP_MEDIAN, E_SMAP_MODE, E_SMAP_NZMODE, 47 /* non-zero versions of a few */ 48 E_SMAP_NZAVE, E_SMAP_NZMIN, E_SMAP_NZMAX, 49 E_SMAP_FINAL /* leave FINAL at the end */ 50 } v2s_map_nums; 51 52 typedef struct 53 { 54 int show; 55 int index; 56 float value; 57 } v2s_oob_t; 58 59 typedef struct 60 { 61 int nalloc; 62 int nused; 63 int max_vals; 64 int memory; 65 int * nodes; 66 int * volind; 67 int * i; 68 int * j; 69 int * k; 70 int * nvals; 71 float ** vals; 72 char ** labels; 73 int nlab; 74 } v2s_results; 75 76 typedef struct 77 { 78 int fake; /* were arguments faked? */ 79 int argc; /* argument list length */ 80 char ** argv; /* argument list */ 81 } v2s_cmd_t; 82 83 typedef struct 84 { 85 int map; /* type of mapping from surfs */ 86 int gp_index; /* grid parent sub-brick (or -1) */ 87 int debug; /* for printing extra output */ 88 int dnode; /* node watched for debug */ 89 int no_head; /* do not write output headers */ 90 int skip_cols; /* which output columns to skip */ 91 int first_node; /* skip nodes before this index */ 92 int last_node; /* skip nodes after this index */ 93 int use_norms; /* use normals for segments */ 94 float norm_len; /* signed length of normal */ 95 int norm_dir; /* default, keep or reverse */ 96 int f_index; /* node or voxel index type */ 97 int f_steps; /* # int steps for mask2 map */ 98 float f_p1_fr; /* fractional dist: add to p1 */ 99 float f_pn_fr; /* fractional dist: add to pn */ 100 float f_p1_mm; /* mm distance to add to p1 */ 101 float f_pn_mm; /* mm distance to add to pn */ 102 char * outfile_1D; /* filename for ascii output */ 103 char * outfile_niml; /* filename for NIML output */ 104 char * segc_file; /* filename for seg coors output */ 105 v2s_cmd_t cmd; /* command info for history */ 106 v2s_oob_t oob; /* display info for oob nodes */ 107 v2s_oob_t oom; /* display info for oom nodes */ 108 } v2s_opts_t; 109 110 typedef struct 111 { 112 int ready, map_all; /* map_all 16 May 2018 [rickr] */ 113 int use0, use1; 114 int s0A, s0B; 115 int s1A, s1B; 116 int gpt_index; /* grid_parent thres ind (init -1) */ 117 float gpt_thresh; /* threshold value (symmetric) */ 118 char * label[4]; /* labels for 2 pairs of surfaces */ 119 THD_3dim_dataset * sv_dset; /* surface volume dataset */ 120 v2s_opts_t sopt; 121 } v2s_plugin_opts; 122 123 /* computational parameters */ 124 typedef struct 125 { 126 THD_3dim_dataset * gpar; /* input dataset */ 127 byte * cmask; /* computed mask */ 128 int nvox; /* gpar nxyz */ 129 int over_steps; /* vals computed over steps */ 130 int nsurf; /* number of surfaces to apply */ 131 SUMA_surface surf[V2S_MAX_SURFS]; /* surface structure info */ 132 } v2s_param_t; 133 134 /* ---- export function prototypes ---- */ 135 136 v2s_results * afni_vol2surf ( THD_3dim_dataset * gpar, int gp_index, 137 SUMA_surface * sA, SUMA_surface * sB, 138 byte * mask, int use_defaults ); 139 v2s_results * opt_vol2surf ( THD_3dim_dataset * gpar, v2s_opts_t * sopt, 140 SUMA_surface *sA, SUMA_surface *sB, byte *mask); 141 v2s_results * vol2surf ( v2s_opts_t * sopt, v2s_param_t * p ); 142 143 int disp_mri_imarr ( char * info, MRI_IMARR * dp ); 144 int disp_v2s_command ( v2s_opts_t * sopt ); 145 int disp_v2s_opts_t ( char * info, v2s_opts_t * sopt ); 146 int disp_v2s_param_t ( char * info, v2s_param_t * p ); 147 int disp_v2s_plugin_opts( char * mesg, v2s_plugin_opts * d ); 148 int disp_v2s_results ( char * mesg, v2s_results * d ); 149 int free_v2s_results ( v2s_results * sd ); 150 int v2s_fill_sopt_default(v2s_opts_t * sopt, int nsurf ); 151 int v2s_is_good_map ( int map, int from_afni ); 152 int v2s_make_command ( v2s_opts_t * opt, v2s_param_t * p ); 153 int v2s_map_type ( char * map_str ); 154 int v2s_vals_over_steps ( int map ); 155 int v2s_write_outfile_1D( v2s_opts_t * sopt, v2s_results * sd, char * label ); 156 int v2s_write_outfile_NSD( v2s_results *, v2s_opts_t *, v2s_param_t *, int); 157 int v2s_write_outfile_niml( v2s_opts_t * sopt, v2s_results * sd, int free_vals); 158 159 160 /* ---- define globals for everyone but vol2surf.c ---- */ 161 #ifndef _VOL2SURF_C_ 162 extern v2s_plugin_opts gv2s_plug_opts; 163 extern char * gv2s_map_names[]; 164 extern char gv2s_history[]; 165 extern char gv2s_no_label[]; 166 #endif 167 168 #ifdef __cplusplus 169 } 170 #endif 171 172 #endif /* _VOL2SURF_H_ */ 173