Doxygen Source Code Documentation
afni_lock.c File Reference
#include "afni.h"Go to the source code of this file.
Functions | |
| void | AFNI_time_lock_change_CB (Widget w, XtPointer cd, XtPointer calld) |
| void | AFNI_time_lock_carryout (Three_D_View *im3d) |
| void | AFNI_lock_enforce_CB (Widget w, XtPointer cd, XtPointer calld) |
| void | AFNI_lock_change_CB (Widget w, XtPointer cd, XtPointer calld) |
| void | AFNI_lock_clear_CB (Widget w, XtPointer cd, XtPointer calld) |
| void | AFNI_lock_setall_CB (Widget w, XtPointer cd, XtPointer calld) |
| void | AFNI_lock_carryout (Three_D_View *im3d) |
| void | AFNI_ijk_lock_change_CB (Widget w, XtPointer cd, XtPointer calld) |
| void | AFNI_thresh_lock_carryout (Three_D_View *im3d) |
| void | AFNI_equate_pbars (Three_D_View *lh3d, Three_D_View *rh3d) |
| void | AFNI_pbar_lock_carryout (Three_D_View *im3d) |
| void | AFNI_thrdrag_lock_carryout (Three_D_View *im3d) |
| void | AFNI_range_lock_carryout (Three_D_View *im3d) |
Function Documentation
|
||||||||||||
|
Definition at line 382 of file afni_lock.c. References AFNI_controller_index(), AFNI_driver(), AV_uformat_fval(), MCW_pbar::bigflip, MCW_pbar::bigmode, MCW_pbar::bigrota, MCW_pbar::bigtop, AFNI_library_type::dc, ENTRY, AFNI_widget_set::func, GLOBAL_library, IM3D_OPEN, AFNI_function_widgets::inten_pbar, MCW_DCOV::label_ov, MCW_pbar::mode, MCW_pbar::num_panes, MCW_pbar::ov_index, MCW_DC::ovc, MCW_pbar::pval, and Three_D_View::vwid. Referenced by AFNI_pbar_lock_carryout().
00383 {
00384 MCW_pbar *lbar , *rbar ;
00385 char cmd[1024] ;
00386 int cc , qq ;
00387 MCW_DCOV *ovc = GLOBAL_library.dc->ovc ;
00388
00389 ENTRY("AFNI_equate_pbars") ;
00390
00391 if( !IM3D_OPEN(lh3d) || !IM3D_OPEN(rh3d) ) EXRETURN ;
00392
00393 lbar = lh3d->vwid->func->inten_pbar ;
00394 rbar = rh3d->vwid->func->inten_pbar ;
00395
00396 cc = AFNI_controller_index(lh3d) ; if( cc < 0 ) EXRETURN ;
00397
00398 if( !rbar->bigmode ){
00399 sprintf(cmd,"SET_PBAR_ALL %c.%c%d" , 'A'+cc ,
00400 (rbar->mode) ? '+' : '-' , rbar->num_panes ) ;
00401 for( qq=0 ; qq < rbar->num_panes ; qq++ )
00402 sprintf(cmd+strlen(cmd)," %s=%s",
00403 AV_uformat_fval(rbar->pval[qq]) ,
00404 ovc->label_ov[rbar->ov_index[qq]] ) ;
00405 } else {
00406 sprintf(cmd,"SET_PBAR_ALL %c.%c%d %f %s\n" , 'A'+cc ,
00407 (rbar->mode) ? '+' : '-' , 99 ,
00408 rbar->bigtop , PBAR_get_bigmap(rbar) ) ;
00409 if( rbar->bigflip )
00410 sprintf(cmd+strlen(cmd)," FLIP") ;
00411 if( rbar->bigrota )
00412 sprintf(cmd+strlen(cmd)," ROTA=%d",rbar->bigrota) ;
00413 }
00414
00415 AFNI_driver( cmd ) ; EXRETURN ;
00416 }
|
|
||||||||||||||||
|
Definition at line 273 of file afni_lock.c. References AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, AFNI_library_type::ijk_lock, AFNI_datamode_widgets::ijk_lock_bbox, IM3D_VALID, MAX_CONTROLLERS, MCW_set_bbox(), MCW_val_bbox(), RESET_AFNI_QUIT, and Three_D_View::vwid.
00274 {
00275 Three_D_View *im3d = (Three_D_View *) cd ;
00276 Three_D_View *qq3d ;
00277 int bval , ii , bold ;
00278
00279 ENTRY("AFNI_ijk_lock_change_CB") ;
00280
00281 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00282
00283 /* get current global setting and compare to changed lock box */
00284
00285 bold = GLOBAL_library.ijk_lock ;
00286 bval = MCW_val_bbox( im3d->vwid->dmode->ijk_lock_bbox ) ;
00287 if( bval == bold ) EXRETURN ; /* same --> nothing to do */
00288
00289 /* new value --> save in global setting */
00290
00291 GLOBAL_library.ijk_lock = bval ;
00292
00293 /* set all other controller lock boxes to the same value */
00294
00295 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00296 qq3d = GLOBAL_library.controllers[ii] ;
00297 if( qq3d == im3d || ! IM3D_VALID(qq3d) ) continue ;
00298
00299 MCW_set_bbox( qq3d->vwid->dmode->ijk_lock_bbox , bval ) ;
00300 }
00301 RESET_AFNI_QUIT(im3d) ;
00302 EXRETURN ;
00303 }
|
|
|
Definition at line 190 of file afni_lock.c. References AFNI_controller_index(), AFNI_set_viewpoint(), AFNI_transform_vector(), Three_D_View::anat_now, AFNI_library_type::controller_lock, AFNI_library_type::controllers, CURRENT_DAXES, ENTRY, GLOBAL_library, AFNI_view_info::i1, AFNI_library_type::ignore_lock, THD_ivec3::ijk, AFNI_library_type::ijk_lock, IM3D_OPEN, AFNI_view_info::j2, AFNI_view_info::k3, LOAD_ANAT_VIEW, LOAD_FVEC3, MAX_CONTROLLERS, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, REDISPLAY_ALL, SAVE_VPT, THD_3dmm_to_3dind(), THD_dicomm_to_3dmm(), Three_D_View::vinfo, AFNI_view_info::xi, AFNI_view_info::yj, and AFNI_view_info::zk. Referenced by AFNI_lock_enforce_CB(), and AFNI_set_viewpoint().
00191 {
00192 Three_D_View *qq3d ;
00193 int ii,jj,kk , cc , glock ;
00194 THD_fvec3 old_fv , fv ;
00195 THD_ivec3 iv ;
00196 THD_dataxes *qaxes , *daxes ;
00197 static int busy = 0 ; /* !=0 if this routine is "busy" */
00198
00199 ENTRY("AFNI_lock_carryout") ;
00200
00201 /* first, determine if there is anything to do */
00202
00203 glock = GLOBAL_library.controller_lock ;
00204
00205 if( busy ) EXRETURN ; /* routine already busy */
00206 if( glock == 0 ) EXRETURN ; /* nothing to do */
00207 if( !IM3D_OPEN(im3d) ) EXRETURN ; /* bad input */
00208 if( GLOBAL_library.ignore_lock ) EXRETURN ; /* ordered not to do anything */
00209
00210 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00211
00212 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00213 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00214
00215 /* something to do? */
00216
00217 busy = 1 ; /* don't let this routine be called recursively */
00218
00219 /* load Dicom location of current point of view in this controller */
00220
00221 LOAD_FVEC3( old_fv , im3d->vinfo->xi, im3d->vinfo->yj, im3d->vinfo->zk ) ;
00222
00223 LOAD_ANAT_VIEW(im3d) ; /* prepare coordinates */
00224 daxes = CURRENT_DAXES(im3d->anat_now) ;
00225
00226 /* loop through other controllers:
00227 for those that ARE open, ARE NOT the current one,
00228 and ARE locked, transform the above vector to the
00229 controller's dataset, and then jump to that point */
00230
00231 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00232
00233 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00234
00235 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00236
00237 LOAD_ANAT_VIEW(qq3d) ; /* prepare coordinates */
00238 qaxes = CURRENT_DAXES(qq3d->anat_now) ;
00239
00240 if( !GLOBAL_library.ijk_lock ){ /* xyz coord lock */
00241
00242 fv = AFNI_transform_vector( im3d->anat_now, old_fv, qq3d->anat_now ) ;
00243 fv = THD_dicomm_to_3dmm( qq3d->anat_now , fv ) ;
00244 iv = THD_3dmm_to_3dind ( qq3d->anat_now , fv ) ;
00245 ii = iv.ijk[0] ; jj = iv.ijk[1] ; kk = iv.ijk[2] ;
00246
00247 } else { /* 11 Sep 2000: ijk index lock */
00248
00249 ii = im3d->vinfo->i1 * qaxes->nxx / daxes->nxx ;
00250 jj = im3d->vinfo->j2 * qaxes->nyy / daxes->nyy ;
00251 kk = im3d->vinfo->k3 * qaxes->nzz / daxes->nzz ;
00252 }
00253
00254 /* if have good new ijk coords, jump to them */
00255
00256 if( ii >= 0 && ii < qaxes->nxx &&
00257 jj >= 0 && jj < qaxes->nyy && kk >= 0 && kk < qaxes->nzz ){
00258
00259 SAVE_VPT(qq3d) ;
00260 AFNI_set_viewpoint( qq3d , ii,jj,kk , REDISPLAY_ALL ) ; /* jump */
00261 }
00262 }
00263 }
00264
00265 busy = 0 ; /* OK, let this routine be activated again */
00266 EXRETURN ;
00267 }
|
|
||||||||||||||||
|
Definition at line 116 of file afni_lock.c. References AFNI_library_type::controller_lock, AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, IM3D_VALID, AFNI_datamode_widgets::lock_bbox, MAX_CONTROLLERS, MCW_set_bbox(), MCW_val_bbox(), RESET_AFNI_QUIT, and Three_D_View::vwid.
00117 {
00118 Three_D_View *im3d = (Three_D_View *) cd ;
00119 Three_D_View *qq3d ;
00120 int bval , ii , bold ;
00121
00122 ENTRY("AFNI_lock_change_CB") ;
00123
00124 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00125
00126 /* get current global setting and compare to changed lock box */
00127
00128 bold = GLOBAL_library.controller_lock ;
00129 bval = MCW_val_bbox( im3d->vwid->dmode->lock_bbox ) ;
00130 if( bval == bold ) EXRETURN ; /* same --> nothing to do */
00131
00132 /* new value --> save in global setting */
00133
00134 GLOBAL_library.controller_lock = bval ;
00135
00136 /* set all other controller lock boxes to the same value */
00137
00138 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00139 qq3d = GLOBAL_library.controllers[ii] ;
00140 if( qq3d == im3d || ! IM3D_VALID(qq3d) ) continue ;
00141
00142 MCW_set_bbox( qq3d->vwid->dmode->lock_bbox , bval ) ;
00143 }
00144 RESET_AFNI_QUIT(im3d) ;
00145 EXRETURN ;
00146 }
|
|
||||||||||||||||
|
Definition at line 150 of file afni_lock.c. References AFNI_library_type::controller_lock, AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, IM3D_VALID, AFNI_datamode_widgets::lock_bbox, MAX_CONTROLLERS, MCW_set_bbox(), and Three_D_View::vwid.
00151 {
00152 Three_D_View *qq3d ;
00153 int ii ;
00154
00155 ENTRY("AFNI_lock_clear_CB") ;
00156
00157 GLOBAL_library.controller_lock = 0 ;
00158 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00159 qq3d = GLOBAL_library.controllers[ii] ;
00160 if( IM3D_VALID(qq3d) )
00161 MCW_set_bbox( qq3d->vwid->dmode->lock_bbox , 0 ) ;
00162 }
00163 EXRETURN ;
00164 }
|
|
||||||||||||||||
|
Definition at line 103 of file afni_lock.c. References AFNI_lock_carryout(), AFNI_time_lock_carryout(), ENTRY, and RESET_AFNI_QUIT.
00104 {
00105 Three_D_View *im3d = (Three_D_View *) cd ;
00106
00107 ENTRY("AFNI_lock_enforce_CB") ;
00108 AFNI_lock_carryout( im3d ) ;
00109 AFNI_time_lock_carryout( im3d ) ; /* 03 Nov 1998 */
00110 RESET_AFNI_QUIT(im3d) ;
00111 EXRETURN ;
00112 }
|
|
||||||||||||||||
|
Definition at line 168 of file afni_lock.c. References AFNI_library_type::controller_lock, AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, IM3D_VALID, AFNI_datamode_widgets::lock_bbox, MAX_CONTROLLERS, MCW_set_bbox(), and Three_D_View::vwid.
00169 {
00170 Three_D_View *qq3d ;
00171 int ii ;
00172
00173 ENTRY("AFNI_lock_setall_CB") ;
00174
00175 GLOBAL_library.controller_lock = 0 ;
00176 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ )
00177 GLOBAL_library.controller_lock |= (1<<ii) ;
00178
00179 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00180 qq3d = GLOBAL_library.controllers[ii] ;
00181 if( IM3D_VALID(qq3d) )
00182 MCW_set_bbox( qq3d->vwid->dmode->lock_bbox ,
00183 GLOBAL_library.controller_lock ) ;
00184 }
00185 EXRETURN ;
00186 }
|
|
|
Definition at line 420 of file afni_lock.c. References AFNI_controller_index(), AFNI_equate_pbars(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, ENTRY, getenv(), GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, and MAX_CONTROLLERS. Referenced by AFNI_inten_pbar_CB().
00421 {
00422 Three_D_View *qq3d ;
00423 static int busy = 0 ; /* !=0 if this routine is "busy" */
00424 int glock , cc,ii ;
00425 char *eee ;
00426
00427 ENTRY("AFNI_pbar_lock_carryout") ;
00428
00429 /* first, determine if there is anything to do */
00430
00431 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00432
00433 if( busy ) EXRETURN; /* routine already busy */
00434 if( glock == 0 ) EXRETURN; /* nothing to do */
00435 if( !IM3D_OPEN(im3d) ) EXRETURN; /* bad input */
00436 if( GLOBAL_library.ignore_lock ) EXRETURN; /* ordered not to do anything */
00437
00438 eee = getenv( "AFNI_PBAR_LOCK" ) ; /* determine how to lock */
00439 if( eee == NULL ) EXRETURN ;
00440 if( *eee != 'Y' && *eee != 'y' ) EXRETURN ;
00441
00442 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00443
00444 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00445 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00446
00447 /* something to do? */
00448
00449 busy = 1 ; /* don't let this routine be called recursively */
00450
00451 /* loop through other controllers:
00452 for those that ARE open, ARE NOT the current one, and ARE locked */
00453
00454 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00455
00456 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00457
00458 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00459
00460 AFNI_equate_pbars( qq3d , im3d ) ;
00461 }
00462 }
00463
00464 busy = 0 ; /* OK, let this routine be activated again */
00465 EXRETURN ;
00466 }
|
|
|
Definition at line 555 of file afni_lock.c. References AFNI_controller_index(), AFNI_driver(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, ENTRY, AFNI_view_info::fim_range, AFNI_widget_set::func, getenv(), GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, MAX_CONTROLLERS, MCW_val_bbox(), AFNI_function_widgets::range_bbox, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_range_bbox_CB().
00556 {
00557 Three_D_View *qq3d ;
00558 static int busy = 0 ; /* !=0 if this routine is "busy" */
00559 int glock , cc,ii,nn ;
00560 float val ;
00561 char cmd[64] , *eee ;
00562
00563 ENTRY("AFNI_range_lock_carryout") ;
00564
00565 /* first, determine if there is anything to do */
00566
00567 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00568
00569 if( busy ) EXRETURN; /* routine already busy */
00570 if( glock == 0 ) EXRETURN; /* nothing to do */
00571 if( !IM3D_OPEN(im3d) ) EXRETURN; /* bad input */
00572 if( GLOBAL_library.ignore_lock ) EXRETURN; /* ordered not to do anything */
00573
00574 eee = getenv( "AFNI_RANGE_LOCK" ); /* determine how to lock */
00575 if( eee == NULL ) EXRETURN;
00576 if( *eee != 'Y' && *eee != 'y' ) EXRETURN;
00577
00578 ii = AFNI_controller_index(im3d); /* which one am I? */
00579
00580 if( ii < 0 ) EXRETURN; /* nobody? bad input! */
00581 if( ((1<<ii) & glock) == 0 ) EXRETURN; /* input not locked */
00582
00583 /* get range of this controller */
00584
00585 val = im3d->vinfo->fim_range ;
00586 if( val <= 0.0 ) EXRETURN; /* shouldn't happen */
00587
00588 /* count how OTHER controllers are are open and locked;
00589 if none of them, there is nothing to do [29 Apr 2005] */
00590
00591 for( nn=cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00592 qq3d = GLOBAL_library.controllers[cc] ;
00593 if( qq3d != im3d && IM3D_OPEN(qq3d) && ((1<<cc) & glock) != 0 ) nn++ ;
00594 }
00595 if( nn < 1 ) EXRETURN ;
00596
00597 /* something to do? */
00598
00599 busy = 1 ; /* don't let this routine be called recursively */
00600
00601 /* loop through other controllers:
00602 for those that ARE open, and ARE locked, set the new range */
00603
00604 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00605
00606 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00607
00608 if( IM3D_OPEN(qq3d) && ((1<<cc) & glock) != 0 ){ /* open and locked */
00609
00610 if( qq3d == im3d && /* no need to set current if not autoRanged */
00611 MCW_val_bbox(im3d->vwid->func->range_bbox) == 0 ) continue;
00612
00613 sprintf( cmd , "SET_FUNC_RANGE %c.%.6f" , 'A'+cc , val ) ;
00614 AFNI_driver( cmd ) ;
00615 }
00616 }
00617
00618 busy = 0 ; /* OK, let this routine be activated again */
00619 EXRETURN ;
00620 }
|
|
|
Definition at line 470 of file afni_lock.c. References AFNI_controller_index(), AFNI_set_thr_pval(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, DSET_BRICK_STATAUX, DSET_BRICK_STATCODE, ENTRY, Three_D_View::fim_now, AFNI_widget_set::func, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, getenv(), GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, MAX_CONTROLLERS, THD_pval_to_stat(), THD_stat_to_pval(), THR_FACTOR, AFNI_view_info::thr_index, AFNI_function_widgets::thr_scale, THR_TOP_EXPON, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_thr_scale_drag_CB().
00471 {
00472 Three_D_View *qq3d ;
00473 static int busy = 0 ; /* !=0 if this routine is "busy" */
00474 int glock , cc,ii , dothresh,dopval , ival , stop ;
00475 float thresh , pval , tval ;
00476 char *eee ;
00477
00478 ENTRY("AFNI_thrdrag_lock_carryout") ;
00479
00480 /* first, determine if there is anything to do */
00481
00482 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00483
00484 if( busy ) EXRETURN; /* routine already busy */
00485 if( glock == 0 ) EXRETURN; /* nothing to do */
00486 if( !IM3D_OPEN(im3d) ) EXRETURN; /* bad input */
00487 if( GLOBAL_library.ignore_lock ) EXRETURN; /* ordered not to do anything */
00488
00489 eee = getenv( "AFNI_THRESH_LOCK" ) ; /* determine how to lock */
00490 if( eee == NULL ) EXRETURN ;
00491 dothresh = (*eee == 'V' || *eee == 'v') ;
00492 dopval = (*eee == 'P' || *eee == 'p') && im3d->fim_now != NULL ;
00493 if( !dothresh && !dopval ) EXRETURN ; /* no command? */
00494
00495 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00496
00497 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00498 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00499
00500 /* something to do? */
00501
00502 busy = 1 ; /* don't let this routine be called recursively */
00503
00504 ival = rint(im3d->vinfo->func_threshold/THR_FACTOR) ;
00505 thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ;
00506 stop = (int)( rint( pow(10.0,THR_TOP_EXPON) ) - 1.0 ) ;
00507
00508 if( dopval ){
00509 pval = THD_stat_to_pval( thresh ,
00510 DSET_BRICK_STATCODE(im3d->fim_now,im3d->vinfo->thr_index) ,
00511 DSET_BRICK_STATAUX (im3d->fim_now,im3d->vinfo->thr_index) ) ;
00512 if( pval < 0.0 || pval > 1.0 ){ dopval = 0; dothresh = 1; }
00513 }
00514
00515 /* loop through other controllers:
00516 for those that ARE open, ARE NOT the current
00517 one, and ARE locked, set the new threshold */
00518
00519 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00520
00521 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00522
00523 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00524
00525 if( qq3d->vinfo->func_thresh_top == im3d->vinfo->func_thresh_top ){
00526
00527 if( dopval && qq3d->fim_now != NULL &&
00528 DSET_BRICK_STATCODE(qq3d->fim_now,qq3d->vinfo->thr_index) > 0 ){
00529
00530 tval = THD_pval_to_stat( pval ,
00531 DSET_BRICK_STATCODE(qq3d->fim_now,qq3d->vinfo->thr_index),
00532 DSET_BRICK_STATAUX (qq3d->fim_now,qq3d->vinfo->thr_index) );
00533 ival = rint( tval/(THR_FACTOR*qq3d->vinfo->func_thresh_top) ) ;
00534 if( ival < 0 ) ival = 0 ; else if( ival > stop ) ival = stop ;
00535
00536 } else if( !dothresh ){
00537 continue ; /* skip this [dopval set, but not a statistic] */
00538 }
00539
00540 /* set the slider and pval marker */
00541
00542 XmScaleSetValue( qq3d->vwid->func->thr_scale , ival ) ;
00543 qq3d->vinfo->func_threshold = THR_FACTOR * ival ;
00544 AFNI_set_thr_pval( qq3d ) ;
00545 }
00546 }
00547 }
00548
00549 busy = 0 ; /* OK, let this routine be activated again */
00550 EXRETURN ;
00551 }
|
|
|
Definition at line 307 of file afni_lock.c. References AFNI_controller_index(), AFNI_driver(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, DSET_BRICK_STATAUX, DSET_BRICK_STATCODE, ENTRY, Three_D_View::fim_now, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, getenv(), GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, MAX_CONTROLLERS, THD_stat_to_pval(), AFNI_view_info::thr_index, and Three_D_View::vinfo. Referenced by AFNI_thr_scale_CB(), and AFNI_thresh_top_CB().
00308 {
00309 Three_D_View *qq3d ;
00310 static int busy = 0 ; /* !=0 if this routine is "busy" */
00311 int glock , cc,ii , dopval,dothresh ;
00312 float thresh , pval , tval ;
00313 char cmd[64] , *eee ;
00314
00315 ENTRY("AFNI_thresh_lock_carryout") ;
00316
00317 /* first, determine if there is anything to do */
00318
00319 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00320
00321 if( busy ) EXRETURN; /* routine already busy */
00322 if( glock == 0 ) EXRETURN; /* nothing to do */
00323 if( !IM3D_OPEN(im3d) ) EXRETURN; /* bad input */
00324 if( GLOBAL_library.ignore_lock ) EXRETURN; /* ordered not to do anything */
00325
00326 eee = getenv( "AFNI_THRESH_LOCK" ) ; /* determine how to lock */
00327 if( eee == NULL ) EXRETURN ;
00328 dothresh = (*eee == 'V' || *eee == 'v') ;
00329 dopval = (*eee == 'P' || *eee == 'p') && im3d->fim_now != NULL ;
00330 if( !dothresh && !dopval ) EXRETURN ; /* no command? */
00331
00332 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00333
00334 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00335 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00336
00337 /* something to do? */
00338
00339 busy = 1 ; /* don't let this routine be called recursively */
00340
00341 /* get true threshold of this controller => all others get this value, too*/
00342
00343 thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ;
00344
00345 /* get p-value corresponding, if that is what's being locked */
00346
00347 if( dopval ){
00348 pval = THD_stat_to_pval( thresh ,
00349 DSET_BRICK_STATCODE(im3d->fim_now,im3d->vinfo->thr_index) ,
00350 DSET_BRICK_STATAUX (im3d->fim_now,im3d->vinfo->thr_index) ) ;
00351 if( pval < 0.0 || pval > 1.0 ){ dopval = 0; dothresh = 1; }
00352 }
00353
00354 /* loop through other controllers:
00355 for those that ARE open, ARE NOT the current
00356 one, and ARE locked, set the new threshold */
00357
00358 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00359
00360 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00361
00362 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00363
00364 if( dothresh )
00365 sprintf( cmd , "SET_THRESHNEW %c %.4f **" , 'A'+cc , thresh ) ;
00366 else if( dopval && qq3d->fim_now != NULL &&
00367 DSET_BRICK_STATCODE(qq3d->fim_now,qq3d->vinfo->thr_index) > 0 )
00368 sprintf( cmd , "SET_THRESHNEW %c %g *p" , 'A'+cc , pval ) ;
00369 else
00370 continue ; /* pval, but not a statistic? */
00371
00372 AFNI_driver( cmd ) ;
00373 }
00374 }
00375
00376 busy = 0 ; /* OK, let this routine be activated again */
00377 EXRETURN ;
00378 }
|
|
|
Definition at line 41 of file afni_lock.c. References AFNI_controller_index(), AFNI_time_index_CB(), AV_assign_ival(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, ENTRY, GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, AFNI_widget_set::imag, MCW_arrowval::ival, MAX_CONTROLLERS, AFNI_view_info::time_index, AFNI_imaging_widgets::time_index_av, AFNI_library_type::time_lock, AFNI_view_info::time_on, AFNI_view_info::top_index, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_lock_enforce_CB(), and AFNI_time_index_CB().
00042 {
00043 Three_D_View *qq3d ;
00044 MCW_arrowval *tav ;
00045 int new_index , qq_index , qq_top , cc , glock , ii ;
00046 static int busy = 0 ; /* !=0 if this routine is "busy" */
00047
00048 ENTRY("AFNI_time_lock_carryout") ;
00049
00050 /* first, determine if there is anything to do */
00051
00052 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00053
00054 if( busy ) EXRETURN ; /* routine already busy */
00055 if( glock == 0 ) EXRETURN ; /* nothing to do */
00056 if( !IM3D_OPEN(im3d) ) EXRETURN ; /* bad input */
00057 if( GLOBAL_library.ignore_lock ) EXRETURN ; /* ordered not to do anything */
00058 if( ! GLOBAL_library.time_lock ) EXRETURN ; /* don't lock time */
00059
00060 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00061
00062 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00063 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00064
00065 /* something to do? */
00066
00067 busy = 1 ; /* don't let this routine be called recursively */
00068
00069 /* load time index of this controller => all others get this value, too*/
00070
00071 new_index = im3d->vinfo->time_index ;
00072
00073 /* loop through other controllers:
00074 for those that ARE open, ARE NOT the current
00075 one, and ARE locked, jump to the new time index */
00076
00077 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00078
00079 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00080
00081 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00082
00083 qq_index = qq3d->vinfo->time_index ; /* old index */
00084 qq_top = qq3d->vinfo->top_index ; /* max allowed */
00085
00086 if( qq3d->vinfo->time_on && qq_top > 1 && qq_index != new_index ){
00087 tav = qq3d->vwid->imag->time_index_av ;
00088 AV_assign_ival( tav , new_index ) ; /* will check range */
00089 if( tav->ival != qq_index )
00090 AFNI_time_index_CB( tav , (XtPointer) qq3d ) ;
00091 }
00092 }
00093 }
00094
00095 busy = 0 ; /* OK, let this routine be activated again */
00096 EXRETURN ;
00097 }
|
|
||||||||||||||||
|
Definition at line 7 of file afni_lock.c. References AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, IM3D_VALID, MAX_CONTROLLERS, MCW_set_bbox(), MCW_val_bbox(), RESET_AFNI_QUIT, AFNI_library_type::time_lock, AFNI_datamode_widgets::time_lock_bbox, and Three_D_View::vwid.
00008 {
00009 Three_D_View *im3d = (Three_D_View *) cd ;
00010 Three_D_View *qq3d ;
00011 int bval , ii , bold ;
00012
00013 ENTRY("AFNI_time_lock_change_CB") ;
00014
00015 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00016
00017 /* get current global setting and compare to changed lock box */
00018
00019 bold = GLOBAL_library.time_lock ;
00020 bval = MCW_val_bbox( im3d->vwid->dmode->time_lock_bbox ) ;
00021 if( bval == bold ) EXRETURN ; /* same --> nothing to do */
00022
00023 /* new value --> save in global setting */
00024
00025 GLOBAL_library.time_lock = bval ;
00026
00027 /* set all other controller lock boxes to the same value */
00028
00029 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00030 qq3d = GLOBAL_library.controllers[ii] ;
00031 if( qq3d == im3d || ! IM3D_VALID(qq3d) ) continue ;
00032
00033 MCW_set_bbox( qq3d->vwid->dmode->time_lock_bbox , bval ) ;
00034 }
00035 RESET_AFNI_QUIT(im3d) ;
00036 EXRETURN ;
00037 }
|