Doxygen Source Code Documentation
kpart.c File Reference
#include "coxplot.h"Go to the source code of this file.
Data Structures | |
| struct | kpart |
Defines | |
| #define | INCKP 16 |
| #define | NEWKP(kp) |
| #define | ATLEAST(kp, n) |
| #define | LONG_TYPE 1 |
| #define | TRAN_TYPE 2 |
| #define | ILLEGAL_TYPE -666 |
| #define | DEL 0.001 |
| #define | FEQ(a, b) (fabs((a)-(b)) < DEL) |
Functions | |
| void | collapse_illegals (kpart *kp) |
| void | collapse_xy (kpart *kp) |
| void | move (kpart *kp, float dx, float dy) |
| void | flip (kpart *kp) |
| void | flip90 (kpart *kp) |
| void | flip180 (kpart *kp) |
| void | crush (kpart *kp) |
Define Documentation
|
|
Value: do{ if( (kp)->nall < (n) ){ \ int nn = (n)+INCKP ; \ (kp)->typ = realloc( (kp)->typ , sizeof(int) *nn ) ; \ (kp)->x = realloc( (kp)->x , sizeof(float)*nn ) ; \ (kp)->y = realloc( (kp)->y , sizeof(float)*nn ) ; \ (kp)->nall= (nn) ; \ } } while(0) |
|
|
|
|
|
Definition at line 47 of file kpart.c. Referenced by collapse_xy(). |
|
|
Definition at line 44 of file kpart.c. Referenced by collapse_xy(), and crush(). |
|
|
|
|
|
|
|
|
Value: |
|
|
Definition at line 43 of file kpart.c. Referenced by crush(), flip(), flip180(), flip90(), and move(). |
Function Documentation
|
|
Definition at line 61 of file kpart.c. References kpart::npart, kpart::typ, kpart::x, and kpart::y. Referenced by collapse_xy().
00062 {
00063 int ii , jj , jtop ;
00064
00065 if( kp == NULL ) return ;
00066
00067 /* find uppermost legal entry */
00068
00069 for( jj=kp->npart-1 ; jj >= 0 ; jj-- )
00070 if( kp->typ[jj] >= 0 ) break ;
00071
00072 if( jj < 0 ){ kp->npart = 0; return; }
00073 if( jj == 0 ){ kp->npart = 1; return; }
00074
00075 jtop = jj ;
00076
00077 /* for each entry below this, see if it is legal */
00078
00079 for( jj=0 ; jj < jtop ; ){
00080
00081 if( kp->typ[jj] < 0 ){ /* illegal entry at jj */
00082 for( ii=jj+1 ; ii <= jtop ; ii++ ){ /* => move all those */
00083 kp->typ[ii-1] = kp->typ[ii] ; /* above jj down by 1 */
00084 kp->x[ii-1] = kp->x[ii] ;
00085 kp->y[ii-1] = kp->y[ii] ;
00086 }
00087 jtop-- ; /* top index is reduced */
00088 } else {
00089 jj++ ; /* go to next entry jj */
00090 }
00091 }
00092
00093 return ;
00094 }
|
|
|
Definition at line 98 of file kpart.c. References collapse_illegals(), FEQ, ILLEGAL_TYPE, kpart::npart, kpart::typ, kpart::x, and kpart::y. Referenced by crush(), flip(), flip180(), and flip90().
00099 {
00100 int ii , jj ;
00101
00102 if( kp == NULL || kp->npart < 2 ) return ;
00103
00104 /* find all partitions that are at the same place */
00105
00106 for( jj=1 ; jj < kp->npart ; jj++ ){
00107 if( kp->typ[jj] < 0 ) continue ; /* skip illegals */
00108
00109 for( ii=0 ; ii < jj ; ii++ ){ /* check all entries below jj */
00110
00111 if( kp->typ[ii] >= 0 && /* if legal */
00112 FEQ(kp->x[ii],kp->x[jj]) && /* and at same place */
00113 FEQ(kp->y[ii],kp->y[jj]) ){
00114
00115 kp->typ[jj] = ILLEGAL_TYPE ; /* mark for demolition */
00116 break ;
00117 }
00118 }
00119 }
00120
00121 collapse_illegals( kp ) ; /* demolition */
00122 return ;
00123 }
|
|
|
Definition at line 256 of file kpart.c. References collapse_xy(), ILLEGAL_TYPE, kpart::npart, TRAN_TYPE, and kpart::typ.
00257 {
00258 int ii , itop ;
00259
00260 if( kp == NULL || kp->npart == 0 ) return ;
00261
00262 itop = kp->npart ;
00263 for( ii=0 ; ii < itop ; kp++ ){
00264 if( kp->typ[ii] == TRAN_TYPE ){ /* transverse is killed */
00265 kp->typ[ii] = ILLEGAL_TYPE ;
00266 }
00267 }
00268
00269 collapse_xy(kp) ;
00270 return ;
00271 }
|
|
|
Definition at line 144 of file kpart.c. References ATLEAST, collapse_xy(), LONG_TYPE, kpart::npart, TRAN_TYPE, kpart::typ, kpart::x, and kpart::y. Referenced by AFNI_drive_set_pbar_all(), ISQ_snapsave(), qh_gausselim(), qh_makenew_simplicial(), qh_makeridges(), SUMA_dPoint_At_Distance(), SUMA_OrientTriangles(), SUMA_Point_At_Distance(), THD_load_1D(), and THD_open_1D().
00145 {
00146 int ii , itop , jj ;
00147
00148 if( kp == NULL || kp->npart == 0 ) return ;
00149
00150 itop = kp->npart ;
00151 for( ii=0 ; ii < itop ; kp++ ){
00152
00153 jj = kp->npart ;
00154
00155 switch( kp->typ[ii] ){
00156
00157 case TRAN_TYPE:{ /* transverse magnetization */
00158 ATLEAST(kp,jj+4) ; /* component breaks into 4 */
00159 /* pieces: 1 at same place, */
00160 kp->typ[jj] = TRAN_TYPE ; /* 1 new transverse */
00161 kp->x[jj] = - kp->x[ii] ; /* and 2 new longitudinal */
00162 kp->y[jj] = - kp->y[ii] ;
00163
00164 kp->typ[jj+1] = LONG_TYPE ;
00165 kp->x[jj+1] = kp->x[ii] ;
00166 kp->y[jj+1] = kp->y[ii] ;
00167
00168 kp->typ[jj+2] = LONG_TYPE ;
00169 kp->x[jj+2] = - kp->x[ii] ;
00170 kp->y[jj+2] = - kp->y[ii] ;
00171 }
00172 break ;
00173
00174 case LONG_TYPE:{ /* longitudinal magnetization */
00175 ATLEAST(kp,jj+1) ; /* breaks into 2 pieces: */
00176 /* 1 at same place */
00177 kp->typ[jj] = LONG_TYPE ; /* 1 new transverse */
00178 kp->x[jj] = kp->x[ii] ;
00179 kp->y[jj] = kp->y[ii] ;
00180 }
00181 break ;
00182
00183 }
00184 }
00185
00186 collapse_xy(kp) ;
00187 return ;
00188 }
|
|
|
Definition at line 236 of file kpart.c. References collapse_xy(), kpart::npart, TRAN_TYPE, kpart::typ, kpart::x, and kpart::y.
00237 {
00238 int ii , itop ;
00239
00240 if( kp == NULL || kp->npart == 0 ) return ;
00241
00242 itop = kp->npart ;
00243 for( ii=0 ; ii < itop ; kp++ ){
00244 if( kp->typ[ii] == TRAN_TYPE ){ /* transverse flips over */
00245 kp->x[ii] = - kp->x[ii] ;
00246 kp->y[ii] = - kp->y[ii] ;
00247 }
00248 }
00249
00250 collapse_xy(kp) ;
00251 return ;
00252 }
|
|
|
Definition at line 192 of file kpart.c. References ATLEAST, collapse_xy(), LONG_TYPE, kpart::npart, TRAN_TYPE, kpart::typ, kpart::x, and kpart::y.
00193 {
00194 int ii , itop , jj ;
00195
00196 if( kp == NULL || kp->npart == 0 ) return ;
00197
00198 itop = kp->npart ;
00199 for( ii=0 ; ii < itop ; kp++ ){
00200
00201 jj = kp->npart ;
00202
00203 switch( kp->typ[ii] ){
00204
00205 case TRAN_TYPE:{ /* rules for transverse are */
00206 ATLEAST(kp,jj+4) ; /* same as previous case */
00207
00208 kp->typ[jj] = LONG_TYPE ;
00209 kp->x[jj] = - kp->x[ii] ;
00210 kp->y[jj] = - kp->y[ii] ;
00211
00212 kp->typ[jj+1] = TRAN_TYPE ;
00213 kp->x[jj+1] = kp->x[ii] ;
00214 kp->y[jj+1] = kp->y[ii] ;
00215
00216 kp->typ[jj+2] = TRAN_TYPE ;
00217 kp->x[jj+2] = - kp->x[ii] ;
00218 kp->y[jj+2] = - kp->y[ii] ;
00219 }
00220 break ;
00221
00222 case LONG_TYPE:{ /* longitudinal is just */
00223 kp->typ[ii] = LONG_TYPE ; /* converted to pure transverse */
00224 }
00225 break ;
00226
00227 }
00228 }
00229
00230 collapse_xy(kp) ;
00231 return ;
00232 }
|
|
||||||||||||||||
|
Definition at line 127 of file kpart.c. References kpart::npart, TRAN_TYPE, kpart::typ, kpart::x, and kpart::y. Referenced by create_image_data(), put_background_in_screen(), and put_image_in_screen().
|