Doxygen Source Code Documentation
plug_funcs.c File Reference
#include "afni.h"
Go to the source code of this file.
Defines | |
#define | MAKE_ATEMP(nvox) |
#define | AT(i, j) atemp[(i)+(j)*nx] |
#define | AR(i, j) ar[(i)+(j)*nx] |
#define | Z(x, y) ( ((x)>(y)) ? 0 : ((x)==(y)) ? 1 : 2 ) |
#define | ZZ(a, b, c) ( Z((a),(b))+Z((c),(b)) >= 3 ) |
#define | QQQMAX 1 |
#define | NRAD 1800 |
#define | DRAD (2.0*PI/NRAD) |
#define | DD 0.47 |
Functions | |
char * | JUNK_main (PLUGIN_interface *plint) |
void | lacy9_box_func (int nx, int ny, double dx, double dy, float *ar) |
void | outer9_box_func (int nx, int ny, double dx, double dy, float *ar) |
DEFINE_PLUGIN_PROTOTYPE PLUGIN_interface * | PLUGIN_init (int ncall) |
Variables | |
float * | atemp = NULL |
int | natemp = -666 |
Define Documentation
|
Definition at line 65 of file plug_funcs.c. Referenced by lacy9_box_func(), and outer9_box_func(). |
|
Definition at line 64 of file plug_funcs.c. |
|
|
|
|
|
Value: do{ if( natemp < (nvox) ){ \ if( atemp != NULL ) free(atemp) ; \ natemp = (nvox) ; \ atemp = (float *) malloc( sizeof(float) * natemp ) ; } } while(0) Definition at line 58 of file plug_funcs.c. |
|
|
|
|
|
|
|
|
Function Documentation
|
Definition at line 51 of file plug_funcs.c. Referenced by PLUGIN_init().
00051 { return NULL ; }
|
|
Definition at line 67 of file plug_funcs.c. References abs, AR, AT, atemp, MAKE_ATEMP, osfilt9_box_func(), and ZZ. Referenced by outer9_box_func(), and PLUGIN_init().
00068 { 00069 int ii , jj , nxy , isp , nnn , qqq , imid,jmid ; 00070 float val ; 00071 00072 if( nx < 3 || ny < 3 ) return ; 00073 00074 osfilt9_box_func( nx,ny,dx,dy,ar ) ; /* smooth */ 00075 00076 /** make space and copy input into it **/ 00077 00078 nxy = nx * ny ; 00079 MAKE_ATEMP(nxy) ; if( atemp == NULL ) return ; 00080 for( ii=0 ; ii < nxy ; ii++ ) atemp[ii] = ar[ii] ; 00081 00082 /** process copy of input back into the input array **/ 00083 00084 #undef Z 00085 #undef ZZ 00086 #define Z(x,y) ( ((x)>(y)) ? 0 : ((x)==(y)) ? 1 : 2 ) 00087 #define ZZ(a,b,c) ( Z((a),(b))+Z((c),(b)) >= 3 ) 00088 00089 for( ii=0 ; ii < nxy ; ii++ ) ar[ii] = 0.0 ; 00090 00091 imid = nx/2 ; jmid = ny/2 ; 00092 00093 for( jj=1 ; jj < ny-1 ; jj++ ){ /* find local peaks */ 00094 for( ii=1 ; ii < nx-1 ; ii++ ){ /* in each 3x3 cell */ 00095 00096 val = AT(ii,jj) ; 00097 00098 #if 0 00099 isp = ZZ( AT(ii-1,jj ) , val , AT(ii+1,jj ) ) 00100 || ZZ( AT(ii-1,jj-1) , val , AT(ii+1,jj+1) ) 00101 || ZZ( AT(ii-1,jj+1) , val , AT(ii+1,jj-1) ) 00102 || ZZ( AT(ii ,jj+1) , val , AT(ii ,jj-1) ) ; 00103 #else 00104 if( abs(ii-imid) <= abs(jj-jmid) ){ 00105 isp = ZZ( AT(ii-1,jj-1) , val , AT(ii+1,jj+1) ) 00106 || ZZ( AT(ii-1,jj+1) , val , AT(ii+1,jj-1) ) 00107 || ZZ( AT(ii ,jj+1) , val , AT(ii ,jj-1) ) ; 00108 } else { 00109 isp = ZZ( AT(ii-1,jj ) , val , AT(ii+1,jj ) ) 00110 || ZZ( AT(ii-1,jj-1) , val , AT(ii+1,jj+1) ) 00111 || ZZ( AT(ii-1,jj+1) , val , AT(ii+1,jj-1) ) ; 00112 } 00113 #endif 00114 00115 if( isp ) ar[ii+jj*nx] = val ; 00116 } 00117 } 00118 00119 #define QQQMAX 1 00120 #if QQQMAX > 0 00121 qqq = 0 ; 00122 do { 00123 nnn = 0 ; 00124 for( ii=0 ; ii < nxy ; ii++ ) atemp[ii] = ar[ii] ; 00125 for( jj=1 ; jj < ny-1 ; jj++ ){ /* clip off those that */ 00126 for( ii=1 ; ii < nx-1 ; ii++ ){ /* are too isolated */ 00127 00128 if( AT(ii,jj) != 0.0 ){ 00129 isp = (AT(ii-1,jj ) != 0.0) + (AT(ii+1,jj ) != 0.0) 00130 + (AT(ii-1,jj+1) != 0.0) + (AT(ii+1,jj+1) != 0.0) 00131 + (AT(ii-1,jj-1) != 0.0) + (AT(ii+1,jj-1) != 0.0) 00132 + (AT(ii ,jj-1) != 0.0) + (AT(ii ,jj-1) != 0.0) ; 00133 00134 if( isp < 2 ){ ar[ii+jj*nx] = 0.0 ; nnn++ ; } 00135 } 00136 } 00137 } 00138 qqq++ ; 00139 } while( qqq < QQQMAX && nnn > 0 ) ; 00140 #endif 00141 00142 for( jj=1 ; jj < ny-1 ; jj++ ){ /* remove isolas */ 00143 for( ii=1 ; ii < nx-1 ; ii++ ){ 00144 00145 if( (AR(ii-1,jj ) == 0.0) && (AR(ii+1,jj ) == 0.0) 00146 && (AR(ii-1,jj+1) == 0.0) && (AR(ii+1,jj+1) == 0.0) 00147 && (AR(ii-1,jj-1) == 0.0) && (AR(ii+1,jj-1) == 0.0) 00148 && (AR(ii ,jj-1) == 0.0) && (AR(ii ,jj-1) == 0.0) ) AR(ii,jj) = 0.0 ; 00149 } 00150 } 00151 00152 return ; 00153 } |
|
process copy of input back into the input array * Definition at line 157 of file plug_funcs.c. References AR, AT, atemp, lacy9_box_func(), and MAKE_ATEMP. Referenced by PLUGIN_init().
00158 { 00159 int ii , jj , nxy , nnn , imid,jmid , ib,jb ; 00160 float xx , yy ; 00161 00162 if( nx < 3 || ny < 3 ) return ; 00163 00164 lacy9_box_func( nx,ny,dx,dy,ar ) ; /* find local peaks */ 00165 00166 /** make space and copy input into it **/ 00167 00168 nxy = nx * ny ; 00169 MAKE_ATEMP(nxy) ; if( atemp == NULL ) return ; 00170 for( ii=0 ; ii < nxy ; ii++ ) atemp[ii] = ar[ii] ; 00171 for( ii=0 ; ii < nxy ; ii++ ) ar[ii] = 0.0 ; 00172 00173 imid = nx/2 ; jmid = ny/2 ; 00174 00175 #define NRAD 1800 00176 #define DRAD (2.0*PI/NRAD) 00177 #define DD 0.47 00178 00179 for( nnn=0 ; nnn < NRAD ; nnn++ ){ 00180 dx = DD*cos(nnn*DRAD) ; dy = DD*sin(nnn*DRAD) ; 00181 xx = imid + 10*dx ; yy = jmid + 10*dy ; 00182 ib = -1 ; jb = -1 ; 00183 00184 do { xx += dx ; yy += dy ; 00185 ii = xx ; jj = yy ; 00186 if( ii < 0 || ii >= nx || jj < 0 || jj > ny ) break ; 00187 00188 if( AT(ii,jj) != 0.0 ){ ib = ii ; jb = jj ; AR(ii,jj) = 1.0 ; } 00189 } while( 1 ) ; 00190 00191 if( ib >= 0 && jb >= 0 ) AR(ib,jb) = 2.0 ; 00192 } 00193 00194 for( jj=1 ; jj < ny-1 ; jj++ ){ /* remove isolas */ 00195 for( ii=1 ; ii < nx-1 ; ii++ ){ 00196 00197 if( (AR(ii-1,jj ) == 0.0) && (AR(ii+1,jj ) == 0.0) 00198 && (AR(ii-1,jj+1) == 0.0) && (AR(ii+1,jj+1) == 0.0) 00199 && (AR(ii-1,jj-1) == 0.0) && (AR(ii+1,jj-1) == 0.0) 00200 && (AR(ii ,jj-1) == 0.0) && (AR(ii ,jj-1) == 0.0) ) AR(ii,jj) = 0.0 ; 00201 } 00202 } 00203 00204 return ; 00205 } |
|
Definition at line 28 of file plug_funcs.c. References AFNI_register_2D_function, JUNK_main(), lacy9_box_func(), outer9_box_func(), and PLUTO_set_sequence().
00029 { 00030 PLUGIN_interface * plint ; /* will be the output of this routine */ 00031 00032 if( ncall > 0 ) return NULL ; /* only one interface */ 00033 00034 /*---------------- set titles and call point ----------------*/ 00035 00036 plint = PLUTO_new_interface( "PlaceHolder" , "PlaceHolder" , NULL , 00037 PLUGIN_CALL_IMMEDIATELY , JUNK_main ) ; 00038 00039 PLUTO_set_sequence( plint , "A:funcs:junk" ) ; 00040 00041 AFNI_register_2D_function( "Lacy9" , lacy9_box_func ) ; 00042 AFNI_register_2D_function( "Outer9" , outer9_box_func ) ; 00043 00044 return plint ; 00045 } |
Variable Documentation
|
Definition at line 55 of file plug_funcs.c. Referenced by lacy9_box_func(), and outer9_box_func(). |
|
Definition at line 56 of file plug_funcs.c. |