Doxygen Source Code Documentation
afni_func.c File Reference
#include "afni.h"
#include "afni_plugout.h"
#include "license.h"
#include "readme_env.h"
Go to the source code of this file.
Defines | |
#define | ZREJ(val) (reject_zero && (val)==0) |
#define | USE_TITLE2(ds) |
#define | STRLIST_SIZE (THD_MAX_PREFIX+64) |
#define | FINDAFUNC |
#define | PICTURIZE(px) |
#define | UNPICTURIZE PICTURIZE(XmUNSPECIFIED_PIXMAP) |
#define | ISIZE 1024 |
#define | NSKIT 50 |
Functions | |
void | AFNI_see_func_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_thr_scale_CB (Widget w, XtPointer client_data, XtPointer call_data) |
void | AFNI_thr_scale_drag_CB (Widget w, XtPointer client_data, XtPointer call_data) |
void | AFNI_set_thresh_top (Three_D_View *im3d, float tval) |
char * | AFNI_thresh_tlabel_CB (MCW_arrowval *av, XtPointer junk) |
void | AFNI_thresh_top_CB (MCW_arrowval *av, XtPointer cd) |
void | AFNI_set_thr_pval (Three_D_View *im3d) |
void | AFNI_hintize_pbar (MCW_pbar *pbar, float fac) |
void | AFNI_inten_pbar_CB (MCW_pbar *pbar, XtPointer cd, int reason) |
void | AFNI_range_rotate_av_CB (MCW_arrowval *av, XtPointer cd) |
void | AFNI_setup_inten_pbar (Three_D_View *im3d) |
void | AFNI_inten_av_CB (MCW_arrowval *av, XtPointer cd) |
char * | AFNI_inten_av_texter (MCW_arrowval *av, XtPointer cd) |
THD_3dim_dataset * | AFNI_follower_dataset (THD_3dim_dataset *anat_parent, THD_3dim_dataset *data_parent) |
void | AFNI_make_descendants_old (THD_sessionlist *, int) |
void | AFNI_make_descendants (THD_sessionlist *ssl) |
void | AFNI_force_adoption (THD_session *ss, Boolean do_anats) |
void | mri_edgize (MRI_IMAGE *im) |
MRI_IMAGE * | AFNI_func_overlay (int n, FD_brick *br_fim) |
MRI_IMAGE * | AFNI_newfunc_overlay (MRI_IMAGE *im_thr, float thresh, MRI_IMAGE *im_fim, float fimbot, float fimtop, rgbyte *fimcolor) |
MRI_IMAGE * | AFNI_ttatlas_overlay (Three_D_View *im3d, int n, int ax_1, int ax_2, int ax_3, MRI_IMAGE *fov) |
char * | AFNI_resam_texter (MCW_arrowval *av, XtPointer junk) |
void | AFNI_resam_av_CB (MCW_arrowval *av, XtPointer cd) |
void | AFNI_underlay_CB (Widget w, XtPointer cd, XtPointer cb) |
char * | AFNI_controller_label (Three_D_View *im3d) |
void | AFNI_set_window_titles (Three_D_View *im3d) |
int | DSET_in_global_session (THD_3dim_dataset *dset) |
void | AFNI_choose_dataset_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_finalize_dataset_CB (Widget wcall, XtPointer cd, MCW_choose_cbs *cbs) |
void | AFNI_close_file_dialog_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_make_file_dialog (Three_D_View *im3d) |
void | AFNI_read_sess_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_append_sessions (THD_session *ssa, THD_session *ssb) |
void | AFNI_finalize_read_sess_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_read_1D_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_finalize_read_1D_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_read_Web_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_finalize_read_Web_CB (Widget w, XtPointer cd, MCW_choose_cbs *cbs) |
void | AFNI_rescan_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_rescan_all_CB (Widget w, XtPointer cd, XtPointer cb) |
int | AFNI_rescan_session_OLD (int sss) |
int | AFNI_rescan_session_NEW (int sss) |
int | AFNI_rescan_session (int sss) |
void | AFNI_rescan_timeseries_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_anatmode_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_funcmode_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_modify_viewing (Three_D_View *im3d, Boolean rescaled) |
void | AFNI_write_many_dataset_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_do_many_writes (Widget wpar, XtPointer cd, MCW_choose_cbs *cbs) |
void | AFNI_write_dataset_CB (Widget w, XtPointer cd, XtPointer cb) |
Boolean | AFNI_refashion_dataset (Three_D_View *im3d, THD_3dim_dataset *dset, THD_dataxes *daxes, int resam_mode) |
void | AFNI_mark_for_death (THD_sessionlist *ssl) |
void | AFNI_andersonville (THD_sessionlist *ssl, Boolean kill_files) |
void | AFNI_imseq_clearstat (Three_D_View *im3d) |
XmString | AFNI_range_label (Three_D_View *im3d) |
XmString | AFNI_autorange_label (Three_D_View *im3d) |
void | AFNI_range_bbox_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_range_av_CB (MCW_arrowval *av, XtPointer cd) |
void | AFNI_inten_bbox_CB (Widget w, XtPointer cd, XtPointer cb) |
void | AFNI_reset_func_range (Three_D_View *im3d) |
void | AFNI_bucket_CB (MCW_arrowval *av, XtPointer cd) |
char * | AFNI_bucket_label_CB (MCW_arrowval *av, XtPointer cd) |
void | AFNI_misc_CB (Widget w, XtPointer cd, XtPointer cbd) |
void | RWCOX_popper (void) |
void | SKIT_popper (Three_D_View *) |
void | AFNI_find_poem_files (void) |
void | AFNI_hidden_CB (Widget w, XtPointer cd, XtPointer cbs) |
void | AFNI_hidden_EV (Widget w, XtPointer cd, XEvent *ev, Boolean *continue_to_dispatch) |
Variables | |
char * | dset_choice [] = { "Session" , "Underlay" , "Overlay" } |
int | num_poem = 0 |
char ** | fname_poem = NULL |
char * | skit [NSKIT][3] |
char | skstr [512] |
Define Documentation
|
|
|
|
|
Definition at line 8454 of file afni_func.c. |
|
Value: ( XtVaSetValues( im3d->vwid->picture, XmNlabelInsensitivePixmap,px, NULL ) , \ MCW_expose_widget( im3d->vwid->picture ) ) Definition at line 3905 of file afni_func.c. Referenced by AFNI_refashion_dataset(). |
|
max size of strings in the list * Definition at line 1936 of file afni_func.c. Referenced by AFNI_choose_dataset_CB(). |
|
Definition at line 3909 of file afni_func.c. Referenced by AFNI_refashion_dataset(). |
|
Value: ( ISVALID_DSET(ds) && \ AFNI_yesenv("AFNI_TITLE_LABEL2") && \ *((ds)->label2) != '\0' && \ strcmp( (ds)->label2 , "zyxt" ) != 0 ) Definition at line 1842 of file afni_func.c. Referenced by AFNI_set_window_titles(). |
|
Definition at line 926 of file afni_func.c. Referenced by AFNI_func_overlay(), and AFNI_newfunc_overlay(). |
Function Documentation
|
check to see which ones are in the old list * Definition at line 3408 of file afni_func.c. References AFNI_modify_viewing(), AFNI_datamode_widgets::anatmode_bbox, AFNI_widget_set::dmode, DMODE_BRICK_BVAL, ENTRY, AFNI_view_info::force_anat_wod, IM3D_VALID, MCW_val_bbox(), RESET_AFNI_QUIT, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, AFNI_view_info::tempflag, Three_D_View::vinfo, and Three_D_View::vwid.
03409 { 03410 Three_D_View *im3d = (Three_D_View *) cd ; 03411 int old_val , new_val ; 03412 THD_fvec3 fv ; 03413 THD_ivec3 iv ; 03414 03415 ENTRY("AFNI_anatmode_CB") ; 03416 03417 if( ! IM3D_VALID(im3d) ) EXRETURN ; 03418 03419 old_val = 1 << im3d->vinfo->force_anat_wod ; 03420 new_val = MCW_val_bbox( im3d->vwid->dmode->anatmode_bbox ) ; 03421 03422 if(PRINT_TRACING){ 03423 char str[256] ; sprintf(str,"old_val=%d new_val=%d",old_val,new_val) ; 03424 STATUS(str) ; } 03425 03426 if( new_val != old_val ){ 03427 im3d->vinfo->force_anat_wod = (new_val != DMODE_BRICK_BVAL) ; 03428 SHOW_AFNI_PAUSE ; 03429 im3d->vinfo->tempflag = 1 ; /* 15 Mar 2000 */ 03430 AFNI_modify_viewing( im3d , True ) ; /* redisplay */ 03431 SHOW_AFNI_READY ; 03432 } 03433 03434 RESET_AFNI_QUIT(im3d) ; 03435 EXRETURN ; 03436 } |
|
Definition at line 4253 of file afni_func.c. References THD_3dim_dataset::death_mark, DOOMED, THD_session::dsset, ENTRY, FIRST_VIEW_TYPE, GLOBAL_library, ISVALID_3DIM_DATASET, ISVALID_SESSION, ISVALID_SESSIONLIST, LAST_VIEW_TYPE, myXtFree, THD_session::num_dsset, THD_sessionlist::num_sess, AFNI_library_type::session, THD_sessionlist::ssar, STATUS, THD_delete_3dim_dataset(), and VIEW_ORIGINAL_TYPE. Referenced by AFNI_marks_transform_CB(), and AFNI_rescan_session_OLD().
04254 { 04255 int iss , jdd , kvv , num_killed=0 ; 04256 THD_session *ss ; 04257 THD_3dim_dataset *dset ; 04258 Boolean kill_me ; 04259 04260 ENTRY("AFNI_andersonville") ; 04261 04262 if( ! ISVALID_SESSIONLIST(ssl) ) EXRETURN ; 04263 04264 /* loop over each session */ 04265 04266 for( iss=0 ; iss < ssl->num_sess ; iss++ ){ 04267 ss = ssl->ssar[iss] ; 04268 if( !ISVALID_SESSION(ss) ) continue ; /* no good ==> skip */ 04269 04270 if( ss == GLOBAL_library.session ) continue ; /* 21 Dec 2001 */ 04271 04272 /* loop over datasets in this session */ 04273 04274 for( jdd=0 ; jdd < ss->num_dsset ; jdd++ ){ 04275 for( kvv=FIRST_VIEW_TYPE ; kvv <= LAST_VIEW_TYPE ; kvv++ ){ 04276 04277 dset = ss->dsset[jdd][kvv] ; 04278 04279 if( ISVALID_3DIM_DATASET(dset) && /* good dset */ 04280 dset->death_mark == DOOMED ){ /* alas, poor Yorick */ 04281 04282 kill_me = (kvv == VIEW_ORIGINAL_TYPE) ? False : kill_files ; 04283 THD_delete_3dim_dataset( dset , kill_me ) ; 04284 myXtFree( dset ) ; 04285 ss->dsset[jdd][kvv] = NULL ; num_killed ++ ; 04286 } 04287 } 04288 } 04289 04290 } /* end of loop over sessions */ 04291 04292 #ifdef AFNI_DEBUG 04293 { char str[256] ; 04294 sprintf(str,"total # datasets killed = %d",num_killed) ; 04295 STATUS(str) ; } 04296 #endif 04297 04298 EXRETURN ; 04299 } |
|
Append datasets in THD_session ssb to those in ssa.
Definition at line 2491 of file afni_func.c. References THD_session::dsset, ENTRY, ISVALID_SESSION, LAST_VIEW_TYPE, THD_session::num_dsset, qs, THD_session::sessname, THD_equiv_files(), and THD_MAX_SESSION_SIZE. Referenced by AFNI_finalize_read_sess_CB(), AFNI_read_inputs(), and AFNI_rescan_session_OLD().
02492 { 02493 int qs, qd, vv ; 02494 02495 ENTRY("AFNI_append_sessions") ; 02496 02497 if( !ISVALID_SESSION(ssa) || !ISVALID_SESSION(ssb) ) EXRETURN ; 02498 if( THD_equiv_files(ssa->sessname,ssb->sessname) ) EXRETURN ; 02499 02500 qs = ssa->num_dsset ; 02501 for( qd=0; qd < ssb->num_dsset && qd+qs < THD_MAX_SESSION_SIZE ; qd++ ) 02502 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ) 02503 ssa->dsset[qd+qs][vv] = ssb->dsset[qd][vv] ; 02504 ssa->num_dsset += qd ; 02505 02506 EXRETURN ; 02507 } |
|
Definition at line 4431 of file afni_func.c. References AV_fval_to_char(), THD_statistics::bstat, DEFAULT_FIM_SCALE, DSET_VALID_BSTAT, ENTRY, AFNI_view_info::fim_autorange, AFNI_view_info::fim_index, Three_D_View::fim_now, ISVALID_3DIM_DATASET, ISVALID_STATISTIC, THD_brick_stats::max, THD_brick_stats::min, RELOAD_STATS, RETURN, s2, THD_3dim_dataset::stats, STATUS, and Three_D_View::vinfo. Referenced by AFNI_reset_func_range().
04432 { 04433 XmString xstr ; 04434 float rrr ; 04435 char buf[32] , qbuf[16] ; 04436 04437 ENTRY("AFNI_autorange_label") ; 04438 04439 if( ! ISVALID_3DIM_DATASET(im3d->fim_now) ){ /* no function */ 04440 rrr = DEFAULT_FIM_SCALE ; 04441 } else { 04442 RELOAD_STATS(im3d->fim_now) ; 04443 if( ISVALID_STATISTIC(im3d->fim_now->stats) ){ 04444 float s1 , s2 ; int iv ; 04445 04446 iv = im3d->vinfo->fim_index ; 04447 04448 if( DSET_VALID_BSTAT(im3d->fim_now,iv) ){ 04449 s1 = fabs(im3d->fim_now->stats->bstat[iv].min) , 04450 s2 = fabs(im3d->fim_now->stats->bstat[iv].max) ; 04451 rrr = (s1<s2) ? s2 : s1 ; /* largest fim */ 04452 } else { 04453 rrr = DEFAULT_FIM_SCALE ; /* don't have stats */ 04454 } 04455 } else { 04456 rrr = DEFAULT_FIM_SCALE ; /* don't have stats */ 04457 } 04458 } 04459 im3d->vinfo->fim_autorange = rrr ; 04460 AV_fval_to_char( rrr , qbuf ) ; 04461 sprintf( buf , "autoRange:%s" , qbuf ) ; 04462 xstr = XmStringCreateLtoR( buf , XmFONTLIST_DEFAULT_TAG ) ; 04463 04464 #ifdef AFNI_DEBUG 04465 { STATUS(buf) ; 04466 sprintf(buf,"rrr=%g",rrr) ; STATUS(buf) ; } 04467 #endif 04468 04469 RETURN(xstr) ; 04470 } |
|
Definition at line 4645 of file afni_func.c. References AFNI_process_funcdisplay(), AFNI_set_viewpoint(), AFNI_setup_viewing(), AFNI_function_widgets::anat_buck_av, AFNI_view_info::anat_index, Three_D_View::anat_now, AV_assign_ival(), DSET_NUM_TIMES, DSET_NVALS, ENTRY, AFNI_function_widgets::fim_buck_av, AFNI_view_info::fim_index, Three_D_View::fim_now, AFNI_widget_set::func, AFNI_view_info::func_visible, IM3D_OPEN, AFNI_widget_set::imag, MCW_arrowval::ival, REDISPLAY_ALL, REDISPLAY_OVERLAY, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, AFNI_view_info::tempflag, AFNI_function_widgets::thr_buck_av, AFNI_view_info::thr_index, AFNI_imaging_widgets::time_index_av, AFNI_view_info::time_on, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_gra_send_CB().
04646 { 04647 Three_D_View *im3d = (Three_D_View *) cd ; 04648 int doit = 0 , iv , redisplay ; 04649 04650 ENTRY("AFNI_bucket_CB") ; 04651 04652 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 04653 04654 /** Anat sub-brick [29 Jul 2003: lock to time_index controller as well] **/ 04655 04656 if( av == im3d->vwid->func->anat_buck_av ){ 04657 iv = av->ival ; 04658 if( iv >= 0 && iv < DSET_NVALS(im3d->anat_now) ){ 04659 doit = (iv != im3d->vinfo->anat_index) ; 04660 im3d->vinfo->anat_index = iv ; 04661 redisplay = REDISPLAY_ALL ; 04662 if( doit && im3d->vinfo->time_on ) 04663 AV_assign_ival( im3d->vwid->imag->time_index_av , iv ) ; 04664 } 04665 } 04666 04667 /** Func sub-brick **/ 04668 04669 else if( av == im3d->vwid->func->fim_buck_av ){ 04670 iv = av->ival ; 04671 if( iv >= 0 && iv < DSET_NVALS(im3d->fim_now) ){ 04672 doit = (iv != im3d->vinfo->fim_index) ; 04673 im3d->vinfo->fim_index = iv ; 04674 redisplay = REDISPLAY_OVERLAY ; 04675 if( doit && im3d->vinfo->time_on && DSET_NUM_TIMES(im3d->anat_now) == 1 ) 04676 AV_assign_ival( im3d->vwid->imag->time_index_av , iv ) ; 04677 } 04678 } 04679 04680 /** Thresh sub-brick **/ 04681 04682 else if( av == im3d->vwid->func->thr_buck_av ){ 04683 iv = av->ival ; 04684 if( iv >= 0 && iv < DSET_NVALS(im3d->fim_now) ){ 04685 doit = (iv != im3d->vinfo->thr_index) ; 04686 im3d->vinfo->thr_index = iv ; 04687 redisplay = REDISPLAY_OVERLAY ; 04688 } 04689 } 04690 04691 /** Change the view, if required **/ 04692 04693 if( doit ){ 04694 SHOW_AFNI_PAUSE ; 04695 im3d->vinfo->tempflag = 1 ; 04696 AFNI_setup_viewing( im3d , False ) ; 04697 AFNI_set_viewpoint( im3d , -1,-1,-1 , redisplay ) ; /* redraw */ 04698 if( redisplay == REDISPLAY_OVERLAY && 04699 im3d->vinfo->func_visible ) AFNI_process_funcdisplay(im3d) ; 04700 SHOW_AFNI_READY ; 04701 } 04702 04703 EXRETURN ; 04704 } |
|
Prepare a bucket label for a menu. 21 Jun 2004: modified to allow label length to be different from 14. ---------------------------------------------------------------------------- Definition at line 4711 of file afni_func.c. References AFNI_numenv(), DSET_BRICK_LAB, DSET_BRICK_LABEL, DSET_NVALS, ENTRY, ISVALID_3DIM_DATASET, ISVALID_DSET, MCW_arrowval::ival, malloc, and RETURN.
04712 { 04713 static THD_3dim_dataset *dset_last = NULL ; 04714 static int nsiz_last = 4 ; 04715 04716 THD_3dim_dataset *dset = (THD_3dim_dataset *) cd ; 04717 static char *fmt[3]={NULL,NULL,NULL} , sfmt[16] , blab[48] ; 04718 int nlab ; 04719 static int nlab_old = 0 ; 04720 04721 ENTRY("AFNI_bucket_label_CB") ; 04722 04723 /** 04 May 2005: customize width to this dataset **/ 04724 04725 if( dset != dset_last && ISVALID_DSET(dset) ){ 04726 int nvals,kk,blw,mblw=4 ; char *lab ; 04727 dset_last = dset ; 04728 nvals = DSET_NVALS(dset) ; 04729 for( kk=0 ; kk < nvals ; kk++ ){ 04730 lab = DSET_BRICK_LAB(dset,kk) ; 04731 if( lab != NULL ){ blw=strlen(lab) ; if(blw>mblw)mblw=blw ; } 04732 } 04733 if( mblw > 32 ) mblw = 32 ; 04734 nsiz_last = mblw ; 04735 } 04736 04737 /* see if the environment overrides the above */ 04738 04739 #if 0 04740 nlab = (int)AFNI_numenv("AFNI_BUCKET_LABELSIZE") ; 04741 if( nlab <= 0 ) nlab = nsiz_last ; 04742 else if( nlab > 32 ) nlab = 32 ; 04743 #else 04744 nlab = nsiz_last ; 04745 #endif 04746 04747 /* make the format for the label string: left justified, width=nlab */ 04748 04749 if( nlab != nlab_old ){ 04750 nlab_old = nlab ; 04751 sprintf(sfmt,"%%-%d.%ds",nlab,nlab) ; 04752 if( fmt[0] == NULL ){ 04753 fmt[0] = malloc(32); fmt[1] = malloc(32); fmt[2] = malloc(32); 04754 } 04755 04756 /* and now the formats including the sub-brick index and the label */ 04757 04758 #ifdef USE_RIGHT_BUCK_LABELS 04759 sprintf(fmt[0],"%s #%%1d",sfmt) ; /* if the #xxx goes to the right */ 04760 sprintf(fmt[1],"%s #%%2d",sfmt) ; 04761 sprintf(fmt[2],"%s #%%3d",sfmt) ; 04762 #else 04763 sprintf(fmt[0],"#%%1d %s",sfmt) ; /* if the #xxx goes to the left */ 04764 sprintf(fmt[1],"#%%2d %s",sfmt) ; 04765 sprintf(fmt[2],"#%%3d %s",sfmt) ; 04766 #endif 04767 } 04768 04769 /* now actually make the label for this particular sub-brick */ 04770 04771 if( ISVALID_3DIM_DATASET(dset) ){ 04772 04773 #ifdef USE_RIGHT_BUCK_LABELS 04774 if( DSET_NVALS(dset) < 10 ) 04775 sprintf(blab, fmt[0] , DSET_BRICK_LABEL(dset,av->ival) , av->ival ) ; 04776 else if( DSET_NVALS(dset) < 100 ) 04777 sprintf(blab, fmt[1] , DSET_BRICK_LABEL(dset,av->ival) , av->ival ) ; 04778 else 04779 sprintf(blab, fmt[2] , DSET_BRICK_LABEL(dset,av->ival) , av->ival ) ; 04780 #else 04781 if( DSET_NVALS(dset) < 10 ) 04782 sprintf(blab, fmt[0] , av->ival , DSET_BRICK_LABEL(dset,av->ival) ) ; 04783 else if( DSET_NVALS(dset) < 100 ) 04784 sprintf(blab, fmt[1] , av->ival , DSET_BRICK_LABEL(dset,av->ival) ) ; 04785 else 04786 sprintf(blab, fmt[2] , av->ival , DSET_BRICK_LABEL(dset,av->ival) ) ; 04787 #endif 04788 } 04789 else 04790 sprintf(blab," #%d ",av->ival) ; /* shouldn't hapeen, but you never know */ 04791 04792 RETURN(blab) ; 04793 } |
|
Definition at line 1938 of file afni_func.c. References AFNI_finalize_dataset_CB(), AFNI_view_info::anat_num, BEEPIT, AFNI_viewing_widgets::choose_anat_pb, AFNI_viewing_widgets::choose_func_pb, AFNI_viewing_widgets::choose_sess_pb, THD_3dim_dataset::dblk, Three_D_View::dc, THD_datablock::diskptr, MCW_DC::display, dset_choice, DSET_COMPRESSED, DSET_GRAPHABLE, DSET_in_global_session(), DSET_NUM_TIMES, DSET_NVALS, DSET_PREFIXSTR, THD_session::dsset, ENTRY, FIRST_VIEW_TYPE, AFNI_view_info::func_num, GLOBAL_library, AFNI_library_type::have_dummy_dataset, IM3D_VALID, ISBUCKET, ISVALID_3DIM_DATASET, LAST_VIEW_TYPE, THD_session::lastname, MAX, MCW_choose_strlist(), MCW_strncpy, MIN, THD_session::num_dsset, THD_sessionlist::num_sess, AFNI_viewing_widgets::popchoose_anat_pb, AFNI_viewing_widgets::popchoose_func_pb, AFNI_viewing_widgets::popchoose_sess_pb, THD_diskptr::prefix, RESET_AFNI_QUIT, AFNI_view_info::sess_num, Three_D_View::ss_now, THD_sessionlist::ssar, AFNI_library_type::sslist, STRLIST_SIZE, THD_MAX_CHOICES, THD_MAX_PREFIX, AFNI_widget_set::view, Three_D_View::vinfo, Three_D_View::vwid, and XtMalloc.
01939 { 01940 static char *strlist[THD_MAX_CHOICES] ; /* strings to choose between */ 01941 static int first_call = 1 ; /* initialization flag */ 01942 01943 int num_str , ii , init_str , vv , jj ; 01944 char *label ; 01945 Widget wpar ; 01946 Three_D_View *im3d = (Three_D_View *) cd ; 01947 int llen , ltop ; 01948 01949 ENTRY("AFNI_choose_dataset_CB") ; 01950 01951 /*--- initialize ---*/ 01952 01953 if( ! IM3D_VALID(im3d) ) EXRETURN ; 01954 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; EXRETURN ; } 01955 01956 if( first_call ){ 01957 for( ii=0 ; ii < THD_MAX_CHOICES ; ii++ ) 01958 strlist[ii] = (char*)XtMalloc( sizeof(char) * (STRLIST_SIZE+1) ) ; 01959 first_call = 0 ; 01960 } 01961 01962 /*--- make a list of session names ---*/ 01963 01964 if( w == im3d->vwid->view->choose_sess_pb || 01965 w == im3d->vwid->view->popchoose_sess_pb ){ 01966 01967 wpar = im3d->vwid->view->choose_sess_pb ; 01968 num_str = GLOBAL_library.sslist->num_sess ; 01969 if( num_str < 1 ) EXRETURN ; 01970 01971 for( ii=0 ; ii < num_str ; ii++ ){ 01972 MCW_strncpy( strlist[ii] , 01973 GLOBAL_library.sslist->ssar[ii]->lastname , 01974 STRLIST_SIZE ) ; 01975 } 01976 01977 init_str = im3d->vinfo->sess_num ; 01978 label = dset_choice[0] ; 01979 01980 /*--- make a list of anatomy names ---*/ 01981 01982 } else if( w == im3d->vwid->view->choose_anat_pb || 01983 w == im3d->vwid->view->popchoose_anat_pb ){ 01984 01985 wpar = im3d->vwid->view->choose_anat_pb ; 01986 num_str = im3d->ss_now->num_dsset ; 01987 if( num_str < 1 ) EXRETURN ; 01988 01989 ltop = 4 ; 01990 for( ii=0 ; ii < num_str ; ii++ ){ 01991 for( vv=FIRST_VIEW_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ ) 01992 if( ISVALID_3DIM_DATASET(im3d->ss_now->dsset[ii][vv]) ) break ; 01993 01994 if( vv <= LAST_VIEW_TYPE ){ 01995 llen = strlen( im3d->ss_now->dsset[ii][vv]->dblk->diskptr->prefix ) ; 01996 ltop = MAX( ltop , llen ) ; 01997 } 01998 } 01999 ltop = MIN(ltop,STRLIST_SIZE-24) ; /* 06 Aug 2002 */ 02000 02001 for( ii=0 ; ii < num_str ; ii++ ){ 02002 for( vv=FIRST_VIEW_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ ) 02003 if( ISVALID_3DIM_DATASET(im3d->ss_now->dsset[ii][vv]) ) break ; 02004 02005 if( vv <= LAST_VIEW_TYPE ){ 02006 sprintf( strlist[ii] , "%-*s" , 02007 ltop,im3d->ss_now->dsset[ii][vv]->dblk->diskptr->prefix ) ; 02008 02009 strcat( strlist[ii] , " [" ) ; 02010 strcat( strlist[ii] , DSET_PREFIXSTR(im3d->ss_now->dsset[ii][vv]) ) ; 02011 02012 if( DSET_NUM_TIMES(im3d->ss_now->dsset[ii][vv]) > 1 ){ 02013 int ll = strlen(strlist[ii]) ; 02014 sprintf( strlist[ii]+ll , ":3D+t:%d]" , 02015 DSET_NUM_TIMES(im3d->ss_now->dsset[ii][vv]) ) ; 02016 } else if( ISBUCKET(im3d->ss_now->dsset[ii][vv]) ){ 02017 int ll = strlen(strlist[ii]) ; 02018 sprintf( strlist[ii]+ll , ":%d]" , 02019 DSET_NVALS(im3d->ss_now->dsset[ii][vv]) ) ; 02020 } else { 02021 strcat( strlist[ii] , "]" ) ; 02022 } 02023 02024 if( DSET_GRAPHABLE(im3d->ss_now->dsset[ii][vv]) ) 02025 strcat( strlist[ii] , "*" ) ; 02026 02027 if( DSET_COMPRESSED(im3d->ss_now->dsset[ii][vv]) ) 02028 strcat( strlist[ii] , "z" ) ; 02029 02030 /* 20 Dec 2001: mark if this is a global dataset */ 02031 02032 if( DSET_in_global_session(im3d->ss_now->dsset[ii][vv]) ) 02033 strcat( strlist[ii] , "G" ) ; 02034 02035 } else 02036 MCW_strncpy( strlist[ii] , "??*BAD*??" , THD_MAX_PREFIX ) ; 02037 } 02038 02039 init_str = im3d->vinfo->anat_num ; 02040 label = dset_choice[1] ; 02041 02042 /*--- make a list of function names ---*/ 02043 02044 } else if( w == im3d->vwid->view->choose_func_pb || 02045 w == im3d->vwid->view->popchoose_func_pb ){ 02046 02047 wpar = im3d->vwid->view->choose_func_pb ; 02048 num_str = im3d->ss_now->num_dsset ; 02049 if( num_str < 1 ) EXRETURN ; 02050 02051 ltop = 4 ; 02052 for( ii=0 ; ii < num_str ; ii++ ){ 02053 for( vv=FIRST_VIEW_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ ) 02054 if( ISVALID_3DIM_DATASET(im3d->ss_now->dsset[ii][vv]) ) break ; 02055 02056 if( vv <= LAST_VIEW_TYPE ){ 02057 llen = strlen( im3d->ss_now->dsset[ii][vv]->dblk->diskptr->prefix ) ; 02058 ltop = MAX( ltop , llen ) ; 02059 } 02060 } 02061 ltop = MIN(ltop,STRLIST_SIZE-24) ; /* 06 Aug 2002 */ 02062 02063 for( ii=0 ; ii < num_str ; ii++ ){ 02064 for( vv=FIRST_VIEW_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ ) 02065 if( ISVALID_3DIM_DATASET(im3d->ss_now->dsset[ii][vv]) ) break ; 02066 02067 if( vv <= LAST_VIEW_TYPE ){ 02068 sprintf( strlist[ii] , "%-*s" , 02069 ltop , im3d->ss_now->dsset[ii][vv]->dblk->diskptr->prefix ) ; 02070 02071 strcat( strlist[ii] , " [" ) ; 02072 strcat( strlist[ii] , DSET_PREFIXSTR(im3d->ss_now->dsset[ii][vv]) ) ; 02073 02074 if( DSET_NUM_TIMES(im3d->ss_now->dsset[ii][vv]) > 1 ){ 02075 int ll = strlen(strlist[ii]) ; 02076 sprintf( strlist[ii]+ll , ":3D+t:%d]" , 02077 DSET_NUM_TIMES(im3d->ss_now->dsset[ii][vv]) ) ; 02078 } else if( ISBUCKET(im3d->ss_now->dsset[ii][vv]) ){ 02079 int ll = strlen(strlist[ii]) ; 02080 sprintf( strlist[ii]+ll , ":%d]" , 02081 DSET_NVALS(im3d->ss_now->dsset[ii][vv]) ) ; 02082 } else { 02083 strcat( strlist[ii] , "]" ) ; 02084 } 02085 02086 if( DSET_COMPRESSED(im3d->ss_now->dsset[ii][vv]) ) 02087 strcat( strlist[ii] , "z" ) ; 02088 02089 /* 20 Dec 2001: mark if this is a global dataset */ 02090 02091 if( DSET_in_global_session(im3d->ss_now->dsset[ii][vv]) ) 02092 strcat( strlist[ii] , "G" ) ; 02093 02094 } else 02095 MCW_strncpy( strlist[ii] , "**?BAD?**" , THD_MAX_PREFIX ) ; 02096 02097 } 02098 02099 init_str = im3d->vinfo->func_num ; 02100 label = dset_choice[2] ; 02101 02102 } else { 02103 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad news! */ 02104 } 02105 02106 /*--- call the chooser ---*/ 02107 02108 MCW_choose_strlist( wpar , label , num_str , init_str , strlist , 02109 AFNI_finalize_dataset_CB , (XtPointer) im3d ) ; 02110 02111 RESET_AFNI_QUIT(im3d) ; 02112 EXRETURN ; 02113 } |
|
Definition at line 2345 of file afni_func.c. References ENTRY, AFNI_widget_set::file_dialog, RWC_XtPopdown(), and Three_D_View::vwid. Referenced by AFNI_make_file_dialog().
02346 { 02347 Three_D_View *im3d = (Three_D_View *) cd ; 02348 02349 ENTRY("AFNI_close_file_dialog") ; 02350 02351 if( im3d->vwid->file_dialog != NULL ) 02352 RWC_XtPopdown( im3d->vwid->file_dialog ) ; 02353 02354 EXRETURN ; 02355 } |
|
July 1996: get the sequences to send their montaging status * Definition at line 1825 of file afni_func.c. References AFNI_controller_index(). Referenced by AFNI_make_surface_widgets(), AFNI_set_window_titles(), AFNI_update_surface_widgets(), DRAW_main(), NOTES_main(), NUD_main(), PLUG_startup_plugin_CB(), RCREND_main(), REND_main(), RT_tell_afni_one(), and TAG_main().
01826 { 01827 static char clabel[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; 01828 static char str[8] ; 01829 int ic ; 01830 01831 ic = AFNI_controller_index( im3d ) ; 01832 if( ic < 0 || ic > 26 ) strcpy (str," ") ; 01833 else sprintf(str,"[%c] ",clabel[ic]) ; 01834 return str ; 01835 } |
|
scan once to find longest string name * Definition at line 3647 of file afni_func.c. References AFNI_refashion_dataset(), AFNI_reset_func_range(), AFNI_set_viewpoint(), AFNI_speak(), Three_D_View::anat_now, AFNI_view_info::anat_resam_mode, AFNI_datamode_widgets::anatmode_bbox, AFNI_library_type::controllers, CURRENT_DAXES, DATAXES_TYPE, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, THD_diskptr::directory_name, THD_datablock::diskptr, AFNI_widget_set::dmode, DMODE_BRICK, DSET_WRITEABLE, ENTRY, THD_diskptr::filecode, Three_D_View::fim_now, AFNI_view_info::func_resam_mode, AFNI_datamode_widgets::funcmode_bbox, GLOBAL_library, MCW_choose_cbs::ilist, IM3D_OPEN, ISFUNC, MAX_CONTROLLERS, MCW_CALLER_KILL, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, MCW_choose_cbs::nilist, PLUTO_find_dset(), REDISPLAY_OVERLAY, AFNI_view_info::resam_vox, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, THD_edit_dataxes(), THD_MAX_NAME, THD_dataxes::type, Three_D_View::vinfo, Three_D_View::vwid, MCW_bbox::wbut, and AFNI_view_info::writeownsize. Referenced by AFNI_write_many_dataset_CB().
03648 { 03649 MCW_idcode *idclist = (MCW_idcode *) cd ; 03650 Three_D_View *im3d = NULL , *qq3d ; 03651 THD_3dim_dataset *dset ; 03652 THD_dataxes new_daxes ; 03653 int ib , resam_mode ; 03654 Boolean good ; 03655 Widget wmsg ; 03656 int cc , ccanat[MAX_CONTROLLERS] , ccfunc[MAX_CONTROLLERS] ; 03657 03658 ENTRY("AFNI_do_many_writes") ; 03659 03660 XtVaGetValues( wpar , XmNuserData , &im3d , NULL ) ; 03661 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 03662 03663 SHOW_AFNI_PAUSE ; 03664 03665 /** mark all controllers as untouched **/ 03666 03667 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ) ccanat[cc] = ccfunc[cc] = 0 ; 03668 03669 wmsg = MCW_popup_message( wpar , 03670 "*******************************\n" 03671 "** Please wait for dataset **\n" 03672 "** computations and disk I/O **\n" 03673 "*******************************" , MCW_CALLER_KILL ) ; 03674 AFNI_speak("Writing",0) ; 03675 03676 /** loop through selected datasets and do the dirty work **/ 03677 03678 for( ib=0 ; ib < cbs->nilist ; ib++ ){ 03679 dset = PLUTO_find_dset( idclist + cbs->ilist[ib] ) ; 03680 if( DSET_WRITEABLE(dset) ){ 03681 03682 fprintf(stderr,"-- writing dataset %s%s (%d of %d)\n" , 03683 dset->dblk->diskptr->directory_name , 03684 dset->dblk->diskptr->filecode , 03685 ib+1 , cbs->nilist ) ; 03686 03687 new_daxes.type = DATAXES_TYPE ; 03688 03689 #ifdef USE_WRITEOWNSIZE 03690 if( im3d->vinfo->writeownsize ) 03691 THD_edit_dataxes( im3d->vinfo->resam_vox , dset->daxes , &new_daxes ) ; 03692 else 03693 #endif 03694 THD_edit_dataxes( im3d->vinfo->resam_vox , 03695 CURRENT_DAXES(im3d->anat_now) , &new_daxes ) ; 03696 03697 resam_mode = (ISFUNC(dset)) ? im3d->vinfo->func_resam_mode 03698 : im3d->vinfo->anat_resam_mode ; 03699 03700 good = AFNI_refashion_dataset( im3d , dset , &new_daxes , resam_mode ) ; 03701 03702 /** if the output failed, put a message to the screen **/ 03703 03704 if( ! good ){ /* bad news! */ 03705 char str[THD_MAX_NAME+128] ; 03706 sprintf( str , "**\n" "** Attempt to write dataset\n" 03707 "** %s%s\n" "** failed for unknown reasons!\n**" , 03708 dset->dblk->diskptr->directory_name , 03709 dset->dblk->diskptr->filecode ) ; 03710 (void) MCW_popup_message( wpar , str , MCW_USER_KILL | MCW_TIMER_KILL ) ; 03711 03712 fprintf(stderr," [output of %s%s failed!]\n", 03713 dset->dblk->diskptr->directory_name , 03714 dset->dblk->diskptr->filecode ) ; 03715 03716 /** otherwise, check if the dataset just done is 03717 the active anatomy or function in any open controller window **/ 03718 03719 } else { 03720 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){ 03721 qq3d = GLOBAL_library.controllers[cc] ; 03722 if( ! IM3D_OPEN(qq3d) ) continue ; 03723 if( dset == qq3d->anat_now ) ccanat[cc] = 1 ; /* flag their */ 03724 if( dset == qq3d->fim_now ) ccfunc[cc] = 1 ; /* controllers */ 03725 } 03726 } 03727 } 03728 } 03729 03730 /** for any controllers whose active datasets were written out, 03731 we need to set the "See Brick" buttons to be sensitive. **/ 03732 03733 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){ 03734 qq3d = GLOBAL_library.controllers[cc] ; 03735 if( ! IM3D_OPEN(qq3d) ) continue ; 03736 03737 if( ccfunc[cc] ){ 03738 STATUS("resetting 'use func brick' button") ; 03739 XtSetSensitive( qq3d->vwid->dmode->funcmode_bbox->wbut[DMODE_BRICK] , True ) ; 03740 AFNI_reset_func_range( qq3d ) ; 03741 AFNI_set_viewpoint( qq3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ; 03742 } 03743 03744 if( ccanat[cc] ){ 03745 STATUS("resetting 'use anat brick' button") ; 03746 XtSetSensitive( qq3d->vwid->dmode->anatmode_bbox->wbut[DMODE_BRICK] , True ) ; 03747 } 03748 } 03749 03750 XtDestroyWidget( wmsg ) ; 03751 SHOW_AFNI_READY ; 03752 EXRETURN ; 03753 } |
|
Definition at line 2117 of file afni_func.c. References AFNI_initialize_view(), Three_D_View::anat_now, AFNI_view_info::anat_num, AFNI_viewing_widgets::choose_anat_pb, AFNI_viewing_widgets::choose_func_pb, AFNI_viewing_widgets::choose_sess_pb, Three_D_View::dc, MCW_DC::display, THD_session::dsset, ENTRY, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, FIRST_VIEW_TYPE, AFNI_view_info::func_num, GLOBAL_library, IM3D_VALID, ISVALID_3DIM_DATASET, MCW_choose_cbs::ival, LAST_VIEW_TYPE, MCW_invert_widget(), MCW_set_bbox(), THD_session::num_dsset, THD_sessionlist::num_sess, AFNI_view_info::sess_num, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, THD_sessionlist::ssar, AFNI_library_type::sslist, AFNI_widget_set::view, AFNI_viewing_widgets::view_bbox, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, and MCW_bbox::wbut. Referenced by AFNI_choose_dataset_CB(), AFNI_drive_switch_anatomy(), AFNI_drive_switch_function(), AFNI_drive_switch_session(), DRAW_finalize_dset_CB(), process_NIML_Node_ROI(), and process_NIML_SUMA_ixyz().
02119 { 02120 Three_D_View *im3d = (Three_D_View *) cd ; 02121 int old_sess , old_anat , old_func , old_view ; 02122 int new_sess=-1 , new_anat=-1 , new_func=-1 , new_view=-1 ; 02123 int ii , vv , ff ; 02124 THD_session *ss_new ; 02125 02126 ENTRY("AFNI_finalize_dataset_CB") ; 02127 02128 if( ! IM3D_VALID(im3d) ) EXRETURN ; 02129 02130 old_sess = im3d->vinfo->sess_num ; /* record current status */ 02131 old_anat = im3d->vinfo->anat_num ; 02132 old_func = im3d->vinfo->func_num ; 02133 old_view = im3d->vinfo->view_type ; 02134 02135 /*--- switch sessions ---*/ 02136 02137 if( wcall == im3d->vwid->view->choose_sess_pb ){ 02138 02139 new_sess = cbs->ival ; 02140 if( new_sess < 0 || new_sess >= GLOBAL_library.sslist->num_sess ){ 02141 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */ 02142 } 02143 02144 ss_new = GLOBAL_library.sslist->ssar[new_sess] ; 02145 02146 /* find an anat in new session to match current anat */ 02147 02148 if( ISVALID_3DIM_DATASET(ss_new->dsset[old_anat][old_view]) ){ /* are OK */ 02149 new_anat = old_anat ; 02150 } else { 02151 for( ii=0 ; ii < ss_new->num_dsset ; ii++ ) 02152 if( ISVALID_3DIM_DATASET(ss_new->dsset[ii][old_view]) ){ 02153 new_anat = ii ; break ; 02154 } 02155 } 02156 if( new_anat < 0 ) new_anat = 0 ; /* use 1st if no match */ 02157 02158 /* find a view to fit this chosen anat */ 02159 02160 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][old_view]) ){ /* are OK */ 02161 new_view = old_view ; 02162 } else { 02163 for( vv=old_view-1 ; vv >= FIRST_VIEW_TYPE ; vv-- ) /* look below */ 02164 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][vv]) ) break ; 02165 02166 if( vv >= FIRST_VIEW_TYPE ){ /* found it below */ 02167 new_view = vv ; 02168 } else { /* look above */ 02169 for( vv=old_view+1 ; vv <= LAST_VIEW_TYPE ; vv++ ) 02170 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][vv]) ) break ; 02171 02172 if( vv <= LAST_VIEW_TYPE ){ /* found it above */ 02173 new_view = vv ; 02174 } else { 02175 XBell(im3d->dc->display,100) ; EXRETURN ; /* bad news */ 02176 } 02177 } 02178 } 02179 02180 /* find a func in new session that fits the new view */ 02181 02182 #define FINDAFUNC 02183 #ifdef FINDAFUNC 02184 if( ISVALID_3DIM_DATASET(ss_new->dsset[old_func][new_view]) ){ /* are OK */ 02185 02186 new_func = old_func ; 02187 } else { 02188 for( ff=0 ; ff < ss_new->num_dsset ; ff++ ) /* search */ 02189 if( ISVALID_3DIM_DATASET(ss_new->dsset[ff][new_view]) ) break ; 02190 02191 if( ff < ss_new->num_dsset ) new_func = ff ; /* found one */ 02192 } 02193 if( new_func < 0 ) new_func = 0 ; /* no match */ 02194 #else 02195 new_func = old_func ; 02196 #endif 02197 02198 /*--- switch anatomy ---*/ 02199 02200 } else if( wcall == im3d->vwid->view->choose_anat_pb ){ 02201 02202 new_sess = old_sess ; 02203 ss_new = GLOBAL_library.sslist->ssar[new_sess] ; 02204 02205 new_anat = cbs->ival ; 02206 if( new_anat < 0 || new_anat >= ss_new->num_dsset ){ 02207 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */ 02208 } 02209 02210 /* find a view to fit this chosen anat */ 02211 02212 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][old_view]) ){ /* are OK */ 02213 new_view = old_view ; 02214 } else { 02215 for( vv=old_view-1 ; vv >= FIRST_VIEW_TYPE ; vv-- ) /* look below */ 02216 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][vv]) ) break ; 02217 02218 if( vv >= FIRST_VIEW_TYPE ){ /* found it below */ 02219 new_view = vv ; 02220 } else { /* look above */ 02221 for( vv=old_view+1 ; vv <= LAST_VIEW_TYPE ; vv++ ) 02222 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][vv]) ) break ; 02223 02224 if( vv <= LAST_VIEW_TYPE ){ /* found it above */ 02225 new_view = vv ; 02226 } else { 02227 XBell(im3d->dc->display,100) ; EXRETURN ; /* bad news */ 02228 } 02229 } 02230 } 02231 02232 /* find a func to match this view */ 02233 02234 #ifdef FINDAFUNC 02235 if( ISVALID_3DIM_DATASET(ss_new->dsset[old_func][new_view]) ){ /* are OK */ 02236 02237 new_func = old_func ; 02238 } else { 02239 for( ff=0 ; ff < ss_new->num_dsset ; ff++ ) /* search */ 02240 if( ISVALID_3DIM_DATASET(ss_new->dsset[ff][new_view]) ) break ; 02241 02242 if( ff < ss_new->num_dsset ) new_func = ff ; /* found one */ 02243 } 02244 if( new_func < 0 ) new_func = 0 ; /* no match */ 02245 #else 02246 new_func = old_func ; 02247 #endif 02248 02249 /*--- switch function ---*/ 02250 02251 } else if( wcall == im3d->vwid->view->choose_func_pb ){ 02252 02253 new_sess = old_sess ; 02254 ss_new = GLOBAL_library.sslist->ssar[new_sess] ; 02255 02256 new_func = cbs->ival ; 02257 if( new_func < 0 || new_func >= ss_new->num_dsset ){ 02258 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */ 02259 } 02260 02261 /* find a view to fit this chosen func */ 02262 02263 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_func][old_view]) ){ /* are OK */ 02264 new_view = old_view ; 02265 } else { 02266 for( vv=old_view-1 ; vv >= FIRST_VIEW_TYPE ; vv-- ) /* look below */ 02267 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_func][vv]) ) break ; 02268 02269 if( vv >= FIRST_VIEW_TYPE ){ /* found it below */ 02270 new_view = vv ; 02271 } else { /* look above */ 02272 for( vv=old_view+1 ; vv <= LAST_VIEW_TYPE ; vv++ ) 02273 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_func][vv]) ) break ; 02274 02275 if( vv <= LAST_VIEW_TYPE ){ /* found it above */ 02276 new_view = vv ; 02277 } else { 02278 XBell(im3d->dc->display,100) ; EXRETURN ; /* bad news */ 02279 } 02280 } 02281 } 02282 02283 /* find an anat to go with the new view (this is NOT optional) */ 02284 02285 if( ISVALID_3DIM_DATASET(ss_new->dsset[old_anat][new_view]) ){ /* are OK */ 02286 02287 new_anat = old_anat ; 02288 } else { 02289 for( ff=0 ; ff < ss_new->num_dsset ; ff++ ) /* search */ 02290 if( ISVALID_3DIM_DATASET(ss_new->dsset[ff][new_view]) ) break ; 02291 02292 if( ff < ss_new->num_dsset ) new_anat = ff ; /* found one */ 02293 } 02294 if( new_anat < 0 ){ 02295 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */ 02296 } 02297 02298 /*--- switch to Hell? ---*/ 02299 02300 } else { 02301 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */ 02302 } 02303 02304 /*--- make sure all values are set OK-ly ---*/ 02305 02306 if( new_view < 0 || new_sess < 0 || new_anat < 0 || new_func < 0 ){ 02307 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */ 02308 } 02309 02310 /*- beep & flash viewing control box if view type changes -*/ 02311 02312 if( old_view != new_view ){ 02313 XBell( im3d->dc->display , 100 ) ; 02314 MCW_set_bbox( im3d->vwid->view->view_bbox , 1 << new_view ) ; 02315 MCW_invert_widget( im3d->vwid->view->view_bbox->wbut[new_view] ) ; 02316 } 02317 02318 /*----- actually do the switch -----*/ 02319 02320 if( im3d->vinfo->sess_num != new_sess ) /* disable FIMage in a new session */ 02321 im3d->fimdata->fimdset = NULL ; 02322 02323 im3d->vinfo->view_type = new_view ; 02324 im3d->vinfo->sess_num = new_sess ; 02325 im3d->vinfo->anat_num = new_anat ; 02326 im3d->vinfo->func_num = new_func ; 02327 02328 SHOW_AFNI_PAUSE ; 02329 AFNI_initialize_view( im3d->anat_now , im3d ) ; 02330 SHOW_AFNI_READY ; 02331 02332 if( old_view != new_view ){ /* end flash */ 02333 XBell( im3d->dc->display , 100 ) ; 02334 MCW_invert_widget( im3d->vwid->view->view_bbox->wbut[new_view] ) ; 02335 } 02336 02337 EXRETURN ; 02338 } |
|
Definition at line 2744 of file afni_func.c. References Three_D_View::dc, MCW_DC::display, ENTRY, far, AFNI_widget_set::file_dialog, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, MRI_FLOAT_PTR, mri_free(), mri_read_1D(), myXtFree, MRI_IMAGE::nvox, MRI_IMAGE::nx, PLUTO_register_timeseries(), RWC_XtPopdown(), and Three_D_View::vwid. Referenced by AFNI_read_1D_CB().
02745 { 02746 Three_D_View *im3d = (Three_D_View *) cd ; 02747 XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) cb ; 02748 02749 ENTRY("AFNI_finalize_read_1D_CB") ; 02750 02751 switch( cbs->reason ){ 02752 02753 /** close the file selection dialog **/ 02754 02755 case XmCR_CANCEL: 02756 RWC_XtPopdown( im3d->vwid->file_dialog ) ; 02757 break ; 02758 02759 /** try to read a new timeseries **/ 02760 02761 case XmCR_OK:{ 02762 char *text = NULL ; 02763 MRI_IMAGE *flim ; 02764 float *far ; 02765 int ii ; 02766 02767 XmStringGetLtoR( cbs->value , XmFONTLIST_DEFAULT_TAG , &text ) ; 02768 flim = mri_read_1D( text ) ; 02769 if( flim == NULL || flim->nx < 2 ){ 02770 XBell(im3d->dc->display,100) ; 02771 (void) MCW_popup_message( w , 02772 "********************************\n" 02773 "** Cannot read data from file **\n" 02774 "********************************" 02775 , MCW_USER_KILL | MCW_TIMER_KILL ) ; 02776 myXtFree(text) ; 02777 break ; 02778 } 02779 02780 far = MRI_FLOAT_PTR(flim) ; 02781 for( ii=0 ; ii < flim->nvox ; ii++ ) 02782 if( fabs(far[ii]) >= 33333.0 ) far[ii] = WAY_BIG ; 02783 02784 PLUTO_register_timeseries( text , flim ) ; 02785 mri_free(flim) ; 02786 myXtFree(text) ; 02787 RWC_XtPopdown( im3d->vwid->file_dialog ) ; 02788 } 02789 break ; 02790 02791 case XmCR_HELP: 02792 (void) MCW_popup_message( w , 02793 "To choose a new timeseries, use the\n" 02794 "Directories and Files selectors,\n" 02795 "and the Filter entry and button,\n" 02796 "to get the 'Selection' box correct;\n" 02797 "that is, 'Selection' should show the\n" 02798 "name of the 1D file which will be input.\n" 02799 "Then press 'Set'.\n" 02800 , MCW_USER_KILL ) ; 02801 break ; 02802 } 02803 EXRETURN ; 02804 } |
|
Definition at line 2515 of file afni_func.c. References AFNI_append_sessions(), AFNI_rescan_timeseries_CB(), Three_D_View::dc, destroy_Htable(), MCW_DC::display, AFNI_widget_set::dmode, THD_session::dsset, ENTRY, AFNI_widget_set::file_dialog, GLOBAL_library, AFNI_library_type::have_dummy_dataset, LAST_VIEW_TYPE, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, myXtFree, new_Htable(), THD_session::num_dsset, THD_sessionlist::num_sess, THD_session::parent, PARENTIZE, AFNI_datamode_widgets::read_sess_pb, RWC_XtPopdown(), AFNI_library_type::session, THD_session::sessname, THD_sessionlist::ssar, AFNI_library_type::sslist, STATUS, subsume_Htable(), THD_equiv_files(), THD_init_session(), THD_is_directory(), THD_is_file(), THD_MAX_NUM_SESSION, THD_reconcile_parents(), UNDUMMYIZE, Three_D_View::vwid, AFNI_library_type::warptable, and THD_session::warptable. Referenced by AFNI_read_sess_CB().
02516 { 02517 Three_D_View *im3d = (Three_D_View *) cd ; 02518 XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) cb ; 02519 02520 ENTRY("AFNI_finalize_read_sess_CB") ; 02521 02522 switch( cbs->reason ){ 02523 02524 /** close the file selection dialog **/ 02525 02526 case XmCR_CANCEL: 02527 RWC_XtPopdown( im3d->vwid->file_dialog ) ; 02528 break ; 02529 02530 /** try to read a new session **/ 02531 02532 case XmCR_OK:{ 02533 char *text = NULL ; 02534 XmStringGetLtoR( cbs->value , XmFONTLIST_DEFAULT_TAG , &text ) ; 02535 if( text != NULL ){ 02536 02537 THD_session *new_ss = NULL ; 02538 02539 /** if the user selected a file, strip it back to a directory **/ 02540 02541 if(PRINT_TRACING) 02542 { char str[256] ; sprintf(str,"input text = %s",text) ; STATUS(str) ; } 02543 02544 if( THD_is_file(text) ){ 02545 int ii = strlen(text)-1 ; 02546 for( ; ii > 0 && text[ii] != '/' ; ii-- ) text[ii] = '\0' ; 02547 02548 if(PRINT_TRACING) 02549 { char str[256] ; sprintf(str,"defiled text = %s",text) ; STATUS(str) ; } 02550 } 02551 02552 /** if the name given is a directory, try to read it **/ 02553 02554 if( THD_is_directory(text) ){ 02555 int ii , eq ; 02556 THD_session *old_ss ; 02557 02558 /** 1st check if this is the same as some other session **/ 02559 02560 STATUS("comparing to other sessions") ; 02561 for( ii=0 ; ii < GLOBAL_library.sslist->num_sess ; ii++ ){ 02562 old_ss = GLOBAL_library.sslist->ssar[ii] ; 02563 eq = THD_equiv_files( old_ss->sessname , text ) ; 02564 if( eq == 1 ) break ; 02565 } 02566 02567 if( eq == 1 ){ 02568 STATUS("illegal duplicate session") ; 02569 XBell(im3d->dc->display,100) ; 02570 (void) MCW_popup_message( w , 02571 "*******************************\n" 02572 "** Illegal duplicate session **\n" 02573 "*******************************" 02574 , MCW_USER_KILL | MCW_TIMER_KILL ) ; 02575 break ; 02576 } else { 02577 STATUS("reading new session") ; 02578 new_ss = THD_init_session( text ) ; /*** Read session! ***/ 02579 } 02580 } else { /** wasn't a directory!? **/ 02581 02582 STATUS("wasn't a directory") ; 02583 XBell(im3d->dc->display,100) ; 02584 (void) MCW_popup_message( w , 02585 "***********************************\n" 02586 "** Cannot find session directory **\n" 02587 "***********************************" 02588 , MCW_USER_KILL | MCW_TIMER_KILL ) ; 02589 break ; 02590 } 02591 02592 /** OK, was a directory and we tried to read it **/ 02593 02594 if( new_ss == NULL || new_ss->num_dsset == 0 ){ /** failed to read anything **/ 02595 02596 STATUS("failed to read new session") ; 02597 XBell(im3d->dc->display,100) ; 02598 (void) MCW_popup_message( w , 02599 "******************************\n" 02600 "** Cannot read any datasets **\n" 02601 "******************************" 02602 , MCW_USER_KILL | MCW_TIMER_KILL ) ; 02603 02604 } else if( GLOBAL_library.sslist->num_sess >= THD_MAX_NUM_SESSION ){ 02605 02606 STATUS("too many sessions") ; 02607 XBell(im3d->dc->display,100) ; 02608 (void) MCW_popup_message( w , 02609 "****************************\n" 02610 "** Max number of sessions **\n" 02611 "** exceeded -- Sorry! **\n" 02612 "****************************" 02613 , MCW_USER_KILL | MCW_TIMER_KILL ) ; 02614 02615 } else { /** GOOD! Actually process a new session. **/ 02616 /** (The following is from AFNI_read_inputs) **/ 02617 int qd , vv ; 02618 char str[356] ; /* for messages */ 02619 02620 STATUS("processing new session") ; 02621 02622 new_ss->parent = NULL ; 02623 02624 for( qd=0 ; qd < new_ss->num_dsset ; qd++ ) /* parentize */ 02625 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ) 02626 PARENTIZE( new_ss->dsset[qd][vv] , NULL ) ; 02627 02628 /* 20 Dec 2001: if have global datasets, put them in here */ 02629 02630 AFNI_append_sessions( new_ss , GLOBAL_library.session ) ; 02631 02632 /* if we were living with a dummy, fix that */ 02633 02634 if( GLOBAL_library.have_dummy_dataset ) UNDUMMYIZE ; 02635 02636 /* put the new session into place in the list of sessions */ 02637 02638 STATUS("adding new session to list") ; 02639 GLOBAL_library.sslist->ssar[GLOBAL_library.sslist->num_sess] = new_ss ; 02640 (GLOBAL_library.sslist->num_sess)++ ; 02641 THD_reconcile_parents( GLOBAL_library.sslist ) ; 02642 02643 sprintf(str," \n Session #%2d" 02644 "\n %s" 02645 "\n %d datasets\n" , 02646 GLOBAL_library.sslist->num_sess , 02647 new_ss->sessname, new_ss->num_dsset ) ; 02648 02649 (void) MCW_popup_message( im3d->vwid->dmode->read_sess_pb, 02650 str, MCW_USER_KILL | MCW_TIMER_KILL ) ; 02651 02652 STATUS("rescanning timeseries files") ; 02653 AFNI_rescan_timeseries_CB(NULL,NULL,NULL) ; 02654 02655 /* 28 Aug 2002: deal with warptables */ 02656 02657 if( new_ss->warptable != NULL ){ 02658 if( GLOBAL_library.warptable == NULL ) /* create global warptable */ 02659 GLOBAL_library.warptable = new_Htable(101) ; 02660 subsume_Htable( new_ss->warptable , GLOBAL_library.warptable ) ; 02661 destroy_Htable( new_ss->warptable ) ; 02662 new_ss->warptable = NULL ; 02663 } 02664 02665 RWC_XtPopdown( im3d->vwid->file_dialog ) ; 02666 } 02667 02668 STATUS("freeing 'text' variable") ; 02669 myXtFree(text) ; 02670 } 02671 } 02672 break ; 02673 02674 case XmCR_HELP: 02675 (void) MCW_popup_message( w , 02676 "To choose a new session, use the\n" 02677 "Directories and Files selectors,\n" 02678 "and the Filter entry and button,\n" 02679 "to get the 'Selection' box correct;\n" 02680 "that is, 'Selection' should either\n" 02681 "be the name of the session directory,\n" 02682 "or the name of a file in the session\n" 02683 "directory. Then press 'Set'.\n" 02684 "\n" 02685 "N.B.: To see datasets in the new\n" 02686 " session, you must use the\n" 02687 " 'Switch Session' button." 02688 , MCW_USER_KILL ) ; 02689 break ; 02690 } 02691 EXRETURN ; 02692 } |
|
Definition at line 2828 of file afni_func.c. References ADDTO_XTARR, AFNI_add_timeseries(), AFNI_initialize_view(), AFNI_view_info::anat_num, MCW_choose_cbs::cval, AFNI_widget_set::dmode, DSET_delete, THD_session::dsset, ENTRY, FREE_XTARR, AFNI_view_info::func_num, GLOBAL_library, AFNI_library_type::have_dummy_dataset, IC_DSET, IC_FLIM, INIT_XTARR, ISVALID_DSET, LAST_VIEW_TYPE, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, mcwCR_string, XtPointer_array::num, THD_session::num_dsset, AFNI_datamode_widgets::read_Web_pb, MCW_choose_cbs::reason, AFNI_view_info::sess_num, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, THD_sessionlist::ssar, AFNI_library_type::sslist, THD_fetch_dataset(), THD_fetch_many_datasets(), THD_MAX_SESSION_SIZE, UNDUMMYIZE, AFNI_view_info::view_type, THD_3dim_dataset::view_type, Three_D_View::vinfo, Three_D_View::vwid, XTARR_IC, and XTARR_XT. Referenced by AFNI_read_Web_CB().
02829 { 02830 Three_D_View *im3d = (Three_D_View *) cd ; 02831 THD_3dim_dataset *dset ; 02832 XtPointer_array *dsar ; 02833 THD_session *ss = GLOBAL_library.sslist->ssar[im3d->vinfo->sess_num] ; 02834 char str[256] ; 02835 int nds,dd,vv , nn, na=-1,nf=-1 ,nts ; 02836 02837 ENTRY("AFNI_finalize_read_Web_CB") ; 02838 02839 if( cbs->reason != mcwCR_string || 02840 cbs->cval == NULL || 02841 cbs->cval[0] == '\0' || 02842 (strstr(cbs->cval,"http://")==NULL && strstr(cbs->cval,"ftp://")==NULL) ){ 02843 02844 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb , 02845 " \n** Illegal URL **\n " , 02846 MCW_USER_KILL | MCW_TIMER_KILL ) ; 02847 02848 XBell( XtDisplay(w) , 100 ) ; EXRETURN ; 02849 } 02850 02851 /** read a list of datasets? **/ 02852 02853 if( strstr(cbs->cval,"AFNILIST") != NULL ){ 02854 02855 SHOW_AFNI_PAUSE ; 02856 dsar = THD_fetch_many_datasets( cbs->cval ) ; /* get array of datasets */ 02857 SHOW_AFNI_READY ; 02858 if( dsar == NULL || dsar->num == 0 ){ 02859 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb , 02860 " \n" 02861 "** Can't get datasets **\n" 02862 "** from that URL! **\n " , 02863 MCW_USER_KILL | MCW_TIMER_KILL ) ; 02864 XBell( XtDisplay(w) , 100 ) ; EXRETURN ; 02865 } 02866 02867 } else { /** read one dataset **/ 02868 02869 SHOW_AFNI_PAUSE ; 02870 dset = THD_fetch_dataset( cbs->cval ) ; 02871 SHOW_AFNI_READY ; 02872 if( dset == NULL ){ 02873 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb , 02874 " \n" 02875 "** Can't get a dataset **\n" 02876 "** from that URL! **\n " , 02877 MCW_USER_KILL | MCW_TIMER_KILL ) ; 02878 XBell( XtDisplay(w) , 100 ) ; EXRETURN ; 02879 } 02880 INIT_XTARR(dsar) ; ADDTO_XTARR(dsar,dset) ; XTARR_IC(dsar,0) = IC_DSET ; 02881 } 02882 02883 /** loop over all datasets in array, place in current session **/ 02884 02885 for( nts=nds=dd=0 ; dd < dsar->num ; dd++ ){ 02886 02887 if( XTARR_IC(dsar,dd) == IC_FLIM ){ /* process a 1D file */ 02888 AFNI_add_timeseries( (MRI_IMAGE *) XTARR_XT(dsar,dd) ) ; 02889 nts++ ; continue ; 02890 } 02891 if( XTARR_IC(dsar,dd) != IC_DSET ) continue ; /* bad */ 02892 02893 dset = (THD_3dim_dataset *) XTARR_XT(dsar,dd) ; 02894 if( !ISVALID_DSET(dset) ) continue ; /* bad */ 02895 vv = dset->view_type ; 02896 nn = ss->num_dsset ; 02897 if( nn >= THD_MAX_SESSION_SIZE ){ 02898 fprintf(stderr,"\a\n*** too many anatomical datasets!\n") ; 02899 DSET_delete(dset) ; /* 01 Nov 2001 */ 02900 } else { 02901 ss->dsset[nn][vv] = dset ; 02902 ss->num_dsset++ ; nds++ ; 02903 if( vv == im3d->vinfo->view_type && na == -1 ) na = nn ; 02904 } 02905 } /* end of loop over dd=datasets in dsar */ 02906 02907 FREE_XTARR(dsar) ; 02908 02909 /*-- popup a message saying what happened --*/ 02910 02911 if( nts > 0 ) 02912 sprintf(str," \n Read %d datasets and \n" 02913 " %d timeseries from\n" 02914 " %s\n ",nds,nts,cbs->cval ) ; 02915 else 02916 sprintf(str," \n Read %d datasets from\n" 02917 " %s\n ",nds,cbs->cval ) ; 02918 02919 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb , 02920 str , MCW_USER_KILL | MCW_TIMER_KILL ) ; 02921 02922 if( nds == 0 ){ XBell(XtDisplay(w),100); EXRETURN; } 02923 02924 /*-- prepare to switch back to AFNI --*/ 02925 02926 if( na >= 0 ) im3d->vinfo->anat_num = na ; /* 1st new anat in current view */ 02927 if( nf >= 0 ) im3d->vinfo->func_num = nf ; /* 1st new func in current view */ 02928 02929 if( GLOBAL_library.have_dummy_dataset ){ 02930 UNDUMMYIZE ; 02931 if( na < 0 && ss->num_dsset > 1 ){ 02932 im3d->vinfo->anat_num = 1 ; 02933 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ){ 02934 if( ISVALID_DSET(ss->dsset[1][vv]) ){ im3d->vinfo->view_type = vv; break; } 02935 } 02936 } else if( na < 0 ){ /* should be impossible */ 02937 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb , 02938 " \n** No datasets available **\n " , 02939 MCW_USER_KILL | MCW_TIMER_KILL ) ; 02940 } 02941 } 02942 02943 AFNI_initialize_view( NULL , im3d ) ; 02944 EXRETURN ; 02945 } |
|
Definition at line 8108 of file afni_func.c. |
|
Definition at line 426 of file afni_func.c. References ADDTO_KILL, AFNI_concatenate_warp(), AFNI_copy_statistics(), THD_3dim_dataset::anat_parent, THD_3dim_dataset::anat_parent_idcode, THD_3dim_dataset::anat_parent_name, THD_datablock::atr, THD_datablock::brick, THD_datablock::brick_bytes, THD_datablock::brick_fac, THD_datablock::brick_lab, THD_diskptr::byte_order, COPY_LMAP_BOUNDS, DATABLOCK_MEM_UNDEFINED, DATABLOCK_TYPE, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, THD_3dim_dataset::death_mark, THD_diskptr::dimsizes, THD_diskptr::directory_name, THD_datablock::diskptr, DISKPTR_TYPE, DSET_HEADNAME, DSET_NUM_TIMES, DSET_unlock, THD_timeaxis::dz_sl, ENTRY, THD_3dim_dataset::func_type, GLOBAL_argopt, THD_3dim_dataset::idcode, IDENTITY_WARP, INIT_KILL, INIT_STAT_AUX, ISVALID_3DIM_DATASET, ISVALID_WARP, THD_datablock::kl, THD_3dim_dataset::kl, THD_3dim_dataset::label1, THD_3dim_dataset::label2, THD_datablock::malloc_type, THD_3dim_dataset::markers, THD_datablock::master_bytes, THD_datablock::master_ival, THD_datablock::master_nvals, MAX_STAT_AUX, MCW_new_idcode, MCW_strncpy, myXtNew, THD_datablock::natr, THD_datablock::natr_alloc, THD_timeaxis::nsl, THD_diskptr::nvals, THD_datablock::nvals, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, THD_3dim_dataset::parent, THD_datablock::parent, PARENTIZE, THD_diskptr::prefix, THD_diskptr::rank, RETURN, THD_warp::rig_bod, THD_3dim_dataset::self_name, THD_3dim_dataset::self_warp, THD_3dim_dataset::stat_aux, THD_3dim_dataset::stats, STATUS, THD_diskptr::storage_mode, STORAGE_UNDEFINED, THD_3dim_dataset::tagset, THD_warp::tal_12, THD_3dim_dataset::taxis, THD_3dim_dataset::tcat_len, THD_3dim_dataset::tcat_list, THD_3dim_dataset::tcat_num, THD_copy_datablock_auxdata(), THD_get_write_order(), THD_init_datablock_brick(), THD_init_datablock_labels(), THD_init_diskptr_names(), THD_MAX_LABEL, THD_MAX_NAME, THD_timeaxis::toff_sl, tross_Copy_History(), THD_diskptr::type, THD_datablock::type, THD_warp::type, THD_3dim_dataset::type, THD_3dim_dataset::view_type, THD_3dim_dataset::vox_warp, THD_talairach_12_warp::warp, THD_affine_warp::warp, THD_3dim_dataset::warp, AF_options::warp_4D, WARP_AFFINE_TYPE, THD_3dim_dataset::warp_parent, THD_3dim_dataset::warp_parent_idcode, THD_3dim_dataset::warp_parent_name, WARP_TALAIRACH_12_TYPE, THD_3dim_dataset::wod_daxes, THD_3dim_dataset::wod_flag, and THD_timeaxis::zorg_sl. Referenced by AFNI_make_descendants_old().
00428 { 00429 THD_3dim_dataset *new_dset ; 00430 int ii ; 00431 00432 ENTRY("AFNI_follower_dataset") ; 00433 00434 /* sanity checks */ 00435 00436 if( ! ISVALID_3DIM_DATASET(anat_parent) || 00437 ! ISVALID_3DIM_DATASET(data_parent) ) RETURN(NULL) ; 00438 00439 /* can't warp a time-dependent dataset (OK, maybe you can) */ 00440 00441 if( DSET_NUM_TIMES(data_parent) > 1 && ! GLOBAL_argopt.warp_4D ) RETURN(NULL) ; 00442 00443 if(PRINT_TRACING) 00444 { char str[256] ; 00445 sprintf(str,"anat_parent=%s data_parent=%s", 00446 DSET_HEADNAME(anat_parent) , DSET_HEADNAME(data_parent) ) ; 00447 STATUS(str); } 00448 00449 /* make new dataset, copying appropriate fields from its various parents */ 00450 00451 new_dset = myXtNew( THD_3dim_dataset ) ; INIT_KILL( new_dset->kl ) ; 00452 00453 new_dset->type = data_parent->type ; /* same data type */ 00454 new_dset->func_type = data_parent->func_type ; 00455 new_dset->view_type = anat_parent->view_type ; /* but different view type */ 00456 00457 new_dset->anat_parent = anat_parent ; /* what else makes sense? */ 00458 00459 new_dset->tagset = NULL ; /* Oct 1998 */ 00460 00461 MCW_strncpy( new_dset->anat_parent_name , 00462 anat_parent->self_name , THD_MAX_NAME ) ; 00463 00464 new_dset->anat_parent_idcode = anat_parent->idcode ; 00465 00466 /* 11/09/94 addition: the data_parent may itself be a warp; 00467 in this case, we want the true warp parent to be the original data */ 00468 00469 new_dset->warp_parent = (data_parent->warp_parent != NULL) 00470 ? (data_parent->warp_parent) : (data_parent) ; 00471 00472 MCW_strncpy( new_dset->warp_parent_name , 00473 new_dset->warp_parent->self_name , THD_MAX_NAME ) ; 00474 00475 new_dset->warp_parent_idcode = new_dset->warp_parent->idcode ; 00476 00477 new_dset->idcode = MCW_new_idcode() ; 00478 00479 /* make the actual warp from the warp_parent to this dataset */ 00480 00481 new_dset->vox_warp = NULL ; 00482 new_dset->warp = myXtNew( THD_warp ) ; 00483 *(new_dset->warp) = IDENTITY_WARP ; /* start with (Dicom) identity */ 00484 new_dset->self_warp = NULL ; /* 26 Aug 2002 */ 00485 00486 /* follow the links backward from desired view to original view */ 00487 00488 AFNI_concatenate_warp( new_dset->warp , anat_parent->warp ) ; 00489 AFNI_concatenate_warp( new_dset->warp , data_parent->warp ) ; 00490 00491 /* reset the bounds in the new warp to be the same as in the anat_parent */ 00492 00493 if( ISVALID_WARP(anat_parent->warp) && 00494 anat_parent->warp->type == new_dset->warp->type ){ 00495 00496 switch( anat_parent->warp->type ){ 00497 00498 case WARP_AFFINE_TYPE: 00499 COPY_LMAP_BOUNDS( new_dset->warp->rig_bod.warp , 00500 anat_parent->warp->rig_bod.warp ) ; 00501 break ; 00502 00503 case WARP_TALAIRACH_12_TYPE: 00504 for( ii=0 ; ii < 12 ; ii++ ) 00505 COPY_LMAP_BOUNDS( new_dset->warp->tal_12.warp[ii] , 00506 anat_parent->warp->tal_12.warp[ii] ) ; 00507 break ; 00508 } 00509 } 00510 00511 /* make up some names for this new dataset */ 00512 00513 MCW_strncpy( new_dset->self_name , 00514 new_dset->warp_parent->self_name , THD_MAX_NAME ) ; 00515 ii = strlen( new_dset->self_name ) ; 00516 new_dset->self_name[ii++] = '@' ; 00517 MCW_strncpy( &(new_dset->self_name[ii]) , 00518 VIEW_typestr[new_dset->view_type] , THD_MAX_NAME-ii ) ; 00519 00520 MCW_strncpy( new_dset->label1 , data_parent->label1 , THD_MAX_LABEL ) ; 00521 MCW_strncpy( new_dset->label2 , data_parent->label2 , THD_MAX_LABEL ) ; 00522 00523 /* set the axes for this new dataset 00524 (same as anatomy parent, since that's the meaning of this routine) */ 00525 00526 new_dset->daxes = myXtNew( THD_dataxes ) ; /* copy data axes of */ 00527 *(new_dset->daxes) = *(anat_parent->daxes) ; /* anatomy parent */ 00528 00529 new_dset->wod_daxes = NULL ; 00530 new_dset->wod_flag = True ; 00531 00532 /* 06 Aug 1996: added ability to use 3D+t datasets here */ 00533 00534 if( DSET_NUM_TIMES(data_parent) < 2 ){ 00535 new_dset->taxis = NULL ; 00536 } else { 00537 new_dset->taxis = myXtNew( THD_timeaxis ) ; /* new */ 00538 *(new_dset->taxis) = *(data_parent->taxis) ; /* copy insides */ 00539 00540 new_dset->taxis->nsl = 0 ; /* no slice stuff */ 00541 new_dset->taxis->toff_sl = NULL ; 00542 new_dset->taxis->zorg_sl = 0.0 ; 00543 new_dset->taxis->dz_sl = 0.0 ; 00544 } 00545 00546 /* create a datablock and diskptr, in case the data is ever 00547 filled into memory (instead of wod) and written to disk */ 00548 00549 new_dset->dblk = myXtNew( THD_datablock ) ; INIT_KILL( new_dset->dblk->kl ) ; 00550 00551 new_dset->dblk->type = DATABLOCK_TYPE ; 00552 new_dset->dblk->nvals = data_parent->dblk->nvals ; 00553 new_dset->dblk->malloc_type = DATABLOCK_MEM_UNDEFINED ; 00554 new_dset->dblk->natr = new_dset->dblk->natr_alloc = 0 ; 00555 new_dset->dblk->atr = NULL ; 00556 new_dset->dblk->parent = (XtPointer) new_dset ; 00557 00558 if( data_parent->dblk->brick_lab == NULL ){ 00559 THD_init_datablock_labels( new_dset->dblk ) ; /* 30 Nov 1997 */ 00560 } else { 00561 THD_copy_datablock_auxdata( data_parent->dblk , new_dset->dblk ) ; 00562 } 00563 00564 DSET_unlock(new_dset) ; /* Feb 1998 */ 00565 00566 new_dset->dblk->diskptr = myXtNew( THD_diskptr ) ; 00567 new_dset->dblk->diskptr->type = DISKPTR_TYPE ; 00568 new_dset->dblk->diskptr->nvals = data_parent->dblk->nvals ; 00569 new_dset->dblk->diskptr->rank = 3 ; 00570 new_dset->dblk->diskptr->storage_mode = STORAGE_UNDEFINED ; 00571 new_dset->dblk->diskptr->byte_order = THD_get_write_order() ; /* 25 April 1998 */ 00572 new_dset->dblk->diskptr->dimsizes[0] = new_dset->daxes->nxx ; 00573 new_dset->dblk->diskptr->dimsizes[1] = new_dset->daxes->nyy ; 00574 new_dset->dblk->diskptr->dimsizes[2] = new_dset->daxes->nzz ; 00575 00576 new_dset->dblk->brick_fac = NULL ; /* initialized below */ 00577 new_dset->dblk->brick_bytes = NULL ; 00578 new_dset->dblk->brick = NULL ; 00579 THD_init_datablock_brick( new_dset->dblk , -1 , data_parent->dblk ) ; 00580 00581 new_dset->dblk->master_nvals = 0 ; /* 11 Jan 1999 */ 00582 new_dset->dblk->master_ival = NULL ; 00583 new_dset->dblk->master_bytes = NULL ; 00584 00585 /* create the names for storage on disk (if ever) 00586 -- note we put it in the same directory as the data_parent */ 00587 00588 THD_init_diskptr_names( new_dset->dblk->diskptr , 00589 data_parent->dblk->diskptr->directory_name , NULL , 00590 data_parent->dblk->diskptr->prefix , 00591 new_dset->view_type , True ) ; 00592 00593 ADDTO_KILL( new_dset->dblk->kl , new_dset->dblk->diskptr ) ; 00594 00595 /* oh yeah, set the new_dset kill list, 00596 copy statistics if available, and NULL out any unused stuff */ 00597 00598 ADDTO_KILL( new_dset->kl , new_dset->warp ) ; 00599 ADDTO_KILL( new_dset->kl , new_dset->daxes ) ; 00600 ADDTO_KILL( new_dset->kl , new_dset->dblk ) ; 00601 00602 new_dset->stats = NULL ; 00603 AFNI_copy_statistics( data_parent , new_dset ) ; 00604 00605 INIT_STAT_AUX( new_dset , MAX_STAT_AUX , data_parent->stat_aux ) ; 00606 00607 new_dset->markers = NULL ; /* no markers */ 00608 new_dset->death_mark = 0 ; /* don't kill me! */ 00609 new_dset->tcat_list = 0 ; 00610 new_dset->tcat_num = 0 ; 00611 new_dset->tcat_len = NULL ; 00612 00613 #ifdef ALLOW_DATASET_VLIST 00614 new_dset->pts = NULL ; 00615 #endif 00616 00617 PARENTIZE(new_dset,data_parent->parent) ; 00618 00619 tross_Copy_History( data_parent , new_dset ) ; /* 18 Oct 1999 */ 00620 00621 RETURN(new_dset) ; 00622 } |
|
Definition at line 765 of file afni_func.c. References AFNI_noenv(), THD_3dim_dataset::anat_parent, DSET_HEADNAME, DSET_in_global_session(), THD_session::dsset, ENTRY, GLOBAL_library, ISANAT, ISVALID_3DIM_DATASET, ISVALID_DSET, ISVALID_SESSION, LAST_VIEW_TYPE, THD_session::lastname, THD_3dim_dataset::markers, THD_session::num_dsset, THD_marker_set::numset, AFNI_library_type::session, STATUS, and VIEW_ORIGINAL_TYPE. Referenced by AFNI_fimmer_execute(), AFNI_marks_transform_CB(), AFNI_read_inputs(), AFNI_rescan_session_NEW(), AFNI_rescan_session_OLD(), PLUTO_add_dset(), and RT_tell_afni_one().
00766 { 00767 int aa , ff , vv , apref=0 , aset=-1 ; 00768 THD_3dim_dataset *dset ; 00769 int quiet = !AFNI_noenv("AFNI_NO_ADOPTION_WARNING") ; /* 03 Dec 1999 */ 00770 int first = 1 ; 00771 00772 ENTRY("AFNI_force_adoption") ; 00773 00774 if( ! ISVALID_SESSION(ss) || ss->num_dsset == 0 ) EXRETURN ; 00775 00776 if( ss == GLOBAL_library.session ) EXRETURN ; /* 21 Dec 2001 */ 00777 00778 /* find a "preferred" parent (one with the most number of markers set) */ 00779 00780 for( aa=0 ; aa < ss->num_dsset ; aa++ ){ 00781 00782 if(PRINT_TRACING) 00783 { char str[256] ; 00784 sprintf(str,"scanning dataset %d for markers",aa) ; STATUS(str) ; } 00785 00786 dset = ss->dsset[aa][0] ; /* original view */ 00787 00788 if( ISVALID_3DIM_DATASET(dset) && /* if a good dataset */ 00789 ISANAT(dset) && /* and is anatomical */ 00790 dset->markers != NULL ){ /* and has markers */ 00791 00792 if( dset->markers->numset > aset ){ /* and has more markers than before */ 00793 apref = aa ; /* try this as our "preferred" parent */ 00794 aset = dset->markers->numset ; 00795 } 00796 } 00797 } 00798 00799 /* count potential parents [08 Dec 1999: modified from 03 Dec 1999 code] */ 00800 00801 vv = 0 ; 00802 if( aset >= 0 ){ 00803 for( aa=0 ; aa < ss->num_dsset ; aa++ ){ 00804 dset = ss->dsset[aa][0] ; 00805 if( ISVALID_DSET(dset) && 00806 ISANAT(dset) && 00807 dset->markers != NULL && dset->markers->numset >= aset ) vv++ ; 00808 } 00809 } 00810 00811 quiet = ( quiet || vv <= 1 ) ; /* be quiet if ordered, or if no alternatives */ 00812 00813 if(aset >= 0 && PRINT_TRACING) 00814 { char str[256] ; 00815 sprintf(str,"session %s: apref=%d [%s] aset=%d", 00816 ss->lastname,apref,DSET_HEADNAME(ss->dsset[apref][0]),aset) ; 00817 STATUS(str) ; } 00818 00819 /* scan through all datasets, all views */ 00820 00821 for( ff=0 ; ff < ss->num_dsset ; ff++ ){ 00822 for( vv=VIEW_ORIGINAL_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ ){ 00823 00824 dset = ss->dsset[ff][vv] ; /* function that needs parent */ 00825 00826 if( ! ISVALID_3DIM_DATASET(dset) || 00827 dset->anat_parent != NULL ) continue ; /* nothing to do */ 00828 00829 if( !do_anats && ISANAT(dset) ) continue ; /* 28 Jul 2003 */ 00830 00831 if( DSET_in_global_session(dset) ) continue ; /* 25 Dec 2001 */ 00832 00833 if( ISVALID_3DIM_DATASET(ss->dsset[apref][vv]) ){ /* if preferred is OK, */ 00834 dset->anat_parent = ss->dsset[apref][vv] ; /* use it here */ 00835 } else { 00836 for( aa=0 ; aa < ss->num_dsset ; aa++ ){ /* search for something, */ 00837 if( ISVALID_3DIM_DATASET(ss->dsset[aa][vv]) 00838 && ISANAT(ss->dsset[aa][vv]) ){ /* anything, and use it */ 00839 dset->anat_parent = ss->dsset[aa][vv] ; break ; 00840 } 00841 } 00842 } 00843 00844 if( !quiet && dset->anat_parent != NULL && dset->anat_parent != dset ){ 00845 if( first ){ 00846 first = 0 ; 00847 fprintf(stderr, 00848 "\nDatasets with a 'forced adoption' of anat parent:\n") ; 00849 } 00850 fprintf(stderr, 00851 " %s gets parent %s\n", 00852 DSET_HEADNAME(dset) , 00853 DSET_HEADNAME(dset->anat_parent) ) ; 00854 } 00855 } 00856 } 00857 00858 EXRETURN ; 00859 } |
|
Make a functional overlay -- very simple routine at present; n = slice index , br_fim = data structure to extract slice from. Note that imseq requires that the overlay be an image of shorts. This routine requires that the function and threshold images be bytes, shorts, or floats (complex-valued functional images are not supported). (The underlay image may be any legal type; this image is not used here.) ------------------------------------------------------------------------- Definition at line 937 of file afni_func.c. References AFNI_CALL_0D_function, AFNI_CALL_2D_function, AFNI_GOOD_FUNC_DTYPE, AFNI_newfunc_overlay(), AFNI_reset_func_range(), AFNI_set_valabel(), AFNI_yesenv(), MCW_pbar::bigbot, MCW_pbar::bigcolor, MCW_pbar::bigmode, MCW_pbar::bigtop, FD_brick::dset, DSET_BRICK_FACTOR, DSET_load, DSET_NVALS, MRI_IMAGE::dx, MRI_IMAGE::dy, ENTRY, FD_warp_to_mri(), AFNI_view_info::fim_autorange, AFNI_view_info::fim_index, Three_D_View::fim_now, AFNI_view_info::fim_range, AFNI_widget_set::func, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, AFNI_view_info::func_val, ind, AFNI_function_widgets::inten_pbar, KILL_1MRI, MRI_IMAGE::kind, LOAD_DSET_VIEWS, MRI_BYTE_PTR, mri_copy(), mri_edgize(), MRI_FLOAT_PTR, mri_free(), mri_maxabs(), mri_new(), mri_rgb_transform_nD(), MRI_SHORT_PTR, mri_threshold(), mri_to_float(), MRI_TYPE_NAME, NPANE_MAX, MCW_pbar::num_panes, MRI_IMAGE::nvox, MRI_IMAGE::nx, MRI_IMAGE::ny, MCW_pbar::ov_index, FD_brick::parent, AFNI_function_widgets::pbar_transform0D_func, AFNI_function_widgets::pbar_transform2D_func, MCW_pbar::pval, RETURN, AFNI_view_info::stats_func_ok, AFNI_view_info::stats_thresh_ok, STATUS, AFNI_view_info::thr_index, AFNI_view_info::thr_val, AFNI_view_info::use_posfunc, Three_D_View::vinfo, Three_D_View::vwid, and ZREJ. Referenced by AFNI_overlay().
00938 { 00939 Three_D_View *im3d ; 00940 MRI_IMAGE *im_thr , *im_fim , *im_ov ; 00941 short *ar_ov ; 00942 short fim_ovc[NPANE_MAX+1] ; 00943 int npix , ii , lp , num_lp , ival ; 00944 float scale_factor , scale_thr ; 00945 MCW_pbar *pbar ; 00946 int simult_thr , need_thr ; 00947 int reject_zero = !AFNI_yesenv("AFNI_OVERLAY_ZERO") ; /* 20 Apr 2005 */ 00948 00949 ENTRY("AFNI_func_overlay") ; 00950 00951 /* sanity check */ 00952 00953 if( br_fim == NULL || n < 0 ) RETURN(NULL) ; /* nothing to do */ 00954 00955 im3d = (Three_D_View *) br_fim->parent ; 00956 00957 ival = im3d->vinfo->thr_index ; /* threshold sub-brick index */ 00958 00959 /* get the component images */ 00960 00961 LOAD_DSET_VIEWS(im3d) ; /* 02 Nov 1996 */ 00962 00963 need_thr = im3d->vinfo->func_threshold > 0.0 ; 00964 00965 /* 29 Mar 2005: make sure statistics of overlay dataset are ready */ 00966 00967 DSET_load( im3d->fim_now ) ; 00968 if( !im3d->vinfo->stats_func_ok || (!im3d->vinfo->stats_thresh_ok && need_thr) ) 00969 AFNI_reset_func_range( im3d ) ; 00970 00971 /* get the threshold image? */ 00972 00973 if( need_thr ){ 00974 STATUS("fetch im_thr") ; 00975 im_thr = FD_warp_to_mri( n , ival , br_fim ) ; 00976 } else{ 00977 STATUS("don't need im_thr") ; 00978 im_thr = NULL ; 00979 } 00980 00981 #if 1 00982 scale_thr = 1.0f ; /* FD_warp_to_mri() already scales this */ 00983 #else 00984 scale_thr = DSET_BRICK_FACTOR(br_fim->dset,ival) ; 00985 if( scale_thr == 0.0f ) scale_thr = 1.0f ; 00986 #endif 00987 00988 /* get function image */ 00989 00990 { int ind ; 00991 00992 ind = im3d->vinfo->fim_index ; 00993 if( ind >= DSET_NVALS(br_fim->dset) ) 00994 ind = DSET_NVALS(br_fim->dset) - 1 ; 00995 00996 if( im_thr != NULL && ind == ival ){ /* 06 Feb 2003: allow for */ 00997 STATUS("copy im_thr to im_fim") ; 00998 im_fim = mri_copy( im_thr ) ; /* func image = thr image */ 00999 } else { 01000 STATUS("fetch im_fim") ; 01001 im_fim = FD_warp_to_mri( n, ind, br_fim ) ; /* get func image */ 01002 } 01003 scale_factor = im3d->vinfo->fim_range ; 01004 if( scale_factor == 0.0 ) scale_factor = im3d->vinfo->fim_autorange ; 01005 if( scale_factor == 0.0 ) scale_factor = 1.0 ; 01006 01007 AFNI_set_valabel( br_fim , n , im_fim , im3d->vinfo->func_val ) ; 01008 } 01009 01010 /* 04 Mar 2003: convert thresh to float if its datum is unacceptable */ 01011 /* 21 Dec 2004: also allow RGB images as threshold via this mechanism */ 01012 01013 if( im_thr != NULL && !(im_thr->kind == MRI_float || 01014 im_thr->kind == MRI_short || 01015 im_thr->kind == MRI_byte ) ){ 01016 01017 MRI_IMAGE *qim = mri_to_float(im_thr) ; 01018 STATUS("scaled im_thr to floats") ; 01019 mri_free(im_thr) ; im_thr = qim ; scale_thr = 1.0f ; 01020 } 01021 01022 AFNI_set_valabel( br_fim , n , im_thr , im3d->vinfo->thr_val ) ; 01023 01024 /* if component images not good, quit now */ 01025 01026 if( im_fim == NULL ){ 01027 STATUS("couldn't get Func image!") ; 01028 KILL_1MRI(im_thr) ; RETURN(NULL) ; 01029 } 01030 01031 /* 15 Apr 2002: allow overlay image to be pure RBG (no colorscale) */ 01032 /* 20 Dec 2004: allow thresholding of RGB overlays */ 01033 01034 if( im_fim->kind == MRI_rgb ){ /* 15 Apr 2002: RGB overlays */ 01035 01036 if( im_thr != NULL && im_thr != im_fim ){ /* 20 Dec 2004: threshold */ 01037 float thresh = im3d->vinfo->func_threshold 01038 * im3d->vinfo->func_thresh_top / scale_thr ; 01039 mri_threshold( -thresh,thresh , im_thr , im_fim ) ; /* in place */ 01040 } 01041 01042 /* 27 Apr 2005: transform RGB func image in place? */ 01043 01044 mri_rgb_transform_nD( im_fim, 0, im3d->vwid->func->pbar_transform0D_func ); 01045 mri_rgb_transform_nD( im_fim, 2, im3d->vwid->func->pbar_transform2D_func ); 01046 01047 if( im_thr != im_fim ) KILL_1MRI(im_thr) ; /* toss the trash */ 01048 RETURN(im_fim) ; 01049 } 01050 01051 if( ! AFNI_GOOD_FUNC_DTYPE(im_fim->kind) ){ /* should never happen! */ 01052 MRI_IMAGE *qim = mri_to_float(im_fim) ; /* (but fix it if it does) */ 01053 STATUS("had to convert im_fim to floats?????") ; 01054 mri_free(im_fim) ; im_fim = qim ; 01055 } 01056 01057 /* 15 Jun 2000: transformation of functional image? */ 01058 01059 if( im3d->vwid->func->pbar_transform0D_func != NULL ){ 01060 MRI_IMAGE *tim = mri_to_float(im_fim) ; 01061 STATUS("transform0D of im_fim") ; 01062 #if 0 01063 im3d->vwid->func->pbar_transform0D_func( tim->nvox , MRI_FLOAT_PTR(tim) ) ; 01064 #else 01065 AFNI_CALL_0D_function( im3d->vwid->func->pbar_transform0D_func , 01066 tim->nvox , MRI_FLOAT_PTR(tim) ) ; 01067 #endif 01068 if( im_fim != im_thr ) mri_free(im_fim) ; 01069 im_fim = tim ; 01070 } 01071 01072 if( im3d->vwid->func->pbar_transform2D_func != NULL ){ 01073 MRI_IMAGE *tim = mri_to_float(im_fim) ; 01074 STATUS("transform2D of im_fim") ; 01075 #if 0 01076 im3d->vwid->func->pbar_transform2D_func( tim->nx, tim->ny, 01077 tim->dx, tim->dy, 01078 MRI_FLOAT_PTR(tim) ) ; 01079 #else 01080 AFNI_CALL_2D_function( im3d->vwid->func->pbar_transform2D_func , 01081 tim->nx, tim->ny, tim->dx, tim->dy, MRI_FLOAT_PTR(tim) ) ; 01082 #endif 01083 if( im_fim != im_thr ) mri_free(im_fim) ; 01084 im_fim = tim ; 01085 } 01086 01087 pbar = im3d->vwid->func->inten_pbar ; 01088 01089 /** 30 Jan 2003: 01090 if the pbar is in "big" mode, 01091 then create an RGB overlay in a separate function **/ 01092 01093 if( pbar->bigmode ){ 01094 float thresh ; 01095 thresh = im3d->vinfo->func_threshold 01096 * im3d->vinfo->func_thresh_top / scale_thr ; 01097 01098 if( PRINT_TRACING && im_thr != NULL ) 01099 { char str[256] ; float tmax ; 01100 sprintf(str,"im_thr: nx=%d ny=%d kind=%s", 01101 im_thr->nx,im_thr->ny,MRI_TYPE_NAME(im_thr)) ; STATUS(str) ; 01102 tmax = (float)mri_maxabs(im_thr) ; 01103 sprintf(str,"maxabs(im_thr)=%g scale_thr=%g thresh=%g",tmax,scale_thr,thresh); 01104 STATUS(str) ; 01105 sprintf(str,"func_threshold=%g func_thresh_top=%g", 01106 im3d->vinfo->func_threshold,im3d->vinfo->func_thresh_top); STATUS(str); 01107 } 01108 01109 im_ov = AFNI_newfunc_overlay( im_thr , thresh , 01110 im_fim , 01111 scale_factor*pbar->bigbot , 01112 scale_factor*pbar->bigtop , 01113 pbar->bigcolor ) ; 01114 goto CLEANUP ; 01115 } 01116 01117 /** create output image the old way (indexes into overlay colors) **/ 01118 01119 npix = im_fim->nx * im_fim->ny ; 01120 im_ov = mri_new( im_fim->nx , im_fim->ny , MRI_short ) ; 01121 ar_ov = MRI_SHORT_PTR( im_ov ) ; 01122 01123 /* set overlay colors */ 01124 01125 num_lp = pbar->num_panes ; 01126 01127 for( lp=0 ; lp < num_lp ; lp++ ) fim_ovc[lp] = pbar->ov_index[lp] ; 01128 01129 fim_ovc[num_lp] = (im3d->vinfo->use_posfunc) ? (0) : (fim_ovc[num_lp-1]) ; 01130 01131 /** process im_fim into overlay, depending on data type **/ 01132 01133 simult_thr = (im_thr != NULL) && /* do threshold */ 01134 (im3d->vinfo->func_threshold > 0.0) && /* simultaneously? */ 01135 (im_fim->kind == im_thr->kind) ; /* (July 15, 1996) */ 01136 01137 switch( im_fim->kind ){ 01138 01139 default: /* should not happen! */ 01140 if( im_thr != im_fim ) mri_free(im_thr) ; 01141 mri_free(im_fim) ; mri_free(im_ov) ; 01142 STATUS("bad im_fim->kind!") ; 01143 RETURN(NULL) ; 01144 01145 case MRI_short:{ 01146 short *ar_fim = MRI_SHORT_PTR(im_fim) ; 01147 float fim_thr[NPANE_MAX] ; /* 13 Nov 1996: changed from short */ 01148 01149 for( lp=0 ; lp < num_lp ; lp++ ) 01150 fim_thr[lp] = scale_factor * pbar->pval[lp+1] ; 01151 01152 if( simult_thr ){ 01153 float thresh = im3d->vinfo->func_threshold 01154 * im3d->vinfo->func_thresh_top / scale_thr ; 01155 short *ar_thr = MRI_SHORT_PTR(im_thr) ; 01156 for( ii=0 ; ii < npix ; ii++ ){ 01157 if( (ar_thr[ii] > -thresh && ar_thr[ii] < thresh) || ZREJ(ar_fim[ii]) ){ 01158 ar_ov[ii] = 0 ; 01159 } else { 01160 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/ 01161 ar_ov[ii] = fim_ovc[lp] ; 01162 } 01163 } 01164 } else { 01165 for( ii=0 ; ii < npix ; ii++ ){ 01166 if( ZREJ(ar_fim[ii]) ){ 01167 ar_ov[ii] = 0 ; 01168 } else { 01169 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/ 01170 ar_ov[ii] = fim_ovc[lp] ; 01171 } 01172 } 01173 } 01174 } 01175 break ; 01176 01177 case MRI_byte:{ 01178 byte *ar_fim = MRI_BYTE_PTR(im_fim) ; 01179 float fim_thr[NPANE_MAX] ; /* 13 Nov 1996: changed from short */ 01180 01181 for( lp=0 ; lp < num_lp ; lp++ ) 01182 fim_thr[lp] = (pbar->pval[lp+1] > 0.0) ? scale_factor*pbar->pval[lp+1] 01183 : 0.0 ; 01184 01185 if( simult_thr ){ 01186 float thresh = im3d->vinfo->func_threshold 01187 * im3d->vinfo->func_thresh_top / scale_thr ; 01188 byte *ar_thr = MRI_BYTE_PTR(im_thr) ; 01189 01190 for( ii=0 ; ii < npix ; ii++ ){ 01191 if( ar_thr[ii] < thresh || ZREJ(ar_fim[ii]) ){ 01192 ar_ov[ii] = 0 ; 01193 } else { 01194 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/ 01195 ar_ov[ii] = fim_ovc[lp] ; 01196 } 01197 } 01198 } else { 01199 for( ii=0 ; ii < npix ; ii++ ){ 01200 if( ZREJ(ar_fim[ii]) ){ 01201 ar_ov[ii] = 0 ; 01202 } else { 01203 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/ 01204 ar_ov[ii] = fim_ovc[lp] ; 01205 } 01206 } 01207 } 01208 } 01209 break ; 01210 01211 case MRI_float:{ 01212 float *ar_fim = MRI_FLOAT_PTR(im_fim) ; 01213 float fim_thr[NPANE_MAX] ; 01214 01215 for( lp=0 ; lp < num_lp ; lp++ ) 01216 fim_thr[lp] = scale_factor * pbar->pval[lp+1] ; 01217 01218 if( simult_thr ){ 01219 float thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ; 01220 float *ar_thr = MRI_FLOAT_PTR(im_thr) ; 01221 01222 for( ii=0 ; ii < npix ; ii++ ){ 01223 if( (ar_thr[ii] > -thresh && ar_thr[ii] < thresh) || ZREJ(ar_fim[ii]) ){ 01224 ar_ov[ii] = 0 ; 01225 } else { 01226 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/ 01227 ar_ov[ii] = fim_ovc[lp] ; 01228 } 01229 } 01230 } else { 01231 for( ii=0 ; ii < npix ; ii++ ){ 01232 if( ZREJ(ar_fim[ii]) ){ 01233 ar_ov[ii] = 0 ; 01234 } else { 01235 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/ 01236 ar_ov[ii] = fim_ovc[lp] ; 01237 } 01238 } 01239 } 01240 } 01241 break ; 01242 } 01243 01244 /** if have yet to do threshold, clip the overlay **/ 01245 01246 if( im_thr != NULL && im3d->vinfo->func_threshold > 0.0 && !simult_thr ){ 01247 01248 switch( im_thr->kind ){ 01249 01250 case MRI_short:{ 01251 float thresh = im3d->vinfo->func_threshold 01252 * im3d->vinfo->func_thresh_top / scale_thr ; 01253 short *ar_thr = MRI_SHORT_PTR(im_thr) ; 01254 01255 for( ii=0 ; ii < npix ; ii++ ) 01256 if( ar_thr[ii] > -thresh && ar_thr[ii] < thresh ) ar_ov[ii] = 0 ; 01257 } 01258 break ; 01259 01260 case MRI_byte:{ 01261 float thresh = im3d->vinfo->func_threshold 01262 * im3d->vinfo->func_thresh_top / scale_thr ; 01263 byte *ar_thr = MRI_BYTE_PTR(im_thr) ; 01264 01265 for( ii=0 ; ii < npix ; ii++ ) 01266 if( ar_thr[ii] < thresh ) ar_ov[ii] = 0 ; 01267 } 01268 break ; 01269 01270 case MRI_float:{ 01271 float thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ; 01272 float *ar_thr = MRI_FLOAT_PTR(im_thr) ; 01273 01274 for( ii=0 ; ii < npix ; ii++ ) 01275 if( ar_thr[ii] > -thresh && ar_thr[ii] < thresh ) ar_ov[ii] = 0 ; 01276 } 01277 break ; 01278 } 01279 } 01280 01281 /* delete the overlay if it contains nothing */ 01282 01283 for( ii=0 ; ii < npix ; ii++ ) if( ar_ov[ii] != 0 ) break ; 01284 if( ii == npix ) KILL_1MRI(im_ov) ; /* no nonzero values --> no overlay */ 01285 01286 /** time to trot, Bwana **/ 01287 01288 CLEANUP: 01289 if( im_thr != NULL && im_thr != im_fim ) mri_free( im_thr ) ; 01290 mri_free( im_fim ) ; 01291 01292 /* 21 Mar 2005: Hollow out overlay? */ 01293 01294 if( AFNI_yesenv("AFNI_EDGIZE_OVERLAY") ) mri_edgize(im_ov) ; 01295 01296 RETURN(im_ov) ; 01297 } |
|
Definition at line 3442 of file afni_func.c. References AFNI_modify_viewing(), AFNI_widget_set::dmode, DMODE_BRICK_BVAL, ENTRY, AFNI_view_info::force_func_wod, AFNI_datamode_widgets::funcmode_bbox, IM3D_VALID, MCW_val_bbox(), RESET_AFNI_QUIT, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, AFNI_view_info::tempflag, Three_D_View::vinfo, and Three_D_View::vwid.
03443 { 03444 Three_D_View *im3d = (Three_D_View *) cd ; 03445 int old_val , new_val ; 03446 THD_fvec3 fv ; 03447 THD_ivec3 iv ; 03448 03449 ENTRY("AFNI_funcmode_CB") ; 03450 03451 if( ! IM3D_VALID(im3d) ) EXRETURN ; 03452 03453 old_val = 1 << im3d->vinfo->force_func_wod ; 03454 new_val = MCW_val_bbox( im3d->vwid->dmode->funcmode_bbox ) ; 03455 03456 if(PRINT_TRACING){ 03457 char str[256] ; sprintf(str,"old_val=%d new_val=%d",old_val,new_val) ; 03458 STATUS(str) ; } 03459 03460 if( new_val != old_val ){ 03461 im3d->vinfo->force_func_wod = (new_val != DMODE_BRICK_BVAL) ; 03462 SHOW_AFNI_PAUSE ; 03463 im3d->vinfo->tempflag = 1 ; /* 15 Mar 2000 */ 03464 AFNI_modify_viewing( im3d , True ) ; /* redisplay */ 03465 SHOW_AFNI_READY ; 03466 } 03467 03468 RESET_AFNI_QUIT(im3d) ; 03469 EXRETURN ; 03470 } |
|
Definition at line 7912 of file afni_func.c. |
|
add files we found to list * Definition at line 8196 of file afni_func.c. |
|
Definition at line 248 of file afni_func.c. References AV_fval_to_char(), MCW_pbar::bigfac, MCW_pbar::bigmode, ENTRY, MCW_register_hint(), MCW_pbar::num_panes, MCW_pbar::panes, MCW_pbar::pval, sb, and top. Referenced by AFNI_drive_set_pbar_all(), AFNI_inten_pbar_CB(), AFNI_range_bbox_CB(), RCREND_choose_av_CB(), RCREND_color_pbar_CB(), RCREND_finalize_func_CB(), RCREND_range_av_CB(), RCREND_range_bbox_CB(), REND_choose_av_CB(), REND_color_pbar_CB(), REND_finalize_func_CB(), REND_range_av_CB(), and REND_range_bbox_CB().
00249 { 00250 int ip , np ; 00251 Widget w ; 00252 char sbot[16],stop[16] , hint[64] , *sb,*st ; 00253 float bot , top ; 00254 00255 ENTRY("AFNI_hintize_pbar") ; 00256 00257 if( pbar == NULL || fac == 0.0 ) EXRETURN ; /* bad */ 00258 00259 if( pbar->bigmode ){ 00260 MCW_register_hint( pbar->panes[0] , 00261 "Button-1=flip; Button-3=menu" ) ; 00262 pbar->bigfac = fac ; /* 11 Feb 2003 */ 00263 } else { 00264 np = pbar->num_panes ; 00265 for( ip=0 ; ip < np ; ip++ ){ 00266 w = pbar->panes[ip] ; /* the widget for the ip-th pane */ 00267 top = pbar->pval[ip] * fac ; /* scaled top value */ 00268 bot = pbar->pval[ip+1] * fac ; /* scaled bot value */ 00269 AV_fval_to_char( bot , sbot ) ; /* convert to a nice string */ 00270 AV_fval_to_char( top , stop ) ; 00271 sb = (sbot[0] == ' ') ? sbot+1 : sbot ; /* skip leading blanks */ 00272 st = (stop[0] == ' ') ? stop+1 : stop ; 00273 sprintf(hint,"%s .. %s",sb,st) ; /* create hint */ 00274 MCW_register_hint( w , hint ) ; /* send to hint system */ 00275 } 00276 } 00277 00278 EXRETURN ; 00279 } |
|
Definition at line 4303 of file afni_func.c. References drive_MCW_imseq(), ENTRY, IM3D_VALID, isqDR_clearstat, Three_D_View::s123, Three_D_View::s231, and Three_D_View::s312. Referenced by PLUTO_dset_redisplay_mode().
04304 { 04305 04306 ENTRY("AFNI_imseq_clearstat") ; 04307 04308 if( ! IM3D_VALID(im3d) ) EXRETURN ; 04309 04310 if( im3d->s123 != NULL ) 04311 drive_MCW_imseq( im3d->s123 , isqDR_clearstat , NULL ) ; 04312 04313 if( im3d->s231 != NULL ) 04314 drive_MCW_imseq( im3d->s231 , isqDR_clearstat , NULL ) ; 04315 04316 if( im3d->s312 != NULL ) 04317 drive_MCW_imseq( im3d->s312 , isqDR_clearstat , NULL ) ; 04318 04319 EXRETURN ; 04320 } |
|
load the values for the current pane count * Definition at line 389 of file afni_func.c. References AFNI_inten_pbar_CB(), alter_MCW_pbar(), MCW_pbar::bigmode, FIX_SCALE_SIZE, HIDE_SCALE, MCW_arrowval::ival, MCW_pbar::mode, NORMAL_cursorize, NPANE_MAX, MCW_pbar::num_panes, MCW_pbar::panew, MCW_pbar::parent, PBAR_set_bigmode(), pmax, pmin, POPUP_cursorize, and MCW_pbar::pval_save.
00390 { 00391 MCW_pbar *pbar = (MCW_pbar *) cd ; 00392 Three_D_View *im3d = (Three_D_View *) pbar->parent ; 00393 00394 HIDE_SCALE(im3d) ; 00395 if( av->ival > NPANE_MAX ){ 00396 int npane=pbar->num_panes , jm=pbar->mode ; 00397 float pmax=pbar->pval_save[npane][0][jm] , 00398 pmin=pbar->pval_save[npane][npane][jm] ; 00399 PBAR_set_bigmode( pbar , 1 , pmin,pmax ) ; 00400 AFNI_inten_pbar_CB( pbar , im3d , 0 ) ; 00401 POPUP_cursorize( pbar->panew ) ; /* 08 Apr 2005 */ 00402 } else { 00403 pbar->bigmode = 0 ; 00404 alter_MCW_pbar( pbar , av->ival , NULL ) ; 00405 NORMAL_cursorize( pbar->panew ) ; /* 08 Apr 2005 */ 00406 } 00407 FIX_SCALE_SIZE(im3d) ; 00408 } |
|
Definition at line 410 of file afni_func.c. References MCW_arrowval::ival, and NPANE_MAX.
|
|
Definition at line 4536 of file afni_func.c. References AFNI_inten_pbar_CB(), AFNI_redisplay_func(), alter_MCW_pbar(), AV_assign_ival(), MCW_pbar::bigmode, MCW_pbar::bigset, ENTRY, FIX_SCALE_SIZE, AFNI_widget_set::func, HIDE_SCALE, IM3D_VALID, AFNI_function_widgets::inten_av, AFNI_function_widgets::inten_bbox, AFNI_function_widgets::inten_pbar, MCW_val_bbox(), MCW_pbar::mode, MCW_pbar::npan_save, NPANE_MAX, MCW_pbar::num_panes, PBAR_MODEBUT, PBAR_MODEPOS, PBAR_set_bigmode(), pmax, pmin, MCW_pbar::pval_save, AFNI_view_info::use_posfunc, Three_D_View::vinfo, Three_D_View::vwid, and MCW_bbox::wbut. Referenced by AFNI_drive_set_pbar_sign().
04537 { 04538 Three_D_View *im3d = (Three_D_View *) cd ; 04539 Boolean new_pos ; 04540 int jm ; 04541 MCW_pbar *pbar ; 04542 04543 ENTRY("AFNI_inten_bbox_CB") ; 04544 04545 if( ! IM3D_VALID(im3d) || 04546 w != im3d->vwid->func->inten_bbox->wbut[PBAR_MODEBUT] ) EXRETURN ; 04547 04548 new_pos = (MCW_val_bbox(im3d->vwid->func->inten_bbox) & PBAR_MODEPOS) != 0 ; 04549 04550 if( new_pos != im3d->vinfo->use_posfunc ){ /* new button value */ 04551 04552 im3d->vinfo->use_posfunc = new_pos ; /* record for later use */ 04553 04554 pbar = im3d->vwid->func->inten_pbar ; 04555 jm = pbar->mode = (new_pos) ? 1 : 0 ; /* pbar mode */ 04556 04557 /* re-panel the pbar befitting its new mode */ 04558 04559 HIDE_SCALE(im3d) ; 04560 if( pbar->bigmode ){ /* 30 Jan 2003 */ 04561 int npane=pbar->num_panes ; 04562 float pmax=pbar->pval_save[npane][0][jm] , 04563 pmin=pbar->pval_save[npane][npane][jm] ; 04564 pbar->bigset = 0 ; 04565 PBAR_set_bigmode( pbar , 1 , pmin,pmax ) ; 04566 AFNI_inten_pbar_CB( pbar , im3d , 0 ) ; 04567 } else { 04568 alter_MCW_pbar( pbar , pbar->npan_save[jm] , NULL ) ; 04569 } 04570 FIX_SCALE_SIZE(im3d) ; 04571 04572 /* set the count on the pbar control arrowval to match */ 04573 04574 if( pbar->bigmode ) 04575 AV_assign_ival( im3d->vwid->func->inten_av, NPANE_MAX+1 ) ; 04576 else 04577 AV_assign_ival( im3d->vwid->func->inten_av, pbar->npan_save[jm] ) ; 04578 04579 AFNI_redisplay_func( im3d ) ; 04580 } 04581 04582 EXRETURN ; 04583 } |
|
Definition at line 286 of file afni_func.c. References AFNI_hintize_pbar(), AFNI_pbar_lock_carryout(), AFNI_redisplay_func(), ENTRY, AFNI_view_info::fim_autorange, AFNI_view_info::fim_range, AFNI_view_info::func_visible, IM3D_VALID, and Three_D_View::vinfo. Referenced by AFNI_drive_set_pbar_all(), AFNI_drive_set_pbar_number(), AFNI_inten_av_CB(), AFNI_inten_bbox_CB(), AFNI_set_pbar_top_CB(), and RCREND_color_bbox_CB().
00287 { 00288 Three_D_View *im3d = (Three_D_View *) cd ; 00289 float fac ; 00290 00291 ENTRY("AFNI_inten_pbar_CB") ; 00292 00293 if( ! IM3D_VALID(im3d) ) EXRETURN ; 00294 00295 if( im3d->vinfo->func_visible ) 00296 AFNI_redisplay_func( im3d ) ; 00297 00298 AFNI_hintize_pbar( pbar , 00299 (im3d->vinfo->fim_range != 0.0) ? im3d->vinfo->fim_range 00300 : im3d->vinfo->fim_autorange ) ; 00301 00302 FIX_SCALE_SIZE(im3d) ; 00303 00304 AFNI_pbar_lock_carryout(im3d) ; /* 07 Feb 2004 */ 00305 EXRETURN ; 00306 } |
|
Definition at line 659 of file afni_func.c. References AFNI_make_descendants_old(), VIEW_ACPCALIGNED_TYPE, and VIEW_ORIGINAL_TYPE. Referenced by AFNI_fimmer_execute(), AFNI_marks_transform_CB(), AFNI_read_inputs(), AFNI_rescan_session_NEW(), AFNI_rescan_session_OLD(), PLUTO_add_dset(), and RT_tell_afni_one().
00660 { 00661 AFNI_make_descendants_old( ssl , VIEW_ORIGINAL_TYPE ) ; 00662 #if 0 00663 AFNI_make_descendants_old( ssl , VIEW_ACPCALIGNED_TYPE ) ; /* doesn't work */ 00664 #endif 00665 return ; 00666 } |
|
In this routine, each occurence of vbase was originally VIEW_ORIGINAL_TYPE * Definition at line 670 of file afni_func.c. References AFNI_follower_dataset(), THD_3dim_dataset::anat_parent, THD_slist_find::dset, DSET_in_global_session(), THD_slist_find::dset_index, THD_session::dsset, ENTRY, FIND_IDCODE, FIND_NAME, GLOBAL_library, THD_3dim_dataset::idcode, ISFUNC, ISVALID_3DIM_DATASET, ISVALID_SESSION, ISVALID_SESSIONLIST, LAST_VIEW_TYPE, THD_session::num_dsset, THD_sessionlist::num_sess, THD_3dim_dataset::self_name, THD_slist_find::sess_index, AFNI_library_type::session, THD_sessionlist::ssar, STATUS, THD_dset_in_sessionlist(), and THD_slist_find::view_index. Referenced by AFNI_make_descendants().
00671 { 00672 int iss , jdd , kvv , num_made=0 ; 00673 THD_session *ss ; 00674 THD_3dim_dataset *orig_dset , *new_dset ; 00675 THD_slist_find find ; 00676 THD_3dim_dataset **anat_parent_row , **orig_row ; 00677 00678 ENTRY("AFNI_make_descendants_old") ; 00679 00680 if( ! ISVALID_SESSIONLIST(ssl) ) EXRETURN ; 00681 00682 /* loop over each session */ 00683 00684 for( iss=0 ; iss < ssl->num_sess ; iss++ ){ 00685 ss = ssl->ssar[iss] ; 00686 if( !ISVALID_SESSION(ss) ) continue ; /* no good ==> skip */ 00687 00688 if( ss == GLOBAL_library.session ) continue ; /* 21 Dec 2001 */ 00689 00690 /* loop over datasets in this session */ 00691 00692 for( jdd=0 ; jdd < ss->num_dsset ; jdd++ ){ 00693 orig_dset = ss->dsset[jdd][vbase] ; /* 03 Jun 98 */ 00694 if( !ISVALID_3DIM_DATASET(orig_dset) || /* no good */ 00695 orig_dset->anat_parent == NULL || /* no parent */ 00696 orig_dset->anat_parent == orig_dset ) continue ; /* ==> skip */ 00697 00698 if( DSET_in_global_session(orig_dset) ) continue ; /* 25 Dec 2001 */ 00699 00700 /* look for orig_dset's anat parent in this sessionlist */ 00701 00702 find = THD_dset_in_sessionlist( FIND_IDCODE , 00703 &(orig_dset->anat_parent->idcode) , 00704 ssl , iss ) ; 00705 if( find.dset == NULL ) 00706 find = THD_dset_in_sessionlist( FIND_NAME , 00707 orig_dset->anat_parent->self_name , 00708 ssl , iss ) ; 00709 00710 /* check for a good find; if it doesn't happen, 00711 then skip (this eventuality should never occur!) */ 00712 00713 if( find.dset == NULL || 00714 ISFUNC(find.dset) || /* anat parent can't be a func! */ 00715 find.view_index != vbase ) continue ; 00716 00717 /* make a pointer to the row of datasets of the anat 00718 parent (this is like the SPGR row in the picture above) */ 00719 00720 anat_parent_row = 00721 &(ssl->ssar[find.sess_index]->dsset[find.dset_index][0]) ; 00722 00723 /* pointer to row of datasets being operated on now 00724 (like the FIM row in the picture above) */ 00725 00726 orig_row = &(ss->dsset[jdd][0]) ; 00727 00728 if( orig_row == anat_parent_row ) continue ; /* 14 Dec 1999 */ 00729 00730 /* loop over downstream dataset positions (from orig_dset); 00731 those that don't exist yet, but have entries in the 00732 anat_parent_row can be brought into being now */ 00733 00734 for( kvv=vbase+1 ; kvv <= LAST_VIEW_TYPE ; kvv++ ){ 00735 if( orig_row[kvv] != NULL ) continue ; 00736 if( anat_parent_row[kvv] == NULL ) continue ; 00737 00738 orig_row[kvv] = AFNI_follower_dataset( anat_parent_row[kvv] , 00739 orig_dset ) ; 00740 num_made ++ ; 00741 } 00742 } /* end of loop over datasets in this session */ 00743 00744 } /* end of loop over sessions */ 00745 00746 if(PRINT_TRACING) 00747 { char str[256] ; 00748 sprintf(str,"total # descendants made = %d",num_made) ; 00749 STATUS(str) ; } 00750 00751 EXRETURN ; 00752 } |
|
Definition at line 2362 of file afni_func.c. References AFNI_close_file_dialog_CB(), Three_D_View::dc, MCW_DC::display, ENTRY, AFNI_widget_set::file_cb, AFNI_widget_set::file_cd, AFNI_widget_set::file_dialog, AFNI_widget_set::file_sbox, MCW_hotcolor(), MCW_set_widget_bg(), STATUS, AFNI_widget_set::top_shell, and Three_D_View::vwid. Referenced by AFNI_pbar_CB(), AFNI_read_1D_CB(), and AFNI_read_sess_CB().
02363 { 02364 02365 ENTRY("AFNI_make_file_dialog") ; 02366 02367 /*** make a new dialog? ***/ 02368 02369 if( im3d->vwid->file_dialog == NULL ){ 02370 XmString oklabel , cancellabel ; 02371 02372 STATUS("creating new dialog") ; 02373 02374 im3d->vwid->file_dialog = 02375 XtVaCreatePopupShell( 02376 "menu" , xmDialogShellWidgetClass , im3d->vwid->top_shell , 02377 XmNtitle , "GPL AFNI" , 02378 XmNdeleteResponse , XmDO_NOTHING , 02379 XmNinitialResourcesPersistent , False , 02380 NULL ) ; 02381 02382 XmAddWMProtocolCallback( /* make "Close" window menu work */ 02383 im3d->vwid->file_dialog , 02384 XmInternAtom( im3d->dc->display , "WM_DELETE_WINDOW" , False ) , 02385 AFNI_close_file_dialog_CB , (XtPointer) im3d ) ; 02386 02387 /** change button labels to conform to other AFNI dialogs **/ 02388 02389 oklabel = XmStringCreateLtoR( "Set" , XmFONTLIST_DEFAULT_TAG ) ; 02390 cancellabel = XmStringCreateLtoR( "Quit" , XmFONTLIST_DEFAULT_TAG ) ; 02391 02392 im3d->vwid->file_sbox = 02393 XtVaCreateManagedWidget( 02394 "menu" , xmFileSelectionBoxWidgetClass , im3d->vwid->file_dialog , 02395 XmNfileTypeMask , XmFILE_ANY_TYPE , 02396 XmNcancelLabelString , cancellabel , 02397 XmNokLabelString , oklabel , 02398 XmNtraversalOn , False , 02399 XmNinitialResourcesPersistent , False , 02400 NULL ) ; 02401 02402 XmStringFree(oklabel) ; XmStringFree(cancellabel) ; 02403 02404 im3d->vwid->file_cb = NULL ; 02405 im3d->vwid->file_cd = NULL ; 02406 02407 #if 1 02408 { Widget www ; 02409 www = XmFileSelectionBoxGetChild( im3d->vwid->file_sbox , 02410 XmDIALOG_TEXT ) ; 02411 if( www != NULL ) MCW_set_widget_bg( www , MCW_hotcolor(www) , 0 ) ; 02412 } 02413 #endif 02414 02415 } else if( im3d->vwid->file_cb != NULL ){ 02416 02417 STATUS("re-initializing old dialog") ; 02418 02419 /*** re-initialize an old dialog to have no callbacks ***/ 02420 02421 XtRemoveCallback( im3d->vwid->file_sbox , XmNokCallback , 02422 im3d->vwid->file_cb , im3d->vwid->file_cd ) ; 02423 02424 XtRemoveCallback( im3d->vwid->file_sbox , XmNcancelCallback , 02425 im3d->vwid->file_cb , im3d->vwid->file_cd ) ; 02426 02427 XtRemoveCallback( im3d->vwid->file_sbox , XmNhelpCallback , 02428 im3d->vwid->file_cb , im3d->vwid->file_cd ) ; 02429 02430 XtVaSetValues( im3d->vwid->file_sbox , XmNpattern,NULL , NULL ) ; 02431 02432 im3d->vwid->file_cb = NULL ; 02433 im3d->vwid->file_cd = NULL ; 02434 } 02435 02436 EXRETURN ; 02437 } |
|
force return of unscaled slices for output * Definition at line 4205 of file afni_func.c. References THD_3dim_dataset::anat_parent, THD_3dim_dataset::death_mark, DOOMED, DSET_MARK_FOR_DEATH, THD_session::dsset, ENTRY, FIRST_VIEW_TYPE, ISVALID_3DIM_DATASET, ISVALID_SESSION, ISVALID_SESSIONLIST, LAST_VIEW_TYPE, THD_session::num_dsset, THD_sessionlist::num_sess, THD_sessionlist::ssar, STATUS, and THD_3dim_dataset::warp_parent. Referenced by AFNI_marks_transform_CB(), and AFNI_rescan_session_OLD().
04206 { 04207 int iss , jdd , kvv , num_marked=0 ; 04208 THD_session *ss ; 04209 THD_3dim_dataset *dset ; 04210 04211 ENTRY("AFNI_mark_for_death") ; 04212 04213 if( ! ISVALID_SESSIONLIST(ssl) ) EXRETURN ; 04214 04215 /* loop over each session */ 04216 04217 for( iss=0 ; iss < ssl->num_sess ; iss++ ){ 04218 ss = ssl->ssar[iss] ; 04219 if( !ISVALID_SESSION(ss) ) continue ; /* no good ==> skip */ 04220 04221 /* loop over datasets in this session */ 04222 04223 for( jdd=0 ; jdd < ss->num_dsset ; jdd++ ){ 04224 for( kvv=FIRST_VIEW_TYPE ; kvv <= LAST_VIEW_TYPE ; kvv++ ){ 04225 04226 dset = ss->dsset[jdd][kvv] ; 04227 04228 if( ISVALID_3DIM_DATASET(dset) && /* good dset */ 04229 dset->anat_parent != NULL && /* has parent */ 04230 dset->anat_parent->death_mark == DOOMED && /* parent dies */ 04231 dset->warp_parent != NULL ){ /* is a warp child */ 04232 04233 DSET_MARK_FOR_DEATH(dset) ; 04234 num_marked ++ ; 04235 } 04236 } 04237 } 04238 } /* end of loop over sessions */ 04239 04240 #ifdef AFNI_DEBUG 04241 { char str[256] ; 04242 sprintf(str,"total # descendants marked = %d",num_marked) ; 04243 STATUS(str) ; } 04244 #endif 04245 04246 EXRETURN ; 04247 } |
|
04 May 2005: customize width to this dataset * Definition at line 4799 of file afni_func.c. References AFNI_init_niml(), AFNI_init_plugouts(), AFNI_purge_dsets(), AFNI_set_viewpoint(), Three_D_View::anat_now, Bool, AFNI_widget_set::butx, AFNI_widget_set::buty, AFNI_library_type::controllers, DATABLOCK_MEM_MALLOC, DATABLOCK_MEM_MMAP, DATABLOCK_MEM_SHARED, THD_3dim_dataset::dblk, DBLK_LOCKED, AFNI_library_type::dc, Three_D_View::dc, MCW_DC::display, AFNI_widget_set::dmode, DSET_ARRAY, ENTRY, ENV_init(), F1D_init(), F2D_init(), Three_D_View::fim_now, free, GLOBAL_library, AFNI_library_type::hints_on, IM3D_OPEN, IM3D_VALID, AFNI_widget_set::imag, malloc, THD_datablock::malloc_type, MAX_CONTROLLERS, MCW_hint_toggle(), mcw_malloc_dump(), MCW_MALLOC_enabled, MCW_popup_message(), MCW_set_bbox(), MCW_set_widget_label(), MCW_TIMER_KILL, MCW_USER_KILL, MCW_val_bbox(), MCW_widget_geom(), AFNI_datamode_widgets::misc_1dchain_pb, AFNI_datamode_widgets::misc_2dchain_pb, AFNI_datamode_widgets::misc_anat_info_pb, AFNI_datamode_widgets::misc_dumpmalloc_pb, AFNI_datamode_widgets::misc_environ_pb, AFNI_datamode_widgets::misc_func_info_pb, AFNI_datamode_widgets::misc_hints_bbox, AFNI_datamode_widgets::misc_hints_pb, AFNI_datamode_widgets::misc_license_pb, AFNI_datamode_widgets::misc_niml_pb, AFNI_datamode_widgets::misc_plugout_pb, AFNI_datamode_widgets::misc_purge_pb, AFNI_datamode_widgets::misc_readme_env_pb, AFNI_datamode_widgets::misc_showmalloc_pb, AFNI_datamode_widgets::misc_tracing_pb, AFNI_datamode_widgets::misc_vcheck_pb, AFNI_datamode_widgets::misc_voxind_bbox, AFNI_datamode_widgets::misc_voxind_pb, AFNI_datamode_widgets::misc_writeownsize_bbox, AFNI_datamode_widgets::misc_writeownsize_pb, new_MCW_textwin(), pclose, PLUG_setup_widgets(), PLUTO_cursorize, popen, REDISPLAY_OVERLAY, RWC_visibilize_widget(), THD_datablock::shm_idint, AFNI_view_info::show_voxind, STATUS, TEXT_READONLY, THD_dataset_info(), THD_zzprintf(), AFNI_imaging_widgets::topper, Three_D_View::vinfo, Three_D_View::vwid, and AFNI_view_info::writeownsize. Referenced by AFNI_imag_pop_CB(), and AFNI_pbar_CB().
04800 { 04801 Three_D_View *im3d = (Three_D_View *) cd ; 04802 XmAnyCallbackStruct *cbs = (XmAnyCallbackStruct *) cbd ; 04803 04804 ENTRY("AFNI_misc_CB") ; 04805 04806 if( !IM3D_OPEN(im3d) || w == NULL ) EXRETURN ; 04807 04808 /*.........................................................*/ 04809 04810 if( w == im3d->vwid->dmode->misc_voxind_pb ){ 04811 im3d->vinfo->show_voxind = MCW_val_bbox(im3d->vwid->dmode->misc_voxind_bbox); 04812 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ; 04813 } 04814 04815 /*.........................................................*/ 04816 04817 #ifndef DONT_USE_HINTS 04818 else if( w == im3d->vwid->dmode->misc_hints_pb ){ 04819 int val = MCW_val_bbox(im3d->vwid->dmode->misc_hints_bbox) ; 04820 if( val != GLOBAL_library.hints_on ){ 04821 int ii ; Three_D_View *qq3d ; 04822 MCW_hint_toggle() ; GLOBAL_library.hints_on = val ; 04823 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){ /* this loop: */ 04824 qq3d = GLOBAL_library.controllers[ii] ; /* 07 Aug 1999 */ 04825 if( IM3D_VALID(qq3d) ) 04826 MCW_set_bbox( qq3d->vwid->dmode->misc_hints_bbox , val ) ; 04827 } 04828 } 04829 } 04830 #endif 04831 04832 /*.........................................................*/ 04833 04834 else if( w == im3d->vwid->dmode->misc_anat_info_pb ){ 04835 char *inf ; 04836 STATUS("getting anat info") ; 04837 inf = THD_dataset_info( im3d->anat_now , 0 ) ; 04838 if( inf != NULL ){ 04839 if( DSET_ARRAY(im3d->anat_now,0) == NULL ){ 04840 inf = THD_zzprintf( inf , "\n*** Not loaded into memory.\n") ; 04841 } else if( im3d->anat_now->dblk->malloc_type == DATABLOCK_MEM_MALLOC ){ 04842 if( DBLK_LOCKED(im3d->anat_now->dblk) ) 04843 inf = THD_zzprintf( inf , "\n*** Locked into memory using malloc.\n") ; 04844 else 04845 inf = THD_zzprintf( inf , "\n*** Loaded into memory using malloc.\n") ; 04846 } else if( im3d->anat_now->dblk->malloc_type == DATABLOCK_MEM_MMAP ){ 04847 inf = THD_zzprintf( inf , "\n*** Loaded into memory using mmap.\n") ; 04848 } else if( im3d->anat_now->dblk->malloc_type == DATABLOCK_MEM_SHARED ){ 04849 inf = THD_zzprintf( inf , "\n*** Loaded into shared memory segment %d.\n", 04850 im3d->anat_now->dblk->shm_idint) ; 04851 } 04852 (void) new_MCW_textwin( im3d->vwid->imag->topper , inf , TEXT_READONLY ) ; 04853 free(inf) ; 04854 } else 04855 XBell( im3d->dc->display , 100 ) ; 04856 } 04857 04858 /*.........................................................*/ 04859 04860 else if( w == im3d->vwid->dmode->misc_func_info_pb ){ 04861 char *inf ; 04862 STATUS("getting func info") ; 04863 inf = THD_dataset_info( im3d->fim_now , 0 ) ; 04864 STATUS("got func info") ; 04865 if( inf != NULL ){ 04866 if( DSET_ARRAY(im3d->fim_now,0) == NULL ){ 04867 inf = THD_zzprintf( inf , "\n*** Not loaded into memory.\n") ; 04868 } else if( im3d->fim_now->dblk->malloc_type == DATABLOCK_MEM_MALLOC ){ 04869 if( DBLK_LOCKED(im3d->fim_now->dblk) ) 04870 inf = THD_zzprintf( inf , "\n*** Locked into memory using malloc.\n") ; 04871 else 04872 inf = THD_zzprintf( inf , "\n*** Loaded into memory using malloc.\n") ; 04873 } else if( im3d->fim_now->dblk->malloc_type == DATABLOCK_MEM_MMAP ){ 04874 inf = THD_zzprintf( inf , "\n*** Loaded into memory using mmap.\n") ; 04875 } else if( im3d->fim_now->dblk->malloc_type == DATABLOCK_MEM_SHARED ){ 04876 inf = THD_zzprintf( inf , "\n*** Loaded into shared memory segment %d.\n", 04877 im3d->fim_now->dblk->shm_idint) ; 04878 } 04879 (void) new_MCW_textwin( im3d->vwid->imag->topper , inf , TEXT_READONLY ) ; 04880 free(inf) ; 04881 } else 04882 XBell( im3d->dc->display , 100 ) ; 04883 } 04884 04885 /*.........................................................*/ 04886 04887 else if( w == im3d->vwid->dmode->misc_license_pb ){ /* 03 Dec 2000 */ 04888 #include "license.h" 04889 char *inf = NULL ; int ii ; 04890 04891 for( ii=0 ; license[ii] != NULL ; ii++ ) 04892 inf = THD_zzprintf( inf , "%s" , license[ii] ) ; 04893 (void) new_MCW_textwin( im3d->vwid->imag->topper , inf , TEXT_READONLY ) ; 04894 free(inf) ; 04895 } 04896 04897 /*.........................................................*/ 04898 04899 else if( w == im3d->vwid->dmode->misc_readme_env_pb ){ /* 05 Aug 2004 */ 04900 #include "readme_env.h" 04901 char *inf = NULL ; int ii ; 04902 04903 for( ii=0 ; readme_env[ii] != NULL ; ii++ ) 04904 inf = THD_zzprintf( inf , "%s" , readme_env[ii] ) ; 04905 (void) new_MCW_textwin( im3d->vwid->imag->topper , inf , TEXT_READONLY ) ; 04906 free(inf) ; 04907 } 04908 04909 /*.........................................................*/ 04910 04911 else if( w == im3d->vwid->dmode->misc_vcheck_pb ){ /* 11 Jan 2000 */ 04912 FILE *fp = popen( "afni_vcheck" , "r" ) ; 04913 if( fp == NULL ){ 04914 (void) MCW_popup_message( im3d->vwid->imag->topper , 04915 " \n" 04916 "* Cannot execute *\n" 04917 "* afni_vcheck! *\n" , 04918 MCW_USER_KILL | MCW_TIMER_KILL ) ; 04919 XBell( im3d->dc->display , 100 ) ; 04920 } else { 04921 #define ISIZE 1024 04922 char *info=(char *)malloc(sizeof(char)*ISIZE) ; int ninfo ; 04923 strcpy(info," \n Output of Program afni_vcheck \n" 04924 " ---------------------------------\n \n" ) ; 04925 ninfo = strlen(info) ; 04926 while( fgets(info+ninfo,ISIZE-ninfo,fp) != NULL ){ 04927 ninfo = strlen(info) ; 04928 if( ninfo >= ISIZE-2 ) break ; 04929 } 04930 pclose(fp) ; 04931 (void) MCW_popup_message( im3d->vwid->imag->topper , info , 04932 MCW_USER_KILL | MCW_TIMER_KILL ) ; 04933 free(info) ; 04934 } 04935 } 04936 04937 /*.........................................................*/ 04938 04939 else if( w == im3d->vwid->dmode->misc_purge_pb ){ 04940 AFNI_purge_dsets( 1 ) ; 04941 } 04942 04943 /*.........................................................*/ 04944 04945 #ifdef USE_TRACING 04946 else if( w == im3d->vwid->dmode->misc_tracing_pb ){ 04947 DBG_trace = (DBG_trace + 1) % 3 ; /* Aug 23 1998: cycle between 0,1,2 */ 04948 MCW_set_widget_label( im3d->vwid->dmode->misc_tracing_pb, DBG_label ) ; /* 01 Aug 1999 */ 04949 04950 XSynchronize( im3d->dc->display, (Bool)(DBG_trace==2) ) ; /* 01 Dec 1999 */ 04951 if( DBG_trace == 2 ) STATUS("XSynchronize enabled") ; 04952 else STATUS("XSynchronize disabled") ; 04953 } 04954 #endif 04955 04956 /*.........................................................*/ 04957 04958 #ifdef USING_MCW_MALLOC /* 07 Mar 1999 */ 04959 else if( MCW_MALLOC_enabled && w == im3d->vwid->dmode->misc_showmalloc_pb ){ 04960 MCHECK ; 04961 } 04962 04963 else if( MCW_MALLOC_enabled && w == im3d->vwid->dmode->misc_dumpmalloc_pb ){ 04964 mcw_malloc_dump() ; 04965 } 04966 #endif 04967 04968 /*.........................................................*/ 04969 04970 #ifdef USE_WRITEOWNSIZE 04971 else if( w == im3d->vwid->dmode->misc_writeownsize_pb ){ 04972 im3d->vinfo->writeownsize = MCW_val_bbox( im3d->vwid->dmode->misc_writeownsize_bbox ) ; 04973 } 04974 #endif 04975 04976 /*.........................................................*/ 04977 04978 #ifdef ALLOW_PLUGINS 04979 else if( w == im3d->vwid->dmode->misc_environ_pb ){ /* 20 Jun 2000 */ 04980 static PLUGIN_interface *plint=NULL ; 04981 Widget wpop ; 04982 04983 /* first time in: create interface like a plugin */ 04984 04985 if( plint == NULL ){ 04986 plint = ENV_init() ; 04987 if( plint == NULL ){ XBell(im3d->dc->display,100); EXRETURN; } 04988 PLUG_setup_widgets( plint , GLOBAL_library.dc ) ; 04989 } 04990 04991 /* code below is from PLUG_startup_plugin_CB() in afni_plugin.c */ 04992 04993 plint->im3d = im3d ; 04994 XtVaSetValues( plint->wid->shell , 04995 XmNtitle , "AFNI Environmentalism", /* top of window */ 04996 XmNiconName , "Green AFNI" , /* label on icon */ 04997 NULL ) ; 04998 PLUTO_cursorize( plint->wid->shell ) ; 04999 05000 /*-- if possible, find where this popup should go --*/ 05001 05002 wpop = plint->wid->shell ; 05003 05004 if( cbs != NULL && cbs->event != NULL 05005 && cbs->event->type == ButtonRelease ){ 05006 05007 XButtonEvent *xev = (XButtonEvent *) cbs->event ; 05008 int xx = (int)xev->x_root , yy = (int)xev->y_root ; 05009 int ww,hh , sw,sh ; 05010 05011 MCW_widget_geom( wpop , &ww,&hh , NULL,NULL ) ; 05012 sw = WidthOfScreen (XtScreen(wpop)) ; 05013 sh = HeightOfScreen(XtScreen(wpop)) ; 05014 05015 if( xx+ww+3 >= sw && ww <= sw ) xx = sw-ww ; 05016 if( yy+hh+3 >= sh && hh <= sh ) yy = sh-hh ; 05017 05018 XtVaSetValues( wpop , XmNx , xx , XmNy , yy , NULL ) ; 05019 } else if( im3d->vwid->butx >= 0 && im3d->vwid->buty >= 0 ){ 05020 XtVaSetValues( wpop , 05021 XmNx , im3d->vwid->butx , 05022 XmNy , im3d->vwid->buty , NULL ) ; /* 17 May 2005 */ 05023 } 05024 05025 /*-- popup widgets --*/ 05026 05027 XtMapWidget( wpop ) ; /* after this, is up to user */ 05028 RWC_visibilize_widget( wpop ) ; 05029 } 05030 05031 /*.........................................................*/ 05032 05033 else if( w == im3d->vwid->dmode->misc_1dchain_pb ){ /* 07 Aug 2001 */ 05034 static PLUGIN_interface *plint=NULL ; 05035 Widget wpop ; 05036 05037 /* first time in: create interface like a plugin */ 05038 05039 if( plint == NULL ){ 05040 plint = F1D_init() ; 05041 if( plint == NULL ){ XBell(im3d->dc->display,100); EXRETURN; } 05042 PLUG_setup_widgets( plint , GLOBAL_library.dc ) ; 05043 } 05044 05045 if( cbs == NULL ) EXRETURN ; /* only for a setup call */ 05046 05047 /* code below is from PLUG_startup_plugin_CB() in afni_plugin.c */ 05048 05049 plint->im3d = im3d ; 05050 XtVaSetValues( plint->wid->shell , 05051 XmNtitle , "AFNI 1DChain Function", /* top of window */ 05052 XmNiconName , "1DChain" , /* label on icon */ 05053 NULL ) ; 05054 PLUTO_cursorize( plint->wid->shell ) ; 05055 05056 /*-- if possible, find where this popup should go --*/ 05057 05058 wpop = plint->wid->shell ; 05059 05060 if( cbs->event != NULL && cbs->event->type == ButtonRelease ){ 05061 05062 XButtonEvent *xev = (XButtonEvent *) cbs->event ; 05063 int xx = (int)xev->x_root , yy = (int)xev->y_root ; 05064 int ww,hh , sw,sh ; 05065 05066 MCW_widget_geom( wpop , &ww,&hh , NULL,NULL ) ; 05067 sw = WidthOfScreen (XtScreen(wpop)) ; 05068 sh = HeightOfScreen(XtScreen(wpop)) ; 05069 05070 if( xx+ww+3 >= sw && ww <= sw ) xx = sw-ww ; 05071 if( yy+hh+3 >= sh && hh <= sh ) yy = sh-hh ; 05072 05073 XtVaSetValues( wpop , XmNx , xx , XmNy , yy , NULL ) ; 05074 } 05075 05076 /*-- popup widgets --*/ 05077 05078 XtMapWidget( wpop ) ; /* after this, is up to user */ 05079 RWC_visibilize_widget( wpop ) ; 05080 } 05081 05082 /*.........................................................*/ 05083 05084 else if( w == im3d->vwid->dmode->misc_2dchain_pb ){ /* 20 Jun 2000 */ 05085 static PLUGIN_interface *plint=NULL ; 05086 Widget wpop ; 05087 05088 /* first time in: create interface like a plugin */ 05089 05090 if( plint == NULL ){ 05091 plint = F2D_init() ; 05092 if( plint == NULL ){ XBell(im3d->dc->display,100); EXRETURN; } 05093 PLUG_setup_widgets( plint , GLOBAL_library.dc ) ; 05094 } 05095 05096 if( cbs == NULL ) EXRETURN ; /* only for a setup call */ 05097 05098 /* code below is from PLUG_startup_plugin_CB() in afni_plugin.c */ 05099 05100 plint->im3d = im3d ; 05101 XtVaSetValues( plint->wid->shell , 05102 XmNtitle , "AFNI 2DChain Function", /* top of window */ 05103 XmNiconName , "2DChain" , /* label on icon */ 05104 NULL ) ; 05105 PLUTO_cursorize( plint->wid->shell ) ; 05106 05107 /*-- if possible, find where this popup should go --*/ 05108 05109 wpop = plint->wid->shell ; 05110 05111 if( cbs->event != NULL && cbs->event->type == ButtonRelease ){ 05112 05113 XButtonEvent *xev = (XButtonEvent *) cbs->event ; 05114 int xx = (int)xev->x_root , yy = (int)xev->y_root ; 05115 int ww,hh , sw,sh ; 05116 05117 MCW_widget_geom( wpop , &ww,&hh , NULL,NULL ) ; 05118 sw = WidthOfScreen (XtScreen(wpop)) ; 05119 sh = HeightOfScreen(XtScreen(wpop)) ; 05120 05121 if( xx+ww+3 >= sw && ww <= sw ) xx = sw-ww ; 05122 if( yy+hh+3 >= sh && hh <= sh ) yy = sh-hh ; 05123 05124 XtVaSetValues( wpop , XmNx , xx , XmNy , yy , NULL ) ; 05125 } 05126 05127 /*-- popup widgets --*/ 05128 05129 XtMapWidget( wpop ) ; /* after this, is up to user */ 05130 RWC_visibilize_widget( wpop ) ; 05131 } 05132 05133 /*.........................................................*/ 05134 05135 else if( w == im3d->vwid->dmode->misc_plugout_pb ){ /* 07 Nov 2001 */ 05136 AFNI_init_plugouts() ; 05137 XtSetSensitive(w,False) ; 05138 } 05139 #endif /* ALLOW_PLUGINS */ 05140 05141 else if( w == im3d->vwid->dmode->misc_niml_pb ){ /* 02 Mar 2002 */ 05142 AFNI_init_niml() ; 05143 XtSetSensitive(w,False) ; 05144 } 05145 05146 /*.........................................................*/ 05147 05148 /****----- Get Outta Here -----****/ 05149 05150 EXRETURN ; 05151 } 05152 05153 #ifdef USE_HIDDEN 05154 05155 /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 05156 May 1995: Hidden popup menu stuff 05157 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ 05158 05159 #ifndef ALLOW_PLUGINS 05160 # undef WANT_RWCOX_IMAGE 05161 #endif 05162 05163 #ifdef WANT_RWCOX_IMAGE 05164 void RWCOX_popper(void) ; 05165 #endif 05166 05167 #ifdef USE_SKIT 05168 void SKIT_popper( Three_D_View * ) ; 05169 #endif 05170 05171 static int num_poem = 0 ; /* 15 Oct 2003 */ 05172 static char **fname_poem=NULL ; 05173 static void AFNI_find_poem_files(void) ; 05174 05175 /*--------------------------------------------------------------- 05176 Callback for all actions in the hidden popup 05177 -----------------------------------------------------------------*/ 05178 05179 void AFNI_hidden_CB( Widget w , XtPointer cd , XtPointer cbs ) 05180 { 05181 Three_D_View *im3d = (Three_D_View *)cd ; 05182 05183 ENTRY("AFNI_hidden_CB") ; 05184 05185 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 05186 05187 #ifdef ALLOW_DATASET_VLIST 05188 /****----- Read points -----****/ 05189 05190 if( w == im3d->vwid->prog->hidden_readpts_ijk_pb || 05191 w == im3d->vwid->prog->hidden_readpts_xyz_pb ){ 05192 05193 im3d->vwid->prog->hidden_code = 05194 (w == im3d->vwid->prog->hidden_readpts_ijk_pb) ? PTS_READ_IJK 05195 : PTS_READ_XYZ ; 05196 05197 POPDOWN_ovcolor_chooser ; 05198 05199 MCW_choose_string( im3d->vwid->picture , 05200 05201 (im3d->vwid->prog->hidden_code == PTS_READ_IJK) 05202 ? "Enter IJK input filename:" 05203 : "Enter XYZ input filename:" , 05204 05205 NULL , AFNI_hidden_pts_CB , cd ) ; 05206 } 05207 05208 /****----- Write points -----****/ 05209 05210 else if( w == im3d->vwid->prog->hidden_writepts_ijk_pb || 05211 w == im3d->vwid->prog->hidden_writepts_xyz_pb ){ 05212 05213 if( im3d->anat_now->pts == NULL || im3d->anat_now->pts->num <= 0 ){ 05214 (void) MCW_popup_message( im3d->vwid->picture , 05215 "No points to write out!" , 05216 MCW_USER_KILL | MCW_TIMER_KILL ) ; 05217 XBell( im3d->dc->display , 100 ) ; 05218 EXRETURN ; 05219 } 05220 05221 POPDOWN_ovcolor_chooser ; 05222 05223 im3d->vwid->prog->hidden_code = 05224 (w == im3d->vwid->prog->hidden_writepts_ijk_pb) ? PTS_WRITE_IJK 05225 : PTS_WRITE_XYZ ; 05226 05227 MCW_choose_string( im3d->vwid->picture , 05228 05229 (im3d->vwid->prog->hidden_code == PTS_WRITE_IJK) 05230 ? "Enter IJK output filename:" 05231 : "Enter XYZ output filename:" , 05232 05233 NULL , AFNI_hidden_pts_CB , cd ) ; 05234 } 05235 05236 /****----- Show points -----****/ 05237 05238 else if( w == im3d->vwid->prog->hidden_colorpts_pb ){ 05239 05240 POPDOWN_string_chooser ; 05241 05242 im3d->vwid->prog->hidden_code = PTS_SET_COLOR ; 05243 05244 MCW_choose_ovcolor( im3d->vwid->picture , 05245 im3d->dc , 05246 im3d->vinfo->pts_color , 05247 AFNI_hidden_pts_CB , cd ) ; 05248 } 05249 #endif /* ALLOW_DATASET_VLIST */ 05250 05251 /****----- Mission Statement -----****/ 05252 05253 if( w == im3d->vwid->prog->hidden_mission_pb ){ 05254 (void) MCW_popup_message( im3d->vwid->picture , 05255 " \n" 05256 " AFNI Mission Statement\n" 05257 " ----------------------\n" 05258 " To empower neuroscientists\n" 05259 " to perform their own state-\n" 05260 " of-the-art data analyses and\n" 05261 " visualizations, so they will \n" 05262 " stop bugging me with their\n" 05263 " pitiful 'quick questions'.\n " , 05264 MCW_USER_KILL | MCW_TIMER_KILL ) ; 05265 } 05266 05267 else if( w == im3d->vwid->prog->hidden_gamberi_pb ){ 05268 AFNI_speak( "The Rime of the Gamberi Cattivi" , 0 ) ; 05269 (void) MCW_popup_message( im3d->vwid->imag->topper , 05270 " \n" 05271 " The Rime of the Ancient Gamberi Cattivi\n" 05272 " (with apologies to Coleridge and Dante)\n" 05273 " -----------------------------------------\n\n" 05274 " Illuminato dal sole toscano,\n" 05275 " volsi lo sguardo all'orizzonte;\n" 05276 " nel mare bagnavo la mano,\n" 05277 " e al cielo volgevo la fronte.\n" 05278 " \n" 05279 " D'improvviso dal mare schiumante,\n" 05280 " due gamberi killer cattivi si avvicinarono.\n" 05281 " Uno stiletto mi poser d'innante,\n" 05282 " mentre i lunghi baffi neri si accarezzavano.\n" 05283 " \n" 05284 " Il piu giovane ordino:\n" 05285 " \"La macchina fotografica dalla giacca sgancia!\"\n" 05286 " mentre la lama premeva forte la guancia.\n" 05287 " Prima di dichiarare \"Del Governo e proprieta,\n" 05288 " sul mio corpo il nemico passar dovra!\",\n" 05289 " il gambero malvagio nella bocca la camera si fionda\n" 05290 " e del Tirreno scuro e profondo ritorna a prender l'onda.\n" 05291 " \n" 05292 " Roberto Cox \"il Magnifico\" di Milwaukee e il dottor Emiliano\n" 05293 " corrono al grido di Ziad, ma e tutto invano.\n" 05294 " \n" 05295 " Ai nostri eroi non resta che accettare l'accaduto,\n" 05296 " e a tutta Italia AFNI e SUMA insegnare.\n" 05297 " Scusateci se lo stile e un po' caduto,\n" 05298 " ma e la scusa per l'anno prossimo a Pisa ritornare.\n" , 05299 MCW_USER_KILL ) ; 05300 } 05301 05302 else if( w == im3d->vwid->prog->hidden_ranpoem_pb ){ 05303 static int *dold=NULL, ndold=0 ; int qq,dd ; 05304 char *poem ; 05305 05306 if( num_poem < 0 ) EXRETURN ; 05307 if( num_poem == 0 ){ 05308 AFNI_find_poem_files() ; 05309 if( num_poem <= 0 ){ num_poem = -1 ; EXRETURN ; } 05310 } 05311 if( ndold == 0 && num_poem > 1 ){ 05312 ndold = num_poem/2 ; 05313 dold = (int *) malloc(sizeof(int)*ndold) ; 05314 for( qq=0 ; qq < ndold ; qq++ ) dold[qq] = -1 ; 05315 } 05316 Retry_dd: 05317 dd = (lrand48() >> 8) % num_poem ; /* pick random file */ 05318 if( num_poem > 1 ){ /* check if used recently */ 05319 for( qq=0 ; qq < ndold && dold[qq] != dd ; qq++ ) ; /* nada */ 05320 if( qq < ndold ) goto Retry_dd ; /* was recent */ 05321 for( qq=1 ; qq < ndold ; qq++ ) /* wasn't, so save in list */ 05322 dold[qq-1] = dold[qq] ; 05323 dold[ndold-1] = dd ; 05324 } 05325 poem = AFNI_suck_file( fname_poem[dd] ) ; 05326 if( poem == NULL ) EXRETURN ; 05327 (void) MCW_popup_message( im3d->vwid->imag->topper, poem, MCW_USER_KILL ); 05328 free( poem ) ; 05329 } 05330 05331 /*------ Faces! [17 Dec 2004] -----*/ 05332 05333 else if( w == im3d->vwid->prog->hidden_faces_pb && w != NULL ){ 05334 05335 AFNI_faceup() ; 05336 } 05337 05338 /*------ Browser [22 Apr 2005] -----*/ 05339 05340 else if( w == im3d->vwid->prog->hidden_browser_pb && w != NULL ){ 05341 05342 system("open http://afni.nimh.nih.gov/afni") ; 05343 } 05344 05345 /*------- random speaking --------*/ 05346 05347 else if( w == im3d->vwid->prog->hidden_speech_pb && w != NULL ){ 05348 static char *words[] = { "What do you want?" , 05349 "Nice to see you" , 05350 "Words fail me now" , 05351 "I do not know what to say" , 05352 "How are you feeling?" , 05353 "Do you like, afnee?" , 05354 "Do you use ess, pee, emm?" , 05355 "Do you use eff, ess, ell?" , 05356 "Exercise your hippocampus daily" 05357 } ; 05358 if( AFNI_noenv("AFNI_SPEECH") ) 05359 XBell( im3d->dc->display , 100 ) ; 05360 else { 05361 static int nold=-1 ; 05362 int nn = sizeof(words)/sizeof(char *) , jj ; 05363 do{ jj = lrand48()%nn ; } while( jj == nold ) ; 05364 AFNI_speak( words[jj] , 1 ) ; nold = jj ; 05365 } 05366 } 05367 05368 /****----- Get Outta Here -----****/ 05369 05370 EXRETURN ; 05371 } 05372 05373 /*--------------------------------------------------------------------------*/ 05374 05375 static void AFNI_find_poem_files(void) /* 15 Oct 2003 */ 05376 { 05377 char *epath , *elocal , *eee ; 05378 char edir[THD_MAX_NAME] , **ename ; 05379 int epos , ll , ii , id , npoem , nx,ny , nep ; 05380 char **fpoem ; 05381 05382 ENTRY("AFNI_find_poem_files") ; 05383 05384 if( num_poem != 0 ) EXRETURN ; /* should never happen */ 05385 05386 /*----- get path to search -----*/ 05387 05388 epath = getenv("AFNI_PLUGINPATH") ; 05389 if( epath == NULL ) epath = getenv("AFNI_PLUGIN_PATH") ; 05390 if( epath == NULL ) epath = getenv("PATH") ; 05391 if( epath == NULL ){ num_poem=-1; EXRETURN ; } 05392 05393 /*----- copy path list into local memory -----*/ 05394 05395 ll = strlen(epath) ; 05396 elocal = AFMALL( char, sizeof(char) * (ll+2) ) ; 05397 05398 /*----- put a blank at the end -----*/ 05399 05400 strcpy( elocal , epath ) ; elocal[ll] = ' ' ; elocal[ll+1] = '\0' ; 05401 05402 /*----- replace colons with blanks -----*/ 05403 05404 for( ii=0 ; ii < ll ; ii++ ) 05405 if( elocal[ii] == ':' ) elocal[ii] = ' ' ; 05406 05407 05408 /*----- extract blank delimited strings; 05409 use as directory names to look for files -----*/ 05410 05411 ename = (char **) malloc(sizeof(char *)*2) ; 05412 ename[0] = (char *) malloc(THD_MAX_NAME) ; 05413 ename[1] = (char *) malloc(THD_MAX_NAME) ; 05414 05415 epos = 0 ; 05416 05417 do{ 05418 ii = sscanf( elocal+epos , "%s%n" , edir , &id ); /* next substring */ 05419 if( ii < 1 ) break ; /* none -> done */ 05420 05421 /** check if edir occurs earlier in elocal **/ 05422 05423 eee = strstr( elocal , edir ) ; 05424 if( eee != NULL && (eee-elocal) < epos ){ epos += id ; continue ; } 05425 05426 epos += id ; /* char after last scanned */ 05427 05428 ii = strlen(edir) ; /* make sure name has */ 05429 if( edir[ii-1] != '/' ){ /* a trailing '/' on it */ 05430 edir[ii] = '/' ; edir[ii+1] = '\0' ; 05431 } 05432 strcpy(ename[0],edir) ; 05433 strcat(ename[0],"poem_*.txt") ; /* add filename pattern */ 05434 nep = 1 ; 05435 05436 MCW_file_expand( nep,ename, &npoem , &fpoem ); /* find files that match */ 05437 if( npoem <= 0 ) continue ; /* no files found */ 05438 05439 /** add files we found to list **/ 05440 05441 if( fname_poem == NULL ) 05442 fname_poem = (char **)malloc(sizeof(char *)*npoem) ; 05443 else 05444 fname_poem = (char **)realloc(fname_poem,sizeof(char *)*(num_poem+npoem)); 05445 05446 for( ii=0 ; ii < npoem ; ii++ ) 05447 fname_poem[num_poem++] = strdup(fpoem[ii]) ; 05448 05449 MCW_free_expand( npoem , fpoem ) ; 05450 05451 } while( epos < ll ) ; /* scan until 'epos' is after end of epath */ 05452 05453 free(elocal) ; free(ename[0]) ; free(ename[1]) ; free(ename) ; 05454 05455 if( num_poem == 0 ) num_poem = -1 ; 05456 EXRETURN ; 05457 } 05458 05459 /*----------------------------------------------------------------- 05460 Event handler to find #3 button press for hidden popup 05461 -------------------------------------------------------------------*/ 05462 05463 void AFNI_hidden_EV( Widget w , XtPointer cd , 05464 XEvent *ev , Boolean *continue_to_dispatch ) 05465 { 05466 Three_D_View *im3d = (Three_D_View *) cd ; 05467 05468 ENTRY("AFNI_hidden_EV") ; 05469 05470 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 05471 05472 /*** handle events ***/ 05473 05474 switch( ev->type ){ 05475 05476 /*----- take button press -----*/ 05477 05478 case ButtonPress:{ 05479 XButtonEvent *event = (XButtonEvent *) ev ; 05480 05481 if( event->button == Button3 || 05482 (event->button == Button1 && 05483 (event->state & (ShiftMask|ControlMask))) ){ 05484 05485 im3d->vwid->butx = event->x_root ; /* 17 May 2005 */ 05486 im3d->vwid->buty = event->y_root ; 05487 event->button = Button3 ; /* fakeout */ 05488 XmMenuPosition( im3d->vwid->prog->hidden_menu , event ) ; /* where */ 05489 XtManageChild ( im3d->vwid->prog->hidden_menu ) ; /* popup */ 05490 } 05491 #ifdef WANT_RWCOX_IMAGE 05492 else if( !NO_frivolities && event->button == Button1 ) RWCOX_popper() ; 05493 #endif 05494 05495 #ifdef USE_SKIT 05496 else if( !NO_frivolities && event->button == Button2 ) SKIT_popper(im3d) ; 05497 #endif 05498 } 05499 break ; 05500 05501 /*----- take key press [09 Sep 2002] -----*/ 05502 05503 case KeyPress:{ 05504 XKeyEvent *event = (XKeyEvent *) ev ; 05505 char buf[32] ; 05506 KeySym ks ; 05507 int nbuf ; 05508 05509 buf[0] = '\0' ; 05510 nbuf = XLookupString( event , buf , 32 , &ks , NULL ) ; 05511 05512 switch( buf[0] ){ 05513 case 'Q': 05514 exit(0) ; /* Death Now! */ 05515 05516 case 'q': 05517 AFNI_quit_CB( w , im3d, NULL ) ; /* Close just this controller */ 05518 break ; 05519 05520 case 'f': 05521 case 'F': 05522 AFNI_faceup() ; /* Faces! [27 Dec 2004] */ 05523 break ; 05524 05525 case 'p': 05526 case 'P': 05527 AFNI_hidden_CB( im3d->vwid->prog->hidden_ranpoem_pb , 05528 (XtPointer)im3d , NULL ) ; 05529 break ; 05530 05531 case 'g': 05532 case 'G': 05533 AFNI_hidden_CB( im3d->vwid->prog->hidden_gamberi_pb , 05534 (XtPointer)im3d , NULL ) ; 05535 break ; 05536 } 05537 } 05538 break ; 05539 } 05540 05541 EXRETURN ; 05542 } 05543 05544 /*-------------------------------------------------------------------*/ 05545 05546 #ifdef ALLOW_DATASET_VLIST 05547 void AFNI_hidden_pts_CB( Widget w , XtPointer cd , MCW_choose_cbs *cbs ) 05548 { 05549 Three_D_View *im3d = (Three_D_View *) cd ; 05550 THD_3dim_dataset *dset_now ; 05551 THD_fvec3 xyz_vec ; 05552 THD_ivec3 ijk_vec ; 05553 Boolean ijk_option , pause_it ; 05554 FILE *fil ; 05555 THD_vector_list *sv ; 05556 int ii ; 05557 05558 ENTRY("AFNI_hidden_pts_CB") ; 05559 05560 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 05561 dset_now = im3d->anat_now ; 05562 if( ! ISVALID_3DIM_DATASET(dset_now) ) EXRETURN ; 05563 05564 ijk_option = False ; 05565 switch( im3d->vwid->prog->hidden_code ){ /* action set by user */ 05566 05567 /*---- Set Color ----*/ 05568 05569 case PTS_SET_COLOR: 05570 im3d->vinfo->pts_color = cbs->ival ; 05571 im3d->vinfo->pts_visible = (cbs->ival > 0) ? True : False ; 05572 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ; /* redraw */ 05573 break ; 05574 05575 /*---- READ pts int ----*/ 05576 05577 case PTS_READ_IJK: 05578 ijk_option = True ; /* fall thru on purpose */ 05579 05580 case PTS_READ_XYZ: 05581 05582 /** open input file **/ 05583 05584 fil = fopen( cbs->cval , "r" ) ; 05585 if( fil == NULL ){ 05586 char buf[256] ; 05587 sprintf(buf,"Cannot open file\n %s\nfor reading!",cbs->cval) ; 05588 (void) MCW_popup_message( im3d->vwid->picture , buf , 05589 MCW_USER_KILL | MCW_TIMER_KILL ) ; 05590 XBell( im3d->dc->display , 100 ) ; 05591 EXRETURN ; 05592 } 05593 05594 POPDOWN_string_chooser ; 05595 05596 pause_it = ( THD_filesize(cbs->cval) > 99999 ) ; 05597 if( pause_it ) SHOW_AFNI_PAUSE ; 05598 05599 /** read points **/ 05600 05601 INIT_VLIST(sv,dset_now) ; 05602 do { 05603 if( ijk_option ) 05604 ii = fscanf( fil , " %d %d %d\n", 05605 &(ijk_vec.ijk[0]),&(ijk_vec.ijk[1]),&(ijk_vec.ijk[2])) ; 05606 else 05607 ii = fscanf( fil , " %f %f %f\n", 05608 &(xyz_vec.xyz[0]),&(xyz_vec.xyz[1]),&(xyz_vec.xyz[2])) ; 05609 05610 if( ii == 3 ){ /* all 3 good! */ 05611 if( ijk_option ){ ADD_IVEC_TO_VLIST(sv,ijk_vec) ; } 05612 else { ADD_FVEC_TO_VLIST(sv,xyz_vec) ; } 05613 } else if( ii == EOF ){ /* end of data! */ 05614 fclose(fil) ; 05615 break ; /* exit do loop */ 05616 } else { 05617 char buf[256] ; /* bad data! */ 05618 fclose(fil) ; 05619 sprintf(buf,"Bad read in file\n %s\nat point # %d", 05620 cbs->cval , sv->num + 1 ) ; 05621 (void) MCW_popup_message( im3d->vwid->picture , buf , 05622 MCW_USER_KILL | MCW_TIMER_KILL ) ; 05623 XBell( im3d->dc->display , 100 ) ; 05624 DESTROY_VLIST(sv) ; 05625 EXRETURN ; 05626 } 05627 } while (1) ; 05628 05629 /** destroy any point sets in all current datasets **/ 05630 05631 for( ii=0 ; ii <= LAST_VIEW_TYPE ; ii++ ){ 05632 if( ISVALID_3DIM_DATASET(im3d->anat_dset[ii]) ){ 05633 DESTROY_VLIST( im3d->anat_dset[ii]->pts ) ; 05634 im3d->anat_dset[ii]->pts_original = False ; 05635 } 05636 } 05637 05638 /** put new point set into current dataset **/ 05639 05640 dset_now->pts = sv ; 05641 dset_now->pts_original = True ; 05642 05643 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ; 05644 if( pause_it ) SHOW_AFNI_READY ; 05645 break ; /* end of read pts */ 05646 05647 /*---- WRITE pts out ----*/ 05648 05649 case PTS_WRITE_IJK: 05650 ijk_option = True ; /* fall thru on purpose */ 05651 05652 case PTS_WRITE_XYZ: 05653 05654 sv = im3d->anat_now->pts ; 05655 if( sv == NULL || sv->num == 0 ){ 05656 XBell( im3d->dc->display , 100 ) ; 05657 EXRETURN ; 05658 } 05659 05660 if( cbs->cval[0] == '|' ){ /* send to standard output */ 05661 fil = stdout ; 05662 } else { 05663 if( THD_is_file(cbs->cval) ){ 05664 char buf[256] ; 05665 sprintf(buf,"Desired output file\n %s\nalready exists!",cbs->cval); 05666 (void) MCW_popup_message( im3d->vwid->picture , buf , 05667 MCW_USER_KILL | MCW_TIMER_KILL ) ; 05668 XBell( im3d->dc->display , 100 ) ; 05669 EXRETURN ; 05670 } 05671 05672 fil = fopen( cbs->cval , "w" ) ; 05673 if( fil == NULL ){ 05674 char buf[256] ; 05675 sprintf(buf,"Cannot open file\n %s\nfor writing!",cbs->cval) ; 05676 (void) MCW_popup_message( im3d->vwid->picture , buf , 05677 MCW_USER_KILL | MCW_TIMER_KILL ) ; 05678 XBell( im3d->dc->display , 100 ) ; 05679 EXRETURN ; 05680 } 05681 } 05682 05683 POPDOWN_string_chooser ; 05684 05685 pause_it = ( sv->num > 6666 ) ; 05686 if( pause_it ) SHOW_AFNI_PAUSE ; 05687 05688 if( ijk_option ){ 05689 for( ii=0 ; ii < sv->num ; ii++ ) 05690 fprintf(fil,"%d %d %d\n", sv->ijk[ii].ijk[0], 05691 sv->ijk[ii].ijk[1], 05692 sv->ijk[ii].ijk[2] ) ; 05693 } else { 05694 for( ii=0 ; ii < sv->num ; ii++ ) 05695 fprintf(fil,"%g %g %g\n", sv->xyz[ii].xyz[0], 05696 sv->xyz[ii].xyz[1], 05697 sv->xyz[ii].xyz[2] ) ; 05698 } 05699 05700 if( fil != stdout ) fclose(fil) ; 05701 if( pause_it ) SHOW_AFNI_READY ; 05702 break ; /* end of write pts */ 05703 05704 } /* end of switch */ 05705 05706 EXRETURN ; 05707 } 05708 #endif 05709 05710 /*====================================================================================*/ 05711 #if defined(WANT_RWCOX_IMAGE) && defined(ALLOW_PLUGINS) 05712 05713 void RWCOX_popper(void) 05714 { 05715 AFNI_splashup() ; 05716 return ; 05717 } 05718 #endif /* WANT_RWCOX_IMAGE */ 05719 /*====================================================================================*/ 05720 #ifdef USE_SKIT 05721 #define NSKIT 50 05722 static char *skit[NSKIT][3] = { 05723 "artless" , "base-court" , "apple-john" , 05724 "bawdy" , "bat-fowling" , "baggage" , 05725 "beslubbering" , "beef-witted" , "barnacle" , 05726 "bootless" , "beetle-headed" , "bladder" , 05727 "churlish" , "boil-brained" , "boar-pig" , 05728 "cockered" , "clapper-clawed" , "bugbear" , 05729 "clouted" , "clay-brained" , "bum-bailey" , 05730 "craven" , "common-kissing" , "canker-blossom" , 05731 "currish" , "crook-pated" , "clack-dish" , 05732 "dankish" , "dismal-dreaming" , "clotpole" , 05733 "dissembling" , "dizzy-eyed" , "coxcomb" , 05734 "droning" , "doghearted" , "codpiece" , 05735 "errant" , "dread-bolted" , "death-token" , 05736 "fawning" , "earth-vexing" , "dewberry" , 05737 "fobbing" , "elf-skinned" , "flap-dragon" , 05738 "froward" , "fat-kidneyed" , "flax-wench" , 05739 "frothy" , "fen-sucked" , "flirt-gill" , 05740 "gleeking" , "flap-mouthed" , "foot-licker" , 05741 "goatish" , "fly-bitten" , "fustilarian" , 05742 "gorbellied" , "folly-fallen" , "giglet" , 05743 "impertinent" , "fool-born" , "gudgeon" , 05744 "infectious" , "full-gorged" , "haggard" , 05745 "jarring" , "guts-griping" , "harpy" , 05746 "loggerheaded" , "half-faced" , "hedge-pig" , 05747 "lumpish" , "hasty-witted" , "horn-beast" , 05748 "mammering" , "hedge-born" , "hugger-mugger" , 05749 "mangled" , "hell-hated" , "joithead" , 05750 "mewling" , "idle-headed" , "lewdster" , 05751 "paunchy" , "ill-breeding" , "lout" , 05752 "pribbling" , "ill-nurtured" , "maggot-pie" , 05753 "puking" , "knotty-pated" , "malt-worm" , 05754 "puny" , "milk-livered" , "mammet" , 05755 "qualling" , "motley-minded" , "measle" , 05756 "rank" , "onion-eyed" , "minnow" , 05757 "reeky" , "plume-plucked" , "miscreant" , 05758 "roguish" , "pottle-deep" , "moldwarp" , 05759 "ruttish" , "pox-marked" , "mumble-news" , 05760 "saucy" , "reeling-ripe" , "nut-hook" , 05761 "spleeny" , "rough-hewn" , "pigeon-egg" , 05762 "spongy" , "rude-growing" , "pignut" , 05763 "surly" , "rump-fed" , "puttock" , 05764 "tottering" , "shard-borne" , "pumpion" , 05765 "unmuzzled" , "sheep-biting" , "ratsbane" , 05766 "vain" , "spur-galled" , "scut" , 05767 "venomed" , "swag-bellied" , "skainsmate" , 05768 "villainous" , "tardy-gaited" , "strumpet" , 05769 "warped" , "tickle-brained" , "varlet" , 05770 "wayward" , "toad-spotted" , "vassal" , 05771 "weedy" , "unchin-snouted" , "whey-face" , 05772 "yeasty" , "weather-bitten" , "wagtail" 05773 } ; 05774 05775 static char skstr[512] ; 05776 05777 void SKIT_popper(Three_D_View *im3d) 05778 { 05779 int ii,jj,kk ; 05780 05781 ii = lrand48() % NSKIT ; jj = lrand48() % NSKIT ; kk = lrand48() % NSKIT ; 05782 sprintf(skstr,"Randomly generated Shakespearean Insult:\n\n" 05783 " Thou %s %s %s! \n" , 05784 skit[ii][0] , skit[jj][1] , skit[kk][2] ) ; 05785 05786 if( lrand48()%7 == 0 ){ 05787 ii = strlen(skstr) ; 05788 sprintf( skstr+ii , "\n [Data provided by Sandy Kindermann]" ) ; 05789 } 05790 05791 (void) MCW_popup_message( im3d->vwid->picture , skstr , 05792 MCW_USER_KILL | MCW_TIMER_KILL ) ; 05793 } 05794 #endif /* USE_SKIT */ 05795 /*====================================================================================*/ 05796 05797 #endif /* USE_HIDDEN */ |
|
Definition at line 3477 of file afni_func.c. References AFNI_3DDATA_VIEW, AFNI_set_viewpoint(), AFNI_setup_viewing(), Three_D_View::anat_now, DISABLE_LOCK, ENABLE_LOCK, ENTRY, AFNI_view_info::i1, THD_ivec3::ijk, IM3D_OPEN, AFNI_view_info::j2, AFNI_view_info::k3, LOAD_ANAT_VIEW, REDISPLAY_ALL, SAVE_VPT, TEMP_FVEC3, TEMP_IVEC3, THD_3dmm_to_3dind(), THD_dicomm_to_3dmm(), Three_D_View::type, Three_D_View::vinfo, AFNI_view_info::xi, AFNI_view_info::yj, and AFNI_view_info::zk. Referenced by AFNI_anatmode_CB(), AFNI_funcmode_CB(), AFNI_resam_av_CB(), AFNI_resam_vox_av_CB(), AFNI_time_index_CB(), and RT_tell_afni_one().
03478 { 03479 THD_fvec3 fv ; 03480 THD_ivec3 iv ; 03481 03482 ENTRY("AFNI_modify_viewing") ; 03483 03484 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 03485 03486 /* set up datasets for new imaging */ 03487 03488 AFNI_setup_viewing( im3d , rescaled ) ; 03489 03490 /* transform current POV to new indices */ 03491 03492 if( im3d->type == AFNI_3DDATA_VIEW ){ /* 19 Oct 1999 */ 03493 03494 LOAD_ANAT_VIEW(im3d) ; /* 02 Nov 1996 */ 03495 03496 fv = THD_dicomm_to_3dmm( 03497 im3d->anat_now , 03498 TEMP_FVEC3(im3d->vinfo->xi, im3d->vinfo->yj, im3d->vinfo->zk) ) ; 03499 03500 iv = THD_3dmm_to_3dind( im3d->anat_now , fv ) ; 03501 03502 } else { 03503 03504 iv = TEMP_IVEC3( im3d->vinfo->i1 , im3d->vinfo->j2 , im3d->vinfo->k3 ) ; 03505 } 03506 03507 /* and redisplay the images */ 03508 03509 DISABLE_LOCK ; 03510 AFNI_set_viewpoint( im3d, iv.ijk[0],iv.ijk[1],iv.ijk[2] , REDISPLAY_ALL ) ; 03511 ENABLE_LOCK ; 03512 03513 SAVE_VPT(im3d) ; 03514 EXRETURN ; 03515 } |
|
Make a functional overlay the new way (30 Jan 2003):
Definition at line 1308 of file afni_func.c. References AFNI_yesenv(), rgbyte::b, ENTRY, rgbyte::g, MRI_IMAGE::kind, MRI_BYTE_PTR, MRI_FLOAT_PTR, mri_free(), mri_new_conforming, MRI_RGB_PTR, MRI_SHORT_PTR, NPANE_BIG, MRI_IMAGE::nvox, rgbyte::r, RETURN, thr, and ZREJ. Referenced by AFNI_func_overlay().
01311 { 01312 MRI_IMAGE *im_ov ; 01313 byte *ovar ; 01314 int ii , npix , zbot , jj ; 01315 float fac , val ; 01316 int reject_zero = !AFNI_yesenv("AFNI_OVERLAY_ZERO") ; /* 20 Apr 2005 */ 01317 01318 ENTRY("AFNI_newfunc_overlay") ; 01319 01320 if( im_fim == NULL || fimbot >= fimtop || fimcolor == NULL ) RETURN(NULL) ; 01321 01322 /* create output image */ 01323 01324 im_ov = mri_new_conforming( im_fim , MRI_rgb ) ; 01325 ovar = MRI_RGB_PTR(im_ov) ; 01326 npix = im_ov->nvox ; 01327 zbot = (fimbot == 0.0) ; /* no color for negative values? */ 01328 fac = NPANE_BIG / (fimtop-fimbot) ; 01329 01330 /* load output image with colors */ 01331 01332 switch( im_fim->kind ){ 01333 01334 default: /* should not happen! */ 01335 mri_free(im_ov) ; 01336 RETURN(NULL) ; 01337 01338 case MRI_short:{ 01339 short *ar_fim = MRI_SHORT_PTR(im_fim) ; 01340 01341 for( ii=0 ; ii < npix ; ii++ ){ 01342 if( ZREJ(ar_fim[ii]) ) continue ; 01343 if( zbot && ar_fim[ii] < 0 ) continue ; 01344 val = fac*(fimtop-ar_fim[ii]) ; 01345 if( val < 0.0 ) val = 0.0; 01346 jj = (int)(val+0.49); if( jj >= NPANE_BIG ) jj = NPANE_BIG-1; 01347 ovar[3*ii ] = fimcolor[jj].r ; 01348 ovar[3*ii+1] = fimcolor[jj].g ; 01349 ovar[3*ii+2] = fimcolor[jj].b ; 01350 } 01351 } 01352 break ; 01353 01354 case MRI_byte:{ 01355 byte *ar_fim = MRI_BYTE_PTR(im_fim) ; 01356 01357 for( ii=0 ; ii < npix ; ii++ ){ 01358 if( ZREJ(ar_fim[ii]) ) continue ; 01359 val = fac*(fimtop-ar_fim[ii]) ; 01360 if( val < 0.0 ) val = 0.0; 01361 jj = (int)(val+0.49); if( jj >= NPANE_BIG ) jj = NPANE_BIG-1; 01362 ovar[3*ii ] = fimcolor[jj].r ; 01363 ovar[3*ii+1] = fimcolor[jj].g ; 01364 ovar[3*ii+2] = fimcolor[jj].b ; 01365 } 01366 } 01367 break ; 01368 01369 case MRI_float:{ 01370 float *ar_fim = MRI_FLOAT_PTR(im_fim) ; 01371 01372 for( ii=0 ; ii < npix ; ii++ ){ 01373 if( ZREJ(ar_fim[ii]) ) continue ; 01374 if( zbot && ar_fim[ii] < 0.0 ) continue ; 01375 val = fac*(fimtop-ar_fim[ii]) ; 01376 if( val < 0.0 ) val = 0.0; 01377 jj = (int)(val+0.49); if( jj >= NPANE_BIG ) jj = NPANE_BIG-1; 01378 ovar[3*ii ] = fimcolor[jj].r ; 01379 ovar[3*ii+1] = fimcolor[jj].g ; 01380 ovar[3*ii+2] = fimcolor[jj].b ; 01381 } 01382 } 01383 break ; 01384 } 01385 01386 /** now apply threshold, if any **/ 01387 01388 if( thresh > 0.0 && im_thr != NULL ){ 01389 switch( im_thr->kind ){ 01390 01391 case MRI_short:{ 01392 float thr = thresh ; 01393 short *ar_thr = MRI_SHORT_PTR(im_thr) ; 01394 01395 for( ii=0 ; ii < npix ; ii++ ){ 01396 if( ar_thr[ii] > -thr && ar_thr[ii] < thr ) 01397 ovar[3*ii] = ovar[3*ii+1] = ovar[3*ii+2] = 0 ; 01398 } 01399 } 01400 break ; 01401 01402 case MRI_byte:{ 01403 float thr = thresh ; 01404 byte *ar_thr = MRI_BYTE_PTR(im_thr) ; 01405 01406 for( ii=0 ; ii < npix ; ii++ ) 01407 if( ar_thr[ii] < thr ) 01408 ovar[3*ii] = ovar[3*ii+1] = ovar[3*ii+2] = 0 ; 01409 } 01410 break ; 01411 01412 case MRI_float:{ 01413 float thr = thresh ; 01414 float *ar_thr = MRI_FLOAT_PTR(im_thr) ; 01415 01416 for( ii=0 ; ii < npix ; ii++ ) 01417 if( ar_thr[ii] > -thr && ar_thr[ii] < thr ) 01418 ovar[3*ii] = ovar[3*ii+1] = ovar[3*ii+2] = 0 ; 01419 } 01420 break ; 01421 } 01422 } 01423 01424 RETURN(im_ov) ; 01425 } |
|
Definition at line 4513 of file afni_func.c. Referenced by AFNI_set_func_range().
04514 { 04515 Three_D_View *im3d = (Three_D_View *) cd ; 04516 04517 ENTRY("AFNI_range_av_CB") ; 04518 04519 if( ! IM3D_VALID(im3d) ) EXRETURN ; 04520 04521 im3d->vinfo->fim_range = av->fval ; 04522 AFNI_redisplay_func( im3d ) ; 04523 04524 AFNI_range_lock_carryout(im3d) ; /* 23 Feb 2004 */ 04525 04526 AFNI_hintize_pbar( im3d->vwid->func->inten_pbar , 04527 (im3d->vinfo->fim_range != 0.0) ? im3d->vinfo->fim_range 04528 : im3d->vinfo->fim_autorange ); 04529 EXRETURN ; 04530 } |
|
|
Definition at line 4332 of file afni_func.c. References AFNI_view_info::anat_index, Three_D_View::anat_now, AV_fval_to_char(), THD_statistics::bstat, DSET_VALID_BSTAT, ENTRY, AFNI_view_info::fim_index, Three_D_View::fim_now, IM3D_OPEN, ISVALID_3DIM_DATASET, ISVALID_STATISTIC, THD_brick_stats::max, THD_brick_stats::min, RELOAD_STATS, RETURN, THD_3dim_dataset::stats, AFNI_view_info::stats_anat_ok, AFNI_view_info::stats_func_ok, AFNI_view_info::stats_thresh_ok, STATUS, AFNI_view_info::thr_index, and Three_D_View::vinfo. Referenced by AFNI_reset_func_range().
04333 { 04334 char anat_minch[10] = " --------" , anat_maxch[10] = " --------" , 04335 fim_minch[10] = " --------" , fim_maxch[10] = " --------" , 04336 thr_minch[10] = " --------" , thr_maxch[10] = " --------" ; 04337 char buf[256] , qbuf[16] ; 04338 XmString xstr ; 04339 int iv ; 04340 04341 ENTRY("AFNI_range_label") ; 04342 04343 if( im3d != NULL && im3d->vinfo != NULL ){ /* 30 Mar 2005 */ 04344 im3d->vinfo->stats_anat_ok = 04345 im3d->vinfo->stats_func_ok = 04346 im3d->vinfo->stats_thresh_ok = 0 ; 04347 } 04348 04349 /*** anat statistics ***/ 04350 04351 if( IM3D_OPEN(im3d) ){ 04352 STATUS("RELOAD_STATS(anat_now)") ; 04353 RELOAD_STATS(im3d->anat_now) ; 04354 } 04355 04356 if( IM3D_OPEN(im3d) && 04357 ISVALID_3DIM_DATASET(im3d->anat_now) && 04358 ISVALID_STATISTIC(im3d->anat_now->stats) ){ 04359 04360 iv = im3d->vinfo->anat_index ; 04361 04362 if( DSET_VALID_BSTAT(im3d->anat_now,iv) ){ 04363 STATUS("anat_now statistics") ; 04364 AV_fval_to_char( im3d->anat_now->stats->bstat[iv].min , qbuf ) ; 04365 sprintf( anat_minch , "%9.9s" , qbuf ) ; 04366 AV_fval_to_char( im3d->anat_now->stats->bstat[iv].max , qbuf ) ; 04367 sprintf( anat_maxch , "%9.9s" , qbuf ) ; 04368 im3d->vinfo->stats_anat_ok = 1 ; 04369 } else { 04370 STATUS("can't load anat_now bstat") ; 04371 } 04372 } 04373 04374 /*** func statistics ***/ 04375 04376 if( IM3D_OPEN(im3d) ){ 04377 STATUS("RELOAD_STATS(fim_now)") ; 04378 RELOAD_STATS(im3d->fim_now) ; 04379 } 04380 04381 if( IM3D_OPEN(im3d) && 04382 ISVALID_3DIM_DATASET(im3d->fim_now) && 04383 ISVALID_STATISTIC(im3d->fim_now->stats) ){ 04384 04385 iv = im3d->vinfo->fim_index ; 04386 04387 if( DSET_VALID_BSTAT(im3d->fim_now,iv) ){ 04388 STATUS("fim_now statistics") ; 04389 AV_fval_to_char( im3d->fim_now->stats->bstat[iv].min , qbuf ) ; 04390 sprintf( fim_minch , "%9.9s" , qbuf ) ; 04391 AV_fval_to_char( im3d->fim_now->stats->bstat[iv].max , qbuf ) ; 04392 sprintf( fim_maxch , "%9.9s" , qbuf ) ; 04393 im3d->vinfo->stats_func_ok = 1 ; 04394 } else { 04395 STATUS("can't load fim_now bstat") ; 04396 } 04397 04398 iv = im3d->vinfo->thr_index ; 04399 04400 if( DSET_VALID_BSTAT(im3d->fim_now,iv) ){ 04401 STATUS("thr_now statistics") ; 04402 AV_fval_to_char( im3d->fim_now->stats->bstat[iv].min , qbuf ) ; 04403 sprintf( thr_minch , "%9.9s" , qbuf ) ; 04404 AV_fval_to_char( im3d->fim_now->stats->bstat[iv].max , qbuf ) ; 04405 sprintf( thr_maxch , "%9.9s" , qbuf ) ; 04406 im3d->vinfo->stats_thresh_ok = 1 ; 04407 } else { 04408 STATUS("can't load thr_now bstat") ; 04409 } 04410 } 04411 04412 /*** make label ***/ 04413 04414 STATUS("make buf label") ; 04415 04416 sprintf( buf , "ULay %s:%s\nOLay %s:%s\nThr %s:%s" , 04417 anat_minch,anat_maxch, fim_minch,fim_maxch, thr_minch,thr_maxch ) ; 04418 04419 STATUS(buf) ; 04420 04421 xstr = XmStringCreateLtoR( buf , XmFONTLIST_DEFAULT_TAG ) ; 04422 04423 RETURN(xstr) ; 04424 } |
|
Definition at line 312 of file afni_func.c. References event.
00313 { 00314 MCW_pbar *pbar = (MCW_pbar *) cd ; 00315 int ddd ; 00316 00317 ENTRY("AFNI_range_rotate_av_CB") ; 00318 00319 /* which way to rotate? */ 00320 00321 if( av->fval > av->old_fval ) ddd = +1 ; 00322 else ddd = -1 ; 00323 00324 /* Shift+click ==> rotate by 4 (useful for bigmode) */ 00325 00326 if( av->xev.type == ButtonPress ){ 00327 XButtonEvent *event = (XButtonEvent *) (&av->xev) ; 00328 if( event->state & ShiftMask ) ddd *= 4 ; 00329 } 00330 00331 rotate_MCW_pbar( pbar , ddd ) ; 00332 EXRETURN ; 00333 } |
|
(The following is from AFNI_read_inputs) * Definition at line 2700 of file afni_func.c. References AFNI_finalize_read_1D_CB(), AFNI_make_file_dialog(), ENTRY, AFNI_widget_set::file_cb, AFNI_widget_set::file_cd, AFNI_widget_set::file_dialog, AFNI_widget_set::file_sbox, RWC_visibilize_widget(), and Three_D_View::vwid.
02701 { 02702 Three_D_View *im3d = (Three_D_View *) cd ; 02703 XmString xstr ; 02704 02705 ENTRY("AFNI_read_1D_CB") ; 02706 02707 AFNI_make_file_dialog( im3d ) ; 02708 02709 XtAddCallback( im3d->vwid->file_sbox , XmNokCallback , 02710 AFNI_finalize_read_1D_CB , cd ) ; 02711 02712 XtAddCallback( im3d->vwid->file_sbox , XmNcancelCallback , 02713 AFNI_finalize_read_1D_CB , cd ) ; 02714 02715 XtAddCallback( im3d->vwid->file_sbox , XmNhelpCallback , 02716 AFNI_finalize_read_1D_CB , cd ) ; 02717 02718 /* 02 Feb 1998: put *.1D* in the filename pattern */ 02719 02720 xstr = XmStringCreateLtoR( "*.1D*" , XmFONTLIST_DEFAULT_TAG ) ; 02721 XtVaSetValues( im3d->vwid->file_sbox , 02722 XmNpattern , xstr , 02723 NULL ) ; 02724 XmStringFree(xstr) ; 02725 02726 im3d->vwid->file_cb = AFNI_finalize_read_1D_CB ; 02727 im3d->vwid->file_cd = cd ; 02728 02729 XtVaSetValues( im3d->vwid->file_dialog, 02730 XmNtitle, "AFNI: Read 1D Timeseries", 02731 NULL ) ; 02732 02733 XtPopup( im3d->vwid->file_dialog , XtGrabNone ) ; 02734 RWC_visibilize_widget( im3d->vwid->file_dialog ) ; /* 09 Nov 1999 */ 02735 02736 EXRETURN ; 02737 } |
|
change button labels to conform to other AFNI dialogs * Definition at line 2445 of file afni_func.c. References AFNI_finalize_read_sess_CB(), AFNI_make_file_dialog(), ENTRY, AFNI_widget_set::file_cb, AFNI_widget_set::file_cd, AFNI_widget_set::file_dialog, AFNI_widget_set::file_sbox, GLOBAL_library, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, NORMAL_cursorize, THD_sessionlist::num_sess, RWC_visibilize_widget(), AFNI_library_type::sslist, THD_MAX_NUM_SESSION, and Three_D_View::vwid.
02446 { 02447 Three_D_View *im3d = (Three_D_View *) cd ; 02448 02449 ENTRY("AFNI_read_sess_CB") ; 02450 02451 if( GLOBAL_library.sslist->num_sess >= THD_MAX_NUM_SESSION ){ 02452 (void) MCW_popup_message( w , 02453 "********************************\n" 02454 "** Maximum number of sessions **\n" 02455 "** would be exceeded. Sorry! **\n" 02456 "********************************" 02457 , MCW_USER_KILL | MCW_TIMER_KILL ) ; 02458 EXRETURN ; 02459 } 02460 02461 AFNI_make_file_dialog( im3d ) ; 02462 02463 XtAddCallback( im3d->vwid->file_sbox , XmNokCallback , 02464 AFNI_finalize_read_sess_CB , cd ) ; 02465 02466 XtAddCallback( im3d->vwid->file_sbox , XmNcancelCallback , 02467 AFNI_finalize_read_sess_CB , cd ) ; 02468 02469 XtAddCallback( im3d->vwid->file_sbox , XmNhelpCallback , 02470 AFNI_finalize_read_sess_CB , cd ) ; 02471 02472 im3d->vwid->file_cb = AFNI_finalize_read_sess_CB ; 02473 im3d->vwid->file_cd = cd ; 02474 02475 XtVaSetValues( im3d->vwid->file_dialog, 02476 XmNtitle, "AFNI: Read Session", 02477 NULL ) ; 02478 02479 XtPopup( im3d->vwid->file_dialog , XtGrabNone ) ; 02480 RWC_visibilize_widget( im3d->vwid->file_dialog ) ; /* 09 Nov 1999 */ 02481 NORMAL_cursorize( im3d->vwid->file_dialog ) ; 02482 02483 EXRETURN ; 02484 } |
|
try to read a new timeseries * Definition at line 2810 of file afni_func.c. References AFNI_finalize_read_Web_CB(), ENTRY, and MCW_choose_string().
02811 { 02812 Three_D_View *im3d = (Three_D_View *) cd ; 02813 XmString xstr ; 02814 02815 ENTRY("AFNI_read_Web_CB") ; 02816 02817 MCW_choose_string( w , 02818 "Complete http:// or ftp:// address of dataset (.HEAD or .mnc or .mnc.gz):\n" 02819 "Examples: ftp://afni.nimh.nih.gov/AFNI/data/astrip+orig.HEAD\n" 02820 " http://afni.nimh.nih.gov/afni/norm305.mnc.gz" 02821 , NULL , AFNI_finalize_read_Web_CB , (XtPointer) im3d ) ; 02822 02823 EXRETURN ; 02824 } |
|
09 Dec 1997: resam_mode is now ignored * Definition at line 3913 of file afni_func.c. References AFNI_dataset_slice(), AFNI_view_info::anat_resam_mode, THD_diskptr::brick_name, THD_diskptr::byte_order, COMPRESS_fclose(), COMPRESS_fopen_write(), COMPRESS_unlink(), DATABLOCK_MEM_MALLOC, DATABLOCK_MEM_MMAP, DATABLOCK_MEM_UNDEFINED, DATAXES_TYPE, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, DBLK_BRICK_FACTOR, DBLK_BRICK_TYPE, DBLK_mmapfix, THD_diskptr::dimsizes, THD_diskptr::directory_name, THD_datablock::diskptr, DSET_BRICK_STATCODE, DSET_BRICK_TYPE, DSET_unlock, ENTRY, far, AFNI_view_info::func_resam_mode, IM3D_OPEN, ISFUNC, MRI_IMAGE::kind, logo_pixmap, THD_datablock::malloc_type, MCW_popdown_meter(), MCW_popup_meter(), MCW_set_meter(), METER_TOP_WIDE, MMAP_THRESHOLD, mri_data_pointer(), mri_datum_size(), mri_free(), mri_short_order(), mri_swap2(), mri_swap4(), MRI_TYPE_NAME, myXtFree, myXtNew, THD_diskptr::nvals, THD_datablock::nvals, MRI_IMAGE::nx, THD_dataxes::nxx, MRI_IMAGE::ny, THD_dataxes::nyy, nz, THD_dataxes::nzz, AFNI_widget_set::picture, PICTURIZE, PURGE_DSET, RETURN, THD_3dim_dataset::self_warp, STATUS, STORAGE_BY_BRICK, THD_diskptr::storage_mode, STORAGE_UNDEFINED, THD_get_write_compression(), THD_get_write_order(), THD_init_datablock_brick(), THD_is_directory(), THD_load_statistics(), THD_MKDIR_MODE, THD_write_3dim_dataset(), AFNI_view_info::thr_resam_mode, AFNI_widget_set::top_shell, THD_datablock::total_bytes, tross_Append_History(), typ, THD_warp::type, THD_dataxes::type, UNPICTURIZE, Three_D_View::vinfo, THD_3dim_dataset::vox_warp, Three_D_View::vwid, THD_3dim_dataset::wod_daxes, THD_3dim_dataset::wod_flag, XtMalloc, and THD_dataxes::zzorient. Referenced by AFNI_do_many_writes(), and AFNI_write_dataset_CB().
03916 { 03917 THD_datablock *dblk = dset->dblk ; 03918 THD_diskptr *dkptr = dset->dblk->diskptr ; 03919 Boolean good ; 03920 int npix , nx,ny,nz,nv , kk , ival , code , nzv , dsiz , isfunc , cmode ; 03921 MRI_IMAGE *im ; 03922 void *imar ; 03923 FILE *far ; 03924 float brfac_save ; 03925 int native_order , save_order ; /* 23 Nov 1999 */ 03926 03927 Boolean picturize ; 03928 Pixmap brain_pixmap ; 03929 03930 #ifndef DONT_USE_METER 03931 Widget meter = NULL ; 03932 int meter_perc , meter_pold ; 03933 #endif 03934 03935 ENTRY("AFNI_refashion_dataset") ; 03936 03937 picturize = IM3D_OPEN(im3d) && im3d->vwid->picture != NULL && 03938 afni48_pixmap != XmUNSPECIFIED_PIXMAP ; 03939 03940 if( picturize ){ 03941 switch( ORIENT_xyz[daxes->zzorient] ){ 03942 default: brain_pixmap = XmUNSPECIFIED_PIXMAP ; break ; 03943 case 'x': brain_pixmap = afni48sag_pixmap ; break ; 03944 case 'y': brain_pixmap = afni48cor_pixmap ; break ; 03945 case 'z': brain_pixmap = afni48axi_pixmap ; break ; 03946 } 03947 } 03948 03949 #ifndef DONT_USE_METER 03950 meter = MCW_popup_meter( im3d->vwid->top_shell , METER_TOP_WIDE ) ; 03951 meter_pold = 0 ; 03952 #endif 03953 03954 /* set up for warp-on-demand */ 03955 03956 dset->wod_daxes = myXtNew(THD_dataxes) ; /* 02 Nov 1996 */ 03957 dset->wod_daxes->type = DATAXES_TYPE ; /* 02 Nov 1996 */ 03958 dset->vox_warp = myXtNew(THD_warp) ; /* 02 Nov 1996 */ 03959 dset->self_warp = NULL ; /* 26 Aug 2002 */ 03960 03961 *(dset->wod_daxes) = *daxes ; /* copy insides of daxes */ 03962 dset->wod_flag = True ; /* mark for warp-on-demand */ 03963 dset->vox_warp->type = ILLEGAL_TYPE ; /* mark for recomputation */ 03964 03965 /* copy the new geometric information into various places */ 03966 03967 *(dset->daxes) = *(daxes) ; /* Make daxes permanent */ 03968 dkptr->dimsizes[0] = dset->daxes->nxx ; /* Will cause trouble */ 03969 dkptr->dimsizes[1] = dset->daxes->nyy ; /* if diskptr and */ 03970 dkptr->dimsizes[2] = dset->daxes->nzz ; /* daxes don't match! */ 03971 03972 /* write the header out */ 03973 03974 good = THD_write_3dim_dataset( NULL,NULL , dset , False ) ; 03975 if( !good ){ 03976 fprintf(stderr,"\a\n*** cannot write dataset header ***\n") ; 03977 if( picturize ) UNPICTURIZE ; 03978 RETURN(False) ; 03979 } 03980 STATUS("wrote output header file") ; 03981 03982 /* purge the datablock that now exists, 03983 then delete the file on disk that now exists (if any) */ 03984 03985 DSET_unlock( dset ) ; /* Feb 1998 */ 03986 PURGE_DSET( dset ) ; 03987 COMPRESS_unlink(dkptr->brick_name) ; 03988 03989 /* refashion its brick data structure, 03990 which requires first saving in a temporary 03991 array the datum type for each sub-brick */ 03992 03993 { int ibr ; int *typ ; 03994 typ = (int *) XtMalloc( sizeof(int) * dblk->nvals ) ; 03995 for( ibr=0 ; ibr < dblk->nvals ; ibr++ ) 03996 typ[ibr] = DBLK_BRICK_TYPE(dblk,ibr) ; 03997 THD_init_datablock_brick( dblk , dblk->nvals , typ ) ; 03998 myXtFree( typ ) ; 03999 } 04000 04001 if( dblk->total_bytes > 500*1024*1024 ){ 04002 int mb = (int)(dblk->total_bytes/(1024*1024)) ; 04003 fprintf(stderr,"++ WARNING: output filesize will be %d Mbytes!\n" 04004 "++ SUGGEST: increasing voxel size to save disk space!\n",mb) ; 04005 } 04006 04007 dkptr->storage_mode = STORAGE_UNDEFINED ; /* just for now */ 04008 dblk->malloc_type = DATABLOCK_MEM_UNDEFINED ; 04009 04010 /*--- open the output file 04011 (N.B.: much of the following code is from THD_write_datablock) ---*/ 04012 04013 /*-- create directory if necessary --*/ 04014 04015 if( ! THD_is_directory(dkptr->directory_name) ){ 04016 kk = mkdir( dkptr->directory_name , THD_MKDIR_MODE ) ; 04017 if( kk != 0 ){ 04018 fprintf(stderr, 04019 "\a\n*** cannot mkdir new directory: %s\n",dkptr->directory_name) ; 04020 if( picturize ) UNPICTURIZE ; 04021 RETURN(False) ; 04022 } 04023 STATUS("created subdirectory") ; 04024 } 04025 04026 /*-- open output file --*/ 04027 04028 cmode = THD_get_write_compression() ; 04029 far = COMPRESS_fopen_write( dkptr->brick_name , cmode ) ; 04030 if( far == NULL ){ 04031 fprintf(stderr, 04032 "\a\n*** cannot open output file %s\n",dkptr->brick_name) ; 04033 if( picturize ) UNPICTURIZE ; 04034 RETURN(False) ; 04035 } 04036 STATUS("created output brick file") ; 04037 04038 /*--------- now, create each slice and write it out ----------*/ 04039 04040 nx = dset->daxes->nxx ; 04041 ny = dset->daxes->nyy ; npix = nx*ny ; 04042 nz = dset->daxes->nzz ; 04043 nv = dkptr->nvals ; nzv = nz*nv ; 04044 04045 isfunc = ISFUNC(dset) ; /* 09 Dec 1997 */ 04046 if( ! isfunc ) 04047 resam_mode = im3d->vinfo->anat_resam_mode ; 04048 04049 native_order = mri_short_order() ; /* 23 Nov 1999 */ 04050 save_order = (dkptr->byte_order > 0) ? dkptr->byte_order 04051 : THD_get_write_order() ; 04052 04053 for( ival=0 ; ival < nv ; ival++ ){ /* for each sub-brick */ 04054 04055 dsiz = mri_datum_size( DSET_BRICK_TYPE(dset,ival) ) ; 04056 04057 /** force return of unscaled slices for output **/ 04058 04059 brfac_save = DBLK_BRICK_FACTOR(dblk,ival) ; 04060 DBLK_BRICK_FACTOR(dblk,ival) = 0.0 ; 04061 04062 if( isfunc ) 04063 resam_mode = (DSET_BRICK_STATCODE(dset,ival) > 0) /* 09 Dec 1997 */ 04064 ? im3d->vinfo->thr_resam_mode 04065 : im3d->vinfo->func_resam_mode ; 04066 04067 for( kk=0 ; kk < nz ; kk++ ){ /* for each slice */ 04068 04069 im = AFNI_dataset_slice( dset , 3 , kk , ival , resam_mode ) ; 04070 STATUS("have new image") ; 04071 04072 if( im == NULL ){ 04073 fprintf(stderr,"\a\n*** failure to compute dataset slice %d\n",kk) ; 04074 COMPRESS_fclose(far) ; 04075 COMPRESS_unlink( dkptr->brick_name ) ; 04076 if( picturize ) UNPICTURIZE ; 04077 #ifndef DONT_USE_METER 04078 MCW_popdown_meter(meter) ; 04079 #endif 04080 RETURN(False) ; 04081 } 04082 04083 #ifdef AFNI_DEBUG 04084 { char str[256] ; 04085 sprintf(str,"writing slice %d: type=%s nx=%d ny=%d\n", 04086 kk,MRI_TYPE_NAME(im) , im->nx,im->ny ) ; 04087 STATUS(str) ; } 04088 #endif 04089 04090 imar = mri_data_pointer(im) ; 04091 if( save_order != native_order ){ /* 23 Nov 1999 */ 04092 switch( im->kind ){ 04093 case MRI_short: mri_swap2( npix,imar) ; break ; 04094 case MRI_float: 04095 case MRI_int: mri_swap4( npix,imar) ; break ; 04096 case MRI_complex: mri_swap4(2*npix,imar) ; break ; 04097 } 04098 } 04099 code = fwrite( imar , dsiz , npix , far ) ; 04100 mri_free(im) ; 04101 04102 if( code != npix ){ 04103 fprintf(stderr, 04104 "\a\n*** failure to write dataset slice %d (is disk full?)\n",kk) ; 04105 COMPRESS_fclose(far) ; 04106 COMPRESS_unlink( dkptr->brick_name ) ; 04107 if( picturize ) UNPICTURIZE ; 04108 #ifndef DONT_USE_METER 04109 MCW_popdown_meter(meter) ; 04110 #endif 04111 RETURN(False) ; 04112 } 04113 04114 if( picturize && kk%7 == 0 ){ 04115 Pixmap pp ; 04116 pp = (kk%2 == 0) ? brain_pixmap : afni48_pixmap ; 04117 PICTURIZE(pp) ; 04118 XmUpdateDisplay( im3d->vwid->picture ) ; 04119 } 04120 04121 #ifndef DONT_USE_METER 04122 meter_perc = (int) ( 100.0 * (kk+ival*nz) / nzv ) ; 04123 if( meter_perc != meter_pold ){ 04124 MCW_set_meter( meter , meter_perc ) ; 04125 meter_pold = meter_perc ; 04126 } 04127 #endif 04128 04129 } /* end of loop over kk (z-direction) */ 04130 04131 /* restore the correct scaling of this sub-brick */ 04132 04133 DBLK_BRICK_FACTOR(dblk,ival) = brfac_save ; 04134 04135 } /* end of loop over iv (nvals direction) */ 04136 STATUS("all slices written") ; 04137 04138 /*--------------------- done!!! ---------------------*/ 04139 04140 COMPRESS_fclose(far) ; 04141 STATUS("output file closed") ; 04142 04143 if( picturize ) PICTURIZE(logo_pixmap) ; 04144 #ifndef DONT_USE_METER 04145 MCW_set_meter( meter , 100 ) ; 04146 #endif 04147 04148 /*--- do a little surgery on the dataset's storage flags ---*/ 04149 04150 dkptr->storage_mode = STORAGE_BY_BRICK ; 04151 #if MMAP_THRESHOLD > 0 04152 dblk->malloc_type = (dblk->total_bytes > MMAP_THRESHOLD) 04153 ? DATABLOCK_MEM_MMAP : DATABLOCK_MEM_MALLOC ; 04154 04155 if( cmode >= 0 ) dblk->malloc_type = DATABLOCK_MEM_MALLOC ; 04156 DBLK_mmapfix(dblk) ; /* 28 Mar 2005 */ 04157 #else 04158 dblk->malloc_type = DATABLOCK_MEM_MALLOC ; 04159 #endif 04160 04161 /*--- recompute the statistics and rewrite the header to hold them ---*/ 04162 04163 STATUS("recomputing statistics") ; 04164 04165 THD_load_statistics( dset ) ; 04166 04167 STATUS("rewriting header") ; 04168 04169 tross_Append_History( dset , "AFNI: resampled and rewritten" ) ; 04170 (void) THD_write_3dim_dataset( NULL,NULL , dset , False ) ; 04171 04172 STATUS("purging datablock") ; 04173 04174 PURGE_DSET( dset ) ; 04175 04176 if( picturize ) UNPICTURIZE ; 04177 #ifndef DONT_USE_METER 04178 MCW_popdown_meter(meter) ; 04179 #endif 04180 04181 myXtFree(dset->wod_daxes) ; myXtFree(dset->vox_warp) ; /* 02 Nov 1996 */ 04182 04183 RETURN(True) ; 04184 } |
|
|
Definition at line 1560 of file afni_func.c. References MCW_arrowval::ival.
01561 { 01562 return RESAM_shortstr[av->ival] ; 01563 } |
|
Definition at line 2984 of file afni_func.c. References AFNI_process_dsetchange(), AFNI_rescan_session(), AFNI_library_type::controllers, ENTRY, GLOBAL_library, IM3D_OPEN, MAX_CONTROLLERS, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, THD_sessionlist::num_sess, POPDOWN_strlist_chooser, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, and AFNI_library_type::sslist.
02985 { 02986 int iss , cc=0 ; 02987 Three_D_View *im3d ; 02988 02989 ENTRY("AFNI_rescan_all_CB") ; 02990 02991 SHOW_AFNI_PAUSE ; 02992 for( iss=0 ; iss < GLOBAL_library.sslist->num_sess ; iss++ ) 02993 cc += AFNI_rescan_session( iss ) ; 02994 if( cc > 0 ){ 02995 char str[256] ; 02996 POPDOWN_strlist_chooser ; 02997 sprintf(str," \n" 02998 " Added %d datasets total \n" , cc ) ; 02999 (void) MCW_popup_message( w , str , MCW_USER_KILL | MCW_TIMER_KILL ) ; 03000 } else { 03001 (void) MCW_popup_message( w , 03002 " \n Found no new datasets \n" , 03003 MCW_USER_KILL | MCW_TIMER_KILL ) ; 03004 } 03005 03006 #if 1 03007 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){ /* 31 Mar 1999 */ 03008 im3d = GLOBAL_library.controllers[cc] ; 03009 if( IM3D_OPEN(im3d) ) AFNI_process_dsetchange( im3d ) ; 03010 } 03011 #endif 03012 03013 SHOW_AFNI_READY ; 03014 EXRETURN ; 03015 } |
|
loop over all datasets in array, place in current session * Definition at line 2951 of file afni_func.c. References AFNI_process_dsetchange(), AFNI_rescan_session(), AFNI_library_type::controllers, ENTRY, GLOBAL_library, IM3D_OPEN, MAX_CONTROLLERS, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, POPDOWN_strlist_chooser, AFNI_view_info::sess_num, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, THD_sessionlist::ssar, AFNI_library_type::sslist, THD_MAX_NAME, and Three_D_View::vinfo. Referenced by AFNI_drive_rescan_controller().
02952 { 02953 Three_D_View *im3d = (Three_D_View *) cd , *qq3d ; 02954 int cc ; 02955 char str[256+THD_MAX_NAME] ; 02956 02957 ENTRY("AFNI_rescan_CB") ; 02958 02959 SHOW_AFNI_PAUSE ; 02960 cc = AFNI_rescan_session( im3d->vinfo->sess_num ) ; 02961 POPDOWN_strlist_chooser ; 02962 if( cc > 0 ){ 02963 sprintf(str," \n" 02964 " Added %d datasets to \n" 02965 " %s\n" , 02966 cc , 02967 GLOBAL_library.sslist->ssar[im3d->vinfo->sess_num]->sessname ) ; 02968 (void) MCW_popup_message( w , str , MCW_USER_KILL | MCW_TIMER_KILL ) ; 02969 } 02970 02971 #if 1 02972 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){ /* 31 Mar 1999 */ 02973 qq3d = GLOBAL_library.controllers[cc] ; 02974 if( IM3D_OPEN(qq3d) ) AFNI_process_dsetchange( qq3d ) ; 02975 } 02976 #endif 02977 02978 SHOW_AFNI_READY ; 02979 EXRETURN ; 02980 } |
|
Use the old or the new rescan session methods -- 07 Feb 2003. ------------------------------------------------------------------------ Definition at line 3338 of file afni_func.c. References AFNI_rescan_session_NEW(), AFNI_rescan_session_OLD(), and getenv(). Referenced by AFNI_rescan_all_CB(), and AFNI_rescan_CB().
03339 { 03340 char *eee = getenv("AFNI_RESCAN_METHOD") ; 03341 03342 return ( eee == NULL || strcmp(eee,"REPLACE") != 0 ) 03343 ? AFNI_rescan_session_NEW( sss ) 03344 : AFNI_rescan_session_OLD( sss ) ; 03345 } |
|
Re-read the session indexed by "sss". THE NEW WAY. Much of this code is taken from AFNI_read_inputs(). WARNING:
Definition at line 3239 of file afni_func.c. References AFNI_force_adoption(), AFNI_make_descendants(), BEEPIT, destroy_Htable(), THD_slist_find::dset, DSET_delete, DSET_PREFIX, DSET_unload, THD_session::dsset, ENTRY, FIND_IDCODE, FIND_PREFIX, free, GLOBAL_argopt, GLOBAL_library, AFNI_library_type::have_dummy_dataset, THD_3dim_dataset::idcode, ISVALID_DSET, ISVALID_SESSION, LAST_VIEW_TYPE, new_Htable(), nr, THD_session::num_dsset, THD_sessionlist::num_sess, RETURN, AFNI_library_type::session, THD_session::sessname, THD_sessionlist::ssar, AFNI_library_type::sslist, STATUS, subsume_Htable(), THD_dset_in_session(), THD_init_session(), THD_MAX_SESSION_SIZE, THD_reconcile_parents(), THD_slist_find::view_index, AF_options::warp_4D, AFNI_library_type::warptable, and THD_session::warptable. Referenced by AFNI_rescan_session().
03240 { 03241 int vv , ii , nr , na_new=0 , nf_new=0 ; 03242 THD_session *new_ss , *old_ss ; 03243 THD_slist_find find ; 03244 THD_3dim_dataset *new_dset ; 03245 03246 ENTRY("AFNI_rescan_session_NEW") ; 03247 { char str[256]; sprintf(str,"session index %d\n",sss); STATUS(str); } 03248 03249 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT; RETURN(0); } 03250 03251 #if 0 03252 fprintf(stderr,"Enter AFNI_rescan_session_NEW on session index %d\n",sss) ; 03253 #endif 03254 03255 /*--- sanity checks ---*/ 03256 03257 if( sss < 0 || sss >= GLOBAL_library.sslist->num_sess ){ BEEPIT; RETURN(0); } 03258 03259 old_ss = GLOBAL_library.sslist->ssar[sss] ; 03260 if( ! ISVALID_SESSION(old_ss) ){ BEEPIT; RETURN(0); } 03261 03262 /* can't rescan global session */ 03263 if( old_ss == GLOBAL_library.session ) RETURN(0); /* 21 Dec 2001 */ 03264 03265 /*--- read in the session again, into a new THD_session struct ---*/ 03266 03267 STATUS("rescanning session now:") ; 03268 STATUS(old_ss->sessname) ; 03269 03270 new_ss = THD_init_session( old_ss->sessname ) ; 03271 if( ! ISVALID_SESSION(new_ss) ){ BEEPIT; RETURN(0); } /* this is BAD */ 03272 03273 /*--- scan datasets and remove those 03274 that already exist in this session ---*/ 03275 03276 for( ii=0 ; ii < new_ss->num_dsset ; ii++ ){ 03277 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ){ 03278 new_dset = new_ss->dsset[ii][vv] ; 03279 if( ISVALID_DSET(new_dset) ){ 03280 find = THD_dset_in_session( FIND_IDCODE, &(new_dset->idcode), old_ss ); 03281 if( find.dset == NULL ){ 03282 find = THD_dset_in_session(FIND_PREFIX, DSET_PREFIX(new_dset),old_ss); 03283 if( find.dset != NULL && find.view_index != vv ) find.dset = NULL ; 03284 } 03285 if( find.dset != NULL ){ 03286 DSET_delete(new_dset); new_ss->dsset[ii][vv] = NULL; 03287 } 03288 } 03289 } 03290 } 03291 03292 /*--- now scan survivors and put them 03293 at the end of the existing session ---*/ 03294 03295 for( ii=0 ; ii < new_ss->num_dsset ; ii++ ){ 03296 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ) /* see if row is empty */ 03297 if( new_ss->dsset[ii][vv] != NULL ) break ; 03298 if( vv > LAST_VIEW_TYPE ) continue ; /* empty row ==> skip */ 03299 nr = old_ss->num_dsset ; /* next row in old_ss */ 03300 if( nr >= THD_MAX_SESSION_SIZE ) break ; /* old session is full */ 03301 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ) /* copy new row to old */ 03302 old_ss->dsset[nr][vv] = new_ss->dsset[ii][vv]; 03303 old_ss->num_dsset ++ ; na_new++ ; /* 1 more row in old */ 03304 } 03305 03306 /*-- 15 Jan 2003: purge all datasets from memory (for Hauke Heekeren) --*/ 03307 03308 for( ii=0 ; ii < old_ss->num_dsset ; ii++ ) 03309 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ) 03310 if( old_ss->dsset[ii][vv] != NULL ) DSET_unload(old_ss->dsset[ii][vv]); 03311 03312 /* assign the warp and anatomy parent pointers; 03313 then, make any datasets that don't exist but logically 03314 descend from the warp and anatomy parents just assigned */ 03315 03316 THD_reconcile_parents( GLOBAL_library.sslist ) ; 03317 AFNI_force_adoption( old_ss , GLOBAL_argopt.warp_4D ) ; 03318 AFNI_make_descendants( GLOBAL_library.sslist ) ; 03319 03320 /* 28 Aug 2002: deal with warptables */ 03321 03322 if( new_ss->warptable != NULL ){ 03323 if( GLOBAL_library.warptable == NULL ) /* create global warptable */ 03324 GLOBAL_library.warptable = new_Htable(101) ; 03325 subsume_Htable( new_ss->warptable , GLOBAL_library.warptable ) ; 03326 destroy_Htable( new_ss->warptable ) ; 03327 new_ss->warptable = NULL ; 03328 } 03329 free(new_ss) ; 03330 03331 RETURN(na_new) ; 03332 } |
|
Re-read the session indexed by "sss". THE OLD WAY. Much of this code is taken from AFNI_read_inputs. WARNING: this will do bad things if the user deletes the session directory or the current active datasets within it before trying this. On the other hand, if the user is that stupid, bad things will probably have happened to him already (like being unable to open dataset files, or being unable to tie his shoes correctly, or being named Mike Beauchamp). ------------------------------------------------------------------------ Definition at line 3029 of file afni_func.c. References AFNI_andersonville(), AFNI_append_sessions(), AFNI_force_adoption(), AFNI_initialize_view(), AFNI_make_descendants(), AFNI_mark_for_death(), Three_D_View::anat_now, AFNI_view_info::anat_num, BEEPIT, AFNI_library_type::controllers, destroy_Htable(), THD_slist_find::dset, DSET_in_global_session(), THD_slist_find::dset_index, DSET_MARK_FOR_DEATH, THD_session::dsset, ENTRY, EXIT, Three_D_View::fim_now, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, FIND_IDCODE, AFNI_view_info::func_num, GLOBAL_argopt, GLOBAL_library, AFNI_library_type::have_dummy_dataset, THD_3dim_dataset::idcode, IM3D_OPEN, ISVALID_3DIM_DATASET, ISVALID_SESSION, ISZERO_IDCODE, LAST_VIEW_TYPE, MAX_CONTROLLERS, myXtFree, new_Htable(), THD_session::num_dsset, THD_sessionlist::num_sess, THD_session::parent, PARENTIZE, POPDOWN_strlist_chooser, RETURN, AFNI_view_info::sess_num, AFNI_library_type::session, THD_session::sessname, Three_D_View::ss_now, THD_sessionlist::ssar, AFNI_library_type::sslist, STATUS, subsume_Htable(), THD_dset_in_session(), THD_init_session(), THD_reconcile_parents(), AFNI_widget_set::top_shell, THD_slist_find::view_index, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, AF_options::warp_4D, AFNI_library_type::warptable, THD_session::warptable, and ZERO_IDCODE. Referenced by AFNI_rescan_session().
03030 { 03031 int vv , ii , cc , nold,nnew ; 03032 THD_session *new_ss , *old_ss ; 03033 Three_D_View *im3d ; 03034 MCW_idcode anat_idcode[MAX_CONTROLLERS] , 03035 func_idcode[MAX_CONTROLLERS] ; 03036 THD_slist_find find ; 03037 03038 ENTRY("AFNI_rescan_session_OLD") ; 03039 { char str[256]; sprintf(str,"session index %d\n",sss); STATUS(str); } 03040 03041 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; RETURN(0) ; } 03042 03043 #if 0 03044 fprintf(stderr,"Enter AFNI_rescan_session_OLD on session index %d\n",sss) ; 03045 #endif 03046 03047 /*--- sanity checks ---*/ 03048 03049 if( sss < 0 || sss >= GLOBAL_library.sslist->num_sess ){ BEEPIT ; RETURN(0) ; } 03050 03051 old_ss = GLOBAL_library.sslist->ssar[sss] ; 03052 if( ! ISVALID_SESSION(old_ss) ){ BEEPIT; RETURN(0); } 03053 03054 if( old_ss == GLOBAL_library.session ) RETURN(0) ; /* 21 Dec 2001 */ 03055 03056 /*--- Make sure that the dataset choosers are closed. 03057 Since these are just instances of the generic strlist 03058 chooser, and we can't tell what is being chosen just now, 03059 we'll just forcibly close the strlist chooser no matter what. ---*/ 03060 03061 POPDOWN_strlist_chooser ; 03062 03063 /*--- mark all datasets in the old session for deletion from memory ---*/ 03064 03065 STATUS("marking old session datasets") ; 03066 03067 nold = old_ss->num_dsset ; 03068 03069 for( ii=0 ; ii < old_ss->num_dsset ; ii++ ) 03070 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ) 03071 if( ISVALID_3DIM_DATASET(old_ss->dsset[ii][vv]) ) 03072 if( DSET_in_global_session(old_ss->dsset[ii][vv]) ) 03073 old_ss->dsset[ii][vv] = NULL ; /* will be added back in later */ 03074 else 03075 DSET_MARK_FOR_DEATH( old_ss->dsset[ii][vv] ) ; 03076 03077 /*--- mark all descendants for purging as well ---*/ 03078 03079 AFNI_mark_for_death( GLOBAL_library.sslist ) ; 03080 03081 /*--- but before actual deletion, find the 03082 active datasets in each main controller window ---*/ 03083 03084 STATUS("checking active controllers") ; 03085 03086 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){ 03087 ZERO_IDCODE(anat_idcode[cc]) ; ZERO_IDCODE(func_idcode[cc]) ; 03088 im3d = GLOBAL_library.controllers[cc] ; 03089 if( IM3D_OPEN(im3d) && im3d->vinfo->sess_num == sss ){ 03090 anat_idcode[cc] = im3d->anat_now->idcode ; 03091 03092 if( ISVALID_3DIM_DATASET(im3d->fim_now) ) 03093 func_idcode[cc] = im3d->fim_now->idcode ; 03094 03095 XmUpdateDisplay(im3d->vwid->top_shell) ; 03096 } 03097 } 03098 03099 /*--- now can flush the old datasets, prior to reading again ---*/ 03100 03101 AFNI_andersonville( GLOBAL_library.sslist , False ) ; /* keep files! */ 03102 03103 /*--- now read in the session again ---*/ 03104 03105 STATUS("rescanning session now:") ; 03106 STATUS(old_ss->sessname) ; 03107 03108 new_ss = THD_init_session( old_ss->sessname ) ; 03109 03110 if( new_ss == NULL || new_ss->num_dsset <= 0 ){ 03111 fprintf(stderr,"\n*** Fatal error: Rescan of session %s finds nothing!\a\n", 03112 old_ss->sessname ) ; 03113 EXIT(1) ; 03114 } 03115 03116 myXtFree( old_ss ) ; /* no longer need this */ 03117 03118 /* set parent pointers */ 03119 03120 STATUS("PARENTIZE-ing datasets in new session") ; 03121 03122 new_ss->parent = NULL ; 03123 for( ii=0 ; ii < new_ss->num_dsset ; ii++ ) 03124 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ) 03125 PARENTIZE( new_ss->dsset[ii][vv] , NULL ) ; 03126 03127 /* put the new session into place in the list of sessions */ 03128 03129 GLOBAL_library.sslist->ssar[sss] = new_ss ; 03130 03131 /* 20 Dec 2001: add the global datasets back in, if any */ 03132 03133 AFNI_append_sessions( new_ss , GLOBAL_library.session ) ; 03134 03135 /* assign the warp and anatomy parent pointers; 03136 then, make any datasets that don't exist but logically 03137 descend from the warp and anatomy parents just assigned */ 03138 03139 THD_reconcile_parents( GLOBAL_library.sslist ) ; 03140 AFNI_force_adoption( new_ss , GLOBAL_argopt.warp_4D ) ; 03141 AFNI_make_descendants( GLOBAL_library.sslist ) ; 03142 03143 /* 28 Aug 2002: deal with warptables */ 03144 03145 if( new_ss->warptable != NULL ){ 03146 if( GLOBAL_library.warptable == NULL ) /* create global warptable */ 03147 GLOBAL_library.warptable = new_Htable(101) ; 03148 subsume_Htable( new_ss->warptable , GLOBAL_library.warptable ) ; 03149 destroy_Htable( new_ss->warptable ) ; 03150 new_ss->warptable = NULL ; 03151 } 03152 03153 /*--- for each main controller window, must reset some pointers ---*/ 03154 03155 STATUS("fixing active controllers") ; 03156 03157 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){ 03158 im3d = GLOBAL_library.controllers[cc] ; 03159 if( IM3D_OPEN(im3d) && im3d->vinfo->sess_num == sss ){ 03160 im3d->ss_now = new_ss ; 03161 vv = im3d->vinfo->view_type ; /* won't change this */ 03162 03163 im3d->fimdata->fimdset = NULL ; /* disable FIMage */ 03164 03165 /* look for old anat dataset in new session */ 03166 03167 find = THD_dset_in_session( FIND_IDCODE , 03168 &(anat_idcode[cc]) , new_ss ) ; 03169 03170 /* if have it, use it, otherwise, pick first anat in this view */ 03171 03172 if( find.dset != NULL && find.view_index == vv ){ 03173 im3d->vinfo->anat_num = find.dset_index ; 03174 } else { 03175 for( ii=0 ; ii < new_ss->num_dsset ; ii++ ) 03176 if( ISVALID_3DIM_DATASET(new_ss->dsset[ii][vv]) ) break ; 03177 if( ii < new_ss->num_dsset ){ 03178 im3d->vinfo->anat_num = ii ; 03179 } else { 03180 fprintf(stderr, 03181 "\n*** Fatal error:" 03182 " Cannot find anat dataset to switch to after" 03183 " rescanning session %s\a\n", 03184 new_ss->sessname ) ; 03185 EXIT(1) ; 03186 } 03187 } 03188 03189 /* do the same for old func dataset, if any */ 03190 03191 if( ! ISZERO_IDCODE(func_idcode[cc]) ){ 03192 find = THD_dset_in_session( FIND_IDCODE , 03193 &(func_idcode[cc]) , new_ss ) ; 03194 03195 if( find.dset != NULL && find.view_index == vv ){ 03196 im3d->vinfo->func_num = find.dset_index ; 03197 } else { 03198 for( ii=0 ; ii < new_ss->num_dsset ; ii++ ) 03199 if( ISVALID_3DIM_DATASET(new_ss->dsset[ii][vv]) ) break ; 03200 if( ii < new_ss->num_dsset ){ 03201 im3d->vinfo->func_num = ii ; 03202 } else { 03203 im3d->vinfo->func_num = 0 ; /* no func is not fatal */ 03204 } 03205 } 03206 } else { 03207 im3d->vinfo->func_num = 0 ; 03208 } 03209 03210 /* switch this controller to the new datasets */ 03211 03212 AFNI_initialize_view( NULL , im3d ) ; 03213 XmUpdateDisplay(im3d->vwid->top_shell) ; 03214 } 03215 } 03216 03217 nnew = new_ss->num_dsset ; 03218 03219 RETURN( (nnew-nold) ) ; 03220 } |
|
Definition at line 3351 of file afni_func.c. References ADDTO_IMARR, ADDTO_SARR, BEEPIT, DESTROY_SARR, ENTRY, FREE_IMARR, GLOBAL_library, AFNI_library_type::have_dummy_dataset, IMARR_COUNT, IMARR_SUBIMAGE, INIT_SARR, mri_free(), MRI_IMAGE::name, THD_sessionlist::num_sess, POPDOWN_timeseries_chooser, THD_session::sessname, THD_sessionlist::ssar, AFNI_library_type::sslist, THD_get_many_timeseries(), and AFNI_library_type::timeseries. Referenced by AFNI_finalize_read_sess_CB().
03352 { 03353 int iss , inew , jold , nnew , nold , nadd=0 ; 03354 THD_string_array *dlist ; 03355 THD_session *ss ; 03356 MRI_IMARR *newtsar ; 03357 MRI_IMAGE *newim , *oldim ; 03358 03359 ENTRY("AFNI_rescan_timeseries_CB") ; 03360 03361 /** assemble list of directories **/ 03362 03363 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; EXRETURN ; } 03364 03365 INIT_SARR( dlist ) ; 03366 03367 for( iss=0 ; iss < GLOBAL_library.sslist->num_sess ; iss++ ){ 03368 ss = GLOBAL_library.sslist->ssar[iss] ; 03369 ADDTO_SARR(dlist,ss->sessname) ; 03370 } 03371 03372 /** read timeseries into a new array **/ 03373 03374 newtsar = THD_get_many_timeseries( dlist ) ; 03375 DESTROY_SARR( dlist ) ; 03376 if( newtsar == NULL ) EXRETURN ; 03377 03378 /** check to see which ones are in the old list **/ 03379 03380 nnew = IMARR_COUNT(newtsar) ; 03381 nold = IMARR_COUNT(GLOBAL_library.timeseries) ; 03382 03383 for( inew=0 ; inew < nnew ; inew++ ){ 03384 newim = IMARR_SUBIMAGE(newtsar,inew) ; /* new timeseries */ 03385 for( jold=0 ; jold < nold ; jold++ ){ 03386 oldim = IMARR_SUBIMAGE(GLOBAL_library.timeseries,jold) ; /* old one */ 03387 03388 if( oldim != NULL && oldim->name != NULL && /* break out of loop */ 03389 strcmp(oldim->name,newim->name) == 0 ) break ; /* when new == old */ 03390 } 03391 03392 if( jold == nold ){ 03393 ADDTO_IMARR(GLOBAL_library.timeseries,newim); nadd++; /* is new */ 03394 } else { 03395 mri_free(newim) ; /* is old */ 03396 } 03397 } 03398 03399 if( nadd > 0 ) POPDOWN_timeseries_chooser ; 03400 FREE_IMARR(newtsar) ; 03401 EXRETURN ; 03402 } |
|
Definition at line 4589 of file afni_func.c. References AFNI_autorange_label(), AFNI_range_label(), AFNI_view_info::autorange_label, ENTRY, AFNI_view_info::fim_autorange, AFNI_view_info::fim_range, AFNI_widget_set::func, MCW_arrowval::fval, HINTIZE_pbar, IM3D_VALID, MCW_expose_widget(), AFNI_view_info::old_range_label, RANGE_AUTOBUT, AFNI_function_widgets::range_av, AFNI_function_widgets::range_bbox, AFNI_function_widgets::range_label, AFNI_view_info::use_autorange, Three_D_View::vinfo, Three_D_View::vwid, and MCW_bbox::wbut. Referenced by AFNI_do_many_writes(), AFNI_fimmer_redisplay(), AFNI_func_overlay(), AFNI_setup_viewing(), AFNI_write_dataset_CB(), and PLUTO_dset_redisplay_mode().
04590 { 04591 XmString xstr ; 04592 Boolean same ; 04593 04594 ENTRY("AFNI_reset_func_range") ; 04595 04596 if( ! IM3D_VALID(im3d) ) EXRETURN ; 04597 04598 /*-- the range label widget --*/ 04599 04600 xstr = AFNI_range_label( im3d ) ; 04601 same = XmStringCompare( xstr , im3d->vinfo->old_range_label ) ; 04602 04603 if( same == False ){ 04604 XtVaSetValues( im3d->vwid->func->range_label , /* redisplay */ 04605 XmNlabelString , xstr , /* if changed */ 04606 NULL ) ; 04607 MCW_expose_widget( im3d->vwid->func->range_label ) ; /* redraw now! */ 04608 XmStringFree(im3d->vinfo->old_range_label) ; /* toss old */ 04609 im3d->vinfo->old_range_label = xstr ; /* new old */ 04610 } else { 04611 XmStringFree( xstr ) ; /* was same --> don't need this copy */ 04612 } 04613 04614 /*-- the autorange toggle widget --*/ 04615 04616 xstr = AFNI_autorange_label( im3d ) ; 04617 same = XmStringCompare( xstr , im3d->vinfo->autorange_label ) ; 04618 04619 if( same == False ){ 04620 Widget www = im3d->vwid->func->range_bbox->wbut[RANGE_AUTOBUT] ; 04621 XtVaSetValues( www , XmNlabelString , xstr , NULL ) ; 04622 MCW_expose_widget( www ) ; 04623 XmStringFree(im3d->vinfo->autorange_label) ; 04624 im3d->vinfo->autorange_label = xstr ; 04625 } else { 04626 XmStringFree( xstr ) ; /* was same --> don't need this copy */ 04627 } 04628 04629 /*-- the functional range itself --*/ 04630 04631 im3d->vinfo->fim_range = 04632 (im3d->vinfo->use_autorange) ? (im3d->vinfo->fim_autorange) 04633 : (im3d->vwid->func->range_av->fval) ; 04634 04635 HINTIZE_pbar(im3d) ; /* 22 Aug 2001 */ 04636 04637 EXRETURN ; 04638 } |
|
Definition at line 18 of file afni_func.c. References AFNI_disable_suma_overlay(), AFNI_redisplay_func(), ENTRY, Three_D_View::fim_now, AFNI_view_info::func_visible, IM3D_VALID, ISVALID_3DIM_DATASET, MCW_set_bbox(), MCW_val_bbox(), RESET_AFNI_QUIT, AFNI_viewing_widgets::see_func_bbox, AFNI_widget_set::view, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_set_func_visible().
00019 { 00020 Three_D_View *im3d = (Three_D_View *) cd ; 00021 int old_val , new_val ; 00022 00023 ENTRY("AFNI_see_func_CB") ; 00024 00025 if( ! IM3D_VALID(im3d) ) EXRETURN ; 00026 00027 old_val = (im3d->vinfo->func_visible) ? 1 : 0 ; 00028 new_val = MCW_val_bbox( im3d->vwid->view->see_func_bbox ) ; 00029 00030 if( old_val != new_val ){ 00031 im3d->vinfo->func_visible = (new_val == 1) ? True : False ; 00032 if( ! ISVALID_3DIM_DATASET(im3d->fim_now) ){ /* 29 Apr 1997 */ 00033 im3d->vinfo->func_visible = False ; 00034 MCW_set_bbox( im3d->vwid->view->see_func_bbox , 0 ) ; /* 29 Jan 1999 */ 00035 } 00036 AFNI_disable_suma_overlay( 0 ) ; /* 16 Jun 2003 */ 00037 AFNI_redisplay_func( im3d ) ; /* 05 Mar 2002 */ 00038 } 00039 00040 RESET_AFNI_QUIT(im3d) ; 00041 EXRETURN ; 00042 } |
|
Definition at line 195 of file afni_func.c. References DSET_BRICK_STATAUX, DSET_BRICK_STATCODE, ENTRY, Three_D_View::fim_now, AFNI_widget_set::func, AFNI_view_info::func_pval, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, IM3D_VALID, ISVALID_3DIM_DATASET, MCW_set_widget_label(), STATUS, THD_stat_to_pval(), AFNI_view_info::thr_index, AFNI_function_widgets::thr_pval_label, THR_PVAL_LABEL_NONE, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_fimmer_redisplay(), AFNI_set_thresh_top(), AFNI_setup_viewing(), AFNI_thr_scale_CB(), AFNI_thr_scale_drag_CB(), and AFNI_thrdrag_lock_carryout().
00196 { 00197 float thresh , pval ; 00198 int dec ; 00199 char buf[16] ; 00200 00201 ENTRY("AFNI_set_thr_pval") ; 00202 00203 if( ! IM3D_VALID(im3d) || ! ISVALID_3DIM_DATASET(im3d->fim_now) ) EXRETURN ; 00204 00205 /* get the "true" threshold (scaled up from being in [0,1]) */ 00206 00207 thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ; 00208 00209 /* get the p-value that goes with this threshold, for this functional dataset */ 00210 00211 pval = THD_stat_to_pval( thresh , 00212 DSET_BRICK_STATCODE(im3d->fim_now,im3d->vinfo->thr_index) , 00213 DSET_BRICK_STATAUX (im3d->fim_now,im3d->vinfo->thr_index) ) ; 00214 00215 im3d->vinfo->func_pval = pval ; /* 06 Feb 2004 */ 00216 00217 if(PRINT_TRACING) 00218 { char buf[128] ; 00219 sprintf( buf, "thresh=%g top=%g pval=%g", 00220 thresh,im3d->vinfo->func_thresh_top,pval ) ; STATUS(buf) ; } 00221 00222 if( pval < 0.0 ){ 00223 strcpy( buf , THR_PVAL_LABEL_NONE ) ; 00224 } else { 00225 if( pval == 0.0 ){ 00226 strcpy( buf , "p = 0" ) ; 00227 } else if( pval >= 0.9999 ){ 00228 strcpy( buf , "p = 1" ) ; 00229 } else if( pval >= 0.0010 ){ 00230 char qbuf[16] ; 00231 sprintf( qbuf , "%5.4f" , pval ) ; 00232 strcpy( buf , qbuf+1 ) ; 00233 } else { 00234 int dec = (int)(0.999 - log10(pval)) ; 00235 pval = pval * pow( 10.0 , (double) dec ) ; /* between 1 and 10 */ 00236 if( dec < 10 ) sprintf( buf , "%3.1f-%1d" , pval , dec ) ; 00237 else sprintf( buf , "%1d.-%2d" , (int)rint(pval), dec ) ; 00238 } 00239 } 00240 MCW_set_widget_label( im3d->vwid->func->thr_pval_label , buf ) ; 00241 EXRETURN ; 00242 } |
|
Definition at line 125 of file afni_func.c. References AFNI_set_thr_pval(), AV_assign_ival(), ENTRY, FIX_SCALE_SIZE, FIX_SCALE_VALUE, AFNI_widget_set::func, AFNI_view_info::func_thresh_top, IM3D_OPEN, MCW_arrowval::ival, AFNI_function_widgets::thr_scale, AFNI_function_widgets::thr_top_av, THR_TOP_EXPON, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_drive_set_threshnew(), AFNI_drive_set_threshold(), and AFNI_thresh_top_CB().
00126 { 00127 int decim ; 00128 00129 ENTRY("AFNI_set_thresh_top") ; 00130 00131 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 00132 00133 if( tval <= 0.0 ) tval = 1.0 ; 00134 00135 decim = (2*THR_TOP_EXPON) - (int)(THR_TOP_EXPON + 0.01 + log10(tval)) ; 00136 if( decim < 0 ) decim = 0 ; 00137 00138 XtVaSetValues( im3d->vwid->func->thr_scale, XmNdecimalPoints, decim, NULL ) ; 00139 00140 im3d->vinfo->func_thresh_top = tval ; 00141 00142 FIX_SCALE_VALUE(im3d) ; 00143 FIX_SCALE_SIZE(im3d) ; /* 09 May 2001 */ 00144 AFNI_set_thr_pval( im3d ) ; 00145 00146 /** fix the option menu at the bottom of the scale **/ 00147 00148 decim = THR_TOP_EXPON - decim ; 00149 if( decim != im3d->vwid->func->thr_top_av->ival ) 00150 AV_assign_ival( im3d->vwid->func->thr_top_av , decim ) ; 00151 00152 EXRETURN ; 00153 } |
|
Definition at line 1847 of file afni_func.c. References AFNI_controller_label(), Three_D_View::anat_now, Three_D_View::anat_wod_flag, THD_3dim_dataset::dblk, THD_diskptr::directory_name, THD_datablock::diskptr, drive_MCW_grapher(), drive_MCW_imseq(), ENTRY, THD_diskptr::filecode, Three_D_View::fim_now, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, GLOBAL_argopt, graDR_title, IM3D_OPEN, isqDR_title, ISVALID_3DIM_DATASET, THD_3dim_dataset::label2, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, SESSTRAIL, THD_MAX_NAME, THD_trailname(), AF_options::title_name, AFNI_widget_set::top_shell, USE_TITLE2, Three_D_View::vwid, and Three_D_View::window_title. Referenced by AFNI_underlay_CB(), ENV_redraw_titles(), ENV_sesstrail(), and PLUTO_fixup_names().
01848 { 01849 Boolean redo_title ; 01850 char ttl[THD_MAX_NAME] , nam[THD_MAX_NAME] ; 01851 char *tnam ; 01852 01853 ENTRY("AFNI_set_window_titles") ; 01854 01855 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 01856 01857 if( im3d->anat_wod_flag ) 01858 sprintf(ttl , "{warp} %s%s: " , 01859 AFNI_controller_label(im3d),GLOBAL_argopt.title_name) ; 01860 else 01861 sprintf(ttl , "%s%s: " , 01862 AFNI_controller_label(im3d),GLOBAL_argopt.title_name) ; 01863 01864 if( USE_TITLE2(im3d->anat_now) ){ 01865 strcat( ttl , im3d->anat_now->label2 ) ; 01866 } else { 01867 strcpy( nam , im3d->anat_now->dblk->diskptr->directory_name ) ; 01868 strcat( nam , im3d->anat_now->dblk->diskptr->filecode ) ; 01869 tnam = THD_trailname(nam,SESSTRAIL+1) ; 01870 strcat( ttl , tnam ) ; 01871 } 01872 01873 if( ISVALID_3DIM_DATASET(im3d->fim_now) ){ 01874 strcat( ttl , " & " ) ; 01875 if( USE_TITLE2(im3d->fim_now) ){ 01876 strcat( ttl , im3d->fim_now->label2 ) ; 01877 } else { 01878 strcat( ttl , im3d->fim_now->dblk->diskptr->filecode ) ; 01879 } 01880 } 01881 01882 redo_title = (Boolean) (strcmp(ttl,im3d->window_title) != 0 ) ; 01883 if( redo_title ){ 01884 strcpy( im3d->window_title , ttl ) ; 01885 XtVaSetValues( im3d->vwid->top_shell , XmNtitle , ttl , NULL ) ; 01886 01887 if( im3d->s123 != NULL ) 01888 drive_MCW_imseq( im3d->s123 , isqDR_title , (XtPointer) ttl ) ; 01889 01890 if( im3d->s231 != NULL ) 01891 drive_MCW_imseq( im3d->s231 , isqDR_title , (XtPointer) ttl ) ; 01892 01893 if( im3d->s312 != NULL ) 01894 drive_MCW_imseq( im3d->s312 , isqDR_title , (XtPointer) ttl ) ; 01895 01896 if( im3d->g123 != NULL ) 01897 drive_MCW_grapher( im3d->g123 , graDR_title , (XtPointer) ttl ) ; 01898 01899 if( im3d->g231 != NULL ) 01900 drive_MCW_grapher( im3d->g231 , graDR_title , (XtPointer) ttl ) ; 01901 01902 if( im3d->g312 != NULL ) 01903 drive_MCW_grapher( im3d->g312 , graDR_title , (XtPointer) ttl ) ; 01904 } 01905 01906 EXRETURN ; 01907 } |
|
6/01/95: changed to put the initialization constants in tables initialized in afni.c, not here. * Definition at line 345 of file afni_func.c. References Three_D_View::dc, ENTRY, AFNI_widget_set::func, i, IM3D_VALID, INIT_ovin_pos, INIT_ovin_sgn, INIT_pval_pos, INIT_pval_sgn, AFNI_function_widgets::inten_pbar, MIN, MCW_pbar::mode, MCW_DCOV::ncol_ov, NPANE_MAX, NPANE_MIN, MCW_pbar::num_panes, MCW_pbar::ov_index, MCW_DC::ovc, MCW_pbar::ovin_save, MCW_pbar::pval, MCW_pbar::pval_save, MCW_pbar::update_me, and Three_D_View::vwid.
00346 { 00347 MCW_pbar *pbar ; 00348 int np , i , jm , lcol ; 00349 00350 ENTRY("AFNI_setup_inten_pbar") ; 00351 00352 if( ! IM3D_VALID(im3d) ) EXRETURN ; 00353 00354 pbar = im3d->vwid->func->inten_pbar ; 00355 jm = pbar->mode ; 00356 lcol = im3d->dc->ovc->ncol_ov - 1 ; 00357 00358 /** load the 'save' values for all possible pane counts **/ 00359 00360 for( np=NPANE_MIN ; np <= NPANE_MAX ; np++ ){ 00361 00362 for( i=0 ; i <= np ; i++ ){ 00363 pbar->pval_save[np][i][0] = INIT_pval_sgn[np][i] ; 00364 pbar->pval_save[np][i][1] = INIT_pval_pos[np][i] ; 00365 } 00366 00367 for( i=0 ; i < np ; i++ ){ 00368 pbar->ovin_save[np][i][0] = MIN( lcol , INIT_ovin_sgn[np][i] ) ; 00369 pbar->ovin_save[np][i][1] = MIN( lcol , INIT_ovin_pos[np][i] ) ; 00370 } 00371 } 00372 00373 /** load the values for the current pane count **/ 00374 00375 np = pbar->num_panes ; 00376 jm = pbar->mode ; 00377 00378 for( i=0 ; i <= np ; i++ ) pbar->pval[i] = pbar->pval_save[np][i][jm] ; 00379 for( i=0 ; i < np ; i++ ) pbar->ov_index[i] = pbar->ovin_save[np][i][jm] ; 00380 00381 pbar->update_me = 1 ; 00382 EXRETURN ; 00383 } |
|
Definition at line 51 of file afni_func.c. References AFNI_redisplay_func(), AFNI_set_thr_pval(), AFNI_thresh_lock_carryout(), client_data, DOING_REALTIME_WORK, ENTRY, FIX_SCALE_SIZE, FIX_SCALE_VALUE, AFNI_widget_set::func, AFNI_view_info::func_pval, AFNI_view_info::func_threshold, AFNI_view_info::func_visible, IM3D_VALID, MCW_register_hint(), REDISPLAY_OPTIONAL, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, THR_FACTOR, AFNI_function_widgets::thr_pval_label, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_drive_set_threshnew(), and AFNI_drive_set_threshold().
00052 { 00053 Three_D_View *im3d = (Three_D_View *) client_data ; 00054 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data ; 00055 float fff ; 00056 int redisplay , ival ; 00057 00058 ENTRY("AFNI_thr_scale_CB") ; 00059 00060 if( ! IM3D_VALID(im3d) ) EXRETURN ; 00061 00062 if( cbs != NULL ) ival = cbs->value ; 00063 else XmScaleGetValue( w , &ival ) ; 00064 00065 fff = THR_FACTOR * ival ; 00066 if( fff >= 0.0 && fff <= 1.0 ) im3d->vinfo->func_threshold = fff ; 00067 00068 FIX_SCALE_VALUE(im3d) ; 00069 FIX_SCALE_SIZE(im3d) ; /* 09 May 2001 */ 00070 00071 redisplay = (im3d->vinfo->func_visible) ? REDISPLAY_OVERLAY 00072 : REDISPLAY_OPTIONAL ; 00073 AFNI_set_thr_pval( im3d ) ; 00074 00075 if( im3d->vinfo->func_pval >= 0.0 && im3d->vinfo->func_pval <= 1.0 ){ 00076 char pstr[32] ; 00077 sprintf( pstr , "nominal p=%.5e" , im3d->vinfo->func_pval ) ; 00078 MCW_register_hint( im3d->vwid->func->thr_pval_label , pstr ) ; 00079 } else { 00080 MCW_register_hint( im3d->vwid->func->thr_pval_label , 00081 "Nominal p-value per voxel" ) ; 00082 } 00083 00084 if( ! DOING_REALTIME_WORK ) 00085 AFNI_redisplay_func( im3d ) ; 00086 00087 AFNI_thresh_lock_carryout(im3d) ; /* 06 Feb 2004 */ 00088 00089 RESET_AFNI_QUIT(im3d) ; 00090 EXRETURN ; 00091 } |
|
Definition at line 98 of file afni_func.c. References AFNI_set_thr_pval(), AFNI_thrdrag_lock_carryout(), client_data, DSET_BRICK_STATCODE, ENTRY, Three_D_View::fim_now, FIX_SCALE_VALUE, FUNC_HAVE_PVAL, AFNI_view_info::func_threshold, IM3D_OPEN, ISVALID_3DIM_DATASET, THR_FACTOR, AFNI_view_info::thr_index, and Three_D_View::vinfo.
00099 { 00100 Three_D_View *im3d = (Three_D_View *) client_data ; 00101 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data ; 00102 float fff ; 00103 00104 ENTRY("AFNI_thr_scale_drag CB") ; 00105 00106 if( IM3D_OPEN(im3d) && ISVALID_3DIM_DATASET(im3d->fim_now) ){ 00107 00108 fff = THR_FACTOR * cbs->value ; 00109 if( fff >= 0.0 && fff <= 1.0 ) im3d->vinfo->func_threshold = fff ; 00110 00111 FIX_SCALE_VALUE(im3d) ; 00112 if( FUNC_HAVE_PVAL(DSET_BRICK_STATCODE(im3d->fim_now,im3d->vinfo->thr_index)) ) 00113 AFNI_set_thr_pval( im3d ) ; 00114 00115 AFNI_thrdrag_lock_carryout( im3d ) ; /* 10 Feb 2004 */ 00116 } 00117 EXRETURN ; 00118 } |
|
fix the option menu at the bottom of the scale * Definition at line 159 of file afni_func.c. References MCW_arrowval::ival.
00160 { 00161 static char tlab[8] ; 00162 sprintf(tlab,"%d",av->ival) ; 00163 return tlab ; 00164 } |
|
Definition at line 170 of file afni_func.c. References AFNI_redisplay_func(), AFNI_set_thresh_top(), AFNI_thresh_lock_carryout(), ENTRY, AFNI_view_info::func_thresh_top, AFNI_view_info::func_visible, IM3D_OPEN, MCW_arrowval::ival, and Three_D_View::vinfo.
00171 { 00172 Three_D_View *im3d = (Three_D_View *) cd ; 00173 static float tval[9] = { 1.0 , 10.0 , 100.0 , 1000.0 , 10000.0 , 00174 100000.0 , 1000000.0 , 10000000.0 , 100000000.0 } ; 00175 00176 ENTRY("AFNI_thresh_top_CB") ; 00177 00178 if( IM3D_OPEN(im3d) && im3d->vinfo->func_thresh_top != tval[av->ival] ){ 00179 00180 AFNI_set_thresh_top( im3d , tval[av->ival] ) ; 00181 00182 if( im3d->vinfo->func_visible ) AFNI_redisplay_func( im3d ) ; 00183 00184 AFNI_thresh_lock_carryout(im3d) ; /* 06 Feb 2004 */ 00185 } 00186 00187 EXRETURN ; 00188 } |
|
now apply threshold, if any * Definition at line 1436 of file afni_func.c. References AFNI_slice_flip(), Three_D_View::anat_now, DSET_load, DSET_NVOX, DSET_NZ, ENTRY, TTRR_params::hemi, TTRR_params::meth, MRI_BYTE_PTR, mri_free(), mri_new_conforming, MRI_SHORT_PTR, TTRR_params::num, MRI_IMAGE::nvox, RESAM_NN_TYPE, RETURN, STATUS, TT_retrieve_atlas(), TT_retrieve_atlas_nz, TTRR_params::ttbrik, TTRR_params::ttovc, TTRR_get_params(), TTRR_HEMI_BOTH, TTRR_HEMI_LEFT, TTRR_HEMI_RIGHT, TTRR_METH_FAG, TTRR_METH_FGA, TTRR_METH_GAF, and TTRR_params::ttval. Referenced by AFNI_overlay().
01439 { 01440 THD_3dim_dataset *dseTT ; 01441 TTRR_params *ttp ; 01442 byte *b0 , *b1 , *brik, *val, *ovc , g_ov,a_ov,final_ov ; 01443 short *ovar ; 01444 MRI_IMAGE *ovim=NULL , *b0im , *b1im ; 01445 int gwin , fwin , nreg , ii,jj , nov ; 01446 01447 ENTRY("AFNI_ttatlas_overlay") ; 01448 01449 /* setup and sanity checks */ 01450 01451 STATUS("checking if have Atlas dataset") ; 01452 01453 /* 01 Aug 2001: retrieve atlas based on z-axis size of underlay dataset */ 01454 #if 1 01455 dseTT = TT_retrieve_atlas_nz( DSET_NZ(im3d->anat_now) ) ; 01456 if( dseTT == NULL ) RETURN(NULL) ; 01457 #else 01458 dseTT = TT_retrieve_atlas() ; if( dseTT == NULL ) RETURN(NULL) ; 01459 #endif 01460 01461 /* make sure Atlas and current dataset match in size */ 01462 01463 STATUS("checking if Atlas and anat dataset match") ; 01464 01465 if( DSET_NVOX(dseTT) != DSET_NVOX(im3d->anat_now) ) RETURN(NULL) ; 01466 01467 /* make sure we are actually drawing something */ 01468 01469 STATUS("checking if Atlas Colors is on") ; 01470 01471 ttp = TTRR_get_params() ; if( ttp == NULL ) RETURN(NULL) ; 01472 01473 /* at this time, hemisphere processing doesn't work in this function */ 01474 01475 #if 0 01476 switch( ttp->hemi ){ 01477 case TTRR_HEMI_LEFT: hbot=HEMX+1 ; break ; 01478 case TTRR_HEMI_RIGHT: hbot= 0 ; break ; 01479 case TTRR_HEMI_BOTH: hbot= 0 ; break ; 01480 } 01481 #endif 01482 01483 /* get slices from TTatlas dataset */ 01484 01485 STATUS("loading Atlas bricks") ; 01486 01487 DSET_load(dseTT) ; 01488 b0im = AFNI_slice_flip( n , 0 , RESAM_NN_TYPE , ax_1,ax_2,ax_3 , dseTT ) ; 01489 if( b0im == NULL ) RETURN(NULL) ; 01490 01491 b1im = AFNI_slice_flip( n , 1 , RESAM_NN_TYPE , ax_1,ax_2,ax_3 , dseTT ) ; 01492 if( b1im == NULL ){ mri_free(b0im) ; RETURN(NULL) ; } 01493 01494 /* make a new overlay image, or just operate on the old one */ 01495 01496 if( fov == NULL ){ 01497 STATUS("making new overlay for Atlas") ; 01498 ovim = mri_new_conforming( b0im , MRI_short ) ; /* new overlay */ 01499 ovar = MRI_SHORT_PTR(ovim) ; 01500 memset( ovar , 0 , ovim->nvox * sizeof(short) ) ; 01501 } else{ 01502 STATUS("re-using old overlay for Atlas") ; 01503 ovim = fov ; /* old overlay */ 01504 ovar = MRI_SHORT_PTR(ovim) ; 01505 if( ovim->nvox != b0im->nvox ){ /* shouldn't */ 01506 mri_free(b0im) ; mri_free(b1im) ; RETURN(NULL) ; /* happen! */ 01507 } 01508 } 01509 01510 b0 = MRI_BYTE_PTR(b0im) ; b1 = MRI_BYTE_PTR(b1im) ; 01511 01512 /* fwin => function 'wins' over Atlas */ 01513 /* gwin => gyral Atlas brick 'wins' over 'area' Atlas brick */ 01514 01515 fwin = (ttp->meth == TTRR_METH_FGA) || (ttp->meth == TTRR_METH_FAG) ; 01516 gwin = (ttp->meth == TTRR_METH_FGA) || (ttp->meth == TTRR_METH_GAF) ; 01517 01518 nreg = ttp->num ; /* number of 'on' regions */ 01519 brik = ttp->ttbrik ; /* which sub-brick in atlas */ 01520 val = ttp->ttval ; /* which code in that sub-brick */ 01521 ovc = ttp->ttovc ; /* which overlay color index */ 01522 01523 /* loop over image voxels, find overlays from Atlas */ 01524 01525 STATUS("doing Atlas overlay") ; 01526 01527 for( nov=ii=0 ; ii < ovim->nvox ; ii++ ){ 01528 01529 if( ovar[ii] && fwin ) continue ; /* function wins */ 01530 01531 /* check Atlas 'on' regions for hits */ 01532 01533 g_ov = a_ov = 0 ; 01534 for( jj=0 ; (g_ov==0 || a_ov==0) && jj<nreg ; jj++ ){ 01535 if( b0[ii] == val[jj] ) g_ov = ovc[jj] ; 01536 else if( b1[ii] == val[jj] ) a_ov = ovc[jj] ; 01537 } 01538 01539 if( g_ov==0 && a_ov==0 ) continue ; /* no hit */ 01540 01541 /* find the winner */ 01542 01543 if( g_ov && (gwin || a_ov==0) ) final_ov = g_ov ; 01544 else final_ov = a_ov ; 01545 01546 ovar[ii] = final_ov ; /* and the winner is ... */ 01547 nov++ ; 01548 } 01549 01550 mri_free(b0im) ; mri_free(b1im) ; /* free at last */ 01551 01552 if(PRINT_TRACING) 01553 { char str[256]; sprintf(str,"Atlas overlaid %d pixels",nov); STATUS(str); } 01554 01555 RETURN(ovim) ; 01556 } |
|
Definition at line 1623 of file afni_func.c. References AFNI_first_tog(), AFNI_IGNORE_EVERYTHING, AFNI_IGNORE_NOTHING, AFNI_IGNORE_REDRAWS, AFNI_process_alteration(), AFNI_set_viewpoint(), AFNI_set_window_titles(), Three_D_View::b123_anat, Three_D_View::b123_fim, Three_D_View::b123_ulay, Three_D_View::b231_anat, Three_D_View::b231_fim, Three_D_View::b231_ulay, Three_D_View::b312_anat, Three_D_View::b312_fim, Three_D_View::b312_ulay, BRICK_DRAWABLE, BRICK_GRAPHABLE, CLEAR_MONTAGE, Three_D_View::dc, MCW_DC::display, drive_MCW_grapher(), drive_MCW_imseq(), FD_brick::dset, DSET_GRAPHABLE, ENTRY, Three_D_View::fim_now, AFNI_widget_set::func, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, graDR_destroy, graDR_newdata, AFNI_imaging_widgets::graph_xyz_pb, AFNI_imaging_widgets::graph_yzx_pb, AFNI_imaging_widgets::graph_zxy_pb, HINTIZE_pbar, Three_D_View::ignore_seq_callbacks, IM3D_OPEN, AFNI_widget_set::imag, AFNI_imaging_widgets::image_xyz_pb, AFNI_imaging_widgets::image_yzx_pb, AFNI_imaging_widgets::image_zxy_pb, isqDR_destroy, isqDR_newseq, isqDR_sendmontage, ISVALID_DSET, LAST_UNDERLAY_TYPE, MCW_set_bbox(), REDISPLAY_ALL, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, UNDERLAY_ALLFUNC, UNDERLAY_ANAT, AFNI_function_widgets::underlay_bbox, AFNI_view_info::underlay_type, Three_D_View::vinfo, Three_D_View::vwid, and MCW_bbox::wbut. Referenced by AFNI_setup_viewing().
01624 { 01625 Three_D_View *im3d = (Three_D_View *) cd ; 01626 int bval ; 01627 Boolean seq_exist ; 01628 01629 ENTRY("AFNI_underlay_CB") ; 01630 01631 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 01632 01633 if( w != NULL ) bval = AFNI_first_tog( LAST_UNDERLAY_TYPE+1 , 01634 im3d->vwid->func->underlay_bbox->wbut ) ; 01635 else bval = im3d->vinfo->underlay_type ; 01636 01637 if( bval == im3d->vinfo->underlay_type && w != NULL ) EXRETURN ; /* nothing */ 01638 01639 im3d->vinfo->underlay_type = bval ; 01640 01641 /*----- set the bricks to use for the underlay images -----*/ 01642 01643 switch( im3d->vinfo->underlay_type ){ 01644 01645 default: 01646 XBell( im3d->dc->display , 100 ) ; /* beep and fall through! */ 01647 01648 case UNDERLAY_ANAT: /* set underlay to anat */ 01649 01650 STATUS("anatomy underlay") ; 01651 01652 im3d->b123_ulay = im3d->b123_anat ; 01653 im3d->b231_ulay = im3d->b231_anat ; 01654 im3d->b312_ulay = im3d->b312_anat ; 01655 break ; 01656 01657 case UNDERLAY_ALLFUNC: 01658 if( ISVALID_DSET(im3d->fim_now) ){ 01659 01660 STATUS("functional underlay") ; 01661 01662 im3d->b123_ulay = im3d->b123_fim ; 01663 im3d->b231_ulay = im3d->b231_fim ; 01664 im3d->b312_ulay = im3d->b312_fim ; 01665 } else { 01666 01667 STATUS("defaulted anatomy underlay") ; 01668 01669 XBell( im3d->dc->display , 100 ) ; 01670 01671 im3d->b123_ulay = im3d->b123_anat ; 01672 im3d->b231_ulay = im3d->b231_anat ; 01673 im3d->b312_ulay = im3d->b312_anat ; 01674 01675 MCW_set_bbox( im3d->vwid->func->underlay_bbox , 1<<UNDERLAY_ANAT ) ; 01676 } 01677 break ; 01678 } 01679 01680 /*--- May 1996: destroy useless graph windows ---*/ 01681 01682 im3d->ignore_seq_callbacks = AFNI_IGNORE_REDRAWS ; /* 16 Feb 97 */ 01683 01684 if( !DSET_GRAPHABLE(im3d->b123_ulay->dset) || !BRICK_GRAPHABLE(im3d->b123_ulay) ){ 01685 if( im3d->g123 != NULL ){ 01686 drive_MCW_grapher( im3d->g123 , graDR_destroy , NULL ) ; 01687 im3d->g123 = NULL ; 01688 } 01689 XtSetSensitive( im3d->vwid->imag->graph_xyz_pb , False ) ; 01690 } else { 01691 XtSetSensitive( im3d->vwid->imag->graph_xyz_pb , True ) ; 01692 } 01693 01694 if( !DSET_GRAPHABLE(im3d->b231_ulay->dset) || !BRICK_GRAPHABLE(im3d->b231_ulay) ){ 01695 if( im3d->g231 != NULL ){ 01696 drive_MCW_grapher( im3d->g231 , graDR_destroy , NULL ) ; 01697 im3d->g231 = NULL ; 01698 } 01699 XtSetSensitive( im3d->vwid->imag->graph_yzx_pb , False ) ; 01700 } else { 01701 XtSetSensitive( im3d->vwid->imag->graph_yzx_pb , True ) ; 01702 } 01703 01704 if( !DSET_GRAPHABLE(im3d->b312_ulay->dset) || !BRICK_GRAPHABLE(im3d->b312_ulay) ){ 01705 if( im3d->g312 != NULL ){ 01706 drive_MCW_grapher( im3d->g312 , graDR_destroy , NULL ) ; 01707 im3d->g312 = NULL ; 01708 } 01709 XtSetSensitive( im3d->vwid->imag->graph_zxy_pb , False ) ; 01710 } else { 01711 XtSetSensitive( im3d->vwid->imag->graph_zxy_pb , True ) ; 01712 } 01713 01714 /** 05 Mar 1997: disable viewers if x or y dimension is 1 pixel **/ 01715 01716 if( !BRICK_DRAWABLE(im3d->b123_ulay) ){ 01717 if( im3d->s123 != NULL ){ 01718 drive_MCW_imseq( im3d->s123 , isqDR_destroy , NULL ) ; 01719 im3d->s123 = NULL ; 01720 } 01721 XtSetSensitive( im3d->vwid->imag->image_xyz_pb , False ) ; 01722 } else { 01723 XtSetSensitive( im3d->vwid->imag->image_xyz_pb , True ) ; 01724 } 01725 01726 if( !BRICK_DRAWABLE(im3d->b231_ulay) ){ 01727 if( im3d->s231 != NULL ){ 01728 drive_MCW_imseq( im3d->s231 , isqDR_destroy , NULL ) ; 01729 im3d->s231 = NULL ; 01730 } 01731 XtSetSensitive( im3d->vwid->imag->image_yzx_pb , False ) ; 01732 } else { 01733 XtSetSensitive( im3d->vwid->imag->image_yzx_pb , True ) ; 01734 } 01735 01736 if( !BRICK_DRAWABLE(im3d->b312_ulay) ){ 01737 if( im3d->s312 != NULL ){ 01738 drive_MCW_imseq( im3d->s312 , isqDR_destroy , NULL ) ; 01739 im3d->s312 = NULL ; 01740 } 01741 XtSetSensitive( im3d->vwid->imag->image_zxy_pb , False ) ; 01742 } else { 01743 XtSetSensitive( im3d->vwid->imag->image_zxy_pb , True ) ; 01744 } 01745 01746 im3d->ignore_seq_callbacks = AFNI_IGNORE_NOTHING ; /* 16 Feb 97 */ 01747 01748 /*--- attach any changes to open image displays ---*/ 01749 01750 seq_exist = (im3d->s123 != NULL) || (im3d->s231 != NULL) || (im3d->s312 != NULL) || 01751 (im3d->g123 != NULL) || (im3d->g231 != NULL) || (im3d->g312 != NULL) ; 01752 01753 /* set the title for all windows */ 01754 01755 AFNI_set_window_titles( im3d ) ; 01756 01757 if( seq_exist ){ 01758 01759 im3d->ignore_seq_callbacks = AFNI_IGNORE_EVERYTHING ; 01760 01761 if( im3d->s123 != NULL ) 01762 drive_MCW_imseq( im3d->s123 , isqDR_newseq , 01763 (XtPointer) im3d->b123_ulay ) ; 01764 01765 if( im3d->s231 != NULL ) 01766 drive_MCW_imseq( im3d->s231 , isqDR_newseq , 01767 (XtPointer) im3d->b231_ulay ) ; 01768 01769 if( im3d->s312 != NULL ) 01770 drive_MCW_imseq( im3d->s312 , isqDR_newseq , 01771 (XtPointer) im3d->b312_ulay ) ; 01772 01773 if( im3d->g123 != NULL ) 01774 drive_MCW_grapher( im3d->g123 , graDR_newdata , 01775 (XtPointer) im3d->b123_ulay ) ; 01776 01777 if( im3d->g231 != NULL ) 01778 drive_MCW_grapher( im3d->g231 , graDR_newdata , 01779 (XtPointer) im3d->b231_ulay ) ; 01780 01781 if( im3d->g312 != NULL ) 01782 drive_MCW_grapher( im3d->g312 , graDR_newdata , 01783 (XtPointer) im3d->b312_ulay ) ; 01784 01785 im3d->ignore_seq_callbacks = AFNI_IGNORE_REDRAWS ; 01786 01787 /** July 1996: get the sequences to send their montaging status **/ 01788 01789 if( im3d->s123 != NULL ) 01790 drive_MCW_imseq( im3d->s123 , isqDR_sendmontage , NULL ) ; 01791 else 01792 CLEAR_MONTAGE( im3d , im3d->b123_ulay ) ; 01793 01794 if( im3d->s231 != NULL ) 01795 drive_MCW_imseq( im3d->s231 , isqDR_sendmontage , NULL ) ; 01796 else 01797 CLEAR_MONTAGE( im3d , im3d->b231_ulay ) ; 01798 01799 if( im3d->s312 != NULL ) 01800 drive_MCW_imseq( im3d->s312 , isqDR_sendmontage , NULL ) ; 01801 else 01802 CLEAR_MONTAGE( im3d , im3d->b312_ulay ) ; 01803 01804 im3d->ignore_seq_callbacks = AFNI_IGNORE_NOTHING ; 01805 01806 if( w != NULL ){ /* a real callback */ 01807 SHOW_AFNI_PAUSE ; 01808 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_ALL ) ; 01809 SHOW_AFNI_READY ; 01810 } 01811 } 01812 01813 /* Feb 1998: if a receiver is open 01814 send it a message that something has altered */ 01815 01816 AFNI_process_alteration(im3d) ; 01817 01818 HINTIZE_pbar(im3d) ; /* 15 Aug 2001 */ 01819 01820 EXRETURN ; 01821 } |
|
for any controllers whose active datasets were written out, we need to set the "See Brick" buttons to be sensitive. * Definition at line 3759 of file afni_func.c. References AFNI_refashion_dataset(), AFNI_reset_func_range(), AFNI_set_viewpoint(), Three_D_View::anat_now, AFNI_view_info::anat_resam_mode, AFNI_datamode_widgets::anatmode_bbox, BEEPIT, CURRENT_DAXES, DATAXES_TYPE, THD_3dim_dataset::daxes, Three_D_View::dc, AF_options::destruct, MCW_DC::display, AFNI_widget_set::dmode, DMODE_BRICK, DSET_IS_1D, DSET_IS_ANALYZE, DSET_IS_CTFMRI, DSET_IS_CTFSAM, DSET_IS_MINC, DSET_IS_NIFTI, DSET_WRITEABLE, ENTRY, Three_D_View::fim_now, FIRST_RESAM_TYPE, AFNI_view_info::func_resam_mode, AFNI_datamode_widgets::funcmode_bbox, GLOBAL_argopt, GLOBAL_library, AFNI_library_type::have_dummy_dataset, IM3D_VALID, ISFUNC, ISVALID_3DIM_DATASET, LAST_RESAM_TYPE, LOAD_DSET_VIEWS, MCW_CALLER_KILL, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, REDISPLAY_OVERLAY, AFNI_view_info::resam_vox, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, THD_edit_dataxes(), AFNI_widget_set::top_shell, THD_dataxes::type, Three_D_View::vinfo, Three_D_View::vwid, MCW_bbox::wbut, THD_3dim_dataset::wod_flag, AFNI_datamode_widgets::write_anat_pb, AFNI_datamode_widgets::write_func_pb, and AFNI_view_info::writeownsize.
03760 { 03761 Three_D_View *im3d = (Three_D_View *) cd ; 03762 THD_3dim_dataset *dset = NULL ; 03763 THD_dataxes new_daxes ; 03764 Widget wmsg ; 03765 int resam_mode ; 03766 Boolean good , destroy ; 03767 03768 ENTRY("AFNI_write_dataset_CB") ; 03769 03770 if( ! IM3D_VALID(im3d) || w == NULL || 03771 ! XtIsWidget(w) || ! XtIsRealized(w) ) EXRETURN ; 03772 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; EXRETURN ; } 03773 03774 if( w == im3d->vwid->dmode->write_anat_pb ){ /* write anatomy */ 03775 dset = im3d->anat_now ; 03776 resam_mode = im3d->vinfo->anat_resam_mode ; 03777 03778 } else if( w == im3d->vwid->dmode->write_func_pb ){ /* write function */ 03779 dset = im3d->fim_now ; 03780 resam_mode = im3d->vinfo->func_resam_mode ; 03781 } 03782 03783 good = ISVALID_3DIM_DATASET(dset) && /* check for bad data */ 03784 resam_mode >= FIRST_RESAM_TYPE && 03785 resam_mode <= LAST_RESAM_TYPE && 03786 im3d->vinfo->resam_vox > 0.0 && 03787 !DSET_IS_MINC(dset) && /* 29 Oct 2001 */ 03788 !DSET_IS_ANALYZE(dset) && /* 27 Aug 2002 */ 03789 !DSET_IS_CTFSAM(dset) && 03790 !DSET_IS_CTFMRI(dset) && 03791 !DSET_IS_1D(dset) && 03792 !DSET_IS_NIFTI(dset) /* 28 Aug 2003 */ 03793 ; 03794 03795 destroy = !DSET_WRITEABLE(dset) ; /* check for destruction */ 03796 03797 if( good && destroy ){ 03798 if( GLOBAL_argopt.destruct ){ 03799 (void) MCW_popup_message( w , 03800 "******************************\n" 03801 "** Potentially destructive **\n" 03802 "** dataset write initiated! **\n" 03803 "******************************" , 03804 MCW_USER_KILL | MCW_TIMER_KILL ) ; 03805 } else { 03806 good = False ; /* destruction not OK */ 03807 } 03808 } 03809 03810 if( !good ){ 03811 03812 XBell(im3d->dc->display,100) ; /* for the fun of it! */ 03813 03814 (void) MCW_popup_message( w , 03815 "****************************************************\n" 03816 "** Cannot write dataset for one of these reasons: **\n" 03817 "** -- It isn't allowed to write data in the **\n" 03818 "** Original View. **\n" 03819 "** -- It isn't allowed to overwrite data that **\n" 03820 "** is not warped from some other dataset. **\n" 03821 "** -- An internal program error has occured! **\n" 03822 "****************************************************" , 03823 MCW_USER_KILL | MCW_TIMER_KILL ) ; 03824 03825 EXRETURN; 03826 } 03827 03828 SHOW_AFNI_PAUSE ; 03829 03830 wmsg = MCW_popup_message( w , 03831 "*******************************\n" 03832 "** Please wait for dataset **\n" 03833 "** computations and disk I/O **\n" 03834 "*******************************" , MCW_CALLER_KILL ) ; 03835 03836 XtSetSensitive( im3d->vwid->top_shell , False ) ; 03837 XmUpdateDisplay( im3d->vwid->top_shell ) ; 03838 03839 LOAD_DSET_VIEWS(im3d) ; /* 02 Nov 1996 */ 03840 03841 new_daxes.type = DATAXES_TYPE ; 03842 03843 #ifdef USE_WRITEOWNSIZE 03844 if( im3d->vinfo->writeownsize ) 03845 THD_edit_dataxes( im3d->vinfo->resam_vox , dset->daxes , &new_daxes ) ; 03846 else 03847 #endif 03848 new_daxes = *CURRENT_DAXES(im3d->anat_now) ; 03849 03850 good = AFNI_refashion_dataset( im3d , dset , &new_daxes , resam_mode ) ; 03851 03852 if(PRINT_TRACING){ 03853 if( good ){ 03854 STATUS("successful refashioning") ; 03855 } else { 03856 STATUS("failed refashioning") ; 03857 }} 03858 03859 if( good && ISFUNC(dset) ){ 03860 AFNI_reset_func_range( im3d ) ; 03861 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ; /* redraw */ 03862 } 03863 03864 XtSetSensitive( im3d->vwid->top_shell , True ) ; 03865 03866 XtDestroyWidget( wmsg ) ; 03867 SHOW_AFNI_READY ; 03868 03869 /* allow the "use data brick" button, if we just wrote the anat out */ 03870 03871 if( good && w == im3d->vwid->dmode->write_anat_pb ){ 03872 STATUS("resetting 'use anat brick' button") ; 03873 XtSetSensitive( im3d->vwid->dmode->anatmode_bbox->wbut[DMODE_BRICK] , True ) ; 03874 } 03875 03876 if( good && w == im3d->vwid->dmode->write_func_pb ){ 03877 STATUS("resetting 'use func brick' button") ; 03878 XtSetSensitive( im3d->vwid->dmode->funcmode_bbox->wbut[DMODE_BRICK] , True ) ; 03879 } 03880 03881 if( ! good ){ /* bad news! */ 03882 03883 XBell(im3d->dc->display,100) ; /* for the fun of it! */ 03884 (void) MCW_popup_message( w , 03885 "***************************************\n" 03886 "** Attempt to write dataset failed **\n" 03887 "** for unknown reasons! Check files! **\n" 03888 "***************************************" , 03889 MCW_USER_KILL ) ; 03890 03891 dset->wod_flag = True ; 03892 } 03893 03894 EXRETURN ; 03895 } |
|
Definition at line 3521 of file afni_func.c. References ADDTO_SARR, AFNI_do_many_writes(), BEEPIT, THD_3dim_dataset::dblk, Three_D_View::dc, THD_diskptr::directory_name, THD_datablock::diskptr, MCW_DC::display, DSET_NUM_TIMES, DSET_NVALS, DSET_WRITEABLE, THD_session::dsset, ENTRY, THD_diskptr::filecode, THD_3dim_dataset::func_type, GLOBAL_library, AFNI_library_type::have_dummy_dataset, THD_3dim_dataset::idcode, IM3D_OPEN, INIT_SARR, ISANAT, ISANATBUCKET, ISFUNC, ISFUNCBUCKET, MAX, MCW_choose_multi_editable_strlist(), MCW_choose_multi_strlist(), MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, mcwCT_multi_mode, MIN, myXtFree, THD_session::num_dsset, THD_sessionlist::num_sess, SESSTRAIL, THD_sessionlist::ssar, AFNI_library_type::sslist, THD_MAX_NAME, THD_trailname(), AFNI_view_info::view_type, Three_D_View::vinfo, and XtRealloc.
03522 { 03523 Three_D_View *im3d = (Three_D_View *) cd ; 03524 static MCW_idcode * idclist = NULL ; 03525 static char **strlist = NULL ; 03526 static int num_dset = -1 ; 03527 03528 int iss , id , vv , llen , ltop ; 03529 THD_session *ss ; 03530 THD_3dim_dataset *dset ; 03531 char nam[THD_MAX_NAME+16] , *tnam , qnam[THD_MAX_NAME+16] ; 03532 03533 ENTRY("AFNI_write_many_dataset_CB") ; 03534 03535 if( ! IM3D_OPEN(im3d) ) EXRETURN ; 03536 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; EXRETURN ; } 03537 03538 if( num_dset > 0 && strlist != NULL ) 03539 for( id=0 ; id < num_dset ; id++ ) myXtFree(strlist[id]) ; 03540 myXtFree(idclist) ; myXtFree(strlist) ; 03541 03542 vv = im3d->vinfo->view_type ; /* select view type */ 03543 03544 /** scan once to find longest string name **/ 03545 03546 ltop = 4 ; 03547 for( iss=0 ; iss < GLOBAL_library.sslist->num_sess ; iss++ ){ 03548 ss = GLOBAL_library.sslist->ssar[iss] ; 03549 03550 for( id=0 ; id < ss->num_dsset ; id++ ){ 03551 dset = ss->dsset[id][vv] ; 03552 if( DSET_WRITEABLE(dset) ){ 03553 strcpy( nam , dset->dblk->diskptr->directory_name ) ; 03554 strcat( nam , dset->dblk->diskptr->filecode ) ; 03555 tnam = THD_trailname(nam,SESSTRAIL+1) ; 03556 llen = strlen(tnam) ; ltop = MAX(ltop,llen) ; 03557 } 03558 } 03559 } 03560 ltop = MIN(ltop,THD_MAX_NAME) ; /* 06 Aug 2002 */ 03561 03562 num_dset = 0 ; 03563 for( iss=0 ; iss < GLOBAL_library.sslist->num_sess ; iss++ ){ 03564 ss = GLOBAL_library.sslist->ssar[iss] ; 03565 03566 /* check anat datasets */ 03567 03568 for( id=0 ; id < ss->num_dsset ; id++ ){ 03569 dset = ss->dsset[id][vv] ; 03570 if( DSET_WRITEABLE(dset) ){ 03571 num_dset++ ; 03572 idclist = (MCW_idcode *) XtRealloc( (char *) idclist , 03573 sizeof(MCW_idcode) * num_dset ) ; 03574 strlist = (char **) XtRealloc( (char *) strlist , 03575 sizeof(char *) * num_dset ) ; 03576 03577 strcpy( nam , dset->dblk->diskptr->directory_name ) ; 03578 strcat( nam , dset->dblk->diskptr->filecode ) ; 03579 tnam = THD_trailname(nam,SESSTRAIL+1) ; 03580 03581 if( ISANAT(dset) ){ 03582 if( ISANATBUCKET(dset) ) /* 30 Nov 1997 */ 03583 sprintf(qnam,"%-*s [%s:%d]" , 03584 ltop,tnam , ANAT_prefixstr[dset->func_type] , DSET_NVALS(dset) ) ; 03585 03586 else if( DSET_NUM_TIMES(dset) == 1 ) 03587 sprintf(qnam,"%-*s [%s]" , 03588 ltop,tnam ,ANAT_prefixstr[dset->func_type] ) ; 03589 03590 else 03591 sprintf(qnam,"%-*s [%s:3D+t]" , 03592 ltop,tnam , ANAT_prefixstr[dset->func_type] ) ; 03593 03594 } else if( ISFUNC(dset) ){ 03595 if( ISFUNCBUCKET(dset) ) /* 30 Nov 1997 */ 03596 sprintf(qnam,"%-*s [%s:%d]" , 03597 ltop,tnam , FUNC_prefixstr[dset->func_type] , DSET_NVALS(dset) ) ; 03598 03599 else if( DSET_NUM_TIMES(dset) == 1 ) 03600 sprintf(qnam,"%-*s [%s]" , 03601 ltop,tnam , FUNC_prefixstr[dset->func_type] ) ; 03602 03603 else 03604 sprintf(qnam,"%-*s [%s:3D+t]" , 03605 ltop,tnam , FUNC_prefixstr[dset->func_type] ) ; 03606 } 03607 03608 strlist[num_dset-1] = XtNewString(qnam) ; 03609 idclist[num_dset-1] = dset->idcode ; 03610 } 03611 } /* end of loop over datasets */ 03612 03613 } /* end of loop over sessions */ 03614 03615 if( num_dset <= 0 ){ 03616 XBell(im3d->dc->display,100) ; /* for the fun of it! */ 03617 03618 (void) MCW_popup_message( w , 03619 "*******************************\n" 03620 "** No datasets are available **\n" 03621 "** to write out to disk. **\n" 03622 "*******************************" , 03623 MCW_USER_KILL | MCW_TIMER_KILL ) ; 03624 EXRETURN ; 03625 } 03626 03627 #if 1 03628 MCW_choose_multi_strlist( w , "Datasets to Write" , mcwCT_multi_mode , 03629 num_dset , NULL , strlist , 03630 AFNI_do_many_writes , (XtPointer) idclist ) ; 03631 #else 03632 { THD_string_array *sar ; /*** This code is for experiments only! ***/ 03633 INIT_SARR(sar) ; 03634 for( id=0 ; id < num_dset ; id++ ) ADDTO_SARR(sar,strlist[id]) ; 03635 03636 MCW_choose_multi_editable_strlist( w , "Datasets to Write" , mcwCT_multi_mode , 03637 sar , NULL , 03638 AFNI_do_many_writes , (XtPointer) idclist ) ; 03639 } 03640 #endif 03641 03642 XtVaSetValues( w , XmNuserData , (XtPointer) im3d , NULL ) ; 03643 03644 EXRETURN ; 03645 } |
|
Determine if dset is in the AFNI global session - 21 Dec 2001. ---------------------------------------------------------------------- Definition at line 1913 of file afni_func.c. References THD_slist_find::dset, FIND_IDCODE, GLOBAL_library, THD_3dim_dataset::idcode, ISVALID_DSET, AFNI_library_type::session, and THD_dset_in_session(). Referenced by AFNI_choose_dataset_CB(), AFNI_force_adoption(), AFNI_make_descendants_old(), and AFNI_rescan_session_OLD().
01914 { 01915 THD_slist_find find ; 01916 01917 if( !ISVALID_DSET(dset) ) return 0 ; 01918 01919 find = THD_dset_in_session( FIND_IDCODE , 01920 &(dset->idcode) , 01921 GLOBAL_library.session ) ; 01922 01923 return (find.dset != NULL) ; 01924 } |
|
Definition at line 867 of file afni_func.c. References free, MRI_IMAGE::kind, malloc, MRI_RGB_PTR, MRI_SHORT_PTR, MRI_IMAGE::nx, MRI_IMAGE::ny, RGBZAS, and RGBZEQ. Referenced by AFNI_func_overlay().
00868 { 00869 int ii , jj , nx,ny,nxy , joff ; 00870 00871 if( im == NULL ) return ; 00872 00873 nx = im->nx ; ny = im->ny ; nxy = nx * ny ; 00874 if( nx < 3 || ny < 3 ) return ; /* no interior pixels at all?! */ 00875 00876 switch( im->kind ){ 00877 00878 case MRI_short:{ 00879 short *ajj , *ajm , *ajp , *atemp , *ar ; 00880 ar = MRI_SHORT_PTR(im) ; 00881 atemp = (short *)malloc(sizeof(short)*nxy); if( atemp == NULL ) return; 00882 memcpy(atemp,ar,sizeof(short)*nxy) ; 00883 for( jj=1 ; jj < ny-1 ; jj++ ){ 00884 joff = jj * nx ; /* offset into this row */ 00885 ajj = atemp + joff ; /* pointer to this row */ 00886 ajm = ajj-nx ; /* pointer to last row */ 00887 ajp = ajj+nx ; /* pointer to next row */ 00888 for( ii=1 ; ii < nx-1 ; ii++ ){ 00889 if( ajj[ii] != 0 && 00890 ajm[ii] != 0 && ajp[ii] != 0 && 00891 ajj[ii+1] != 0 && ajj[ii-1] != 0 ) ar[ii+joff] = 0 ; 00892 } 00893 } 00894 free((void *)atemp) ; 00895 } 00896 return ; 00897 00898 case MRI_rgb:{ 00899 rgbyte *ajj , *ajm , *ajp , *atemp , *ar ; 00900 ar = (rgbyte *)MRI_RGB_PTR(im) ; 00901 atemp = (rgbyte *)malloc(sizeof(rgbyte)*nxy); if( atemp == NULL ) return; 00902 memcpy(atemp,ar,sizeof(rgbyte)*nxy) ; 00903 for( jj=1 ; jj < ny-1 ; jj++ ){ 00904 joff = jj * nx ; 00905 ajj = atemp + joff ; 00906 ajm = ajj-nx ; 00907 ajp = ajj+nx ; 00908 for( ii=1 ; ii < nx-1 ; ii++ ){ 00909 if( !RGBZEQ(ajj[ii]) && 00910 !RGBZEQ(ajm[ii]) && !RGBZEQ(ajp[ii]) && 00911 !RGBZEQ(ajj[ii+1]) && !RGBZEQ(ajj[ii-1]) ) RGBZAS(ar[ii+joff]) ; 00912 } 00913 } 00914 free((void *)atemp) ; 00915 } 00916 return ; 00917 00918 } 00919 00920 return ; /* default im->kind case ==> do nothing */ 00921 } |
|
Definition at line 8446 of file afni_func.c. |
|
Definition at line 8510 of file afni_func.c. |
Variable Documentation
|
labels for the chooser window * Definition at line 1932 of file afni_func.c. Referenced by AFNI_choose_dataset_CB(). |
|
Definition at line 7905 of file afni_func.c. |
|
Definition at line 7904 of file afni_func.c. |
|
Definition at line 8455 of file afni_func.c. |
|
Definition at line 8508 of file afni_func.c. |