Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
plug_maxima.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006    
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #define R_MAX_AFNI_DSETS          3
00019 #define R_MESSAGE_L             256
00020 #define R_FILE_L                128
00021 
00022 #define rWARNING( string ) fprintf( stderr, "\033[1m%s\033[0m\n", string )
00023 #define rERROR(   string ) fprintf( stderr, "\007\033[2m%s\033[0m\n", string )
00024 
00025 
00026 
00027 
00028 typedef struct
00029 {
00030     
00031     int                 must_be_short;               
00032     int                 want_floats;                 
00033     int                 subs_must_equal;             
00034     int                 max_subs;                    
00035 
00036     
00037     THD_3dim_dataset  * dset    [ R_MAX_AFNI_DSETS ];
00038     short             * simage  [ R_MAX_AFNI_DSETS ];
00039     float               factor  [ R_MAX_AFNI_DSETS ];
00040     int                 subs    [ R_MAX_AFNI_DSETS ]; 
00041     int                 sub_brick;                    
00042 
00043     int                 nx, ny, nz, nvox;
00044 
00045     
00046     float             * fimage  [ R_MAX_AFNI_DSETS ]; 
00047 
00048     u_short             max_u_short;                  
00049     int                 num_dsets;                    
00050 } r_afni_s;
00051 
00052 
00053 
00054 
00055 extern char grMessage [ R_MESSAGE_L ];          
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 #define MAX_MASK_FILL_VAL       1
00064 
00065 #define MAX_SORT_N_REMOVE_STYLE 1
00066 #define MAX_WEIGHTED_AVE_STYLE  2
00067 #define MAX_MAX_STYLE           2
00068 
00069 typedef struct
00070 {
00071     int   * plist;
00072     int     used;
00073     int     M;
00074 } point_list_s;
00075 
00076 
00077 typedef struct
00078 {
00079     THD_3dim_dataset  * dset;                   
00080     short             * sdata;                  
00081     short             * result;                 
00082     int                 nx, ny, nz, nxy, nvox;
00083 
00084     point_list_s        P;                      
00085 
00086     int                 extrema_count;          
00087 
00088     int                 data_type;              
00089     int                 adn_type;               
00090     int                 func_type;              
00091 
00092     char                outfile[ R_FILE_L ];    
00093     int                 sval_style;             
00094 
00095     float               cutoff;                 
00096     float               min_dist;               
00097     float               out_rad;                
00098 
00099     int                 negatives;              
00100     int                 ngbr_style;             
00101     int                 overwrite;              
00102     int                 quiet;                  
00103     int                 true_max;               
00104     int                 dicom_coords;           
00105     int                 debug;                  
00106 } maxima_s;
00107 
00108 
00109 static int      add_point_to_list  ( point_list_s *, int );
00110 static int      apply_fill_radius  ( maxima_s * );
00111 static int      apply_min_dist     ( maxima_s * );
00112 static int      clear_around_point ( int, maxima_s *, point_list_s * );
00113 static int      create_point_list  ( maxima_s * );
00114 static int      display_coords     ( r_afni_s *, maxima_s * );
00115 static int      find_local_maxima  ( maxima_s * );
00116 static void     free_memory        ( r_afni_s *, maxima_s * );
00117 static int      init_maxima_s      ( maxima_s *, r_afni_s *, char * );
00118 static int      init_afni_s        ( r_afni_s * );
00119 static char *   process_args       ( r_afni_s *, maxima_s *,PLUGIN_interface *);
00120 static int      process_data       ( maxima_s * );
00121 static int      radial_fill        ( int, int, int, maxima_s *, int );
00122 static int      weighted_index     ( point_list_s *, maxima_s * );
00123 static int      write_results      ( r_afni_s *, maxima_s *,PLUGIN_interface *);
00124 
00125 static void     show_point_list_s  ( char * mesg, point_list_s *, int );
00126 static void     show_maxima_s      ( char * mesg, maxima_s * );
00127 
00128 int             point_comp_neg     ( const void *, const void * );
00129 int             point_comp_pos     ( const void *, const void * );
00130 
00131 
00132 int r_set_afni_s_from_dset( r_afni_s *, THD_3dim_dataset * );
00133 u_short r_get_max_u_short( ushort *, int );
00134 
00135 
00136 
00137 static short *  gr_orig_data = NULL;
00138 static float    gr_fac = 1.0;
00139 
00140