Doxygen Source Code Documentation
afni.c File Reference
#include "afni.h"#include <X11/keysym.h>#include "afni_plugout.h"#include <signal.h>Go to the source code of this file.
Defines | |
| #define | MAIN |
| #define | ANNOUNCEMENT |
| #define | USE_FRIENDS |
| #define | REPORT_PROGRESS(str) do{ if(AFNI_VERBOSE){printf(str);fflush(stdout);} } while(0) |
| #define | EMPTY_STRING(str) ((str)[0] = '\0') |
| #define | USE_SIDES |
| #define | CATCH_SIGNALS |
| #define | REFRESH XmUpdateDisplay(MAIN_im3d->vwid->top_shell) |
| #define | RX 0.2 |
| #define | PSX(i) (s1*((i)+0.5)) |
| #define | PSY(j) (1.0-s2*((j)+0.5)) |
| #define | ORCODE(aa) |
| #define | OR3OK(x, y, z) ( ((x)&6) + ((y)&6) + ((z)&6) == 6 ) |
| #define | QQ_NXYZ 16 |
| #define | QQ_NT 12 |
| #define | QQ_FOV 240.0 |
| #define | LL 0 |
| #define | RR 1 |
| #define | AA 2 |
| #define | PP 3 |
| #define | SS 4 |
| #define | II 5 |
| #define | GETWIN(w) |
| #define | VSTR(x) ( ((x)[0] == '\0') ? ("?") : (x) ) |
| #define | PUTPIX(x, y) (tem->dx[npix] = (x) , tem->dy[npix++] = (y)) |
| #define | CHKPIX if( npix >= MAXOVPIX ) break |
| #define | REMANAGE_MARKS 1 |
| #define | REMANAGE_FUNC |
| #define | BEEP_AND_RETURN { XBell(XtDisplay(w),100); EXRETURN ; } |
| #define | MVEC(im) TEMP_FVEC3(markers->xyz[im][0],markers->xyz[im][1],markers->xyz[im][2]) |
| #define | MAKE_MAP(xx, yy, zz) |
| #define | ADD_ERROR(str) |
| #define | ADD_REPORT(str) |
| #define | GETVAL(vvv, nnn) |
| #define | FLOOR(qq) ( ((qq) >= 0) ? ((int)(qq)) : (-1+(int)(qq)) ) |
| #define | PARENT_MYSELF |
| #define | NAME2INT(nnn, iii, bot, top) |
| #define | NAME2FLOAT(nnn, fff, bot, top) |
| #define | NAME2STRING(nnn, sss) |
| #define | BAD -999 |
Functions | |
| Boolean | MAIN_workprocess (XtPointer) |
| void | AFNI_syntax (void) |
| void | AFNI_parse_args (int in_argc, char *in_argv[]) |
| void | AFNI_handler (char *msg) |
| int | AFNI_xerrhandler (Display *d, XErrorEvent *x) |
| void | AFNI_sigfunc (int sig) |
| int | check_string (char *targ, int ns, char *ss[]) |
| int | main (int argc, char *argv[]) |
| void | FatalError (char *str) |
| char * | random_goodbye (void) |
| void | AFNI_quit_CB (Widget wcall, XtPointer cd, XtPointer cbs) |
| void | AFNI_quit_timeout_CB (XtPointer client_data, XtIntervalId *id) |
| void | AFNI_startup_timeout_CB (XtPointer client_data, XtIntervalId *id) |
| XtPointer | AFNI_brick_to_mri (int n, int type, FD_brick *br) |
| void | AFNI_set_valabel (FD_brick *br, int nsl, MRI_IMAGE *im, char *blab) |
| THD_3dim_dataset * | AFNI_read_images (int nf, char *fname[]) |
| void | AFNI_seq_send_CB (MCW_imseq *seq, FD_brick *br, ISQ_cbs *cbs) |
| void | AFNI_gra_send_CB (MCW_grapher *grapher, FD_brick *br, GRA_cbs *cbs) |
| void | AFNI_read_inputs (int argc, char *argv[]) |
| void | AFNI_startup_3dview (Three_D_View *im3d) |
| void | AFNI_closedown_3dview (Three_D_View *im3d) |
| void | AFNI_controller_panel_CB (Widget wcall, XtPointer cd, XtPointer cbs) |
| void | AFNI_crosshair_visible_CB (MCW_arrowval *av, XtPointer client_data) |
| void | AFNI_wrap_bbox_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_xhall_bbox_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_crosshair_color_CB (MCW_arrowval *av, XtPointer client_data) |
| void | AFNI_crosshair_gap_CB (MCW_arrowval *av, XtPointer client_data) |
| void | AFNI_time_index_CB (MCW_arrowval *av, XtPointer client_data) |
| void | AFNI_view_xyz_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_viewbut_EV (Widget w, XtPointer cd, XEvent *ev, Boolean *continue_to_dispatch) |
| void | AFNI_redisplay_func (Three_D_View *im3d) |
| void | AFNI_do_bkgd_lab (Three_D_View *im3d) |
| void | AFNI_range_setter (Three_D_View *im3d, MCW_imseq *seq) |
| void | AFNI_view_setter (Three_D_View *im3d, MCW_imseq *seq) |
| void | AFNI_set_viewpoint (Three_D_View *im3d, int xx, int yy, int zz, int redisplay_option) |
| MRI_IMAGE * | AFNI_overlay (int n, FD_brick *br) |
| XmString | AFNI_crosshair_label (Three_D_View *im3d) |
| void | AFNI_marktog_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_set_tog (int nset, int ntog, Widget *tog) |
| int | AFNI_first_tog (int ntog, Widget *tog) |
| void | AFNI_marks_action_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_resam_vox_av_CB (MCW_arrowval *av, XtPointer cd) |
| void | AFNI_marks_disp_av_CB (MCW_arrowval *av, XtPointer client_data) |
| void | AFNI_make_ptmask (int size, int gap, AFNI_ovtemplate *tem) |
| void | AFNI_make_tagmask (int size, int gap, AFNI_ovtemplate *tem) |
| void | AFNI_switchview_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_purge_unused_dsets (void) |
| void | AFNI_purge_dsets (int doall) |
| void | AFNI_initialize_view (THD_3dim_dataset *old_anat, Three_D_View *im3d) |
| THD_warp * | AFNI_find_warp (THD_3dim_dataset *dset_to, THD_3dim_dataset *dset_from) |
| void | AFNI_setup_viewing (Three_D_View *im3d, Boolean rescaled) |
| int | AFNI_can_transform_vector (THD_3dim_dataset *old_dset, THD_3dim_dataset *new_dset) |
| THD_fvec3 | AFNI_transform_vector (THD_3dim_dataset *old_dset, THD_fvec3 old_fv, THD_3dim_dataset *new_dset) |
| THD_fvec3 | AFNI_forward_warp_vector (THD_warp *warp, THD_fvec3 old_fv) |
| THD_fvec3 | AFNI_backward_warp_vector (THD_warp *warp, THD_fvec3 old_fv) |
| void | AFNI_define_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_marks_edits_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_see_marks_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_crosshair_EV (Widget w, XtPointer cd, XEvent *ev, Boolean *continue_to_dispatch) |
| void | AFNI_crosshair_relabel (Three_D_View *im3d) |
| void | AFNI_crosshair_pop_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_imag_pop_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_talto_CB (Widget w, XtPointer cd, MCW_choose_cbs *cbs) |
| void | AFNI_pop_whereami_kill (Three_D_View *im3d) |
| char * | AFNI_ttatlas_query (Three_D_View *im3d) |
| void | AFNI_see_ttatlas_CB (Widget w, XtPointer cd, XtPointer cb) |
| void | AFNI_mnito_CB (Widget w, XtPointer cd, MCW_choose_cbs *cbs) |
| void | AFNI_jumpto_CB (Widget w, XtPointer cd, MCW_choose_cbs *cbs) |
| int | AFNI_jumpto_dicom (Three_D_View *im3d, float xx, float yy, float zz) |
| int | AFNI_jumpto_ijk (Three_D_View *im3d, int ii, int jj, int kk) |
| void | AFNI_jumpto_ijk_CB (Widget w, XtPointer cd, MCW_choose_cbs *cbs) |
| void | AFNI_sumato_CB (Widget w, XtPointer cd, MCW_choose_cbs *cbs) |
| void | AFNI_marks_transform_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| THD_warp * | AFNI_make_warp (Three_D_View *im3d) |
| Boolean | AFNI_marks_quality_check (Boolean make_report, Three_D_View *im3d) |
| THD_3dim_dataset * | AFNI_init_warp (Three_D_View *im3d, THD_3dim_dataset *parent_dset, THD_warp *warp_init, float resam_vox) |
| void | AFNI_copy_statistics (THD_3dim_dataset *dsold, THD_3dim_dataset *dsnew) |
| void | AFNI_set_cursor (int cursor_code) |
| void | AFNI_load_defaults (Widget w) |
| void | AFNI_popup_sonnet (Widget w, int ii) |
| void | AFNI_sonnet_CB (Widget w, XtPointer client_data, XtPointer call_data) |
| void | AFNI_register_nD_function (int nd, char *name, generic_func *func, int flags) |
| void | AFNI_register_nD_func_init (int nd, generic_func *fin) |
| void | AFNI_store_dset_index (int ijk, int tin) |
| int | AFNI_needs_dset_ijk (void) |
| int | AFNI_needs_dset_tin (void) |
| void | AFNI_add_timeseries (MRI_IMAGE *tsim) |
Variables | |
| XtAppContext | MAIN_app |
| XtErrorHandler | MAIN_old_handler |
| Three_D_View * | MAIN_im3d |
| MCW_DC * | MAIN_dc |
| Widget | MAIN_shell = NULL |
| int | MAIN_argc |
| char ** | MAIN_argv |
| int | COM_num = 0 |
| char * | COM_com [1024] |
| char * | FALLback [] |
| char * | AFNI_image_help |
| char * | AFNI_arrowpad_help |
| char * | AFNI_arrowpad_hint [] |
| int | dset_ijk = -1 |
| int | dset_tin = -1 |
Define Documentation
|
|
|
|
|
Value: { int ll = strlen(str) + strlen(error_list) + 16 ; \
STATUS(str) ; \
error_list = (char*) XtRealloc( error_list , ll ) ; \
strcat( error_list , "*** ERROR: ") ; \
strcat( error_list , str ) ; num_error++ ; }Definition at line 8848 of file afni.c. Referenced by AFNI_marks_quality_check(). |
|
|
Value: { int ll = strlen(str) + strlen(error_list) + 16 ; \
STATUS(str) ; \
error_list = (char*)XtRealloc( error_list , ll ) ; \
strcat( error_list , str ) ; num_report++ ; }Definition at line 8855 of file afni.c. Referenced by AFNI_marks_quality_check(). |
|
|
Value: "GPL AFNI: Analysis of Functional NeuroImages, by RW Cox (" COXEMAIL ")\n" \ "This is Version " VERSION "\n\n" \ " ** This software was designed to be used only for research purposes. **\n" \ " ** Clinical uses are not recommended, and have never been evaluated. **\n" \ " ** This software comes with no warranties of any kind whatsoever, **\n" \ " ** and may not be useful for anything. Use it at your own risk! **\n" \ " ** If these terms are not acceptable, you aren't allowed to use AFNI.**\n" \ " ** See 'Define Datamode->Misc->License Info' for more details. **\n\n" Definition at line 62 of file afni.c. Referenced by AFNI_syntax(), and main(). |
|
|
Definition at line 9763 of file afni.c. Referenced by AFNI_load_defaults(), and main(). |
|
|
Definition at line 8431 of file afni.c. Referenced by AFNI_marks_transform_CB(). |
|
|
|
|
|
Definition at line 6411 of file afni.c. Referenced by AFNI_make_ptmask(), and AFNI_make_tagmask(). |
|
|
Definition at line 82 of file afni.c. Referenced by AFNI_init_warp(), AFNI_read_images(), T3D_initialize_user_data(), T3D_read_images(), and T3D_save_file_CB(). |
|
|
|
|
|
Value: |
|
|
Value: do{ XtVaSetValues( (w) , XmNx,(int)(event->x_root), \ XmNy,(int)(event->y_root), NULL ); \ XMapRaised( XtDisplay(w) , XtWindow(w) ) ; \ } while(0) Definition at line 5174 of file afni.c. Referenced by AFNI_viewbut_EV(). |
|
|
|
|
|
|
|
|
|
|
|
Value: (\ LOAD_DIAG_MAT( twarp->warp[W_ ## xx ## yy ## zz].mfor , \ scale_ ## xx , scale_ ## yy , scale_ ## zz ) ,\ \ LOAD_DIAG_MAT( twarp->warp[W_ ## xx ## yy ## zz].mbac , \ 1.0 / scale_ ## xx , 1.0 / scale_ ## yy , 1.0 / scale_ ## zz ) ,\ \ twarp->warp[W_ ## xx ## yy ## zz].bvec = bv_ ## yy , \ \ twarp->warp[W_ ## xx ## yy ## zz].svec = sv_ ## yy , \ \ LOAD_FVEC3( twarp->warp[W_ ## xx ## yy ## zz].bot , \ bot_ ## xx , bot_ ## yy , bot_ ## zz ) ,\ \ LOAD_FVEC3( twarp->warp[W_ ## xx ## yy ## zz].top , \ top_ ## xx , top_ ## yy , top_ ## zz ) \ ) |
|
|
Definition at line 8589 of file afni.c. Referenced by AFNI_make_warp(), and AFNI_marks_quality_check(). |
|
|
Value: { xdef = RWC_getname(display,nnn) ; \
if( xdef != NULL ){ \
fval = strtod( xdef , &cpt ) ; \
if( *cpt == '\0' && fval >= (bot) && fval <= (top) ) (fff) = fval ; } }Definition at line 9752 of file afni.c. Referenced by AFNI_load_defaults(). |
|
|
Value: { xdef = RWC_getname(display,nnn) ; \
if( xdef != NULL ){ \
ival = strtol( xdef , &cpt , 10 ) ; \
if( *cpt == '\0' && ival >= (bot) && ival <= (top) ) (iii) = ival ; } }Definition at line 9746 of file afni.c. Referenced by AFNI_load_defaults(). |
|
|
Value: { xdef = RWC_getname(display,nnn) ; \
if( xdef != NULL ) sss = XtNewString(xdef) ; }Definition at line 9758 of file afni.c. Referenced by AFNI_load_defaults(). |
|
|
|
|
|
Value: ( (aa)=='R' ? ORI_R2L_TYPE : (aa)=='L' ? ORI_L2R_TYPE : \ (aa)=='P' ? ORI_P2A_TYPE : (aa)=='A' ? ORI_A2P_TYPE : \ (aa)=='I' ? ORI_I2S_TYPE : (aa)=='S' ? ORI_S2I_TYPE : ILLEGAL_TYPE ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 6410 of file afni.c. Referenced by AFNI_make_ptmask(), and AFNI_make_tagmask(). |
|
|
|
|
|
|
|
|
|
|
|
set the function to call if run out of memory when creating datasets * Definition at line 1371 of file afni.c. Referenced by AFNI_read_inputs(). |
|
|
|
|
|
|
|
|
Definition at line 78 of file afni.c. Referenced by AFNI_read_images(), AFNI_read_inputs(), main(), and MAIN_workprocess(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function Documentation
|
|
Definition at line 10176 of file afni.c. References ADDTO_IMARR, ENTRY, GLOBAL_library, POPDOWN_timeseries_chooser, and AFNI_library_type::timeseries. Referenced by AFNI_finalize_read_Web_CB(), AFNI_gra_send_CB(), AFNI_read_inputs(), PLUTO_register_timeseries(), and process_NIML_MRI_IMAGE().
10177 {
10178 ENTRY("AFNI_add_timeseries") ;
10179
10180 if( tsim != NULL ){
10181 POPDOWN_timeseries_chooser ;
10182 ADDTO_IMARR(GLOBAL_library.timeseries,tsim) ;
10183 }
10184 EXRETURN ;
10185 }
|
|
||||||||||||
|
Definition at line 7429 of file afni.c. References THD_linear_mapping::bot, MATVEC_SUB, THD_linear_mapping::mbac, THD_warp::rig_bod, THD_linear_mapping::svec, THD_warp::tal_12, THD_linear_mapping::top, THD_warp::type, THD_affine_warp::warp, THD_talairach_12_warp::warp, WARP_AFFINE_TYPE, WARP_TALAIRACH_12_TYPE, and THD_fvec3::xyz. Referenced by AFNI_transform_vector(), and main().
07430 {
07431 THD_fvec3 new_fv ;
07432
07433 if( warp == NULL ) return old_fv ;
07434
07435 switch( warp->type ){
07436
07437 default: new_fv = old_fv ; break ;
07438
07439 case WARP_TALAIRACH_12_TYPE:{
07440 THD_linear_mapping map ;
07441 int iw ;
07442
07443 /* test if input is in bot..top of each defined map */
07444
07445 for( iw=0 ; iw < 12 ; iw++ ){
07446 map = warp->tal_12.warp[iw] ;
07447
07448 if( old_fv.xyz[0] >= map.bot.xyz[0] &&
07449 old_fv.xyz[1] >= map.bot.xyz[1] &&
07450 old_fv.xyz[2] >= map.bot.xyz[2] &&
07451 old_fv.xyz[0] <= map.top.xyz[0] &&
07452 old_fv.xyz[1] <= map.top.xyz[1] &&
07453 old_fv.xyz[2] <= map.top.xyz[2] ) break ; /* leave loop */
07454 }
07455 new_fv = MATVEC_SUB(map.mbac,old_fv,map.svec) ;
07456 }
07457 break ;
07458
07459 case WARP_AFFINE_TYPE:{
07460 THD_linear_mapping map = warp->rig_bod.warp ;
07461 new_fv = MATVEC_SUB(map.mbac,old_fv,map.svec) ;
07462 }
07463 break ;
07464
07465 }
07466 return new_fv ;
07467 }
|
|
||||||||||||||||
|
Definition at line 1927 of file afni.c. References FD_brick::a123, a2, abs, AFNI_3DDATA_VIEW, AFNI_do_bkgd_lab(), AFNI_get_xhair_node(), AFNI_gra_send_CB(), AFNI_noenv(), AFNI_overlay(), AFNI_seq_send_CB(), AFNI_set_valabel(), AFNI_yesenv(), AFNI_view_info::anat_index, Three_D_View::anat_now, AFNI_view_info::anat_val, MCW_grapher_status::aux, MCW_imseq_status::aux, AFNI_surface_widgets::boxsize_av, create_memplot_surely(), AFNI_view_info::crosshair_gap, AFNI_view_info::crosshair_ovcolor, AFNI_view_info::crosshair_visible, CURRENT_DAXES, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, Three_D_View::dc, DC_parse_color(), DCOV_BLUEBYTE, DCOV_GREENBYTE, DCOV_REDBYTE, FD_brick::del1, FD_brick::del2, FD_brick::del3, DESTROY_MEMPLOT, FD_brick::dset, DSET_NVALS, ENTRY, EQUIV_DSETS, FD_brick_to_series(), FD_warp_to_mri(), AFNI_view_info::fim_index, Three_D_View::fim_now, get_active_memplot(), getenv(), GLOBAL_library, graCR_getseries, graCR_getstatus, i1, AFNI_view_info::i1, i2, SUMA_ixyz::id, SUMA_surface::ijk, THD_ivec3::ijk, IM3D_OPEN, AFNI_widget_set::imag, isqCR_getimage, isqCR_getlabel, isqCR_getmemplot, isqCR_getoverlay, isqCR_getqimage, isqCR_getstatus, MCW_arrowval::ival, SUMA_surface::ixyz, AFNI_view_info::j2, AFNI_view_info::k3, MRI_IMAGE::kind, AFNI_surface_widgets::linewidth_av, LOAD_DSET_VIEWS, LOAD_FVEC3, LOAD_IVEC3, MCW_grapher::mat, MCW_set_widget_label(), MCW_val_bbox(), MEMPLOT_NLINE, MIN, mp, myXtNew, FD_brick::n1, FD_brick::n2, FD_brick::n3, MCW_grapher_status::namecode, FD_brick::namecode, AFNI_surface_widgets::nrow, SUMA_surface::num_ijk, SUMA_surface::num_ixyz, MCW_grapher_status::num_series, MCW_imseq_status::num_series, MCW_grapher_status::num_total, MCW_imseq_status::num_total, THD_datablock::nvals, MCW_grapher_status::nx, MCW_grapher_status::ny, MCW_grapher_status::nz, MCW_grapher_status::parent, FD_brick::parent, MCW_imseq_status::parent, plotline_memplot(), plotrect_memplot(), AFNI_imaging_widgets::pop_bkgd_lab, AFNI_library_type::registered_0D, AFNI_library_type::registered_1D, AFNI_library_type::registered_2D, AFNI_library_type::registered_slice_proj, RETURN, s2, SCLADD_FVEC3, MCW_grapher_status::send_CB, MCW_imseq_status::send_CB, SESSION_HAS_SUMA, set_color_memplot(), set_thick_memplot(), MCW_imseq_status::slice_proj, Three_D_View::ss_now, STATUS, strtod(), THD_session::su_num, THD_session::su_surf, SUMA_ENABLED, SUMA_find_node_id(), AFNI_surface_widgets::surf_bbox, AFNI_surface_widgets::surf_ledg_av, AFNI_surface_widgets::surf_line_av, AFNI_surface_widgets::surf_node_av, AFNI_viewing_widgets::swid, TEMP_IVEC3, THD_3dfind_to_fdfind(), THD_3dind_to_3dmm(), THD_3dind_to_fdind(), THD_3dmm_to_3dfind(), THD_3dmm_to_dicomm(), THD_dicomm_to_3dmm(), THD_fdind_to_3dind(), MCW_grapher_status::transforms0D, MCW_imseq_status::transforms0D, MCW_grapher_status::transforms1D, MCW_imseq_status::transforms2D, Three_D_View::type, UNDERLAY_ANAT, UNDERLAY_TO_GRAPHER, AFNI_view_info::underlay_type, AFNI_widget_set::view, Three_D_View::vinfo, Three_D_View::vwid, SUMA_ixyz::x, AFNI_view_info::xhairs_all, AFNI_view_info::xhairs_ndown, AFNI_view_info::xhairs_nskip, AFNI_view_info::xhairs_nup, AFNI_view_info::xhairs_orimask, AFNI_view_info::xhairs_periodic, AFNI_view_info::xhairs_show_montage, THD_dataxes::xxmax, THD_dataxes::xxmin, THD_dataxes::xxorient, THD_fvec3::xyz, SUMA_ixyz::y, THD_dataxes::yymax, THD_dataxes::yymin, THD_dataxes::yyorient, SUMA_ixyz::z, THD_dataxes::zzmax, THD_dataxes::zzmin, and THD_dataxes::zzorient. Referenced by AFNI_view_xyz_CB().
01928 {
01929 MRI_IMAGE * im ;
01930 MCW_imseq_status * stat ;
01931 int i1,i2,jb,bb , dd1,dd2,tt1,tt2 ;
01932
01933 ENTRY("AFNI_brick_to_mri") ;
01934
01935 if(PRINT_TRACING){ char str[256] ; sprintf(str,"n=%d type=%d",n,type) ; STATUS(str) ; }
01936
01937 /*-------------------------------------------------*/
01938 /*-------- May 1996: graph callbacks first --------*/
01939
01940 if( type == graCR_getstatus ){
01941 MCW_grapher_status * grstat = myXtNew( MCW_grapher_status ) ;
01942
01943 grstat->num_total = grstat->num_series = br->dset->dblk->nvals ;
01944 grstat->nx = br->n1 ;
01945 grstat->ny = br->n2 ;
01946 grstat->nz = br->n3 ;
01947
01948 grstat->send_CB = AFNI_gra_send_CB ;
01949 grstat->parent = (XtPointer) br ;
01950 grstat->aux = NULL ;
01951
01952 grstat->transforms0D = & (GLOBAL_library.registered_0D) ;
01953 grstat->transforms1D = & (GLOBAL_library.registered_1D) ;
01954
01955 strcpy( grstat->namecode , br->namecode ) ;
01956
01957 RETURN( (XtPointer) grstat ) ;
01958 }
01959
01960 if( type == graCR_getseries ){
01961 im = FD_brick_to_series( n , br ) ;
01962 RETURN( (XtPointer) im ) ;
01963 }
01964
01965 /*----------------------------------------*/
01966 /*-------- Now do imseq callbacks --------*/
01967
01968 if( n < 0 || n >= br->n3 ) RETURN(NULL) ;
01969
01970 /*--- overlay # n ---*/
01971
01972 if( type == isqCR_getoverlay ){
01973 Three_D_View * im3d = (Three_D_View *) br->parent ;
01974
01975 STATUS("get overlay") ;
01976
01977 im = AFNI_overlay( n , br ) ;
01978 if( !AFNI_noenv("AFNI_VALUE_LABEL") ) AFNI_do_bkgd_lab( im3d ) ;
01979 RETURN( (XtPointer) im ) ;
01980 }
01981
01982 /*--- status ---*/
01983
01984 if( type == isqCR_getstatus ){
01985
01986 STATUS("get status") ;
01987
01988 stat = myXtNew( MCW_imseq_status ) ;
01989
01990 stat->num_total = br->n3 ;
01991 stat->num_series = br->n3 ;
01992 stat->send_CB = AFNI_seq_send_CB ;
01993 stat->parent = (XtPointer) br ;
01994 stat->aux = NULL ;
01995
01996 stat->transforms0D = & (GLOBAL_library.registered_0D) ;
01997 stat->transforms2D = & (GLOBAL_library.registered_2D) ;
01998 stat->slice_proj = & (GLOBAL_library.registered_slice_proj) ;
01999
02000 RETURN( (XtPointer) stat ) ;
02001 }
02002
02003 /*--- 26 Feb 2001: return a memplot drawing struct ---*/
02004 /*--- 22 Mar 2002: add crosshairs to surface stuff ---*/
02005
02006 #define RX 0.2
02007 if( type == isqCR_getmemplot ){
02008 Three_D_View *im3d = (Three_D_View *) br->parent ;
02009 int do_xhar=(im3d->vinfo->crosshair_visible && AFNI_yesenv("AFNI_CROSSHAIR_LINES"));
02010 int do_surf;
02011 MEM_plotdata *mp ;
02012 AFNI_surface_widgets *swid = im3d->vwid->view->swid ; /* 19 Aug 2002 */
02013 THD_session *suss=im3d->ss_now ; /* 20 Jan 2004 */
02014 THD_dataxes *daxes=CURRENT_DAXES(br->dset) ;
02015
02016 if( !IM3D_OPEN(im3d) ) RETURN(NULL) ;
02017
02018 /* 20 Jan 2004: surfaces are now in the session, not on the dataset! */
02019
02020 do_surf = SUMA_ENABLED && SESSION_HAS_SUMA(suss) ;
02021 if( !do_surf && !do_xhar ) RETURN(NULL) ; /* nothing to do */
02022
02023 /* get ready to plot */
02024
02025 STATUS("creating memplot for image overlay") ;
02026 create_memplot_surely( "SUMA_plot" , 1.0 ) ;
02027 mp = get_active_memplot() ;
02028
02029 /* plot surface stuff, if any */
02030
02031 if( do_surf ){
02032 int ks ;
02033 int kbest=-1 , ibest=-1 ; /* 24 Feb 2003 */
02034
02035 AFNI_get_xhair_node( im3d , &kbest , &ibest ) ; /* 24 Feb 2003 */
02036
02037 for( ks=0 ; ks < suss->su_num ; ks++ ){ /* 14 Aug 2002: loop over surfaces */
02038 SUMA_surface *ag = suss->su_surf[ks] ;
02039 int nn , ii,jj ;
02040 SUMA_ixyz *nod ;
02041 THD_ivec3 iv,ivp,ivm ;
02042 THD_fvec3 fv,fvp,fvm ;
02043 float s1=1.0/br->n1 , s2=1.0/br->n2 , dxyz ;
02044 float rr_box=1.0,gg_box=0.0,bb_box=0.0 ; /* white */
02045 float rr_lin=0.4,gg_lin=0.0,bb_lin=0.7 ; /* dark blue */
02046 float rr_led=1.0,gg_led=0.0,bb_led=0.0 ;
02047 char str[32] , *eee ;
02048 float rx=RX ; /* default rectangle halfsize */
02049 int kkk=0 ;
02050 float xyz=0.0,xyzp,xyzm , rxm,rxp ;
02051 int skip_boxes=1 , skip_lines=0 , skip_lcen=0, skip_ledg=1 ;
02052 float boxsize=RX , linewidth=0.0 ; /* 23 Feb 2003 */
02053 int firstb ; /* 23 Jan 2004 */
02054
02055 if( ag == NULL ) continue ; /* skip this non-existent one */
02056 nn = ag->num_ixyz ; nod = ag->ixyz ;
02057 if( nn < 1 || nod == NULL ) continue ; /* nothing to do */
02058
02059 /* define parameters for node boxes and triangle lines */
02060
02061 STATUS("defining surface drawing parameters") ;
02062 if( swid != NULL && ks < swid->nrow ){ /* 19 Aug 2002: the new way */
02063 int cc, dd ; /* to set colors: */
02064 /* from the surface widgets */
02065
02066 cc = MCW_val_bbox(swid->surf_bbox[ks]) ; /* 19 Feb 2003: skip it all? */
02067 if( cc == 0 ){
02068 skip_boxes = skip_lines = 1 ;
02069 } else { /* see what is turned on */
02070 cc = swid->surf_node_av[ks]->ival ;
02071 skip_boxes = (cc == 0) ;
02072 if( !skip_boxes ){
02073 rr_box = DCOV_REDBYTE(im3d->dc,cc) / 255.0 ;
02074 gg_box = DCOV_GREENBYTE(im3d->dc,cc) / 255.0 ;
02075 bb_box = DCOV_BLUEBYTE(im3d->dc,cc) / 255.0 ;
02076 }
02077 cc = swid->surf_line_av[ks]->ival ;
02078 dd = swid->surf_ledg_av[ks]->ival ; /* 26 Feb 2003 */
02079 skip_lcen = (cc == 0) ;
02080 skip_ledg = (dd == 0) ;
02081 skip_lines = (skip_lcen && skip_ledg) ;
02082 if( cc > 0 ){
02083 rr_lin = DCOV_REDBYTE(im3d->dc,cc) / 255.0 ;
02084 gg_lin = DCOV_GREENBYTE(im3d->dc,cc) / 255.0 ;
02085 bb_lin = DCOV_BLUEBYTE(im3d->dc,cc) / 255.0 ;
02086 }
02087 if( dd > 0 ){ /* 26 Feb 2003 */
02088 rr_led = DCOV_REDBYTE(im3d->dc,dd) / 255.0 ;
02089 gg_led = DCOV_GREENBYTE(im3d->dc,dd) / 255.0 ;
02090 bb_led = DCOV_BLUEBYTE(im3d->dc,dd) / 255.0 ;
02091 }
02092 boxsize = swid->boxsize_av->ival * 0.1 ; /* 23 Feb 2003 */
02093 linewidth = swid->linewidth_av->ival * 0.002 ;
02094 }
02095
02096 } else { /* the old way */
02097 /* to set colors: */
02098 eee = getenv("AFNI_SUMA_BOXCOLOR") ; /* from environment */
02099 if( eee != NULL ){
02100 if( strcmp(eee,"none") == 0 || strcmp(eee,"skip") == 0 )
02101 skip_boxes = 1 ; /* don't do boxes */
02102 else
02103 DC_parse_color( im3d->dc , eee , &rr_box,&gg_box,&bb_box ) ;
02104 }
02105
02106 eee = getenv("AFNI_SUMA_LINECOLOR") ;
02107 if( eee != NULL ){
02108 if( (strcmp(eee,"none")==0 || strcmp(eee,"skip")==0) )
02109 skip_lines = 1 ;
02110 else
02111 DC_parse_color( im3d->dc , eee , &rr_lin,&gg_lin,&bb_lin ) ;
02112 }
02113
02114 eee = getenv("AFNI_SUMA_BOXSIZE") ; /* maybe set boxsize? */
02115 if( eee != NULL ){
02116 float val=strtod(eee,NULL) ;
02117 if( val > 0.0 ) boxsize = val ;
02118 } else if( swid != NULL ){
02119 boxsize = swid->boxsize_av->ival * 0.1 ;
02120 }
02121
02122 eee = getenv( "AFNI_SUMA_LINESIZE" ) ; /* maybe set linewidth? */
02123 if( eee != NULL ){
02124 float val = strtod(eee,NULL) ;
02125 if( val < 0.0 || val > 0.1 ) val = 0.0 ;
02126 linewidth = val ;
02127 } else if( swid != NULL ){
02128 linewidth = swid->linewidth_av->ival * 0.002 ;
02129 }
02130 }
02131
02132 if( skip_boxes && skip_lines ) continue ; /* nothing to do? */
02133
02134 /** 21 Mar 2002:
02135 We calculate plotting coordinates in "fdfind" coordinates,
02136 which are floating point indexes into the FD_brick. However,
02137 these run from 0..n1-1 (in x), which are the centers of the
02138 voxels. In turn these must be mapped to screen locations.
02139 For example, with n1=5, we have these voxels
02140
02141 0 1 2 3 4 = index of voxel
02142 ---------------------
02143 | | | | | |
02144 ---------------------
02145 0.0 1.0 = screen coordinate (for memplot)
02146
02147 Thus voxel index i maps to screen location (i+0.5)/n1.
02148 Previously, I forgot the +0.5, which didn't matter much,
02149 until the introduction of the image zoom feature last week. **/
02150
02151 rx = boxsize ; /* 23 Feb 2003 */
02152 rxm = rx-0.5 ; rxp = rx+0.5 ; /* The 0.5 voxel shift */
02153
02154 /* find DICOM coordinates of next slice and previous slice */
02155
02156 LOAD_IVEC3(iv,0,0,n+1) ; /* next */
02157 ivp = THD_fdind_to_3dind( br , iv ) ;
02158 fvp = THD_3dind_to_3dmm ( br->dset , ivp ) ;
02159 fvp = THD_3dmm_to_dicomm( br->dset , fvp ) ;
02160 LOAD_IVEC3(iv,0,0,n-1) ; /* previous */
02161 ivm = THD_fdind_to_3dind( br , iv ) ;
02162 fvm = THD_3dind_to_3dmm ( br->dset , ivm ) ;
02163 fvm = THD_3dmm_to_dicomm( br->dset , fvm ) ;
02164
02165 /* threshold for determining which axis this slice is along */
02166
02167 dxyz = MIN(br->del1,br->del2) ;
02168 dxyz = MIN(dxyz ,br->del3) ; dxyz *= 0.1 ;
02169
02170 set_color_memplot(rr_box,gg_box,bb_box) ; /* box drawing colors */
02171 set_thick_memplot(0.0) ;
02172 firstb = 1 ; /* 23 Jan 2004 */
02173
02174 /* find nodes inside this slice */
02175
02176 if( skip_boxes ) STATUS("finding slice planes") ;
02177 else STATUS("drawing node boxes") ;
02178
02179 if( fabs(fvm.xyz[0]-fvp.xyz[0]) > dxyz ){ /* search x */
02180 float xb=fvm.xyz[0] , xt=fvp.xyz[0] , xm,xw ; /* range of */
02181 if( xb > xt ){ float t=xb ; xb=xt ; xt=t ; } /* x in slice */
02182 xm = 0.5*(xb+xt); xw = 0.25*(xt-xb); xb = xm-xw; xt = xm+xw;
02183 STATUS(" - x plane") ;
02184 if( !skip_boxes ){
02185 for( ii=0 ; ii < nn ; ii++ ){
02186 if( nod[ii].x >= xb && nod[ii].x <= xt ){ /* inside? */
02187 LOAD_FVEC3(fv,nod[ii].x,nod[ii].y,nod[ii].z) ; /* convert */
02188 fv = THD_dicomm_to_3dmm( br->dset , fv ) ; /* coords */
02189 fv = THD_3dmm_to_3dfind( br->dset , fv ) ; /* to slice */
02190 fv = THD_3dfind_to_fdfind( br , fv ) ; /* indexes */
02191
02192 if( firstb ){
02193 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]-rxm),
02194 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+rxp) );
02195 firstb = 0 ;
02196 }
02197
02198 plotrect_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]-rxm),
02199 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+rxp) ) ;
02200
02201 if( ks == kbest && nod[ii].id == ibest ){ /* 24 Feb 2003 */
02202 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]-rxm),
02203 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+rxp) );
02204 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]+rxp),
02205 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]-rxm) );
02206 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]+0.5),
02207 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+0.5) );
02208 plotline_memplot( s1*(fv.xyz[0]+0.5), 1.0-s2*(fv.xyz[1]-rxm),
02209 s1*(fv.xyz[0]+0.5), 1.0-s2*(fv.xyz[1]+rxp) );
02210 }
02211 }
02212 }
02213 }
02214 kkk = 0; xyz = xm; xyzp = xt; xyzm = xb; /* for the triangles/lines below */
02215 }
02216 else if( fabs(fvm.xyz[1]-fvp.xyz[1]) > dxyz ){ /* search y */
02217 float yb=fvm.xyz[1] , yt=fvp.xyz[1] , ym,yw ;
02218 if( yb > yt ){ float t=yb ; yb=yt ; yt=t ; }
02219 ym = 0.5*(yb+yt); yw = 0.25*(yt-yb); yb = ym-yw; yt = ym+yw;
02220 STATUS(" - y plane") ;
02221 if( !skip_boxes ){
02222 for( ii=0 ; ii < nn ; ii++ ){
02223 if( nod[ii].y >= yb && nod[ii].y <= yt ){
02224 LOAD_FVEC3(fv,nod[ii].x,nod[ii].y,nod[ii].z) ;
02225 fv = THD_dicomm_to_3dmm( br->dset , fv ) ;
02226 fv = THD_3dmm_to_3dfind( br->dset , fv ) ;
02227 fv = THD_3dfind_to_fdfind( br , fv ) ;
02228
02229 if( firstb ){
02230 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]-rxm),
02231 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+rxp) );
02232 firstb = 0 ;
02233 }
02234
02235 plotrect_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]-rxm),
02236 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+rxp) ) ;
02237
02238 if( ks == kbest && nod[ii].id == ibest ){ /* 24 Feb 2003 */
02239 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]-rxm),
02240 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+rxp) );
02241 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]+rxp),
02242 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]-rxm) );
02243 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]+0.5),
02244 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+0.5) );
02245 plotline_memplot( s1*(fv.xyz[0]+0.5), 1.0-s2*(fv.xyz[1]-rxm),
02246 s1*(fv.xyz[0]+0.5), 1.0-s2*(fv.xyz[1]+rxp) );
02247 }
02248 }
02249 }
02250 }
02251 kkk = 1; xyz = ym; xyzp = yt; xyzm = yb; /* for the triangles/lines below */
02252 }
02253 else if( fabs(fvm.xyz[2]-fvp.xyz[2]) > dxyz ){ /* search z */
02254 float zb=fvm.xyz[2] , zt=fvp.xyz[2] , zm,zw ;
02255 if( zb > zt ){ float t=zb ; zb=zt ; zt=t ; }
02256 zm = 0.5*(zb+zt); zw = 0.25*(zt-zb); zb = zm-zw; zt = zm+zw;
02257 STATUS(" - z plane") ;
02258 if( !skip_boxes ){
02259 for( ii=0 ; ii < nn ; ii++ ){
02260 if( nod[ii].z >= zb && nod[ii].z <= zt ){
02261 LOAD_FVEC3(fv,nod[ii].x,nod[ii].y,nod[ii].z) ;
02262 fv = THD_dicomm_to_3dmm( br->dset , fv ) ;
02263 fv = THD_3dmm_to_3dfind( br->dset , fv ) ;
02264 fv = THD_3dfind_to_fdfind( br , fv ) ;
02265
02266 if( firstb ){
02267 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]-rxm),
02268 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+rxp) );
02269 firstb = 0 ;
02270 }
02271
02272 plotrect_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]-rxm),
02273 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+rxp) ) ;
02274
02275 if( ks == kbest && nod[ii].id == ibest ){ /* 24 Feb 2003 */
02276 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]-rxm),
02277 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+rxp) );
02278 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]+rxp),
02279 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]-rxm) );
02280 plotline_memplot( s1*(fv.xyz[0]-rxm), 1.0-s2*(fv.xyz[1]+0.5),
02281 s1*(fv.xyz[0]+rxp), 1.0-s2*(fv.xyz[1]+0.5) );
02282 plotline_memplot( s1*(fv.xyz[0]+0.5), 1.0-s2*(fv.xyz[1]-rxm),
02283 s1*(fv.xyz[0]+0.5), 1.0-s2*(fv.xyz[1]+rxp) );
02284 }
02285 }
02286 }
02287 }
02288 kkk = 2; xyz = zm; xyzp = zt; xyzm = zb; /* for the triangles/lines below */
02289 }
02290
02291 /* 10 Mar 2002:
02292 For each triangle that crosses the plane of the slice,
02293 plot a line segment at the intersection of the plane and triangle.
02294 The plane is along DICOM axis #kkk at coordinate xyz;
02295 these variables were set just above in the node display code. */
02296
02297 if( !skip_lines && ag->num_ijk > 0 && ag->ijk != NULL ){
02298 SUMA_ijk *tr = ag->ijk ; /* triangle list */
02299 int ntr = ag->num_ijk ; /* number of triangles */
02300 int id,jd,kd ;
02301 THD_fvec3 fvijk[3] ;
02302 float ci,cj,ck , xlev ;
02303 int ilev ;
02304
02305 for( ilev=0 ; ilev <= 2 ; ilev++ ){ /* 26 Feb 2003: loop over levels: */
02306 /* slice center, top & bot edges */
02307 if( ilev == 0 ){
02308 if( skip_lcen ) continue ; /* don't do center plane */
02309 xlev = xyz ;
02310 set_color_memplot(rr_lin,gg_lin,bb_lin) ; /* line drawing colors */
02311 set_thick_memplot(linewidth) ;
02312 } else {
02313 if( skip_ledg ) continue ; /* don't do edge planes */
02314 xlev = (ilev == 1) ? xyzp : xyzm ;
02315 set_color_memplot(rr_led,gg_led,bb_led) ;
02316 set_thick_memplot(0.0) ;
02317 }
02318
02319 STATUS("drawing triangle lines") ;
02320
02321 /* loop over triangles */
02322
02323 for( ii=0 ; ii < ntr ; ii++ ){
02324
02325 /* get indexes of triangle's nodes (from their id's) */
02326
02327 id = SUMA_find_node_id(ag,tr[ii].id); if( id < 0 ) continue;
02328 jd = SUMA_find_node_id(ag,tr[ii].jd); if( jd < 0 ) continue;
02329 kd = SUMA_find_node_id(ag,tr[ii].kd); if( kd < 0 ) continue;
02330
02331 /* load DICOM coords of triangle's nodes */
02332
02333 LOAD_FVEC3(fvijk[0], nod[id].x, nod[id].y, nod[id].z) ;
02334 LOAD_FVEC3(fvijk[1], nod[jd].x, nod[jd].y, nod[jd].z) ;
02335 LOAD_FVEC3(fvijk[2], nod[kd].x, nod[kd].y, nod[kd].z) ;
02336
02337 /* want 1 node on one size of plane, and 2 on the other */
02338
02339 ci = fvijk[0].xyz[kkk] - xlev; /* differences from center */
02340 cj = fvijk[1].xyz[kkk] - xlev; /* of current slice plane */
02341 ck = fvijk[2].xyz[kkk] - xlev;
02342 jj = 4*(ci > 0.0) + 2*(cj > 0.0) + (ck > 0.0) ;
02343 if( jj == 0 || jj == 7 ) continue ; /* all have same sign */
02344
02345 /* setup id,jd,kd so fvijk[id] is on one side of plane,
02346 and so that fvijk[jd] and fvijk[kd] are on other side */
02347
02348 switch( jj ){
02349 case 6:
02350 case 1: id = 2 ; jd = 0 ; kd = 1 ; break ; /* kd is the 1 */
02351 case 5:
02352 case 2: id = 1 ; jd = 0 ; kd = 2 ; break ; /* jd is the 1 */
02353 case 4:
02354 case 3: id = 0 ; jd = 1 ; kd = 2 ; break ; /* id is the 1 */
02355 }
02356
02357 /* linearly interpolate between fvijk[id] and fvijk[jd]
02358 to find the point where this line hits the slice plane */
02359
02360 ci = fvijk[id].xyz[kkk] - xlev;
02361 cj = fvijk[id].xyz[kkk] - fvijk[jd].xyz[kkk] ;
02362 if( cj == 0.0 ) continue ; /* should not happen */
02363 ck = ci / cj ;
02364 if( ck < 0.0 || ck > 1.0 ) continue ; /* should not happen */
02365 cj = 1.0 - ck ;
02366 fvp = SCLADD_FVEC3(cj,fvijk[id],ck,fvijk[jd]) ;
02367
02368 /* linearly interpolate between fvijk[id] and fvijk[kd] */
02369
02370 cj = fvijk[id].xyz[kkk] - fvijk[kd].xyz[kkk] ;
02371 if( cj == 0.0 ) continue ;
02372 ck = ci / cj ;
02373 if( ck < 0.0 || ck > 1.0 ) continue ;
02374 cj = 1.0 - ck ;
02375 fvm = SCLADD_FVEC3(cj,fvijk[id],ck,fvijk[kd]) ;
02376
02377 /* transform interpolated points to FD_brick coords */
02378
02379 fvp = THD_dicomm_to_3dmm( br->dset , fvp ) ;
02380 if( fvp.xyz[0] < daxes->xxmin ||
02381 fvp.xyz[0] > daxes->xxmax ||
02382 fvp.xyz[1] < daxes->yymin ||
02383 fvp.xyz[1] > daxes->yymax ||
02384 fvp.xyz[2] < daxes->zzmin ||
02385 fvp.xyz[2] > daxes->zzmax ) continue ; /* 08 Jan 2004 */
02386 fvp = THD_3dmm_to_3dfind( br->dset , fvp ) ;
02387 fvp = THD_3dfind_to_fdfind( br , fvp ) ;
02388
02389 fvm = THD_dicomm_to_3dmm( br->dset , fvm ) ;
02390 if( fvm.xyz[0] < daxes->xxmin ||
02391 fvm.xyz[0] > daxes->xxmax ||
02392 fvm.xyz[1] < daxes->yymin ||
02393 fvm.xyz[1] > daxes->yymax ||
02394 fvm.xyz[2] < daxes->zzmin ||
02395 fvm.xyz[2] > daxes->zzmax ) continue ; /* 08 Jan 2004 */
02396 fvm = THD_3dmm_to_3dfind( br->dset , fvm ) ;
02397 fvm = THD_3dfind_to_fdfind( br , fvm ) ;
02398
02399 /* plot a line segment between them, in the plane of the slice */
02400 /* [21 Mar 2002: include the 0.5 shift mentioned way up above] */
02401
02402 plotline_memplot( s1*(fvp.xyz[0]+0.5) , 1.0-s2*(fvp.xyz[1]+0.5) ,
02403 s1*(fvm.xyz[0]+0.5) , 1.0-s2*(fvm.xyz[1]+0.5) ) ;
02404
02405 } /* end of loop over triangles */
02406 set_thick_memplot(0.0) ; /* 15 Jan 2003 */
02407 } /* end of loop over levels: 26 Feb 2003 */
02408 } /* end of if over doing lines */
02409 } /* end of loop over surface index ks */
02410 } /* end of plotting surface stuff */
02411
02412 /*----- put crosshairs on with lines, if desired -----*/
02413 /****** 22 Mar 2002: adapted from pixel overlay ******/
02414
02415 if( do_xhar ){
02416 MCW_grapher * grapher = UNDERLAY_TO_GRAPHER(im3d,br) ;
02417
02418 THD_ivec3 ib = THD_3dind_to_fdind( br ,
02419 TEMP_IVEC3( im3d->vinfo->i1 ,
02420 im3d->vinfo->j2 ,
02421 im3d->vinfo->k3 ) ) ;
02422 STATUS("drawing crosshairs") ;
02423 set_thick_memplot(0.0) ;
02424
02425 if( n == ib.ijk[2] || im3d->vinfo->xhairs_all ){
02426 int jp,ip , jcen,icen , gappp , jj,ii ;
02427 int idown,iup,iskip , jdown,jup,jskip , imon,jmon ;
02428 int a1 = br->a123.ijk[0] , /* x axis of the brick? */
02429 ax = abs(a1) - 1 ; /* 0,1,2 for dataset x,y,z */
02430 int a2 = br->a123.ijk[1] , /* y axis of the brick? */
02431 ay = abs(a2) - 1 ; /* 0,1,2 for dataset x,y,z */
02432 int a3 = br->a123.ijk[2] , /* z axis of the brick? */
02433 az = abs(a3) - 1 ; /* 0,1,2 for dataset x,y,z */
02434
02435 int gap,icr,jcr , nx=br->n1 , ny=br->n2 ;
02436
02437 float rr,gg,bb ; /* colors */
02438 float s1=1.0/br->n1 , s2=1.0/br->n2 ; /* scale pixels to plot coords */
02439 #define PSX(i) (s1*((i)+0.5))
02440 #define PSY(j) (1.0-s2*((j)+0.5))
02441
02442 /* spatial orientations of image axes */
02443
02444 int ox = (ax==0) ? br->dset->daxes->xxorient :
02445 (ax==1) ? br->dset->daxes->yyorient : br->dset->daxes->zzorient ;
02446
02447 int oy = (ay==0) ? br->dset->daxes->xxorient :
02448 (ay==1) ? br->dset->daxes->yyorient : br->dset->daxes->zzorient ;
02449
02450 jp = im3d->vinfo->crosshair_ovcolor ;
02451 rr = DCOV_REDBYTE (im3d->dc,jp) / 255.0 ;
02452 gg = DCOV_GREENBYTE(im3d->dc,jp) / 255.0 ;
02453 bb = DCOV_BLUEBYTE (im3d->dc,jp) / 255.0 ;
02454 set_color_memplot(rr,gg,bb) ;
02455
02456 gap = (grapher==NULL) ? im3d->vinfo->crosshair_gap : (grapher->mat+1)/2 ;
02457
02458 icen = ib.ijk[0] ; /* x-index of image pixel at focus */
02459 jcen = ib.ijk[1] ; /* y-index */
02460
02461 /** initialize montage steps **/
02462
02463 if( im3d->vinfo->xhairs_show_montage ){ /* in "Multi" mode */
02464 iskip = im3d->vinfo->xhairs_nskip.ijk[ax] + 1 ;
02465 jskip = im3d->vinfo->xhairs_nskip.ijk[ay] + 1 ;
02466 if( a1 > 0 ){
02467 idown = im3d->vinfo->xhairs_ndown.ijk[ax] ;
02468 iup = im3d->vinfo->xhairs_nup.ijk[ax] ;
02469 } else {
02470 iup = im3d->vinfo->xhairs_ndown.ijk[ax] ;
02471 idown = im3d->vinfo->xhairs_nup.ijk[ax] ;
02472 }
02473 if( a2 > 0 ){
02474 jdown = im3d->vinfo->xhairs_ndown.ijk[ay] ;
02475 jup = im3d->vinfo->xhairs_nup.ijk[ay] ;
02476 } else {
02477 jup = im3d->vinfo->xhairs_ndown.ijk[ay] ;
02478 jdown = im3d->vinfo->xhairs_nup.ijk[ay] ;
02479 }
02480
02481 } else { /* in "Single" Mode */
02482 idown = iup = jdown = jup = iskip = jskip = 0 ;
02483 if( grapher != NULL ){ idown=-(iup+1); jdown=-(jup+1); } /* skip lines? */
02484 }
02485
02486 /* draw vertical lines first */
02487
02488 if( (im3d->vinfo->xhairs_orimask & (1<<oy)) != 0 ){
02489 for( imon=-idown ; imon <= iup ; imon++ ){
02490 icr = icen + imon * iskip ;
02491
02492 if( im3d->vinfo->xhairs_periodic ){
02493 while( icr < 0 ) icr += nx ;
02494 while( icr >= nx ) icr -= nx ;
02495 } else {
02496 if( icr < 0 || icr >= nx ) continue ;
02497 }
02498
02499 gappp = (abs(icr-icen) <= gap) ? gap : -1 ; /* no gap if far from center */
02500
02501 if( gappp < 0 ){ /* no gap => 1 vertical line */
02502
02503 plotline_memplot( PSX(icr) , 0.0 , PSX(icr) , 1.0 ) ;
02504
02505 } else { /* gap => 2 vertical lines */
02506
02507 jj = jcen-gappp-1 ;
02508 if( jj >= 0 )
02509 plotline_memplot( PSX(icr) , 1.0 , PSX(icr) , PSY(jj+0.5) ) ;
02510
02511 jj = jcen+gappp+1 ;
02512 if( jj < ny )
02513 plotline_memplot( PSX(icr) , PSY(jj-0.5) , PSX(icr) , 0.0 ) ;
02514 }
02515
02516 }
02517 }
02518
02519 /* draw horizontal lines */
02520
02521 if( (im3d->vinfo->xhairs_orimask & (1<<ox)) != 0 ){ /* 31 Dec 1998 */
02522 for( jmon=-jdown ; jmon <= jup ; jmon++ ){
02523 jcr = jcen + jmon * jskip ;
02524 if( im3d->vinfo->xhairs_periodic ){
02525 while( jcr < 0 ) jcr += ny ;
02526 while( jcr >= ny ) jcr -= ny ;
02527 } else {
02528 if( jcr < 0 || jcr >= ny ) continue ;
02529 }
02530
02531 gappp = (abs(jcr-jcen) <= gap) ? gap : -1 ; /* no gap if far from center */
02532
02533 if( gappp < 0 ){ /* no gap => 1 horizontal line */
02534
02535 plotline_memplot( 0.0 , PSY(jcr) , 1.0 , PSY(jcr) ) ;
02536
02537 } else { /* gap => 2 horizontal lines */
02538
02539 ii = icen-gappp-1 ;
02540 if( ii >= 0 )
02541 plotline_memplot( 0.0 , PSY(jcr) , PSX(ii+0.5) , PSY(jcr) ) ;
02542
02543 ii = icen+gappp+1 ;
02544 if( ii < nx )
02545 plotline_memplot( PSX(ii-0.5) , PSY(jcr) , 1.0 , PSY(jcr) ) ;
02546 }
02547 }
02548 }
02549
02550 /* draw grapher frame, if needed */
02551
02552 if( grapher != NULL ){
02553 int gs = gap , gb = (grapher->mat +2)/2 ;
02554
02555 jcr = jcen ; icr = icen ;
02556
02557 ip = icr - gb ; if( ip < 0 ) ip = 0 ;
02558 ii = icr + gs ; if( ii >= nx ) ii = nx-1 ;
02559
02560 jp = jcr - gb ; if( jp < 0 ) jp = 0 ;
02561 jj = jcr + gs ; if( jj >= ny ) jj = ny-1 ;
02562
02563 plotline_memplot( PSX(ip+0.5),PSY(jp+0.5) , PSX(ii-0.5),PSY(jp+0.5) ) ;
02564 plotline_memplot( PSX(ii-0.5),PSY(jp+0.5) , PSX(ii-0.5),PSY(jj-0.5) ) ;
02565 plotline_memplot( PSX(ii-0.5),PSY(jj-0.5) , PSX(ip+0.5),PSY(jj-0.5) ) ;
02566 plotline_memplot( PSX(ip+0.5),PSY(jj-0.5) , PSX(ip+0.5),PSY(jp+0.5) ) ;
02567
02568 } /* end if "if grapher exists" */
02569
02570 } /* end of "if correct slice" (or do all slices) */
02571 } /* end of crosshairs */
02572
02573 /*----- return the completed plot -----*/
02574
02575 if( MEMPLOT_NLINE(mp) < 1 ) DESTROY_MEMPLOT(mp) ;
02576
02577 RETURN(mp) ; /* will be destroyed in imseq */
02578 }
02579
02580 /*--- 20 Sep 2001: image label ---*/
02581
02582 if( type == isqCR_getlabel ){
02583 Three_D_View * im3d = (Three_D_View *) br->parent ;
02584 char *lab , str[32] , *dd ;
02585 THD_ivec3 iv,ivp,ivm ;
02586 THD_fvec3 fv,fvp,fvm ;
02587 float dxyz , cc ;
02588 int ii ;
02589
02590 if( im3d->type != AFNI_3DDATA_VIEW ) RETURN(NULL) ;
02591
02592 LOAD_IVEC3(iv,0,0,n) ;
02593 ivp = THD_fdind_to_3dind( br , iv ) ;
02594 fvp = THD_3dind_to_3dmm ( br->dset , ivp ) ;
02595 fvp = THD_3dmm_to_dicomm( br->dset , fvp ) ;
02596
02597 if( n == 0 ) LOAD_IVEC3(iv,0,0,1) ;
02598 else LOAD_IVEC3(iv,0,0,n-1) ;
02599 ivm = THD_fdind_to_3dind( br , iv ) ;
02600 fvm = THD_3dind_to_3dmm ( br->dset , ivm ) ;
02601 fvm = THD_3dmm_to_dicomm( br->dset , fvm ) ;
02602
02603 dxyz = MIN(br->del1,br->del2) ;
02604 dxyz = MIN(dxyz ,br->del3) ; dxyz *= 0.1 ;
02605
02606 if( fabs(fvm.xyz[0]-fvp.xyz[0]) > dxyz ){ /* +=R -=L */
02607 cc = fvp.xyz[0] ;
02608 dd = ( cc >= 0.0 ) ? "L" : "R" ;
02609 } else if( fabs(fvm.xyz[1]-fvp.xyz[1]) > dxyz ){ /* +=P -=A */
02610 cc = fvp.xyz[1] ;
02611 dd = ( cc >= 0.0 ) ? "P" : "A" ;
02612 } else if( fabs(fvm.xyz[2]-fvp.xyz[2]) > dxyz ){ /* +=S -=I */
02613 cc = fvp.xyz[2] ;
02614 dd = ( cc >= 0.0 ) ? "S" : "I" ;
02615 } else {
02616 RETURN(NULL) ; /* should never happen */
02617 }
02618
02619 sprintf(str,"%6.2f",fabs(cc)) ;
02620 for( ii=strlen(str)-1 ; ii > 0 && str[ii] == '0' ; ii-- ) str[ii] = '\0' ;
02621 if( str[ii] == '.' ) str[ii] = '\0' ;
02622 strcat(str,dd) ; lab = strdup(str) ; RETURN(lab) ;
02623 }
02624
02625 /*--- underlay image # n ---*/
02626
02627 if( type == isqCR_getimage || type == isqCR_getqimage ){
02628 Three_D_View * im3d = (Three_D_View *) br->parent ;
02629 int ival ;
02630
02631 /*** decide which 3D brick to extract data from (ival) ***/
02632
02633 if( EQUIV_DSETS(br->dset,im3d->anat_now) ) /* underlay dataset */
02634 ival = im3d->vinfo->anat_index ;
02635 else if( EQUIV_DSETS(br->dset,im3d->fim_now) ) /* overlay dataset */
02636 ival = im3d->vinfo->fim_index ;
02637 else
02638 ival = 0 ; /* shouldn't happen */
02639
02640 if( type == isqCR_getqimage ) ival = -1 ; /* get empty image */
02641 else if( ival >= DSET_NVALS(br->dset) ) ival = br->dset->dblk->nvals -1 ;
02642
02643 if(PRINT_TRACING)
02644 { char str[256] ;
02645 sprintf(str,"getting image n1=%d n2=%d ival=%d",br->n1,br->n2,ival) ;
02646 STATUS(str) ; }
02647
02648 LOAD_DSET_VIEWS(im3d) ; /* 02 Nov 1996 */
02649
02650 im = FD_warp_to_mri( n , ival , br ) ; /* actually get image from dataset */
02651
02652 if( ival < 0 ) RETURN( (XtPointer) im ) ; /* return fake image */
02653
02654 /* Load value of current pixel into display label */
02655 /* April 1996: only if image is at current slice */
02656
02657 { char buf[64] = "\0" ; int ibest=-1 ;
02658 AFNI_set_valabel( br , n , im , buf ) ;
02659 if( buf[0] != '\0' ){
02660 if( im3d->vinfo->underlay_type == UNDERLAY_ANAT )
02661 strcpy( im3d->vinfo->anat_val , buf ) ;
02662 else
02663 im3d->vinfo->anat_val[0] = '\0' ;
02664
02665 if( !AFNI_noenv("AFNI_VALUE_LABEL") ) AFNI_do_bkgd_lab( im3d ) ;
02666
02667 if( im->kind != MRI_complex && im->kind != MRI_rgb ){
02668 char qbuf[64] = "bg =" ;
02669 strcat(qbuf,buf) ; strcpy(buf,qbuf) ;
02670 }
02671 AFNI_get_xhair_node( im3d , NULL , &ibest ) ; /* 21 Feb 2003 */
02672 if( ibest >= 0 ){
02673 char qbuf[64]; sprintf(qbuf,"\nxh = #%d",ibest); strcat(buf,qbuf);
02674 }
02675 MCW_set_widget_label( im3d->vwid->imag->pop_bkgd_lab , buf ) ;
02676 XtManageChild( im3d->vwid->imag->pop_bkgd_lab ) ;
02677 }
02678 }
02679
02680 RETURN( (XtPointer) im ) ;
02681 }
02682
02683 STATUS("get something else, but I don't care!") ;
02684
02685 RETURN( NULL ) ;
02686 }
|
|
||||||||||||
|
12 Dec 2001: only refit menus if dataset has changed * Definition at line 7294 of file afni.c. References THD_3dim_dataset::anat_parent, VIEW_ORIGINAL_TYPE, THD_3dim_dataset::view_type, and THD_3dim_dataset::warp_parent.
07296 {
07297 if( old_dset==NULL || new_dset==NULL ) return 0 ;
07298
07299 if( old_dset == new_dset->warp_parent ) return 1 ;
07300
07301 if( old_dset->warp_parent == new_dset ) return 1 ;
07302
07303 if( old_dset->warp_parent == new_dset->warp_parent &&
07304 old_dset->warp_parent != NULL ) return 1 ;
07305
07306 if( new_dset->view_type == VIEW_ORIGINAL_TYPE &&
07307 old_dset->view_type != VIEW_ORIGINAL_TYPE &&
07308 old_dset->anat_parent != NULL &&
07309 old_dset->anat_parent->warp_parent != NULL ) return 1 ;
07310
07311 if( old_dset->view_type == VIEW_ORIGINAL_TYPE &&
07312 new_dset->view_type != VIEW_ORIGINAL_TYPE &&
07313 new_dset->anat_parent != NULL &&
07314 new_dset->anat_parent->warp_parent != NULL ) return 1 ;
07315
07316 return 0 ;
07317 }
|
|
|
||||||||||||||||
|
Definition at line 4590 of file afni.c. References AFNI_marks_action_CB(), CLOSE_PANEL, AFNI_widget_set::dmode, ENTRY, AFNI_viewing_widgets::frame, AFNI_marks_widgets::frame, AFNI_function_widgets::frame, AFNI_datamode_widgets::frame, AFNI_widget_set::func, IM3D_OPEN, AFNI_widget_set::marks, MCW_invert_widget(), AFNI_program_widgets::panel_pb, AFNI_program_widgets::panel_pb_inverted, AFNI_widget_set::prog, RESET_AFNI_QUIT, AFNI_widget_set::view, and Three_D_View::vwid. Referenced by AFNI_closedown_3dview().
04591 {
04592 Three_D_View * im3d = (Three_D_View *) cd ;
04593
04594 ENTRY("AFNI_controller_panel_CB") ;
04595
04596 if( ! IM3D_OPEN(im3d) || im3d->vwid->prog->panel_pb == NULL ) EXRETURN ;
04597
04598 /** if view frame is open, close it and all its children **/
04599
04600 if( XtIsManaged(im3d->vwid->view->frame) == True ){
04601
04602 if( XtIsManaged(im3d->vwid->marks->frame) == True ){
04603 AFNI_marks_action_CB( NULL , (XtPointer) im3d , NULL ) ;
04604 }
04605
04606 if( XtIsManaged(im3d->vwid->func->frame) ){
04607 CLOSE_PANEL(im3d,func) ;
04608 }
04609
04610 if( XtIsManaged(im3d->vwid->dmode->frame) ){
04611 CLOSE_PANEL(im3d,dmode) ;
04612 }
04613
04614 XtUnmanageChild(im3d->vwid->view->frame) ;
04615 if( im3d->vwid->prog->panel_pb_inverted ){
04616 MCW_invert_widget(im3d->vwid->prog->panel_pb) ;
04617 im3d->vwid->prog->panel_pb_inverted = False ;
04618 }
04619
04620 } else { /** open the view frame (but not its children) **/
04621
04622 XtManageChild(im3d->vwid->view->frame) ;
04623 if( ! im3d->vwid->prog->panel_pb_inverted ){
04624 MCW_invert_widget(im3d->vwid->prog->panel_pb) ;
04625 im3d->vwid->prog->panel_pb_inverted = True ;
04626 }
04627 }
04628
04629 RESET_AFNI_QUIT(im3d) ;
04630 EXRETURN ;
04631 }
|
|
||||||||||||
|
Definition at line 9599 of file afni.c. References ADDTO_KILL, THD_statistics::bstat, THD_3dim_dataset::dblk, ENTRY, INVALIDATE_BSTAT, ISVALID_3DIM_DATASET, ISVALID_STATISTIC, THD_3dim_dataset::kl, myXtNew, THD_statistics::nbstat, THD_datablock::nvals, THD_statistics::parent, STATISTICS_TYPE, THD_3dim_dataset::stats, THD_statistics::type, XtMalloc, and XtRealloc. Referenced by adwarp_follower_dataset(), AFNI_follower_dataset(), and AFNI_init_warp().
09600 {
09601 int ibr , nvold , nvnew ;
09602 THD_statistics * stold , * stnew ;
09603
09604 ENTRY("AFNI_copy_statistics") ;
09605
09606 if( !ISVALID_3DIM_DATASET(dsold) || !ISVALID_3DIM_DATASET(dsnew) ) EXRETURN ;
09607
09608 nvold = dsold->dblk->nvals ;
09609 nvnew = dsnew->dblk->nvals ;
09610 stold = dsold->stats ;
09611 stnew = dsnew->stats ;
09612 if( !ISVALID_STATISTIC(stold) ) EXRETURN ;
09613
09614 if( stnew == NULL ){
09615 dsnew->stats = stnew = myXtNew( THD_statistics ) ;
09616 stnew->type = STATISTICS_TYPE ;
09617 stnew->nbstat = nvnew ;
09618 stnew->bstat = (THD_brick_stats *)
09619 XtMalloc( sizeof(THD_brick_stats) * nvnew ) ;
09620 ADDTO_KILL(dsnew->kl,stnew) ;
09621 stnew->parent = (XtPointer) dsnew ;
09622 } else {
09623 stnew->nbstat = nvnew ;
09624 stnew->bstat = (THD_brick_stats *)
09625 XtRealloc( (char *) stnew->bstat ,
09626 sizeof(THD_brick_stats) * nvnew ) ;
09627 }
09628
09629 for( ibr=0 ; ibr < nvnew ; ibr++ ){
09630 if( ibr < nvold )
09631 stnew->bstat[ibr] = stold->bstat[ibr] ;
09632 else
09633 INVALIDATE_BSTAT(stnew->bstat[ibr]) ;
09634 }
09635
09636 EXRETURN ;
09637 }
|
|
||||||||||||
|
Definition at line 4746 of file afni.c. References AFNI_set_viewpoint(), client_data, AFNI_view_info::crosshair_ovcolor, AFNI_view_info::crosshair_visible, ENTRY, IM3D_VALID, ipx, MCW_arrowval::ival, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, and Three_D_View::vinfo.
04747 {
04748 Three_D_View * im3d = (Three_D_View *) client_data ;
04749 int ipx = av->ival ;
04750
04751 ENTRY("AFNI_crosshair_color_CB") ;
04752
04753 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04754
04755 im3d->vinfo->crosshair_ovcolor = ipx ;
04756 if( im3d->vinfo->crosshair_visible ){
04757 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
04758 }
04759
04760 RESET_AFNI_QUIT(im3d) ;
04761 EXRETURN ;
04762 }
|
|
||||||||||||||||||||
|
Definition at line 7756 of file afni.c. References AFNI_widget_set::butx, AFNI_widget_set::buty, AFNI_imaging_widgets::crosshair_label, AFNI_imaging_widgets::crosshair_menu, ENTRY, ev, event, IM3D_OPEN, AFNI_widget_set::imag, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, and Three_D_View::vwid.
07758 {
07759 Three_D_View *im3d = (Three_D_View *)cd ;
07760
07761 ENTRY("AFNI_crosshair_EV") ;
07762
07763 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
07764
07765 /*** handle events ***/
07766
07767 switch( ev->type ){
07768
07769 /*----- take button press -----*/
07770
07771 case ButtonPress:{
07772 XButtonEvent *event = (XButtonEvent *)ev ;
07773
07774 if( event->button == Button3 ||
07775 (event->button == Button1 &&
07776 (event->state & (ShiftMask|ControlMask))) ){
07777
07778 im3d->vwid->butx = event->x_root ; /* 17 May 2005 */
07779 im3d->vwid->buty = event->y_root ;
07780 event->button = Button3 ; /* fake */
07781 XmMenuPosition( im3d->vwid->imag->crosshair_menu , event ); /* where */
07782 XtManageChild ( im3d->vwid->imag->crosshair_menu ) ; /* popup */
07783 }
07784
07785 else {
07786 (void) MCW_popup_message( im3d->vwid->imag->crosshair_label ,
07787 " The road goes ever on and on\n"
07788 " Out from the door from where it began.\n"
07789 " Now, far ahead the road has gone\n"
07790 " And I must follow if I can.\n"
07791 " Pursuing it with eager feet\n"
07792 " Until it meets some other way\n"
07793 " Where many paths and errands meet\n"
07794 " And whither then I cannot say." ,
07795 MCW_USER_KILL | MCW_TIMER_KILL ) ;
07796 }
07797 }
07798 break ;
07799
07800 /*----- take key press -----*/
07801
07802 #if 0
07803 case KeyPress:{
07804 XKeyEvent * event = (XKeyEvent *) ev ;
07805 char buf[32] ;
07806 KeySym ks ;
07807 int nbuf ;
07808
07809 buf[0] = '\0' ;
07810 nbuf = XLookupString( event , buf , 32 , &ks , NULL ) ;
07811
07812 switch( buf[0] ){
07813 default: break ;
07814 }
07815 }
07816 break ;
07817 #endif
07818 }
07819
07820 EXRETURN ;
07821 }
|
|
||||||||||||
|
Definition at line 4766 of file afni.c. References AFNI_set_viewpoint(), client_data, AFNI_view_info::crosshair_gap, AFNI_view_info::crosshair_gap_old, AFNI_view_info::crosshair_visible, ENTRY, IM3D_VALID, ipx, MCW_arrowval::ival, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, and Three_D_View::vinfo. Referenced by AFNI_seq_send_CB().
04767 {
04768 Three_D_View * im3d = (Three_D_View *) client_data ;
04769 int ipx ;
04770
04771 ENTRY("AFNI_crosshair_gap_CB") ;
04772
04773 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04774
04775 if( av != NULL ){
04776 ipx = av->ival ;
04777 } else {
04778 if( im3d->vinfo->crosshair_gap_old > 0 ){
04779 ipx = im3d->vinfo->crosshair_gap_old ;
04780 im3d->vinfo->crosshair_gap_old = 0 ;
04781 } else {
04782 im3d->vinfo->crosshair_gap_old = im3d->vinfo->crosshair_gap ;
04783 ipx = 0 ;
04784 }
04785 }
04786
04787 im3d->vinfo->crosshair_gap = ipx ;
04788 if( im3d->vinfo->crosshair_visible ){
04789 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
04790 }
04791
04792 RESET_AFNI_QUIT(im3d) ;
04793 EXRETURN ;
04794 }
|
|
|
initialize montage steps * Definition at line 5958 of file afni.c. References AFNI_IMAGES_VIEW, AFNI_library_type::cord, DSET_INMEMORY, ENTRY, Three_D_View::fim_now, THD_coorder::first, AFNI_view_info::func_visible, GLOBAL_library, AFNI_view_info::i1, THD_ivec3::ijk, IM3D_OPEN, IM3D_VALID, ISVALID_3DIM_DATASET, AFNI_view_info::j2, AFNI_view_info::k3, THD_coorder::orcode, RETURN, THD_coorder::second, AFNI_view_info::show_voxind, STATUS, TEMP_FVEC3, THD_3dmm_to_3dind(), THD_dicomm_to_3dmm(), THD_coorder::third, Three_D_View::type, Three_D_View::vinfo, THD_3dim_dataset::wod_flag, AFNI_view_info::xi, THD_coorder::xxsign, AFNI_view_info::yj, THD_coorder::yysign, AFNI_view_info::zk, and THD_coorder::zzsign. Referenced by AFNI_crosshair_relabel().
05959 {
05960 char buf[128] ;
05961 XmString xstr ;
05962 static char * RR="[R]" , * LL="[L]" ,
05963 * PP="[P]" , * AA="[A]" ,
05964 * SS="[S]" , * II="[I]" , * ZZ=" " ;
05965 char * xx , * yy , * zz ;
05966 float xval,yval,zval ;
05967
05968 ENTRY("AFNI_crosshair_label") ;
05969
05970 if( ! IM3D_VALID(im3d) ) RETURN( NULL );
05971
05972 if( ! IM3D_OPEN(im3d) ){
05973
05974 buf[0] = '\0' ;
05975 if( im3d->type != AFNI_IMAGES_VIEW ) strcat(buf," \n") ;
05976 strcat(buf, "1234567890123456789\n"
05977 "1234567890123456789\n"
05978 "1234567890123456789" ) ;
05979
05980 } else if( im3d->type == AFNI_IMAGES_VIEW || im3d->vinfo->show_voxind ){
05981
05982 STATUS("voxel indexes") ;
05983
05984 if( ISVALID_3DIM_DATASET(im3d->fim_now) &&
05985 im3d->vinfo->func_visible && DSET_INMEMORY(im3d->fim_now) ){
05986 THD_fvec3 fv ;
05987 THD_ivec3 iv ;
05988 int flag ;
05989
05990 flag = im3d->fim_now->wod_flag ;
05991 im3d->fim_now->wod_flag = False ;
05992
05993 fv = THD_dicomm_to_3dmm( im3d->fim_now ,
05994 TEMP_FVEC3(im3d->vinfo->xi,im3d->vinfo->yj,im3d->vinfo->zk) ) ;
05995 iv = THD_3dmm_to_3dind( im3d->fim_now , fv ) ;
05996
05997 im3d->fim_now->wod_flag = flag ;
05998
05999 sprintf( buf , "x: an=%4d fun=%4d\ny: an=%4d fun=%4d\nz: an=%4d fun=%4d" ,
06000 im3d->vinfo->i1,iv.ijk[0] ,
06001 im3d->vinfo->j2,iv.ijk[1] ,
06002 im3d->vinfo->k3,iv.ijk[2] ) ;
06003 } else {
06004 sprintf( buf , "voxel x = %4d\nvoxel y = %4d\nvoxel z = %4d" ,
06005 im3d->vinfo->i1 , im3d->vinfo->j2 , im3d->vinfo->k3 ) ;
06006 }
06007 } else {
06008 char bxyz[3][32] , *cname ;
06009
06010 STATUS("voxel coordinates") ;
06011
06012 xval = im3d->vinfo->xi ;
06013 yval = im3d->vinfo->yj ;
06014 zval = im3d->vinfo->zk ;
06015
06016 xx = (xval==0.0) ? (ZZ) : ( (xval<0.0) ? (RR) : (LL) ) ;
06017 yy = (yval==0.0) ? (ZZ) : ( (yval<0.0) ? (AA) : (PP) ) ;
06018 zz = (zval==0.0) ? (ZZ) : ( (zval<0.0) ? (II) : (SS) ) ;
06019
06020 /** 16 July 1997 **/
06021 #if 1
06022 sprintf( bxyz[0] , "=%9.3f mm %s" ,
06023 GLOBAL_library.cord.xxsign * xval , xx ) ;
06024
06025 sprintf( bxyz[1] , "=%9.3f mm %s" ,
06026 GLOBAL_library.cord.yysign * yval , yy ) ;
06027
06028 sprintf( bxyz[2] , "=%9.3f mm %s" ,
06029 GLOBAL_library.cord.zzsign * zval , zz ) ;
06030
06031 if( strcmp(GLOBAL_library.cord.orcode,"RAI") == 0 )
06032 cname = "=DICOM" ;
06033 else if( strcmp(GLOBAL_library.cord.orcode,"LPI") == 0 )
06034 cname = "=SPM " ;
06035 else
06036 cname = " " ;
06037
06038 sprintf( buf , "[order: %s%s]\nx %17s\ny %17s\nz %17s" ,
06039 GLOBAL_library.cord.orcode , cname ,
06040 bxyz[GLOBAL_library.cord.first] ,
06041 bxyz[GLOBAL_library.cord.second] ,
06042 bxyz[GLOBAL_library.cord.third] ) ;
06043 #else
06044 sprintf( buf , "x =%9.3f mm %s\ny =%9.3f mm %s\nz =%9.3f mm %s" ,
06045 xval,xx , yval,yy , zval,zz ) ;
06046 #endif
06047 }
06048
06049 xstr = XmStringCreateLtoR( buf , XmFONTLIST_DEFAULT_TAG ) ;
06050
06051 RETURN( xstr ) ;
06052 }
|
|
||||||||||||||||
|
|
Definition at line 7827 of file afni.c. References AFNI_crosshair_label(), AFNI_imaging_widgets::crosshair_label, ENTRY, IM3D_OPEN, AFNI_widget_set::imag, MCW_expose_widget(), AFNI_view_info::old_crosshair_label, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_crosshair_pop_CB(), and AFNI_set_viewpoint().
07828 {
07829 XmString xstr ;
07830 Boolean same ;
07831
07832 ENTRY("AFNI_crosshair_relabel") ;
07833
07834 if( !IM3D_OPEN(im3d) ) EXRETURN ;
07835 xstr = AFNI_crosshair_label( im3d ) ; if( xstr == NULL ) EXRETURN ;
07836 if( im3d->vinfo->old_crosshair_label == (XmString)NULL ) /* shouldn't */
07837 same = False ; /* happen */
07838 else
07839 same = XmStringCompare( xstr , im3d->vinfo->old_crosshair_label ) ;
07840
07841 if( same == False ){
07842 XtVaSetValues( im3d->vwid->imag->crosshair_label , /* redisplay */
07843 XmNlabelString , xstr , /* if changed */
07844 NULL ) ;
07845 MCW_expose_widget( im3d->vwid->imag->crosshair_label ) ; /* redraw now! */
07846 if( im3d->vinfo->old_crosshair_label != (XmString)NULL )
07847 XmStringFree(im3d->vinfo->old_crosshair_label) ; /* toss old */
07848 im3d->vinfo->old_crosshair_label = xstr ; /* new old */
07849 } else {
07850 XmStringFree( xstr ) ; /* was same --> don't need this copy */
07851 }
07852
07853 EXRETURN ;
07854 }
|
|
||||||||||||
|
open the view frame (but not its children) * Definition at line 4637 of file afni.c. References AFNI_process_viewpoint(), AFNI_set_viewpoint(), AFNI_XHAIRS_AP, AFNI_XHAIRS_AP_IS, AFNI_XHAIRS_IS, AFNI_XHAIRS_LR, AFNI_XHAIRS_LR_AP, AFNI_XHAIRS_LR_IS, AFNI_XHAIRS_MULTI, AFNI_XHAIRS_OFF, AFNI_XHAIRS_SINGLE, client_data, AFNI_view_info::crosshair_visible, ENTRY, IM3D_VALID, MCW_arrowval::ival, MCW_arrowval::old_ival, ORIMASK_ALL, ORIMASK_AP, ORIMASK_AP_IS, ORIMASK_IS, ORIMASK_LR, ORIMASK_LR_AP, ORIMASK_LR_IS, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, Three_D_View::vinfo, AFNI_view_info::xhairs_orimask, and AFNI_view_info::xhairs_show_montage. Referenced by AFNI_drive_set_xhairs(), and AFNI_startup_layout_CB().
04638 {
04639 Three_D_View * im3d = (Three_D_View *) client_data ;
04640 int val , omold ;
04641
04642 ENTRY("AFNI_crosshair_visible_CB") ;
04643
04644 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04645
04646 if( av->ival == av->old_ival ) EXRETURN ;
04647
04648 switch( av->ival ){
04649 case AFNI_XHAIRS_OFF:
04650 im3d->vinfo->crosshair_visible = False ;
04651 im3d->vinfo->xhairs_show_montage = False ;
04652 break ;
04653
04654 case AFNI_XHAIRS_SINGLE:
04655 im3d->vinfo->crosshair_visible = True ;
04656 im3d->vinfo->xhairs_show_montage = False ;
04657 break ;
04658
04659 default: /* 31 Dec 1998: */
04660 case AFNI_XHAIRS_MULTI: /* new options */
04661 im3d->vinfo->crosshair_visible = True ; /* like Multi */
04662 im3d->vinfo->xhairs_show_montage = True ;
04663 break ;
04664 }
04665
04666 /* 31 Dec 1998: only allow crosshairs of some orientations */
04667
04668 omold = im3d->vinfo->xhairs_orimask ; /* 02 Jun 1999 */
04669
04670 switch( av->ival ){
04671 default: im3d->vinfo->xhairs_orimask = ORIMASK_ALL ; break;
04672 case AFNI_XHAIRS_LR_AP: im3d->vinfo->xhairs_orimask = ORIMASK_LR_AP; break;
04673 case AFNI_XHAIRS_LR_IS: im3d->vinfo->xhairs_orimask = ORIMASK_LR_IS; break;
04674 case AFNI_XHAIRS_AP_IS: im3d->vinfo->xhairs_orimask = ORIMASK_AP_IS; break;
04675 case AFNI_XHAIRS_LR: im3d->vinfo->xhairs_orimask = ORIMASK_LR ; break;
04676 case AFNI_XHAIRS_AP: im3d->vinfo->xhairs_orimask = ORIMASK_AP ; break;
04677 case AFNI_XHAIRS_IS: im3d->vinfo->xhairs_orimask = ORIMASK_IS ; break;
04678 }
04679
04680 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
04681
04682 /* 02 Jun 1999: if xhairs layout has changed, send a notice */
04683
04684 if( omold != im3d->vinfo->xhairs_orimask ) AFNI_process_viewpoint( im3d ) ;
04685
04686 RESET_AFNI_QUIT(im3d) ;
04687 EXRETURN ;
04688 }
|
|
||||||||||||||||
|
Definition at line 7488 of file afni.c. References AFNI_marks_widgets::action_rowcol, AFNI_marks_action_CB(), AFNI_marks_edits_CB(), AFNI_see_marks_CB(), AFNI_set_viewpoint(), Three_D_View::anat_now, AV_SENSITIZE, AFNI_marks_widgets::changed, client_data, CLOSE_PANEL, AFNI_marks_widgets::control_frame, AFNI_marks_widgets::control_rowcol, AFNI_viewing_widgets::define_dmode_pb, AFNI_viewing_widgets::define_func_pb, AFNI_viewing_widgets::define_marks_pb, AFNI_marks_widgets::disp_gap_av, AFNI_marks_widgets::disp_scolor_av, AFNI_marks_widgets::disp_size_av, AFNI_widget_set::dmode, AFNI_marks_widgets::edits_bbox, ENTRY, FIX_SCALE_SIZE, FIX_SCALE_VALUE, AFNI_marks_widgets::frame, AFNI_function_widgets::frame, AFNI_datamode_widgets::frame, AFNI_widget_set::func, HIDE_SCALE, IM3D_VALID, AFNI_function_widgets::inten_pbar, AFNI_function_widgets::inten_rowcol, ISVALID_VIEW, MAIN_app, THD_3dim_dataset::markers, AFNI_widget_set::marks, MCW_set_bbox(), THD_marker_set::numset, AFNI_marks_widgets::old_visible, OPEN_PANEL, AFNI_function_widgets::options_rowcol, AFNI_marks_widgets::ov_visible, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, AFNI_marks_widgets::rowcol, AFNI_function_widgets::rowcol, AFNI_viewing_widgets::see_marks_bbox, SENSITIZE, STATUS, AFNI_function_widgets::thr_rowcol, AFNI_marks_widgets::tlrc_big_bbox, AFNI_marks_widgets::tog_frame, AFNI_marks_widgets::tog_rowcol, AFNI_marks_widgets::transform_pb, update_MCW_pbar(), AFNI_widget_set::view, VIEW_TALAIRACH_TYPE, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, WARPED_VIEW, and MCW_bbox::wrowcol. Referenced by AFNI_open_panel().
07489 {
07490 Three_D_View * im3d = (Three_D_View *) client_data ;
07491 int vwarp ;
07492
07493 ENTRY("AFNI_define_CB") ;
07494
07495 if( ! IM3D_VALID(im3d) ) EXRETURN ;
07496
07497 /*----- define marks panel -----*/
07498
07499 if( w == im3d->vwid->view->define_marks_pb ){
07500
07501 AFNI_viewing_widgets * view = im3d->vwid->view ;
07502 AFNI_marks_widgets * marks = im3d->vwid->marks ;
07503
07504 if( XtIsManaged(marks->frame) == True ){ /* close it down */
07505
07506 STATUS("closing marks") ;
07507
07508 AFNI_marks_action_CB( NULL , (XtPointer) im3d , NULL ) ;
07509
07510 } else { /* open it up */
07511
07512 STATUS("opening marks") ;
07513
07514 marks->old_visible = marks->ov_visible ;
07515 marks->ov_visible = True ;
07516 marks->changed = False ; /* not changed yet! */
07517
07518 MCW_set_bbox( marks->edits_bbox , 0 ) ;
07519 AFNI_marks_edits_CB( NULL , (XtPointer) im3d , NULL ) ;
07520
07521 MCW_set_bbox( view->see_marks_bbox , 1 ) ;
07522 if( marks->old_visible != marks->ov_visible )
07523 AFNI_see_marks_CB( NULL , (XtPointer) im3d , NULL ) ;
07524
07525 /* Oct 1998: turn off some controls if no markers present */
07526
07527 if( im3d->anat_now->markers == NULL ){
07528 SENSITIZE( marks->edits_bbox->wrowcol , False ) ;
07529 SENSITIZE( marks->tlrc_big_bbox->wrowcol , False ) ;
07530 AV_SENSITIZE( marks->disp_scolor_av , False ) ;
07531 AV_SENSITIZE( marks->disp_size_av , False ) ;
07532 AV_SENSITIZE( marks->disp_gap_av , False ) ;
07533 SENSITIZE( marks->action_rowcol , False ) ;
07534 SENSITIZE( marks->transform_pb , False ) ;
07535 } else {
07536 vwarp = WARPED_VIEW(im3d->vinfo->view_type) ;
07537 SENSITIZE( marks->edits_bbox->wrowcol ,
07538 (Boolean) ISVALID_VIEW(vwarp) ) ;
07539 SENSITIZE( marks->tlrc_big_bbox->wrowcol ,
07540 (Boolean) (vwarp==VIEW_TALAIRACH_TYPE) ) ;
07541 AV_SENSITIZE( marks->disp_scolor_av , True ) ;
07542 AV_SENSITIZE( marks->disp_size_av , True ) ;
07543 AV_SENSITIZE( marks->disp_gap_av , True ) ;
07544 SENSITIZE( marks->action_rowcol , True ) ;
07545 }
07546
07547 /*** I don't know why this is needed, but it prevents the
07548 marks panels geometry from getting screwed up, so it's here ***/
07549
07550 #ifndef USING_LESSTIF
07551 #define REMANAGE_MARKS 1
07552 #else
07553 #define REMANAGE_MARKS 0
07554 #endif
07555
07556 #if 1
07557 { static int first=1 ;
07558 if( REMANAGE_MARKS || first ){ /* CYGWIN: must do 1st time in */
07559 XtUnmanageChild( marks->rowcol ) ; /* but not on later times -- */
07560 XtUnmanageChild( marks->tog_rowcol ) ; /* probably a LessTif bug */
07561 XtUnmanageChild( marks->control_rowcol ) ;
07562 XtUnmanageChild( marks->control_frame ) ;
07563 XtUnmanageChild( marks->tog_frame ) ;
07564 first = 0 ;
07565 }
07566 }
07567 #endif
07568
07569 OPEN_PANEL(im3d,marks) ;
07570
07571 #if 1
07572 #if 0
07573 XFlush( XtDisplay(marks->rowcol) ) ; XSync( XtDisplay(marks->rowcol),False ) ;
07574 #endif
07575 if( im3d->anat_now->markers != NULL ){ /* Oct 1998 */
07576 XtManageChild( marks->tog_rowcol ) ;
07577 XtManageChild( marks->tog_frame ) ;
07578 }
07579 XtManageChild( marks->control_rowcol ) ;
07580 XtManageChild( marks->control_frame ) ;
07581 XtManageChild( marks->rowcol ) ;
07582 #endif
07583
07584 /* redraw markers if not visible already (if there are any to redraw) */
07585
07586 if( marks->old_visible != True &&
07587 im3d->anat_now->markers != NULL &&
07588 im3d->anat_now->markers->numset > 0 )
07589
07590 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
07591 }
07592
07593 EXRETURN ;
07594 }
07595
07596 /*----- define function panel -----*/
07597
07598 if( w == im3d->vwid->view->define_func_pb ){
07599 AFNI_viewing_widgets * view = im3d->vwid->view ;
07600 AFNI_function_widgets * func = im3d->vwid->func ;
07601
07602 if( XtIsManaged(func->frame) ){
07603
07604 STATUS("closing function") ;
07605
07606 CLOSE_PANEL(im3d,func) ;
07607 } else {
07608
07609 STATUS("opening function" ) ;
07610
07611 #ifndef USING_LESSTIF
07612 #define REMANAGE_FUNC
07613 #endif
07614
07615 #ifdef REMANAGE_FUNC
07616 STATUS("unmanaging children") ;
07617 XtUnmanageChild( im3d->vwid->func->rowcol ) ;
07618 XtUnmanageChild( im3d->vwid->func->thr_rowcol ) ;
07619 XtUnmanageChild( im3d->vwid->func->inten_rowcol ) ;
07620 XtUnmanageChild( im3d->vwid->func->options_rowcol ) ;
07621 #endif
07622
07623 STATUS("opening panel") ;
07624 OPEN_PANEL(im3d,func) ;
07625
07626 #ifdef REMANAGE_FUNC
07627 STATUS("remanaging children") ;
07628 XtManageChild( im3d->vwid->func->thr_rowcol ) ;
07629 XtManageChild( im3d->vwid->func->inten_rowcol ) ;
07630 XtManageChild( im3d->vwid->func->options_rowcol ) ;
07631 XtManageChild( im3d->vwid->func->rowcol ) ;
07632 #endif
07633 HIDE_SCALE(im3d) ;
07634 update_MCW_pbar( im3d->vwid->func->inten_pbar ) ;
07635 FIX_SCALE_SIZE(im3d) ; FIX_SCALE_VALUE(im3d) ;
07636
07637 #ifdef FIX_SCALE_SIZE_LATER
07638 (void) XtAppAddTimeOut( MAIN_app,50,fixscale,im3d ) ; /* 09 May 2001 */
07639 #endif
07640
07641 /*** XtManageChild( im3d->vwid->func->inten_bbox->wrowcol ) ; ***/
07642 }
07643
07644 EXRETURN ;
07645 }
07646
07647 /*-- define datamode panel --*/
07648
07649 if( w == im3d->vwid->view->define_dmode_pb ){
07650 AFNI_viewing_widgets * view = im3d->vwid->view ;
07651 AFNI_datamode_widgets * dmode = im3d->vwid->dmode ;
07652
07653 if( XtIsManaged(dmode->frame) ){
07654
07655 STATUS("closing dmode") ;
07656
07657 CLOSE_PANEL(im3d,dmode) ;
07658 } else {
07659
07660 STATUS("opening dmode" ) ;
07661
07662 OPEN_PANEL(im3d,dmode) ;
07663 }
07664
07665 EXRETURN ;
07666 }
07667
07668 RESET_AFNI_QUIT(im3d) ;
07669 EXRETURN ;
07670 }
|
|
|
Definition at line 5230 of file afni.c. References AFNI_view_info::anat_val, AFNI_function_widgets::bkgd_lab, AFNI_imaging_widgets::do_bkgd_lab, FIX_SCALE_SIZE, AFNI_widget_set::func, AFNI_view_info::func_val, IM3D_OPEN, AFNI_widget_set::imag, MCW_set_widget_label(), AFNI_view_info::thr_val, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_brick_to_mri(), and AFNI_set_viewpoint().
05231 {
05232 char str[256] ;
05233
05234 if( !IM3D_OPEN(im3d) || !im3d->vwid->imag->do_bkgd_lab ) return ;
05235
05236 #define VSTR(x) ( ((x)[0] == '\0') ? ("?") : (x) )
05237
05238 sprintf(str,"ULay = %s\n"
05239 "OLay = %s\n"
05240 "Thr = %s" ,
05241 VSTR(im3d->vinfo->anat_val),
05242 VSTR(im3d->vinfo->func_val),
05243 VSTR(im3d->vinfo->thr_val ) ) ;
05244
05245 #undef VSTR
05246
05247 MCW_set_widget_label( im3d->vwid->func->bkgd_lab , str ) ;
05248 XtManageChild( im3d->vwid->func->bkgd_lab ) ;
05249 FIX_SCALE_SIZE(im3d) ;
05250 }
|
|
||||||||||||
|
Find the warp that takes one dataset to another, if it exists. [28 Aug 2002] ------------------------------------------------------------------------ Definition at line 6749 of file afni.c. References findin_Htable(), GLOBAL_library, THD_3dim_dataset::idcode, MCW_idcode::str, and AFNI_library_type::warptable. Referenced by AFNI_setup_viewing(), and AFNI_transform_vector().
06750 {
06751 THD_warp *swarp = NULL ;
06752 char idkey[256] ;
06753
06754 if( GLOBAL_library.warptable == NULL ||
06755 dset_to == NULL ||
06756 dset_from == NULL ) return NULL ;
06757
06758 sprintf(idkey,"%s,%s",dset_to->idcode.str,dset_from->idcode.str) ;
06759 swarp = (THD_warp *) findin_Htable( idkey , GLOBAL_library.warptable ) ;
06760 return swarp ;
06761 }
|
|
||||||||||||
|
Definition at line 6139 of file afni.c. Referenced by AFNI_marks_action_CB(), AFNI_marktog_CB(), AFNI_switchview_CB(), and AFNI_underlay_CB().
|
|
||||||||||||
|
Definition at line 7384 of file afni.c. References THD_linear_mapping::bot, THD_linear_mapping::bvec, MATVEC_SUB, THD_linear_mapping::mfor, THD_warp::rig_bod, THD_warp::tal_12, THD_linear_mapping::top, THD_warp::type, THD_affine_warp::warp, THD_talairach_12_warp::warp, WARP_AFFINE_TYPE, WARP_TALAIRACH_12_TYPE, and THD_fvec3::xyz. Referenced by AFNI_transform_vector(), and main().
07385 {
07386 THD_fvec3 new_fv ;
07387
07388 if( warp == NULL ) return old_fv ;
07389
07390 switch( warp->type ){
07391
07392 default: new_fv = old_fv ; break ;
07393
07394 case WARP_TALAIRACH_12_TYPE:{
07395 THD_linear_mapping map ;
07396 int iw ;
07397
07398 /* forward transform each possible case,
07399 and test if result is in bot..top of defined map */
07400
07401 for( iw=0 ; iw < 12 ; iw++ ){
07402 map = warp->tal_12.warp[iw] ;
07403 new_fv = MATVEC_SUB(map.mfor,old_fv,map.bvec) ;
07404
07405 if( new_fv.xyz[0] >= map.bot.xyz[0] &&
07406 new_fv.xyz[1] >= map.bot.xyz[1] &&
07407 new_fv.xyz[2] >= map.bot.xyz[2] &&
07408 new_fv.xyz[0] <= map.top.xyz[0] &&
07409 new_fv.xyz[1] <= map.top.xyz[1] &&
07410 new_fv.xyz[2] <= map.top.xyz[2] ) break ; /* leave loop */
07411 }
07412 }
07413 break ;
07414
07415 case WARP_AFFINE_TYPE:{
07416 THD_linear_mapping map = warp->rig_bod.warp ;
07417 new_fv = MATVEC_SUB(map.mfor,old_fv,map.bvec) ;
07418 }
07419 break ;
07420
07421 }
07422 return new_fv ;
07423 }
|
|
||||||||||||||||
|
July 1996: an image viewer changed montage layout * Definition at line 3454 of file afni.c. References FD_brick::a123, abs, AFNI_add_timeseries(), AFNI_bucket_CB(), AFNI_fimmer_execute(), AFNI_fimmer_setignore(), AFNI_fimmer_setort(), AFNI_fimmer_setpolort(), AFNI_fimmer_setref(), AFNI_IGNORE_EVERYTHING, AFNI_IGNORE_NOTHING, AFNI_process_drawing(), AFNI_set_viewpoint(), AFNI_time_index_CB(), AFNI_ts_in_library(), AFNI_view_setter(), AFNI_function_widgets::anat_buck_av, AFNI_view_info::anat_index, AV_assign_ival(), AFNI_view_info::crosshair_visible, drive_MCW_grapher(), drive_MCW_imseq(), ENTRY, MCW_grapher::fdw_graph, Three_D_View::fimdata, AFNI_fimmer_type::fimort, AFNI_fimmer_type::fimref, AFNI_widget_set::func, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, GLOBAL_library, graCR_button2_points, graCR_clearfim, graCR_clearort, graCR_destroy, graCR_dofim, graCR_newxyzm, graCR_pickort, graCR_pickref, graCR_polort, graCR_refadd, graCR_refequals, graCR_refsmooth, graCR_setignore, graCR_setindex, graCR_timeseries_library, graCR_winaver, graDR_winaver, AFNI_imaging_widgets::graph_xyz_pb, AFNI_imaging_widgets::graph_yzx_pb, AFNI_imaging_widgets::graph_zxy_pb, GRAPHER_TO_VIEWER, Three_D_View::ignore_seq_callbacks, THD_ivec3::ijk, IM3D_VALID, AFNI_widget_set::imag, IMARR_COUNT, AFNI_fimmer_type::init_ignore, isqDR_overlay, GRA_cbs::key, GRA_cbs::mat, MCW_choose_timeseries(), MCW_invert_widget(), MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, MIN, MRI_FLOAT_PTR, mri_free(), mri_to_float(), myXtFree, FD_brick::n1, FD_brick::n2, FD_brick::n3, NORMAL_cursorize, MRI_IMAGE::nvox, MRI_IMAGE::nx, MRI_IMAGE::ny, MCW_grapher::option_rowcol, OSFILT, MCW_grapher::parent, GRA_cbs::reason, REDISPLAY_OPTIONAL, REDISPLAY_OVERLAY, AFNI_fimmer_type::refadd_count, SINGLE_MODE, STATUS, MCW_grapher::status, TEMP_IVEC3, THD_fdind_to_3dind(), AFNI_imaging_widgets::time_index_av, AFNI_view_info::time_on, AFNI_library_type::timeseries, GRA_cbs::userdata, Three_D_View::vinfo, Three_D_View::vwid, GRA_cbs::xcen, GRA_cbs::ycen, and GRA_cbs::zcen. Referenced by AFNI_brick_to_mri().
03455 {
03456 Three_D_View *im3d = (Three_D_View *)grapher->parent ;
03457
03458 ENTRY("AFNI_gra_send_CB") ;
03459
03460 if(PRINT_TRACING)
03461 { char str[256] ; sprintf(str,"reason=%d",cbs->reason) ; STATUS(str) ; }
03462
03463 if( ! IM3D_VALID(im3d) ||
03464 (im3d->ignore_seq_callbacks==AFNI_IGNORE_EVERYTHING) ) EXRETURN ;
03465
03466 switch( cbs->reason ){
03467
03468 default: break ; /* unimplemented reasons */
03469
03470 /*** Death ***/
03471
03472 case graCR_destroy:{
03473 MCW_grapher * gxyz = im3d->g123 ,
03474 * gyzx = im3d->g231 ,
03475 * gzxy = im3d->g312 ;
03476 MCW_imseq * seq = GRAPHER_TO_VIEWER(im3d,grapher) ;
03477 Widget w ;
03478
03479 if( grapher == gxyz ){
03480 w = im3d->vwid->imag->graph_xyz_pb ; im3d->g123 = NULL ;
03481 STATUS("destruction of g123") ;
03482 }
03483 else if( grapher == gyzx ){
03484 w = im3d->vwid->imag->graph_yzx_pb ; im3d->g231 = NULL ;
03485 STATUS("destruction of g231") ;
03486 }
03487 else if( grapher == gzxy ){
03488 w = im3d->vwid->imag->graph_zxy_pb ; im3d->g312 = NULL ;
03489 STATUS("destruction of g312") ;
03490 }
03491 else
03492 EXRETURN ; /* something goofy happened? */
03493
03494 myXtFree( grapher->status ) ; /* 08 Mar 1999: via mcw_malloc.c */
03495 myXtFree( grapher ) ; /* free the data space */
03496 MCW_invert_widget(w) ; /* back to normal */
03497 NORMAL_cursorize(w) ; /* 20 Jul 2005 */
03498
03499 /* redisplay the crosshairs, if needed */
03500
03501 if( seq != NULL && im3d->vinfo->crosshair_visible==True &&
03502 im3d->ignore_seq_callbacks == AFNI_IGNORE_NOTHING )
03503
03504 drive_MCW_imseq( seq , isqDR_overlay , (XtPointer) -1 ) ;
03505 }
03506 MPROBE ;
03507 break ; /* end of destroy */
03508
03509 /*** User sets new location ***/
03510
03511 case graCR_newxyzm:{
03512 THD_ivec3 id ;
03513
03514 if( cbs->xcen >= 0 && cbs->xcen < br->n1 &&
03515 cbs->ycen >= 0 && cbs->ycen < br->n2 &&
03516 cbs->zcen >= 0 && cbs->zcen < br->n3 ){
03517
03518 id = THD_fdind_to_3dind(
03519 br , TEMP_IVEC3(cbs->xcen,cbs->ycen,cbs->zcen) );
03520
03521 if(PRINT_TRACING)
03522 { char str[256] ;
03523 sprintf(str," 3D dataset coordinates %d %d %d",
03524 id.ijk[0],id.ijk[1],id.ijk[2] ) ; STATUS(str) ; }
03525
03526 if( im3d->ignore_seq_callbacks == AFNI_IGNORE_NOTHING ){
03527 AFNI_view_setter(im3d,NULL) ;
03528 AFNI_set_viewpoint(
03529 im3d ,
03530 id.ijk[0] , id.ijk[1] , id.ijk[2] ,
03531 (im3d->vinfo->crosshair_visible==True) ?
03532 REDISPLAY_OVERLAY : REDISPLAY_OPTIONAL ) ;
03533 }
03534 }
03535 }
03536 break ; /* end of newxyzm */
03537
03538 /*** User asks for a reference function ***/
03539
03540 case graCR_pickref:{
03541
03542 STATUS("graCR_pickref") ;
03543
03544 if( IMARR_COUNT(GLOBAL_library.timeseries) > 0 ){
03545 int init_ts = AFNI_ts_in_library( im3d->fimdata->fimref ) ;
03546
03547 MCW_choose_timeseries( grapher->fdw_graph , "FIM Reference Vector" ,
03548 GLOBAL_library.timeseries , init_ts ,
03549 AFNI_fimmer_pickref_CB , (XtPointer) im3d ) ;
03550 } else {
03551 (void) MCW_popup_message(
03552 grapher->option_rowcol ,
03553 "No timeseries library\nexists to pick from!" ,
03554 MCW_USER_KILL | MCW_TIMER_KILL ) ;
03555 }
03556 }
03557 break ; /* end of pickref */
03558
03559 /*** User asks for an ort function ***/
03560
03561 case graCR_pickort:{
03562
03563 STATUS("graCR_pickort") ;
03564
03565 if( IMARR_COUNT(GLOBAL_library.timeseries) > 0 ){
03566 int init_ts = AFNI_ts_in_library( im3d->fimdata->fimort ) ;
03567
03568 MCW_choose_timeseries( grapher->fdw_graph , "FIM Ort Vector" ,
03569 GLOBAL_library.timeseries , init_ts ,
03570 AFNI_fimmer_pickort_CB , (XtPointer) im3d ) ;
03571 } else {
03572 (void) MCW_popup_message(
03573 grapher->option_rowcol ,
03574 "No timeseries library\nexists to pick from!" ,
03575 MCW_USER_KILL | MCW_TIMER_KILL ) ;
03576 }
03577 }
03578 break ; /* end of pickort */
03579
03580
03581 /*** User asks to clear FIM ***/
03582
03583 case graCR_clearfim:{
03584 AFNI_fimmer_setref( im3d , NULL ) ;
03585 im3d->fimdata->refadd_count = 0 ;
03586 }
03587 break ; /* end of clearfim */
03588
03589 /*** User asks to clear Ort ***/
03590
03591 case graCR_clearort:{
03592 AFNI_fimmer_setort( im3d , NULL ) ;
03593 }
03594 break ; /* end of clearfim */
03595
03596 /*** 27 Jan 2004:
03597 User toggled WinAver on in one graph window,
03598 so we toggle it off in the other windows. ***/
03599
03600 case graCR_winaver:{
03601 if( im3d->g123 != NULL && im3d->g123 != grapher )
03602 drive_MCW_grapher( im3d->g123 , graDR_winaver , 0 ) ;
03603 if( im3d->g231 != NULL && im3d->g231 != grapher )
03604 drive_MCW_grapher( im3d->g231 , graDR_winaver , 0 ) ;
03605 if( im3d->g312 != NULL && im3d->g312 != grapher )
03606 drive_MCW_grapher( im3d->g312 , graDR_winaver , 0 ) ;
03607 }
03608 break ; /* end of winaver */
03609
03610 /*** 12 Nov 1996:
03611 User supplies a timeseries to add to the global library ***/
03612
03613 case graCR_timeseries_library:{
03614 MRI_IMAGE * tsim = (MRI_IMAGE *) cbs->userdata ;
03615
03616 AFNI_add_timeseries( tsim ) ;
03617 }
03618 break ; /* end of timeseries_library */
03619
03620 /*** User supplies a timeseries for FIM (equals or add) ***/
03621
03622 case graCR_refadd:
03623 case graCR_refequals:{
03624 MRI_IMAGE * tsim = (MRI_IMAGE *) cbs->userdata ;
03625 MRI_IMAGE * qim , * sim ;
03626 float * sar , * qar ;
03627
03628 if( tsim != NULL ){
03629 qim = mri_to_float( tsim ) ; /* make a copy of input */
03630 if( im3d->fimdata->fimref == NULL ||
03631 cbs->reason == graCR_refequals ||
03632 im3d->fimdata->refadd_count < 1 ){
03633
03634 /** equals **/
03635
03636 AFNI_fimmer_setref( im3d , qim ) ;
03637 im3d->fimdata->refadd_count = 1 ;
03638
03639 } else {
03640 int jj,ii , nxs , nyy , nxq , nxx , npix ;
03641 float fs , fq ;
03642
03643 /** average **/
03644
03645 sim = mri_to_float( im3d->fimdata->fimref ) ; /* add into this copy */
03646 sar = MRI_FLOAT_PTR(sim) ;
03647 qar = MRI_FLOAT_PTR(qim) ;
03648 nxs = sim->nx ; nxq = qim->nx ; nxx = MIN(nxs,nxq) ;
03649 nyy = MIN( sim->ny , qim->ny ) ;
03650 npix = MIN( sim->nvox , qim->nvox ) ;
03651
03652 fq = 1.0/( im3d->fimdata->refadd_count + 1.0 ) ;
03653 fs = 1.0 - fq ;
03654
03655 for( jj=0 ; jj < nyy ; jj++ ){
03656 for( ii=0 ; ii < nxx ; ii++ ){
03657 if( sar[ii+jj*nxs] >= WAY_BIG || qar[ii+jj*nxq] >= WAY_BIG )
03658 sar[ii+jj*nxs] = WAY_BIG ;
03659 else
03660 sar[ii+jj*nxs] = fs * sar[ii+jj*nxs] + fq * qar[ii+jj*nxq] ;
03661 }
03662 }
03663 mri_free( qim ) ;
03664
03665 AFNI_fimmer_setref( im3d , sim ) ; /* since caller may free it later */
03666 im3d->fimdata->refadd_count++ ;
03667 }
03668 }
03669 }
03670 break ;
03671
03672 /*** User asks to smooth reference ***/
03673
03674 case graCR_refsmooth:{
03675 if( im3d->fimdata->fimref != NULL ){
03676 MRI_IMAGE * sim = mri_to_float(im3d->fimdata->fimref) ; /* copy */
03677 float * sar = MRI_FLOAT_PTR(sim) ;
03678 float aa,bb,cc ;
03679 int ii,jj , nx=sim->nx , ny=sim->ny ;
03680
03681 for( jj=0 ; jj < ny ; jj++ ){
03682 bb = sar[jj*nx] ; cc = sar[1+jj*nx] ;
03683 for( ii=1 ; ii < nx-1 ; ii++ ){
03684 aa = bb ; bb = cc ; cc = sar[ii+1+jj*nx] ;
03685 if( aa < WAY_BIG && bb < WAY_BIG &&
03686 cc < WAY_BIG && ii > im3d->fimdata->init_ignore )
03687 sar[ii+jj*nx] = OSFILT(aa,bb,cc) ;
03688 }
03689 }
03690 AFNI_fimmer_setref( im3d , sim ) ;
03691 }
03692 }
03693 break ;
03694
03695 /*** User asks to do fim! ***/
03696
03697 case graCR_dofim:{
03698 AFNI_fimmer_execute( im3d , cbs->key , cbs->mat ) ;
03699 }
03700 break ; /* end of dofim */
03701
03702 /*** User sets initial ignore count ***/
03703
03704 case graCR_setignore:{
03705 AFNI_fimmer_setignore( im3d , cbs->key ) ;
03706 }
03707 break ;
03708
03709 /*** User sets the polort order [27 May 1999] ***/
03710
03711 case graCR_polort:{
03712 AFNI_fimmer_setpolort( im3d , cbs->key ) ;
03713 }
03714 break ;
03715
03716 /*** User sets time_index (from graph) ***/
03717 /*** 24 Jan 2001: or bucket index ***/
03718 /*** 29 Jul 2003: time_index and anat_index are almost merged now ***/
03719
03720 case graCR_setindex:{
03721 MCW_arrowval *tav = im3d->vwid->imag->time_index_av ;
03722 MCW_arrowval *aav = im3d->vwid->func->anat_buck_av ;
03723 int new_index = cbs->key ;
03724
03725 if( new_index != im3d->vinfo->anat_index ){
03726 if( im3d->vinfo->time_on ){
03727 AV_assign_ival( tav , new_index ) ; /* set time_index */
03728 AFNI_time_index_CB( tav, (XtPointer) im3d ); /* will set anat_index */
03729 } else {
03730 AV_assign_ival( aav, new_index ) ; /* set anat index directly */
03731 AFNI_bucket_CB( aav, im3d ) ;
03732 }
03733 }
03734 }
03735 break ;
03736
03737 /*** Feb 1998: user clicked button2 ***/
03738
03739 case graCR_button2_points:{
03740 THD_ivec3 id ;
03741 int fixed_plane ;
03742
03743 if( cbs->xcen >= 0 && cbs->xcen < br->n1 &&
03744 cbs->ycen >= 0 && cbs->ycen < br->n2 &&
03745 cbs->zcen >= 0 && cbs->zcen < br->n3 ){
03746
03747 /* translate image to dataset coordinates */
03748
03749 id = THD_fdind_to_3dind(
03750 br , TEMP_IVEC3(cbs->xcen,cbs->ycen,cbs->zcen) );
03751
03752 /* send a single point */
03753
03754 fixed_plane = abs(br->a123.ijk[2]) ;
03755
03756 AFNI_process_drawing( im3d , SINGLE_MODE + fixed_plane ,
03757 1, &id.ijk[0], &id.ijk[1], &id.ijk[2] ) ;
03758 }
03759 }
03760 break ;
03761
03762 } /* end of switch on callback reasons */
03763
03764 EXRETURN ;
03765 }
|
|
|
16 July 1997: orientation code change * Definition at line 1021 of file afni.c. Referenced by main().
01021 { return ; }
|
|
||||||||||||||||
|
Definition at line 7888 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_controller_index(), AFNI_driver(), AFNI_jumpto_CB(), AFNI_jumpto_ijk_CB(), AFNI_misc_CB(), AFNI_mnito_CB(), AFNI_pop_whereami_kill(), AFNI_set_viewpoint(), AFNI_sumato_CB(), AFNI_talto_CB(), AFNI_ttatlas_query(), AFNI_view_setter(), AFNI_widget_set::butx, AFNI_widget_set::buty, CAN_TALTO, client_data, AFNI_library_type::cord, AFNI_widget_set::dmode, drive_MCW_imseq(), ENTRY, free, GLOBAL_library, AFNI_view_info::i1_old, IM3D_VALID, AFNI_widget_set::imag, ISQ_REALZ, isqDR_onoffwid, isqDR_togwid, AFNI_view_info::j2_old, AFNI_view_info::k3_old, malloc, MCW_choose_string(), MCW_choose_strlist(), MCW_register_help(), MCW_register_hint(), MCW_textwinkill_CB(), MCW_widget_geom(), AFNI_datamode_widgets::misc_environ_pb, name, new_MCW_textwin_2001(), NULLIFY_ON_DESTROY, THD_coorder::orcode, AFNI_imaging_widgets::pop_drawdataset_pb, AFNI_imaging_widgets::pop_environment_pb, AFNI_imaging_widgets::pop_imageonly_pb, AFNI_imaging_widgets::pop_jumpback_pb, AFNI_imaging_widgets::pop_jumpto_ijk_pb, AFNI_imaging_widgets::pop_jumpto_pb, AFNI_imaging_widgets::pop_mnito_pb, AFNI_imaging_widgets::pop_sumato_pb, AFNI_imaging_widgets::pop_talto_pb, AFNI_imaging_widgets::pop_ttren_pb, AFNI_imaging_widgets::pop_whereami_pb, AFNI_imaging_widgets::pop_whereami_twin, AFNI_imaging_widgets::popmenu, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, SAVE_VPT, SESSION_HAS_SUMA, Three_D_View::ss_now, TEXT_READONLY, AFNI_widget_set::top_shell, TTO_COUNT, TTO_current, TTO_FORMAT, TTO_labeled, TTO_labels, TTO_list, TTO_LMAX, TTRR_popup(), Three_D_View::type, VIEW_TALAIRACH_TYPE, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, MCW_imseq::wbar, MCW_textwin::wshell, and MCW_textwin::wtext.
07890 {
07891 Three_D_View *im3d = (Three_D_View *) client_data ;
07892 MCW_imseq *seq ;
07893
07894 ENTRY("AFNI_imag_pop_CB") ;
07895
07896 if( ! IM3D_VALID(im3d) ) EXRETURN ;
07897
07898 XtVaGetValues( im3d->vwid->imag->popmenu, XmNuserData, &seq, NULL ) ;
07899 AFNI_view_setter(im3d,seq) ;
07900
07901 /*-- jump back to old location --*/
07902
07903 if( w == im3d->vwid->imag->pop_jumpback_pb ){
07904 int ij,jj,kk ;
07905
07906 ij = im3d->vinfo->i1_old ; /* extract old place */
07907 jj = im3d->vinfo->j2_old ;
07908 kk = im3d->vinfo->k3_old ;
07909
07910 SAVE_VPT(im3d) ; /* save current place as old one */
07911 AFNI_set_viewpoint( im3d , ij,jj,kk , REDISPLAY_OVERLAY ) ; /* jump */
07912 }
07913
07914 /*-- switch window display mode --*/
07915
07916 else if( w == im3d->vwid->imag->pop_imageonly_pb ){
07917 if( ISQ_REALZ(seq) )
07918 drive_MCW_imseq( seq , isqDR_onoffwid , (XtPointer) isqDR_togwid ) ;
07919 }
07920
07921 /*-- jump to a point --*/
07922
07923 else if( w == im3d->vwid->imag->pop_jumpto_pb &&
07924 im3d->type == AFNI_3DDATA_VIEW ){
07925
07926 char tbuf[128] ;
07927
07928 if( ISQ_REALZ(seq) ){
07929 sprintf(tbuf , "Enter new x y z (%s mm):" , GLOBAL_library.cord.orcode ) ;
07930 MCW_choose_string( seq->wbar , tbuf , NULL ,
07931 AFNI_jumpto_CB , (XtPointer) im3d ) ;
07932 }
07933 }
07934
07935 else if( w == im3d->vwid->imag->pop_jumpto_ijk_pb &&
07936 im3d->type == AFNI_3DDATA_VIEW ){
07937
07938 if( ISQ_REALZ(seq) ){
07939 MCW_choose_string( seq->wbar , "Enter new i j k:" , NULL ,
07940 AFNI_jumpto_ijk_CB , (XtPointer) im3d ) ;
07941 }
07942 }
07943
07944 /*-- 01 May 2002: jump to MNI coordinates --*/
07945
07946 else if( w == im3d->vwid->imag->pop_mnito_pb &&
07947 im3d->type == AFNI_3DDATA_VIEW ){
07948
07949 if( ISQ_REALZ(seq) && CAN_TALTO(im3d) ){
07950 MCW_choose_string( seq->wbar , "Enter MNI x,y,z:" , NULL ,
07951 AFNI_mnito_CB , (XtPointer) im3d ) ;
07952 } else {
07953 XBell(XtDisplay(w),100) ; /* should never happen */
07954 }
07955 }
07956
07957 /*-- 06 Mar 2002: jump to a node in a surface --*/
07958
07959 else if( w == im3d->vwid->imag->pop_sumato_pb &&
07960 SESSION_HAS_SUMA(im3d->ss_now) &&
07961 im3d->type == AFNI_3DDATA_VIEW ){
07962
07963 if( ISQ_REALZ(seq) ){
07964 MCW_choose_string( seq->wbar , "Enter SUMA node ID:" , NULL ,
07965 AFNI_sumato_CB , (XtPointer) im3d ) ;
07966 }
07967 }
07968
07969 /*-- jump to a predetermined Talairach anatomical reference point --*/
07970
07971 else if( w == im3d->vwid->imag->pop_talto_pb &&
07972 im3d->type == AFNI_3DDATA_VIEW &&
07973 CAN_TALTO(im3d) ){
07974
07975 if( ! TTO_labeled ){ /* initialize labels */
07976 int ii ;
07977 for( ii=0 ; ii < TTO_COUNT ; ii++ ){
07978 TTO_labels[ii] = (char *) malloc( sizeof(char) * TTO_LMAX ) ;
07979 sprintf( TTO_labels[ii] , TTO_FORMAT , TTO_list[ii].name ,
07980 TTO_list[ii].xx , TTO_list[ii].yy , TTO_list[ii].zz ) ;
07981 }
07982 TTO_labeled = 1 ;
07983 }
07984 if( ISQ_REALZ(seq) ){
07985 MCW_choose_strlist( seq->wbar ,
07986 "Brain Structure (from San Antonio Talairach Daemon)" ,
07987 TTO_COUNT , TTO_current , TTO_labels ,
07988 AFNI_talto_CB , (XtPointer) im3d ) ;
07989 }
07990 }
07991
07992 /*---- 10 Jul 2001: Talairach "Where Am I?" ----*/
07993
07994 else if( w == im3d->vwid->imag->pop_whereami_pb &&
07995 w != NULL &&
07996 im3d->type == AFNI_3DDATA_VIEW &&
07997 CAN_TALTO(im3d) ){
07998
07999 char *tlab ;
08000
08001 /*- if one is already open, kill it -*/
08002
08003 if( im3d->vwid->imag->pop_whereami_twin != NULL ){
08004 MCW_textwinkill_CB(NULL,
08005 (XtPointer)im3d->vwid->imag->pop_whereami_twin,NULL);
08006 im3d->vwid->imag->pop_whereami_twin = NULL ;
08007 }
08008
08009 /*- get TT atlas location, if any -*/
08010
08011 tlab = AFNI_ttatlas_query( im3d ) ;
08012
08013 /*- open a window to show it -*/
08014
08015 if( tlab != NULL ){
08016
08017 im3d->vwid->imag->pop_whereami_twin =
08018 new_MCW_textwin_2001( seq->wbar , tlab , TEXT_READONLY ,
08019 AFNI_pop_whereami_kill , im3d ) ;
08020
08021 #if 0
08022 /* 31 Jul 2001: NULL out the pointer when the window is destroyed */
08023
08024 NULLIFY_ON_DESTROY( im3d->vwid->imag->pop_whereami_twin ,
08025 im3d->vwid->imag->pop_whereami_twin->wshell ) ;
08026 #endif
08027
08028 XtVaSetValues( im3d->vwid->imag->pop_whereami_twin->wtext ,
08029 XmNresizeHeight , True ,
08030 XmNresizeWidth , True ,
08031 NULL ) ;
08032
08033 MCW_register_hint( im3d->vwid->imag->pop_whereami_twin->wtext ,
08034 "Use BHelp for documentation" ) ;
08035
08036 MCW_register_help( im3d->vwid->imag->pop_whereami_twin->wtext ,
08037 "Lists the brain structures near the crosshair focus point\n"
08038 "according to the Talairach Daemon database (kindly provided\n"
08039 "by Jack Lancaster and Peter Fox of RIC UTHSCSA).\n"
08040 "\n"
08041 "The search is conducted outwards from the focus point, until\n"
08042 "9 different structures are found, or a 7 mm radius is reached,\n"
08043 "whichever occurs first. (Distances are rounded to nearest 1 mm,\n"
08044 "the grid spacing on which the database is constructed.) Labels\n"
08045 "reported on different output lines came from different voxels.\n"
08046 "\n"
08047 "In the database, some voxels have 2 labels - a larger scale\n"
08048 "'gyral' name and a finer scale 'area' name. Locations that\n"
08049 "are doubly labeled will appear with a listing like\n"
08050 " Within 2 mm: Right Precuneus -AND- Right Brodmann area 31\n"
08051 "In the database there are\n"
08052 " 1,205,737 voxels with at least one label\n"
08053 " 709,953 voxels with only a 'gyral' label\n"
08054 " 15,898 voxels with only a 'area' label\n"
08055 " 479,886 voxels with both types of labels\n"
08056 "A list of all the labels (of either type) is presented by the\n"
08057 "'Talairach to' control. In the database, there are\n"
08058 " 50 'gyral' labels (times 2 for Left and Right)\n"
08059 " 68 'area' labels\n"
08060 " 355 distinct combinations of labels\n"
08061 "Note Very Well:\n"
08062 "* This feature of AFNI is experimental, and is subject to change.\n"
08063 "* The Atlas is only useful as a ROUGH guide to determining where\n"
08064 " you are in any individual brain. Do not rely exclusively on\n"
08065 " the Atlas for brain region identification: you must use your\n"
08066 " knowledge, skills, and abilities as well.\n"
08067 "* Do NOT use this feature for surgical or therapeutic planning!!!"
08068 ) ;
08069
08070 free(tlab) ;
08071 }
08072 }
08073
08074 /*---- 12 Jul 2001 ----*/
08075
08076 else if( w == im3d->vwid->imag->pop_ttren_pb &&
08077 w != NULL &&
08078 im3d->type == AFNI_3DDATA_VIEW &&
08079 im3d->vinfo->view_type == VIEW_TALAIRACH_TYPE && /* 01 Aug 2001 */
08080 CAN_TALTO(im3d) ){
08081
08082 TTRR_popup( im3d ) ;
08083 }
08084
08085 /*---- 05 Nov 2003: start the Edit Environment pseudo-plugin ----*/
08086
08087 else if( w == im3d->vwid->imag->pop_environment_pb &&
08088 w != NULL ){
08089
08090 AFNI_misc_CB( im3d->vwid->dmode->misc_environ_pb ,
08091 (XtPointer) im3d , (XtPointer) NULL ) ;
08092 }
08093
08094 /*---- 17 May 2005: open Draw Dataset plugin ----*/
08095
08096 else if( w == im3d->vwid->imag->pop_drawdataset_pb &&
08097 w != NULL ){
08098
08099 char cmd[128] , cc='A'+AFNI_controller_index(im3d) ;
08100 int xx,yy ;
08101
08102 #if 0
08103 MCW_widget_geom(im3d->vwid->top_shell,NULL,NULL,&xx,&yy); xx+=29; yy+=19;
08104 #else
08105 xx = im3d->vwid->butx ; yy = im3d->vwid->buty ;
08106 #endif
08107 sprintf(cmd,"OPEN_WINDOW %c.plugin.Draw_Dataset geom=+%d+%d",cc,xx,yy) ;
08108 (void) AFNI_driver(cmd) ;
08109 }
08110
08111 /*--- unmap of the popup itself [elided] ---*/
08112
08113 /*--- exit ---*/
08114
08115 RESET_AFNI_QUIT(im3d) ;
08116 EXRETURN ;
08117 }
|
|
||||||||||||||||||||
|
Definition at line 9154 of file afni.c. References ADDTO_KILL, THD_marker_set::aflags, AFNI_concatenate_warp(), AFNI_copy_statistics(), THD_3dim_dataset::anat_parent, THD_3dim_dataset::anat_parent_idcode, THD_3dim_dataset::anat_parent_name, ATLAS_BBOX_ANT, ATLAS_BBOX_INF, ATLAS_BBOX_INF_NEW, ATLAS_BBOX_LAT, ATLAS_BBOX_POS, ATLAS_BBOX_SUP, THD_datablock::atr, base, THD_linear_mapping::bot, THD_datablock::brick, THD_datablock::brick_bytes, THD_datablock::brick_fac, THD_linear_mapping::bvec, THD_diskptr::byte_order, DATABLOCK_MEM_UNDEFINED, DATABLOCK_TYPE, DATAXES_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_unlock, DUMP_FVEC3, DUMP_LMAP, DUMP_T12_WARP, EMPTY_STRING, ENTRY, FIRST_WARP_TYPE, THD_3dim_dataset::func_type, HEAD_ANAT_TYPE, THD_marker_set::help, THD_3dim_dataset::idcode, THD_ivec3::ijk, INIT_KILL, INIT_STAT_AUX, THD_3dim_dataset::kl, THD_datablock::kl, THD_marker_set::label, THD_3dim_dataset::label1, THD_3dim_dataset::label2, LAST_WARP_TYPE, LOAD_DIAG_MAT, LOAD_FVEC3, THD_datablock::malloc_type, THD_3dim_dataset::markers, AFNI_widget_set::marks, MARKS_MAXFLAG, MARKS_MAXHELP, MARKS_MAXLAB, MARKS_MAXNUM, THD_datablock::master_bytes, THD_datablock::master_ival, THD_datablock::master_nvals, MATVEC_SUB, MAX_FVEC3, MAX_STAT_AUX, MCW_new_idcode, MCW_strncpy, MCW_val_bbox(), THD_linear_mapping::mfor, MIN_FVEC3, myXtNew, THD_datablock::natr, THD_datablock::natr_alloc, NMARK_BOUNDING, THD_marker_set::numdef, THD_marker_set::numset, THD_diskptr::nvals, THD_datablock::nvals, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, ORI_A2P_TYPE, ORI_I2S_TYPE, ORI_R2L_TYPE, THD_marker_set::ovcolor, THD_datablock::parent, THD_dataxes::parent, THD_3dim_dataset::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_3dmm_to_dicomm(), THD_copy_datablock_auxdata(), THD_get_write_order(), THD_init_datablock_brick(), THD_init_diskptr_names(), THD_MAX_LABEL, THD_MAX_NAME, THD_null_datablock_auxdata, AFNI_marks_widgets::tlrc_big_bbox, THD_dataxes::to_dicomm, THD_linear_mapping::top, THD_warp::type, THD_3dim_dataset::type, THD_diskptr::type, THD_datablock::type, THD_dataxes::type, THD_marker_set::type, THD_marker_set::valid, VIEW_ACPCALIGNED_TYPE, THD_3dim_dataset::view_type, THD_3dim_dataset::vox_warp, Three_D_View::vwid, THD_3dim_dataset::warp, THD_affine_warp::warp, WARP_AFFINE_TYPE, THD_3dim_dataset::warp_parent, THD_3dim_dataset::warp_parent_idcode, THD_3dim_dataset::warp_parent_name, WARP_TALAIRACH_12_TYPE, WARPED_VIEW, THD_3dim_dataset::wod_daxes, THD_3dim_dataset::wod_flag, THD_dataxes::xxdel, THD_dataxes::xxmax, THD_dataxes::xxmin, THD_dataxes::xxorg, THD_dataxes::xxorient, THD_fvec3::xyz, THD_marker_set::xyz, THD_dataxes::yydel, THD_dataxes::yymax, THD_dataxes::yymin, THD_dataxes::yyorg, THD_dataxes::yyorient, ZERO_IDCODE, THD_dataxes::zzdel, THD_dataxes::zzmax, THD_dataxes::zzmin, THD_dataxes::zzorg, and THD_dataxes::zzorient. Referenced by AFNI_marks_transform_CB().
09157 {
09158 THD_3dim_dataset * adam_dset ; /* the farthest ancestor */
09159 THD_warp * warp_total ; /* the warp from that ancestor */
09160 THD_fvec3 xnew_bot , xnew_top ;
09161
09162 THD_3dim_dataset * new_dset ;
09163 THD_datablock * new_dblk , * adam_dblk , * parent_dblk ;
09164 THD_dataxes * new_daxes , * adam_daxes , * parent_daxes ;
09165 THD_diskptr * new_dkptr , * adam_dkptr , * parent_dkptr ;
09166 THD_marker_set * new_markers ;
09167
09168 int new_nx , new_ny , new_nz , ii ;
09169 THD_ivec3 ivbot , ivtop ;
09170
09171 ENTRY("AFNI_init_warp") ;
09172
09173 /*----- It is possible that this warp is one in a succession
09174 of warps. In that case, the actual transformation is
09175 to be done directly from the "adam" dataset, rather
09176 than in succession from the parent. The reason for
09177 this is to avoid repeated interpolation. Thus, we
09178 first scan backward along the line of descent, and
09179 create the total warp from "adam" to the new dataset -----*/
09180
09181 adam_dset = parent_dset ;
09182 warp_total = myXtNew( THD_warp ) ; /* copy initial warp into final warp */
09183 *warp_total = *warp_init ;
09184
09185 while( adam_dset->warp != NULL ){
09186 AFNI_concatenate_warp( warp_total , adam_dset->warp ) ;
09187 adam_dset = adam_dset->warp_parent ;
09188 }
09189
09190 if( warp_total->type < FIRST_WARP_TYPE ||
09191 warp_total->type > LAST_WARP_TYPE ) RETURN(NULL) ; /* error! */
09192
09193 #ifdef AFNI_DEBUG
09194 { char str[256] ;
09195 sprintf(str,"parent = %s ; adam = %s",
09196 parent_dset->self_name , adam_dset->self_name ) ;
09197 STATUS(str) ;
09198
09199 STATUS("warp_total dump:") ;
09200 if( warp_total->type == WARP_AFFINE_TYPE ){
09201 DUMP_LMAP(warp_total->rig_bod.warp) ;
09202 } else {
09203 DUMP_T12_WARP(warp_total->tal_12) ;
09204 }
09205 }
09206 #endif
09207
09208 adam_dblk = adam_dset->dblk ;
09209 adam_daxes = adam_dset->daxes ;
09210 adam_dkptr = adam_dblk->diskptr ;
09211
09212 parent_dblk = parent_dset->dblk ;
09213 parent_daxes = parent_dset->daxes ;
09214 parent_dkptr = parent_dblk->diskptr ;
09215
09216 /*----- We now determine the bounding box of the new dataset.
09217 This depends on the warp type:
09218 affine warps --> use transformed bounding box of adam;
09219 Talairach warp --> use Talairach standard geometry;
09220 The results are in the vectors xnew_bot and xnew_top. -----*/
09221
09222 switch( warp_total->type ){
09223
09224 default: RETURN(NULL) ; /* something bad happened */
09225
09226 /*--- 12 case Talairach mapping
09227 (sizes chosen to include borders of Atlas figures) ---*/
09228
09229 case WARP_TALAIRACH_12_TYPE:{
09230 int use_tlrc_big=MCW_val_bbox( im3d->vwid->marks->tlrc_big_bbox ) ;
09231 float xtop=ATLAS_BBOX_LAT ,
09232 ybot=ATLAS_BBOX_ANT ,
09233 ytop=ATLAS_BBOX_POS ,
09234 zbot=(use_tlrc_big) ? ATLAS_BBOX_INF_NEW : ATLAS_BBOX_INF ,
09235 ztop=ATLAS_BBOX_SUP ;
09236
09237 #define GETVAL(vvv,nnn) do{ char *eee = getenv(nnn) ; \
09238 if( eee != NULL ){ \
09239 float val=strtod(eee,NULL); if(val>0.0) vvv = val; \
09240 } } while(0)
09241
09242 GETVAL(xtop,"AFNI_TLRC_BBOX_LAT") ; /* 16 Apr 2002: get new bounding box */
09243 GETVAL(ybot,"AFNI_TLRC_BBOX_ANT") ; /* from environment variables, maybe */
09244 GETVAL(ytop,"AFNI_TLRC_BBOX_POS") ;
09245 GETVAL(zbot,"AFNI_TLRC_BBOX_INF") ;
09246 GETVAL(ztop,"AFNI_TLRC_BBOX_SUP") ;
09247
09248 #undef GETVAL
09249
09250 LOAD_FVEC3( xnew_bot ,-xtop,-ybot,-zbot ) ;
09251 LOAD_FVEC3( xnew_top , xtop, ytop, ztop ) ;
09252 }
09253 break ;
09254
09255 /*--- linear warp ---*/
09256
09257 case WARP_AFFINE_TYPE:{
09258 THD_fvec3 corner , base , xnew , aff_bot , aff_top ;
09259 THD_mat33 to_new ;
09260
09261 to_new = warp_total->rig_bod.warp.mfor ;
09262 base = warp_total->rig_bod.warp.bvec ;
09263
09264 /*--- transform each of the 8 corner locations in
09265 the adam dataset to the aligned system, and
09266 determine the outer limits of the new datablock ---*/
09267
09268 LOAD_FVEC3(corner,adam_daxes->xxmin,
09269 adam_daxes->yymin,adam_daxes->zzmin) ; /* 1 */
09270 corner = THD_3dmm_to_dicomm( adam_dset , corner ) ;
09271 xnew_bot = xnew_top = MATVEC_SUB(to_new,corner,base) ;
09272
09273 LOAD_FVEC3(corner,adam_daxes->xxmax,
09274 adam_daxes->yymin,adam_daxes->zzmin) ; /* 2 */
09275 corner = THD_3dmm_to_dicomm( adam_dset , corner ) ;
09276 xnew = MATVEC_SUB(to_new,corner,base) ;
09277 xnew_bot = MIN_FVEC3(xnew_bot,xnew) ;
09278 xnew_top = MAX_FVEC3(xnew_top ,xnew ) ;
09279
09280 LOAD_FVEC3(corner,adam_daxes->xxmin,
09281 adam_daxes->yymax,adam_daxes->zzmin) ; /* 3 */
09282 corner = THD_3dmm_to_dicomm( adam_dset , corner ) ;
09283 xnew = MATVEC_SUB(to_new,corner,base) ;
09284 xnew_bot = MIN_FVEC3(xnew_bot,xnew) ;
09285 xnew_top = MAX_FVEC3(xnew_top ,xnew ) ;
09286
09287 LOAD_FVEC3(corner,adam_daxes->xxmax,
09288 adam_daxes->yymax,adam_daxes->zzmin) ; /* 4 */
09289 corner = THD_3dmm_to_dicomm( adam_dset , corner ) ;
09290 xnew = MATVEC_SUB(to_new,corner,base) ;
09291 xnew_bot = MIN_FVEC3(xnew_bot,xnew) ;
09292 xnew_top = MAX_FVEC3(xnew_top ,xnew ) ;
09293
09294 LOAD_FVEC3(corner,adam_daxes->xxmin,
09295 adam_daxes->yymin,adam_daxes->zzmax) ; /* 5 */
09296 corner = THD_3dmm_to_dicomm( adam_dset , corner ) ;
09297 xnew = MATVEC_SUB(to_new,corner,base) ;
09298 xnew_bot = MIN_FVEC3(xnew_bot,xnew) ;
09299 xnew_top = MAX_FVEC3(xnew_top ,xnew ) ;
09300
09301 LOAD_FVEC3(corner,adam_daxes->xxmax,
09302 adam_daxes->yymin,adam_daxes->zzmax) ; /* 6 */
09303 corner = THD_3dmm_to_dicomm( adam_dset , corner ) ;
09304 xnew = MATVEC_SUB(to_new,corner,base) ;
09305 xnew_bot = MIN_FVEC3(xnew_bot,xnew) ;
09306 xnew_top = MAX_FVEC3(xnew_top ,xnew ) ;
09307
09308 LOAD_FVEC3(corner,adam_daxes->xxmin,
09309 adam_daxes->yymax,adam_daxes->zzmax) ; /* 7 */
09310 corner = THD_3dmm_to_dicomm( adam_dset , corner ) ;
09311 xnew = MATVEC_SUB(to_new,corner,base) ;
09312 xnew_bot = MIN_FVEC3(xnew_bot,xnew) ;
09313 xnew_top = MAX_FVEC3(xnew_top ,xnew ) ;
09314
09315 LOAD_FVEC3(corner,adam_daxes->xxmax,
09316 adam_daxes->yymax,adam_daxes->zzmax) ; /* 8 */
09317 corner = THD_3dmm_to_dicomm( adam_dset , corner ) ;
09318 xnew = MATVEC_SUB(to_new,corner,base) ;
09319 xnew_bot = MIN_FVEC3(xnew_bot,xnew) ;
09320 xnew_top = MAX_FVEC3(xnew_top ,xnew ) ;
09321
09322 /* If the warp had any data in it about
09323 the region to map to, apply that data. */
09324
09325 aff_bot = warp_total->rig_bod.warp.bot ;
09326 aff_top = warp_total->rig_bod.warp.top ;
09327
09328 if( (aff_bot.xyz[0] < aff_top.xyz[0]) &&
09329 (aff_bot.xyz[1] < aff_top.xyz[1]) &&
09330 (aff_bot.xyz[2] < aff_top.xyz[2]) ){
09331
09332 /* 3/25/95: use the bot & top INSTEAD of the corners
09333 (old version used in ADDITION to corners) */
09334
09335 #if 0
09336 xnew_bot = MIN_FVEC3(xnew_bot,aff_bot) ;
09337 xnew_top = MAX_FVEC3(xnew_top,aff_top) ;
09338 #else
09339 xnew_bot = aff_bot ;
09340 xnew_top = aff_top ;
09341 #endif
09342 }
09343
09344 } /* end of affine warp case */
09345 break ;
09346
09347 } /* end of xnew_bot & xnew_top computed from warp */
09348
09349 /* force bounds to be integral multiples of resampling size */
09350
09351 #define FLOOR(qq) ( ((qq) >= 0) ? ((int)(qq)) : (-1+(int)(qq)) )
09352
09353 ivbot.ijk[0] = FLOOR( 0.01 + xnew_bot.xyz[0] / resam_vox ) ;
09354 ivbot.ijk[1] = FLOOR( 0.01 + xnew_bot.xyz[1] / resam_vox ) ;
09355 ivbot.ijk[2] = FLOOR( 0.01 + xnew_bot.xyz[2] / resam_vox ) ;
09356
09357 ivtop.ijk[0] = FLOOR( 0.99 + xnew_top.xyz[0] / resam_vox ) ;
09358 ivtop.ijk[1] = FLOOR( 0.99 + xnew_top.xyz[1] / resam_vox ) ;
09359 ivtop.ijk[2] = FLOOR( 0.99 + xnew_top.xyz[2] / resam_vox ) ;
09360
09361 #undef FLOOR
09362
09363 xnew_bot.xyz[0] = ivbot.ijk[0] * resam_vox ;
09364 xnew_bot.xyz[1] = ivbot.ijk[1] * resam_vox ;
09365 xnew_bot.xyz[2] = ivbot.ijk[2] * resam_vox ;
09366
09367 xnew_top.xyz[0] = ivtop.ijk[0] * resam_vox ;
09368 xnew_top.xyz[1] = ivtop.ijk[1] * resam_vox ;
09369 xnew_top.xyz[2] = ivtop.ijk[2] * resam_vox ;
09370
09371 /* compute dimensions of the new brick */
09372
09373 new_nx = (xnew_top.xyz[0] - xnew_bot.xyz[0])/resam_vox + 1.5 ;
09374 new_ny = (xnew_top.xyz[1] - xnew_bot.xyz[1])/resam_vox + 1.5 ;
09375 new_nz = (xnew_top.xyz[2] - xnew_bot.xyz[2])/resam_vox + 1.5 ;
09376
09377 xnew_top.xyz[0] = xnew_bot.xyz[0] + (new_nx-1) * resam_vox ;
09378 xnew_top.xyz[1] = xnew_bot.xyz[1] + (new_ny-1) * resam_vox ;
09379 xnew_top.xyz[2] = xnew_bot.xyz[2] + (new_nz-1) * resam_vox ;
09380
09381 #ifdef AFNI_DEBUG
09382 DUMP_FVEC3(" -- xnew_bot",xnew_bot) ;
09383 DUMP_FVEC3(" -- xnew_top",xnew_top) ;
09384 printf(" ==> new nx=%d ny=%d nz=%d\n",new_nx,new_ny,new_nz) ;
09385 #endif
09386
09387 /*----- make a new 3D dataset !!! -----*/
09388
09389 new_dset = myXtNew( THD_3dim_dataset ) ;
09390 new_dblk = new_dset->dblk = myXtNew( THD_datablock ) ;
09391 new_daxes = new_dset->daxes = myXtNew( THD_dataxes ) ;
09392 new_markers = new_dset->markers = NULL ; /* later, dude */
09393 new_dkptr = new_dblk->diskptr = myXtNew( THD_diskptr ) ;
09394
09395 INIT_KILL(new_dset->kl) ; INIT_KILL(new_dblk->kl) ;
09396
09397 ADDTO_KILL(new_dset->kl,new_dblk) ;
09398 ADDTO_KILL(new_dset->kl,new_daxes) ;
09399 ADDTO_KILL(new_dset->kl,new_dkptr) ;
09400
09401 ADDTO_KILL(new_dset->kl,warp_total) ;
09402
09403 new_dset->wod_daxes = NULL ;
09404 new_dset->wod_flag = True ;
09405
09406 new_dset->taxis = NULL ;
09407 new_dset->tagset = NULL ; /* Oct 1998 */
09408
09409 INIT_STAT_AUX( new_dset , MAX_STAT_AUX , parent_dset->stat_aux ) ;
09410
09411 #define PARENT_MYSELF /* 14 Dec 1999 */
09412
09413 new_dset->idcode = MCW_new_idcode() ;
09414 new_dset->warp_parent_idcode = adam_dset->idcode ;
09415 #ifndef PARENT_MYSELF
09416 ZERO_IDCODE(new_dset->anat_parent_idcode) ;
09417 new_dset->anat_parent = NULL ;
09418 #else
09419 new_dset->anat_parent_idcode = new_dset->idcode ; /* 14 Dec 1999 */
09420 new_dset->anat_parent = new_dset ; /* 14 Dec 1999 */
09421 #endif
09422
09423 EMPTY_STRING(new_dset->anat_parent_name) ;
09424
09425 /*------------ initialize dataset fields -------------*/
09426 /**** July 1997: be careful about adam and parent ****/
09427
09428 STATUS("init new_dset") ;
09429
09430 new_dset->type = parent_dset->type; /* data types */
09431 new_dset->func_type = parent_dset->func_type;
09432 new_dset->view_type = WARPED_VIEW(parent_dset->view_type) ; /* view type */
09433
09434 new_dset->warp = warp_total ; /* warp info */
09435 new_dset->vox_warp = NULL ;
09436 new_dset->self_warp = NULL ; /* 26 Aug 2002 */
09437
09438 new_dset->warp_parent = adam_dset ;
09439 MCW_strncpy( new_dset->warp_parent_name ,
09440 adam_dset->self_name , THD_MAX_NAME ) ;
09441
09442 MCW_strncpy( new_dset->label1 , parent_dset->label1 , THD_MAX_LABEL ) ;
09443 MCW_strncpy( new_dset->label2 , parent_dset->label2 , THD_MAX_LABEL ) ;
09444
09445 MCW_strncpy( new_dset->self_name ,
09446 parent_dset->self_name , THD_MAX_NAME ) ; /* make up */
09447 ii = strlen( new_dset->self_name ) ; /* a new name */
09448 new_dset->self_name[ii++] = '+' ;
09449 MCW_strncpy( &(new_dset->self_name[ii]) ,
09450 VIEW_typestr[new_dset->view_type] ,
09451 THD_MAX_NAME-ii ) ;
09452
09453 new_dset->death_mark = 0 ;
09454 new_dset->tcat_list = 0 ;
09455 new_dset->tcat_num = 0 ;
09456 new_dset->tcat_len = NULL ;
09457
09458 /*--- initialize disk pointer fields ---*/
09459
09460 STATUS("init new_dkptr") ;
09461
09462 new_dkptr->type = DISKPTR_TYPE ;
09463 new_dkptr->rank = 3 ;
09464 new_dkptr->nvals = adam_dkptr->nvals ;
09465 new_dkptr->dimsizes[0] = new_nx ;
09466 new_dkptr->dimsizes[1] = new_ny ;
09467 new_dkptr->dimsizes[2] = new_nz ;
09468 new_dkptr->storage_mode = STORAGE_UNDEFINED ;
09469 new_dkptr->byte_order = THD_get_write_order() ; /* 25 April 1998 */
09470
09471 THD_init_diskptr_names( new_dkptr ,
09472 parent_dkptr->directory_name, NULL, parent_dkptr->prefix ,
09473 new_dset->view_type , True ) ;
09474
09475 /*--- initialize datablock fields ---*/
09476
09477 STATUS("init new_dblk") ;
09478
09479 new_dblk->type = DATABLOCK_TYPE ;
09480 new_dblk->nvals = adam_dblk->nvals ;
09481 new_dblk->malloc_type = DATABLOCK_MEM_UNDEFINED ;
09482 new_dblk->natr = new_dblk->natr_alloc = 0 ;
09483 new_dblk->atr = NULL ;
09484 new_dblk->parent = (XtPointer) new_dset ;
09485
09486 new_dblk->brick_fac = NULL ; /* THD_init_datablock_brick */
09487 new_dblk->brick_bytes = NULL ; /* will initialize these arrays */
09488 new_dblk->brick = NULL ;
09489 THD_init_datablock_brick( new_dblk , -1 , adam_dblk ) ;
09490
09491 new_dblk->master_nvals = 0 ; /* 11 Jan 1999 */
09492 new_dblk->master_ival = NULL ;
09493 new_dblk->master_bytes = NULL ;
09494
09495 DSET_unlock(new_dset) ;
09496
09497 THD_null_datablock_auxdata( new_dblk ) ;
09498 THD_copy_datablock_auxdata( adam_dblk , new_dblk ) ; /* 30 Nov 1997 */
09499
09500 /*--- initialize data axes fields ---*/
09501
09502 STATUS("init new_daxes") ;
09503
09504 new_daxes->type = DATAXES_TYPE ;
09505 new_daxes->nxx = new_nx ;
09506 new_daxes->nyy = new_ny ;
09507 new_daxes->nzz = new_nz ;
09508 new_daxes->xxorg = xnew_bot.xyz[0] ;
09509 new_daxes->yyorg = xnew_bot.xyz[1] ;
09510 new_daxes->zzorg = xnew_bot.xyz[2] ;
09511 new_daxes->xxdel = resam_vox ; /* cubical voxels */
09512 new_daxes->yydel = resam_vox ;
09513 new_daxes->zzdel = resam_vox ;
09514 new_daxes->xxmin = xnew_bot.xyz[0] ; /* save new bounding box */
09515 new_daxes->yymin = xnew_bot.xyz[1] ;
09516 new_daxes->zzmin = xnew_bot.xyz[2] ;
09517 new_daxes->xxmax = xnew_top.xyz[0] ;
09518 new_daxes->yymax = xnew_top.xyz[1] ;
09519 new_daxes->zzmax = xnew_top.xyz[2] ;
09520 new_daxes->parent = (XtPointer) new_dset ;
09521
09522 new_daxes->xxorient = ORI_R2L_TYPE ; /* Dicom standard axes! */
09523 new_daxes->yyorient = ORI_A2P_TYPE ;
09524 new_daxes->zzorient = ORI_I2S_TYPE ;
09525 LOAD_DIAG_MAT(new_daxes->to_dicomm,1,1,1) ; /* identity matrix */
09526
09527 /*--- if view type is appropriate, set new markers ---*/
09528
09529 switch( new_dset->view_type ){
09530
09531 default:
09532 STATUS("no new_markers") ;
09533 break ; /* no markers */
09534
09535 /*--- AC-PC aligned ==> can do the BOUNDING set of markers ---*/
09536
09537 case VIEW_ACPCALIGNED_TYPE:
09538 if( new_dset->type == HEAD_ANAT_TYPE ){
09539 int ii , jj ;
09540
09541 STATUS("init new_markers") ;
09542
09543 new_markers = new_dset->markers = myXtNew( THD_marker_set ) ;
09544 ADDTO_KILL(new_dset->kl,new_markers) ;
09545
09546 new_markers->numdef = NMARK_BOUNDING ;
09547 new_markers->numset = 0 ; /* null data out */
09548 for( ii=0 ; ii < MARKS_MAXNUM ; ii++ ){
09549
09550 new_markers->xyz[ii][0] =
09551 new_markers->xyz[ii][1] =
09552 new_markers->xyz[ii][2] = -99999999.99 ;
09553
09554 for( jj=0 ; jj < MARKS_MAXLAB ; jj++ )
09555 new_markers->label[ii][jj] = '\0' ;
09556
09557 for( jj=0 ; jj < MARKS_MAXHELP ; jj++ )
09558 new_markers->help[ii][jj] = '\0' ;
09559
09560 new_markers->valid[ii] = False ;
09561 new_markers->ovcolor[ii] = -1 ; /* not used yet */
09562 }
09563
09564 for( ii=0 ; ii < NMARK_BOUNDING ; ii++ ){ /* copy strings in */
09565 MCW_strncpy( &(new_markers->label[ii][0]) ,
09566 THD_bounding_label[ii] , MARKS_MAXLAB ) ;
09567 MCW_strncpy( &(new_markers->help[ii][0]) ,
09568 THD_bounding_help[ii] , MARKS_MAXHELP ) ;
09569 }
09570
09571 for( ii=0 ; ii < MARKS_MAXFLAG ; ii++ ) /* copy flags in */
09572 new_markers->aflags[ii] = THD_bounding_aflags[ii] ;
09573 new_markers->type = new_markers->aflags[0] ;
09574 }
09575 break ; /* end of BOUNDING markers */
09576
09577 } /* end of marker creation */
09578
09579 /*----- copy statistics, if any -----*/
09580
09581 new_dset->stats = NULL ;
09582 AFNI_copy_statistics( adam_dset , new_dset ) ;
09583
09584 #ifdef ALLOW_DATASET_VLIST
09585 new_dset->pts = NULL ;
09586 #endif
09587
09588 /*----- dataset ready for warping -----*/
09589
09590 PARENTIZE(new_dset,adam_dset->parent) ;
09591
09592 STATUS("initialization complete") ;
09593
09594 RETURN( new_dset ) ;
09595 }
|
|
||||||||||||
|
Definition at line 6546 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_marks_action_CB(), AFNI_purge_unused_dsets(), AFNI_set_viewpoint(), AFNI_setup_viewing(), AFNI_transform_vector(), AFNI_view_setter(), AFNI_marks_widgets::always_popup, Three_D_View::anat_dset, Three_D_View::anat_now, AFNI_view_info::anat_num, AF_options::auto_purge, THD_3dim_dataset::daxes, AFNI_viewing_widgets::define_marks_pb, DISABLE_LOCK, THD_session::dsset, Three_D_View::dummied, AFNI_marks_widgets::editable, AFNI_marks_widgets::edits_bbox, ENABLE_LOCK, ENTRY, Three_D_View::fim_dset, Three_D_View::fim_now, AFNI_marks_widgets::frame, AFNI_view_info::func_num, GLOBAL_argopt, GLOBAL_library, AFNI_library_type::have_dummy_dataset, THD_marker_set::help, AFNI_view_info::i1, THD_ivec3::ijk, IM3D_VALID, AFNI_marks_widgets::inverted, ISVALID_3DIM_DATASET, AFNI_view_info::j2, AFNI_view_info::k3, THD_marker_set::label, LAST_VIEW_TYPE, LOAD_ANAT_VIEW, LOAD_IVEC3, THD_3dim_dataset::markers, AFNI_widget_set::marks, MARKS_MAXHELP, MARKS_MAXNUM, MCW_invert_widget(), MCW_set_bbox(), MCW_set_widget_label(), MCW_strncpy, MCW_val_bbox(), AFNI_marks_widgets::num_always_popup, AFNI_marks_widgets::num_sometimes_popup, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, AFNI_marks_widgets::ov_visible, AFNI_marks_widgets::pop_clear_pb, AFNI_marks_widgets::pop_set_pb, AFNI_marks_widgets::poptog, REDISPLAY_ALL, SAVE_VPT, AFNI_viewing_widgets::see_marks_bbox, SENSITIZE, AFNI_view_info::sess_num, AFNI_marks_widgets::sometimes_popup, Three_D_View::ss_now, THD_sessionlist::ssar, AFNI_library_type::sslist, STATUS, AFNI_marks_widgets::tag_visible, TEMP_FVEC3, THD_3dmm_to_3dind(), THD_dicomm_to_3dmm(), AFNI_marks_widgets::tog, AFNI_marks_widgets::tog_help, Three_D_View::type, THD_marker_set::valid, AFNI_widget_set::view, AFNI_viewing_widgets::view_bbox, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, MCW_bbox::wbut, MCW_bbox::wrowcol, AFNI_view_info::xi, AFNI_view_info::yj, and AFNI_view_info::zk. Referenced by AFNI_drive_open_window(), AFNI_fimmer_redisplay(), AFNI_finalize_dataset_CB(), AFNI_finalize_read_Web_CB(), AFNI_rescan_session_OLD(), AFNI_switchview_CB(), MAIN_workprocess(), PLUTO_add_dset(), and RT_tell_afni_one().
06547 {
06548 int vvv , itog , lll , sss , aaa , fff , id ;
06549 THD_3dim_dataset * dset , * new_anat , * new_func ;
06550 THD_marker_set * markers ;
06551 AFNI_viewing_widgets * view ;
06552 AFNI_marks_widgets * marks ;
06553 THD_fvec3 fv ;
06554 THD_ivec3 iv ;
06555
06556 ENTRY("AFNI_initialize_view") ;
06557
06558 if( ! IM3D_VALID(im3d) ) EXRETURN ;
06559
06560 vvv = im3d->vinfo->view_type ; /* locations of new data to view */
06561 sss = im3d->vinfo->sess_num ;
06562 aaa = im3d->vinfo->anat_num ;
06563 fff = im3d->vinfo->func_num ;
06564
06565 if(PRINT_TRACING)
06566 { char str[256] ;
06567 sprintf(str,"view=%d session=%d anat=%d func=%d",vvv,sss,aaa,fff);
06568 STATUS(str) ; }
06569
06570 new_anat = GLOBAL_library.sslist->ssar[sss]->dsset[aaa][vvv] ;
06571 new_func = GLOBAL_library.sslist->ssar[sss]->dsset[fff][vvv] ;
06572
06573 /*----------------------------------------------*/
06574 /*--- if the old dataset has markers and the
06575 marker panel is open, shut it down now ---*/
06576
06577 if( old_anat != NULL && /** old_anat->markers != NULL && **/
06578 old_anat != new_anat && XtIsManaged(im3d->vwid->marks->frame) ){
06579
06580 AFNI_marks_action_CB( NULL, (XtPointer) im3d, NULL) ; /* "done" */
06581 }
06582
06583 if( GLOBAL_argopt.auto_purge == True ){ /* purge old datasets? */
06584
06585 STATUS("purging old datasets from memory (maybe)") ;
06586
06587 im3d->anat_now = new_anat ;
06588 im3d->fim_now = new_func ;
06589 AFNI_purge_unused_dsets() ;
06590 }
06591
06592 /*---------------------------------------------------------*/
06593 /* set the new datasets that we will deal with from now on */
06594
06595 for( id=0 ; id <= LAST_VIEW_TYPE ; id++ ){
06596 im3d->anat_dset[id] = GLOBAL_library.sslist->ssar[sss]->dsset[aaa][id] ;
06597 im3d->fim_dset[id] = GLOBAL_library.sslist->ssar[sss]->dsset[fff][id] ;
06598
06599 if( ISVALID_3DIM_DATASET(im3d->anat_dset[id]) )
06600 SENSITIZE( im3d->vwid->view->view_bbox->wbut[id], True ) ;
06601 else
06602 SENSITIZE( im3d->vwid->view->view_bbox->wbut[id], False) ;
06603 }
06604
06605 im3d->anat_now = im3d->anat_dset[vvv] ;
06606 im3d->fim_now = im3d->fim_dset[vvv] ;
06607 im3d->ss_now = GLOBAL_library.sslist->ssar[sss] ;
06608
06609 /*------------------------------------------------*/
06610 /*--- if markers are defined, then set them up ---*/
06611
06612 dset = im3d->anat_now ;
06613 markers = dset->markers ;
06614 view = im3d->vwid->view ;
06615 marks = im3d->vwid->marks ;
06616
06617 if( markers == NULL ){ /*--------- markers NOT defined ---------*/
06618
06619 STATUS("turning markers off") ;
06620
06621 /* turn controls off */
06622
06623 #if 0
06624 SENSITIZE( view->define_marks_pb , False ) ;
06625 SENSITIZE( view->see_marks_bbox->wrowcol , False ) ;
06626 #endif
06627
06628 marks->editable = False ;
06629
06630 vvv = MCW_val_bbox( view->see_marks_bbox ) ;
06631 marks->tag_visible = marks->ov_visible = (vvv) ? True : False ;
06632
06633 XtUnmanageChildren( marks->always_popup , marks->num_always_popup ) ;
06634 XtUnmanageChildren( marks->sometimes_popup , marks->num_sometimes_popup ) ;
06635
06636 } else { /*------------- markers ARE defined ----------------*/
06637
06638 STATUS("turning markers on") ;
06639
06640 /* turn controls on */
06641
06642 SENSITIZE( view->define_marks_pb , True ) ;
06643 SENSITIZE( view->see_marks_bbox->wrowcol , True ) ;
06644
06645 vvv = MCW_val_bbox( view->see_marks_bbox ) ;
06646 marks->tag_visible = marks->ov_visible = (vvv) ? True : False ;
06647
06648 marks->editable = False ;
06649 MCW_set_bbox( marks->edits_bbox , 0 ) ;
06650
06651 SENSITIZE( marks->pop_set_pb , marks->editable ) ;
06652 SENSITIZE( marks->pop_clear_pb , marks->editable ) ;
06653
06654 /* copy help into location where MCW_help will find it */
06655
06656 for( itog=0 ; itog < MARKS_MAXNUM ; itog++ ){
06657 MCW_strncpy( &(marks->tog_help[itog][0]) ,
06658 &(markers->help[itog][0]) , MARKS_MAXHELP ) ;
06659 }
06660
06661 /* copy the non-empty labels into the toggle labels,
06662 and make the toggle buttons active (panel AND popup) */
06663
06664 XtManageChildren( marks->always_popup ,
06665 marks->num_always_popup ) ;
06666
06667 for( itog=0 ; itog < MARKS_MAXNUM ; itog++ ){
06668 lll = strlen( &(markers->label[itog][0]) ) ;
06669
06670 if( lll == 0 ){
06671 XtUnmanageChild( marks->tog[itog] ) ; /* empty label! */
06672 XtUnmanageChild( marks->poptog[itog] ) ;
06673 } else {
06674 MCW_set_widget_label( marks->tog[itog] ,
06675 &(markers->label[itog][0]) ) ;
06676 SENSITIZE( marks->tog[itog] , True ) ;
06677 XtManageChild( marks->tog[itog] ) ;
06678
06679 MCW_set_widget_label( marks->poptog[itog] ,
06680 &(markers->label[itog][0]) ) ;
06681 SENSITIZE( marks->poptog[itog] , True ) ;
06682 XtManageChild( marks->poptog[itog] ) ;
06683
06684 if( markers->valid[itog] && ! marks->inverted[itog] ){
06685 MCW_invert_widget( marks->tog[itog] ) ;
06686 MCW_invert_widget( marks->poptog[itog] ) ;
06687 marks->inverted[itog] = True ;
06688 }
06689
06690 if( ! markers->valid[itog] && marks->inverted[itog] ){
06691 MCW_invert_widget( marks->tog[itog] ) ;
06692 MCW_invert_widget( marks->poptog[itog] ) ;
06693 marks->inverted[itog] = False ;
06694 }
06695 }
06696 } /* end of loop over markers */
06697
06698 } /* end of dealing with markers */
06699
06700 /*------------------------------*/
06701 /*----- set up for viewing -----*/
06702
06703 AFNI_setup_viewing( im3d , True ) ;
06704
06705 /*-----------------------------------------------------*/
06706 /*----- reset viewpoint to same Dicom coordinates -----*/
06707
06708 if( im3d->type == AFNI_3DDATA_VIEW ){
06709 fv = AFNI_transform_vector(
06710 old_anat ,
06711 TEMP_FVEC3( im3d->vinfo->xi, im3d->vinfo->yj, im3d->vinfo->zk ),
06712 dset ) ;
06713
06714 LOAD_ANAT_VIEW(im3d) ; /* 02 Nov 1996 */
06715
06716 fv = THD_dicomm_to_3dmm( dset , fv ) ;
06717 iv = THD_3dmm_to_3dind( dset , fv ) ;
06718 } else {
06719 LOAD_IVEC3( iv, im3d->vinfo->i1, im3d->vinfo->j2, im3d->vinfo->k3 ) ;
06720 }
06721
06722 /* 27 Jan 2004: set coordinate to center of dataset
06723 if we were formerly looking at the dummy dataset */
06724
06725 if( im3d->dummied && !GLOBAL_library.have_dummy_dataset ){
06726 im3d->dummied = 0 ;
06727 LOAD_IVEC3( iv , im3d->anat_now->daxes->nxx/2 ,
06728 im3d->anat_now->daxes->nyy/2 ,
06729 im3d->anat_now->daxes->nzz/2 ) ;
06730 }
06731
06732 DISABLE_LOCK ; /* 11 Nov 1996 */
06733
06734 AFNI_view_setter(im3d,NULL) ;
06735 AFNI_set_viewpoint( im3d, iv.ijk[0],iv.ijk[1],iv.ijk[2] , REDISPLAY_ALL ) ;
06736
06737 ENABLE_LOCK ; /* 11 Nov 1996 */
06738
06739 SAVE_VPT(im3d) ; /* save current location as jumpback */
06740
06741 EXRETURN ;
06742 }
|
|
||||||||||||||||
|
Definition at line 8298 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_jumpto_dicom(), AFNI_library_type::cord, MCW_choose_cbs::cval, Three_D_View::dc, MCW_DC::display, ENTRY, GLOBAL_library, IM3D_VALID, mcwCR_string, MCW_choose_cbs::reason, RESET_AFNI_QUIT, THD_coorder_to_dicom(), and Three_D_View::type. Referenced by AFNI_imag_pop_CB().
08299 {
08300 Three_D_View * im3d = (Three_D_View *) cd ;
08301 float xx,yy,zz ;
08302 char dum1[32],dum2[32];
08303 int nn ;
08304
08305 ENTRY("AFNI_jumpto_CB") ;
08306
08307 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
08308 if( cbs->reason != mcwCR_string ) EXRETURN ; /* error */
08309
08310 nn = sscanf( cbs->cval , "%f%[ ,]%f%[ ,]%f" , &xx,dum1,&yy,dum2,&zz ) ;
08311 if( nn != 5 ){ XBell( im3d->dc->display , 100 ) ; EXRETURN ; }
08312
08313 THD_coorder_to_dicom( &GLOBAL_library.cord , &xx,&yy,&zz ) ;
08314
08315 nn = AFNI_jumpto_dicom( im3d , xx,yy,zz ) ;
08316 if( nn < 0 ) XBell( im3d->dc->display , 100 ) ;
08317
08318 RESET_AFNI_QUIT(im3d) ;
08319 EXRETURN ;
08320 }
|
|
||||||||||||||||||||
|
Definition at line 8324 of file afni.c. References AFNI_set_viewpoint(), Three_D_View::anat_now, CURRENT_DAXES, Three_D_View::dc, MCW_DC::display, ENTRY, THD_ivec3::ijk, LOAD_ANAT_VIEW, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, REDISPLAY_ALL, RETURN, SAVE_VPT, TEMP_FVEC3, THD_3dmm_to_3dind(), and THD_dicomm_to_3dmm(). Referenced by AFNI_drive_set_dicom_xyz(), AFNI_drive_set_spm_xyz(), AFNI_jumpto_CB(), AFNI_mnito_CB(), AFNI_process_plugout(), AFNI_sumato_CB(), process_NIML_SUMA_crosshair_xyz(), and TAG_tog_CB().
08325 {
08326 THD_dataxes * daxes ;
08327 THD_fvec3 fv ; THD_ivec3 iv ;
08328 int ii,jj,kk ;
08329
08330 ENTRY("AFNI_jumpto_dicom") ;
08331
08332 LOAD_ANAT_VIEW(im3d) ; /* 02 Nov 1996 */
08333
08334 fv = THD_dicomm_to_3dmm( im3d->anat_now , TEMP_FVEC3(xx,yy,zz) ) ;
08335 iv = THD_3dmm_to_3dind ( im3d->anat_now , fv ) ;
08336 ii = iv.ijk[0] ; jj = iv.ijk[1] ; kk = iv.ijk[2] ;
08337
08338 daxes = CURRENT_DAXES(im3d->anat_now) ;
08339 if( ii >= 0 && ii < daxes->nxx &&
08340 jj >= 0 && jj < daxes->nyy && kk >= 0 && kk < daxes->nzz ){
08341
08342 SAVE_VPT(im3d) ;
08343 AFNI_set_viewpoint( im3d , ii,jj,kk , REDISPLAY_ALL ) ; /* jump */
08344 RETURN(1) ;
08345 } else {
08346 XBell( im3d->dc->display , 100 ) ;
08347 RETURN(-1) ;
08348 }
08349 }
|
|
||||||||||||||||||||
|
Definition at line 8353 of file afni.c. References AFNI_set_viewpoint(), Three_D_View::anat_now, CURRENT_DAXES, Three_D_View::dc, MCW_DC::display, ENTRY, LOAD_ANAT_VIEW, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, REDISPLAY_ALL, RETURN, and SAVE_VPT. Referenced by AFNI_jumpto_ijk_CB().
08354 {
08355 THD_dataxes * daxes ;
08356
08357 ENTRY("AFNI_jumpto_ijk") ;
08358
08359 LOAD_ANAT_VIEW(im3d) ;
08360
08361 daxes = CURRENT_DAXES(im3d->anat_now) ;
08362 if( ii >= 0 && ii < daxes->nxx &&
08363 jj >= 0 && jj < daxes->nyy && kk >= 0 && kk < daxes->nzz ){
08364
08365 SAVE_VPT(im3d) ;
08366 AFNI_set_viewpoint( im3d , ii,jj,kk , REDISPLAY_ALL ) ; /* jump */
08367 RETURN(1) ;
08368 } else {
08369 XBell( im3d->dc->display , 100 ) ;
08370 RETURN(-1) ;
08371 }
08372 }
|
|
||||||||||||||||
|
Definition at line 8376 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_jumpto_ijk(), MCW_choose_cbs::cval, Three_D_View::dc, MCW_DC::display, ENTRY, IM3D_VALID, mcwCR_string, MCW_choose_cbs::reason, RESET_AFNI_QUIT, and Three_D_View::type. Referenced by AFNI_imag_pop_CB().
08377 {
08378 Three_D_View * im3d = (Three_D_View *) cd ;
08379 int ii,jj,kk ;
08380 int nn ;
08381 char dum1[32],dum2[32];
08382
08383 ENTRY("AFNI_jumpto_CB") ;
08384
08385 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
08386 if( cbs->reason != mcwCR_string ) EXRETURN ; /* error */
08387
08388 nn = sscanf( cbs->cval , "%d%[ ,]%d%[ ,]%d" , &ii,dum1,&jj,dum2,&kk ) ;
08389 if( nn != 5 ){ XBell( im3d->dc->display , 100 ) ; EXRETURN ; }
08390
08391 nn = AFNI_jumpto_ijk( im3d , ii,jj,kk ) ;
08392 if( nn < 0 ) XBell( im3d->dc->display , 100 ) ;
08393
08394 RESET_AFNI_QUIT(im3d) ;
08395 EXRETURN ;
08396 }
|
|
|
initialization values (static values are used in afni.c only) * Definition at line 9765 of file afni.c.
09766 {
09767 char * xdef ;
09768 Display * display ;
09769 int ival , ii,jj ;
09770 float fval ;
09771 char * cpt ;
09772 char buf[64] ;
09773 float pthr[NPANE_MAX+1] ;
09774 int pov[NPANE_MAX+1] ;
09775
09776 ENTRY("AFNI_load_defaults") ;
09777
09778 if( w == NULL ){
09779 fprintf(stderr,"\n*** AFNI_load_defaults: NULL input widget ***\n") ;
09780 EXRETURN ;
09781 }
09782
09783 display = XtDisplay( w ) ;
09784
09785 /** initialize overlay color arrays from defaults **/
09786
09787 for( ii=0 ; ii < DEFAULT_NCOLOVR ; ii++ ){
09788 INIT_colovr[ii] = XtNewString(INIT_def_colovr[ii]) ;
09789 INIT_labovr[ii] = XtNewString(INIT_def_labovr[ii]) ;
09790 }
09791 for( ; ii < MAX_NCOLOVR ; ii++ ){
09792 INIT_colovr[ii] = INIT_labovr[ii] = NULL ;
09793 }
09794
09795 /** initialize display and overlay colors **/
09796
09797 NAME2INT("ncolors",INIT_ngray,3,MAX_COLORS) ;
09798
09799 NAME2INT("ncolovr",INIT_ncolovr,2,MAX_NCOLOVR) ;
09800
09801 NAME2FLOAT("gamma",INIT_gamma,0.1,9.9) ;
09802
09803 for( ii=0 ; ii < INIT_ncolovr ; ii++ ){
09804 sprintf( buf , "ovdef%02d" , ii+1 ) ;
09805 NAME2STRING(buf,INIT_colovr[ii] ) ;
09806
09807 sprintf( buf , "ovlab%02d" , ii+1 ) ;
09808 NAME2STRING(buf,INIT_labovr[ii] ) ;
09809 }
09810
09811 NAME2INT("ovcrosshair" , INIT_crosshair_color,0,INIT_ncolovr) ;
09812 NAME2INT("ovmarksprimary" , INIT_marks1_color ,0,INIT_ncolovr) ;
09813 NAME2INT("ovmarkssecondary" , INIT_marks2_color ,0,INIT_ncolovr) ;
09814 NAME2INT("markssize" , INIT_marks_size ,2,MAXOVSIZE ) ;
09815 NAME2INT("marksgap" , INIT_marks_gap ,0,MAXOVSIZE-1 ) ;
09816 NAME2INT("crosshairgap" , INIT_crosshair_gap ,0,MAXOVSIZE ) ;
09817 NAME2INT("bigscroll" , INIT_bigscroll ,1,MAXOVSIZE ) ;
09818
09819 NAME2INT("graph_boxes_color" ,INIT_GR_boxes_color ,BLUEST_COLOR,INIT_ncolovr) ;
09820 NAME2INT("graph_backg_color" ,INIT_GR_backg_color ,BLUEST_COLOR,INIT_ncolovr) ;
09821 NAME2INT("graph_grid_color" ,INIT_GR_grid_color ,BLUEST_COLOR,INIT_ncolovr) ;
09822 NAME2INT("graph_text_color" ,INIT_GR_text_color ,BLUEST_COLOR,INIT_ncolovr) ;
09823 NAME2INT("graph_data_color" ,INIT_GR_data_color ,BLUEST_COLOR,INIT_ncolovr) ;
09824 NAME2INT("graph_ideal_color" ,INIT_GR_ideal_color ,BLUEST_COLOR,INIT_ncolovr) ;
09825 NAME2INT("graph_ort_color" ,INIT_GR_ort_color ,BLUEST_COLOR,INIT_ncolovr) ;
09826 NAME2INT("graph_ignore_color",INIT_GR_ignore_color,BLUEST_COLOR,INIT_ncolovr) ;
09827 NAME2INT("graph_dplot_color" ,INIT_GR_dplot_color ,BLUEST_COLOR,INIT_ncolovr) ;
09828
09829 NAME2INT("graph_boxes_thick" ,INIT_GR_boxes_thick ,0,1) ;
09830 NAME2INT("graph_grid_thick" ,INIT_GR_grid_thick ,0,1) ;
09831 NAME2INT("graph_data_thick" ,INIT_GR_data_thick ,0,1) ;
09832 NAME2INT("graph_ideal_thick" ,INIT_GR_ideal_thick ,0,1) ;
09833 NAME2INT("graph_ort_thick" ,INIT_GR_ort_thick ,0,1) ;
09834 NAME2INT("graph_dplot_thick" ,INIT_GR_dplot_thick ,0,1) ;
09835
09836 NAME2INT("graph_ggap" ,INIT_GR_ggap ,0,19); /* 27 May 1999 */
09837 NAME2INT("fim_polort" ,INIT_fim_polort ,0,MAX_POLORT); /* 30 May 1999 */
09838 NAME2INT("graph_matrix" ,INIT_GR_gmat ,1,MAT_MAX); /* 10 Feb 2003 */
09839 NAME2INT("graph_gthick" ,INIT_GR_gthick ,2,10); /* 06 Oct 2004 */
09840
09841 /** initialize other junk **/
09842
09843 cpt = NULL ;
09844 NAME2STRING( "tlrc_big" , cpt ) ;
09845 if( cpt != NULL ){
09846 INIT_tlrc_big = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09847 XtFree(cpt) ;
09848 }
09849
09850 cpt = NULL ;
09851 NAME2STRING( "montage_periodic" , cpt ) ;
09852 if( cpt != NULL ){
09853 INIT_montage_periodic = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09854 XtFree(cpt) ;
09855 }
09856
09857 NAME2INT("fim_ignore",INIT_ignore,0,999) ;
09858
09859 cpt = NULL ;
09860 NAME2STRING( "purge" , cpt ) ;
09861 if( cpt != NULL ){
09862 INIT_purge = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09863 myXtFree(cpt) ;
09864 }
09865
09866 NAME2FLOAT("resam_vox",INIT_resam_vox,0.1,4.0) ;
09867 INIT_resam_vox = 0.1 * ( (int)(10*INIT_resam_vox) ) ;
09868
09869 cpt = NULL ;
09870 NAME2STRING( "resam_anat" , cpt ) ;
09871 if( cpt != NULL ){
09872 for( ii=FIRST_RESAM_TYPE ; ii <= LAST_RESAM_TYPE ; ii++ ){
09873 if( strcmp(cpt,RESAM_shortstr[ii]) == 0 ) break ;
09874 }
09875 if( ii <= LAST_RESAM_TYPE ) INIT_resam_anat = ii ;
09876 myXtFree(cpt) ;
09877 }
09878
09879 cpt = NULL ;
09880 NAME2STRING( "resam_func" , cpt ) ;
09881 if( cpt != NULL ){
09882 for( ii=FIRST_RESAM_TYPE ; ii <= LAST_RESAM_TYPE ; ii++ ){
09883 if( strcmp(cpt,RESAM_shortstr[ii]) == 0 ) break ;
09884 }
09885 if( ii <= LAST_RESAM_TYPE ) INIT_resam_func = ii ;
09886 (char*)myXtFree(cpt) ;
09887 }
09888
09889 cpt = NULL ;
09890 NAME2STRING( "resam_thr" , cpt ) ;
09891 if( cpt != NULL ){
09892 for( ii=FIRST_RESAM_TYPE ; ii <= LAST_RESAM_TYPE ; ii++ ){
09893 if( strcmp(cpt,RESAM_shortstr[ii]) == 0 ) break ;
09894 }
09895 if( ii <= LAST_RESAM_TYPE ) INIT_resam_thr = ii ;
09896 myXtFree(cpt) ;
09897 }
09898
09899 /** initialize pbar panes **/
09900
09901 cpt = NULL ;
09902 NAME2STRING( "pbar_posfunc" , cpt ) ;
09903 if( cpt != NULL ){
09904 INIT_posfunc = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09905 myXtFree(cpt) ;
09906 }
09907
09908 cpt = NULL ;
09909 NAME2STRING( "pbar_hide" , cpt ) ;
09910 if( cpt != NULL ){
09911 INIT_panes_hide = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09912 myXtFree(cpt) ;
09913 }
09914
09915 NAME2INT("pbar_pos_pane_count" , INIT_panes_pos , NPANE_MIN , NPANE_MAX ) ;
09916 NAME2INT("pbar_sgn_pane_count" , INIT_panes_sgn , NPANE_MIN , NPANE_MAX ) ;
09917
09918 /* start with positive panes */
09919
09920 for( ii=NPANE_INIT+1 ; ii <= NPANE_MAX ; ii++ ){
09921 fval = 1.0 / ii ;
09922 pthr[0] = 1.0 ;
09923 pthr[ii] = 0.0 ;
09924 for( jj=1 ; jj < ii ; jj++ ) pthr[jj] = fval * (ii-jj) ;
09925 for( jj=0 ; jj < ii ; jj++ ) pov[jj] = (jj % INIT_ncolovr) + 1 ;
09926
09927 for( jj=0 ; jj <= ii ; jj++ ) INIT_pval_pos[ii][jj] = pthr[jj] ;
09928 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_pos[ii][jj] = pov[jj] ;
09929 }
09930
09931 for( ii=NPANE_MIN ; ii <= NPANE_MAX ; ii++ ){
09932
09933 for( jj=0 ; jj <= ii ; jj++ ){
09934 sprintf( buf , "pbar_pos_pane%02d_thr%02d" , ii,jj ) ;
09935 pthr[jj] = BAD ;
09936 NAME2FLOAT(buf,pthr[jj],0.0,1.0) ;
09937 }
09938
09939 for( jj=0 ; jj < ii ; jj++ ){
09940 sprintf( buf , "pbar_pos_pane%02d_ov%02d" , ii,jj ) ;
09941 pov[jj] = BAD ;
09942 NAME2INT(buf,pov[jj],0,INIT_ncolovr) ;
09943 }
09944
09945 /* check pthr for OK-ness; if not good, skip to next pane count (ii) */
09946
09947 if( pthr[0] != 1.0 || pthr[jj] != 0.0 ) continue ;
09948 for( jj=1 ; jj <= ii ; jj++ ){
09949 if( pthr[jj] == BAD || pthr[jj] >= pthr[jj-1] ) break ;
09950 }
09951 if( jj <= ii ) continue ;
09952
09953 /* check pov for OK-ness */
09954
09955 for( jj=0 ; jj < ii ; jj++ ) if( pov[jj] == BAD ) break ;
09956 if( jj < ii ) continue ;
09957
09958 /* get to here --> load pthr and pov into arrays */
09959
09960 for( jj=0 ; jj <= ii ; jj++ ) INIT_pval_pos[ii][jj] = pthr[jj] ;
09961 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_pos[ii][jj] = pov[jj] ;
09962
09963 }
09964
09965 /** initialize signed pbar panes **/
09966
09967 for( ii=NPANE_INIT+1 ; ii <= NPANE_MAX ; ii++ ){
09968 fval = 1.0 / ii ;
09969 pthr[0] = 1.0 ;
09970 pthr[ii] = -1.0 ;
09971 for( jj=1 ; jj < ii ; jj++ ) pthr[jj] = fval * (ii-2*jj) ;
09972 for( jj=0 ; jj < ii ; jj++ ) pov[jj] = (jj % INIT_ncolovr) + 1 ;
09973
09974 for( jj=0 ; jj <= ii ; jj++ ) INIT_pval_sgn[ii][jj] = pthr[jj] ;
09975 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_sgn[ii][jj] = pov[jj] ;
09976 }
09977
09978 for( ii=NPANE_MIN ; ii <= NPANE_MAX ; ii++ ){
09979
09980 for( jj=0 ; jj <= ii ; jj++ ){
09981 sprintf( buf , "pbar_sgn_pane%02d_thr%02d" , ii,jj ) ;
09982 pthr[jj] = BAD ;
09983 NAME2FLOAT(buf,pthr[jj],-1.0,1.0) ; /* 14 Apr 1999: 0.0 changed to -1.0! */
09984 }
09985
09986 for( jj=0 ; jj < ii ; jj++ ){
09987 sprintf( buf , "pbar_sgn_pane%02d_ov%02d" , ii,jj ) ;
09988 pov[jj] = BAD ;
09989 NAME2INT(buf,pov[jj],0,INIT_ncolovr) ;
09990 }
09991
09992 /* check pthr for OK-ness; if not good, skip to next pane count (ii) */
09993
09994 if( pthr[0] != 1.0 || pthr[jj] != -1.0 ) continue ;
09995 for( jj=1 ; jj <= ii ; jj++ ){
09996 if( pthr[jj] == BAD || pthr[jj] >= pthr[jj-1] ) break ;
09997 }
09998 if( jj <= ii ) continue ;
09999
10000 /* check pov for OK-ness */
10001
10002 for( jj=0 ; jj < ii ; jj++ ) if( pov[jj] == BAD ) break ;
10003 if( jj < ii ) continue ;
10004
10005 /* get to here --> load pthr and pov into arrays */
10006
10007 for( jj=0 ; jj <= ii ; jj++ ) INIT_pval_sgn[ii][jj] = pthr[jj] ;
10008 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_sgn[ii][jj] = pov[jj] ;
10009
10010 }
10011
10012 /* 10 Jun 2002: put RGB cyclic maps in place */
10013
10014 #if defined(RGBCYC_COUNT) && RGBCYC_COUNT <= NPANE_MAX
10015 ii = RGBCYC_COUNT ;
10016 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_pos[ii][jj] = RGBCYC_FIRST+jj+1 ;
10017 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_sgn[ii][jj] = RGBCYC_FIRST+jj+1 ;
10018 #endif
10019
10020 EXRETURN ;
10021 }
|
|
||||||||||||||||
|
Definition at line 6413 of file afni.c. References abs, CHKPIX, ENTRY, AFNI_ovtemplate::numpix, and PUTPIX. Referenced by AFNI_marks_disp_av_CB().
06414 {
06415 register int ix , npix=0 , ax ;
06416
06417 ENTRY("AFNI_make_ptmask") ;
06418
06419 for( ix=-size ; ix <= size ; ix++ ){
06420 PUTPIX(ix,-size) ; CHKPIX ;
06421 PUTPIX(ix, size) ; CHKPIX ;
06422 ax = abs(ix) ;
06423 if( ax != size ){ PUTPIX( size,ix); CHKPIX; PUTPIX(-size,ix); CHKPIX; }
06424 if( ax > gap ){ PUTPIX(ix,0) ; CHKPIX; PUTPIX(0,ix) ; CHKPIX; }
06425 }
06426
06427 tem->numpix = npix ;
06428 EXRETURN ;
06429 }
|
|
||||||||||||||||
|
Definition at line 6433 of file afni.c. References abs, CHKPIX, ENTRY, AFNI_ovtemplate::numpix, and PUTPIX. Referenced by AFNI_overlay().
06434 {
06435 register int ix , npix=0 , ax ;
06436
06437 ENTRY("AFNI_make_tagmask") ;
06438
06439 PUTPIX(-size,0) ; PUTPIX(size,0) ;
06440 for( ix=-size+1 ; ix < size ; ix++ ){
06441 ax = abs(ix) ;
06442 PUTPIX(ix,ax-size) ; CHKPIX ;
06443 PUTPIX(ix,size-ax) ; CHKPIX ;
06444
06445 if( ax > gap ){ PUTPIX(ix,0); CHKPIX; PUTPIX(0,ix); CHKPIX; }
06446 }
06447
06448 tem->numpix = npix ;
06449 EXRETURN ;
06450 }
|
|
|
Definition at line 8592 of file afni.c. References AFNI_marks_quality_check(), AFNI_transform_vector(), Three_D_View::anat_now, ATLAS_AC_TO_LAT, ATLAS_AC_TO_PC, ATLAS_AC_TO_TOP, ATLAS_ALIGNBOX_ANT, ATLAS_ALIGNBOX_INF, ATLAS_ALIGNBOX_LAT, ATLAS_ALIGNBOX_POS, ATLAS_ALIGNBOX_SUP, ATLAS_BOT_TO_AC, ATLAS_FRONT_TO_AC, ATLAS_PC_TO_BACK, THD_linear_mapping::bot, THD_linear_mapping::bvec, CROSS_FVEC3, DOT_FVEC3, DUMP_LMAP, ENTRY, gamma, IMARK_ACPM, IMARK_ACSE, IMARK_MANT, IMARK_MINF, IMARK_MLEF, IMARK_MPOS, IMARK_MRIG, IMARK_MSA1, IMARK_MSA2, IMARK_MSUP, IMARK_PCIE, L, LOAD_FVEC3, MAPPING_LINEAR_TYPE, THD_3dim_dataset::markers, MARKSET_ALIGN, MARKSET_BOUNDING, THD_mat33::mat, MATVEC, THD_linear_mapping::mbac, THD_linear_mapping::mfor, MVEC, myXtNew, NEGATE_FVEC3, NORMALIZE_FVEC3, RETURN, S, SCLADD_FVEC3, STATUS, SUB_FVEC3, THD_linear_mapping::svec, THD_3dmm_to_dicomm(), THD_linear_mapping::top, TRANSPOSE_MAT, THD_marker_set::type, THD_talairach_12_warp::type, THD_affine_warp::type, THD_linear_mapping::type, THD_affine_warp::warp, WARP_AFFINE_TYPE, THD_3dim_dataset::warp_parent, WARP_TALAIRACH_12_TYPE, THD_marker_set::xyz, and THD_fvec3::xyz. Referenced by AFNI_marks_transform_CB().
08593 {
08594 THD_3dim_dataset * anat = im3d->anat_now ;
08595 THD_marker_set * markers = im3d->anat_now->markers ;
08596 THD_warp * warp ;
08597 Boolean good ;
08598
08599 ENTRY("AFNI_make_warp") ;
08600
08601 /*--- check the markers for OK-osity ---*/
08602
08603 good = AFNI_marks_quality_check( False , im3d ) ;
08604 if( !good ) RETURN(NULL) ;
08605
08606 /*--- make a new warp, and then construct it,
08607 based on the type of marker set we have here ---*/
08608
08609 warp = myXtNew( THD_warp ) ;
08610
08611 switch( markers->type ){ /* type of marker set */
08612
08613 default: RETURN(NULL) ; /* something bad happened */
08614
08615 /*--- bounding box markers set ---*/
08616
08617 case MARKSET_BOUNDING:{
08618 THD_talairach_12_warp * twarp = (THD_talairach_12_warp *) warp ;
08619 THD_fvec3 mant,mpos,msup,minf,mrig,mlef , pcie ;
08620 float dist_sup , dist_inf , dist_ant , dist_med , dist_pos ,
08621 dist_lef , dist_rig ;
08622 float scale_S , scale_I , scale_A , scale_M , scale_P ,
08623 scale_L , scale_R , shift_P ;
08624 float bot_S , bot_I , bot_A , bot_M , bot_P ,
08625 bot_L , bot_R ;
08626 float top_S , top_I , top_A , top_M , top_P ,
08627 top_L , top_R ;
08628 THD_fvec3 bv_A , bv_M , bv_P , sv_A , sv_M , sv_P ;
08629
08630 /* let the world know what kind of warp is being built */
08631
08632 twarp->type = WARP_TALAIRACH_12_TYPE ;
08633
08634 /* extract the marker vectors, put in Dicom coords */
08635
08636 mant = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MANT) ) ;
08637 mpos = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MPOS) ) ;
08638 msup = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MSUP) ) ;
08639 minf = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MINF) ) ;
08640 mrig = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MRIG) ) ;
08641 mlef = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MLEF) ) ;
08642
08643 /* convert Posterior Commissure from parent to current coords */
08644
08645 LOAD_FVEC3( pcie ,
08646 anat->warp_parent->markers->xyz[IMARK_PCIE][0] ,
08647 anat->warp_parent->markers->xyz[IMARK_PCIE][1] ,
08648 anat->warp_parent->markers->xyz[IMARK_PCIE][2] ) ;
08649
08650 pcie = THD_3dmm_to_dicomm( anat->warp_parent , pcie ) ;
08651 pcie = AFNI_transform_vector( anat->warp_parent , pcie , anat ) ;
08652
08653 /* compute distances between points in various directions */
08654
08655 dist_ant = -mant.xyz[1] ;
08656 dist_med = pcie.xyz[1] ;
08657 dist_pos = mpos.xyz[1] - pcie.xyz[1] ;
08658
08659 dist_sup = msup.xyz[2] ;
08660 dist_inf = -minf.xyz[2] ;
08661 dist_lef = mlef.xyz[0] ;
08662 dist_rig = -mrig.xyz[0] ;
08663
08664 /* from these, compute the scalings needed in each
08665 direction and the shift needed posterior to the PC */
08666
08667 scale_A = ATLAS_FRONT_TO_AC / dist_ant ;
08668 scale_M = ATLAS_AC_TO_PC / dist_med ;
08669 scale_P = ATLAS_PC_TO_BACK / dist_pos ;
08670 scale_S = ATLAS_AC_TO_TOP / dist_sup ;
08671 scale_I = ATLAS_BOT_TO_AC / dist_inf ;
08672 scale_L = ATLAS_AC_TO_LAT / dist_lef ;
08673 scale_R = ATLAS_AC_TO_LAT / dist_rig ;
08674
08675 shift_P = scale_P * dist_med - ATLAS_AC_TO_PC ;
08676
08677 /* shift vectors in each direction, for each y cell (A,M,P) */
08678
08679 LOAD_FVEC3( bv_A , 0,0,0 ) ; bv_M = sv_A = sv_M = bv_A ;
08680
08681 LOAD_FVEC3( bv_P , 0 , shift_P , 0 ) ;
08682 LOAD_FVEC3( sv_P , 0 , -shift_P / scale_P , 0 ) ;
08683
08684 /* bounds information for each direction, for each cell */
08685
08686 bot_A = -9999.0 ; top_A = 0.0 ;
08687 bot_M = 0.0 ; top_M = ATLAS_AC_TO_PC ;
08688 bot_P = ATLAS_AC_TO_PC ; top_P = 9999.0 ;
08689
08690 bot_R = -9999.0 ; top_R = 0.0 ;
08691 bot_L = 0.0 ; top_L = 9999.9 ;
08692
08693 bot_I = -9999.0 ; top_I = 0.0 ;
08694 bot_S = 0.0 ; top_S = 9999.9 ;
08695
08696 /* Compute the 12 linear maps:
08697 They are all linear scalings (diagonal matrices);
08698 posterior to the PC, they also contain shifts
08699 to align stuff to the nominal PC location.
08700 N.B.: these are maps from AC-PC aligned coordinates
08701 to the Talairach system. Maps from the
08702 original data to the Talairach system
08703 will be computed later (in AFNI_concatenate_warps). */
08704
08705 /* ------- a macro to automate map making:
08706 xx = R or L , yy = A, M, or P , zz = I or S --------*/
08707
08708 #define MAKE_MAP(xx,yy,zz) \
08709 (\
08710 LOAD_DIAG_MAT( twarp->warp[W_ ## xx ## yy ## zz].mfor , \
08711 scale_ ## xx , scale_ ## yy , scale_ ## zz ) ,\
08712 \
08713 LOAD_DIAG_MAT( twarp->warp[W_ ## xx ## yy ## zz].mbac , \
08714 1.0 / scale_ ## xx , 1.0 / scale_ ## yy , 1.0 / scale_ ## zz ) ,\
08715 \
08716 twarp->warp[W_ ## xx ## yy ## zz].bvec = bv_ ## yy , \
08717 \
08718 twarp->warp[W_ ## xx ## yy ## zz].svec = sv_ ## yy , \
08719 \
08720 LOAD_FVEC3( twarp->warp[W_ ## xx ## yy ## zz].bot , \
08721 bot_ ## xx , bot_ ## yy , bot_ ## zz ) ,\
08722 \
08723 LOAD_FVEC3( twarp->warp[W_ ## xx ## yy ## zz].top , \
08724 top_ ## xx , top_ ## yy , top_ ## zz ) \
08725 )
08726
08727 /*------- end of MAKE_MAP macro --------*/
08728
08729 MAKE_MAP(R,A,S) ; /* right-anterior -superior */
08730 MAKE_MAP(L,A,S) ; /* left -anterior -superior */
08731 MAKE_MAP(R,M,S) ; /* right-medial -superior */
08732 MAKE_MAP(L,M,S) ; /* left -medial -superior */
08733 MAKE_MAP(R,P,S) ; /* right-posterior-superior */
08734 MAKE_MAP(L,P,S) ; /* left -posterior-superior */
08735 MAKE_MAP(R,A,I) ; /* right-anterior -inferior */
08736 MAKE_MAP(L,A,I) ; /* left -anterior -inferior */
08737 MAKE_MAP(R,M,I) ; /* right-medial -inferior */
08738 MAKE_MAP(L,M,I) ; /* left -medial -inferior */
08739 MAKE_MAP(R,P,I) ; /* right-posterior-inferior */
08740 MAKE_MAP(L,P,I) ; /* left -posterior-inferior */
08741
08742 #undef MAKE_MAP
08743
08744 }
08745 break ; /* end of Bounding markers set */
08746
08747 /*--- AC-PC alignment markers set ---*/
08748
08749 case MARKSET_ALIGN:{
08750 THD_affine_warp * awarp = (THD_affine_warp *) warp ;
08751
08752 THD_fvec3 acsup , acpos , pcinf , msag1 , msag2 ,
08753 alpha1,alpha2,alpha,beta,gamma,rr1,rr2,rr , dif ;
08754 THD_mat33 to_al ;
08755 float size ;
08756
08757 /* let the world know what kind of warp is being built */
08758
08759 awarp->type = WARP_AFFINE_TYPE ;
08760
08761 /* extract the marker vectors, put in Dicom coords */
08762
08763 acsup = THD_3dmm_to_dicomm( anat , MVEC(IMARK_ACSE) ) ;
08764 acpos = THD_3dmm_to_dicomm( anat , MVEC(IMARK_ACPM) ) ;
08765 pcinf = THD_3dmm_to_dicomm( anat , MVEC(IMARK_PCIE) ) ;
08766 msag1 = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MSA1) ) ;
08767 msag2 = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MSA2) ) ;
08768
08769 /*--- new y direction (beta) ---*/
08770
08771 beta = SUB_FVEC3(pcinf,acsup) ; beta = NORMALIZE_FVEC3(beta) ;
08772
08773 /*--- new x direction (alpha) ---*/
08774
08775 rr = SUB_FVEC3(msag1,acsup) ;
08776 alpha1 = CROSS_FVEC3(beta,rr) ; alpha1 = NORMALIZE_FVEC3(alpha1) ;
08777
08778 rr = SUB_FVEC3(msag2,acsup) ;
08779 alpha2 = CROSS_FVEC3(beta,rr) ; alpha2 = NORMALIZE_FVEC3(alpha2) ;
08780
08781 alpha = SCLADD_FVEC3(0.5,alpha1,0.5,alpha2) ;
08782 alpha = NORMALIZE_FVEC3(alpha) ;
08783
08784 /*--- new z direction (gamma) ---*/
08785
08786 gamma = CROSS_FVEC3(alpha,beta) ; gamma = NORMALIZE_FVEC3(gamma) ;
08787
08788 /*--- origin of Talairach coordinates (rr) --*/
08789
08790 dif = SUB_FVEC3(acsup,acpos) ;
08791 size = DOT_FVEC3(dif,gamma) ;
08792 rr1 = SCLADD_FVEC3(1.0,acpos,size,gamma) ;
08793
08794 size = DOT_FVEC3(dif,beta) ;
08795 rr2 = SCLADD_FVEC3(1.0,acsup,-size,beta) ;
08796
08797 rr = SCLADD_FVEC3(0.5,rr1,0.5,rr2) ;
08798
08799 /*--- at this point, have:
08800 new origin in rr ;
08801 new axes directions in alpha,beta,gamma.
08802 Now construct the transformation between
08803 the Dicom coordinate systems ---------------------*/
08804
08805 to_al.mat[0][0] = alpha.xyz[0] ; /* first row is alpha */
08806 to_al.mat[0][1] = alpha.xyz[1] ;
08807 to_al.mat[0][2] = alpha.xyz[2] ;
08808
08809 to_al.mat[1][0] = beta.xyz[0] ; /* second row is beta */
08810 to_al.mat[1][1] = beta.xyz[1] ;
08811 to_al.mat[1][2] = beta.xyz[2] ;
08812
08813 to_al.mat[2][0] = gamma.xyz[0] ; /* third row is gamma */
08814 to_al.mat[2][1] = gamma.xyz[1] ;
08815 to_al.mat[2][2] = gamma.xyz[2] ;
08816
08817 /*--- put into warp structure ---*/
08818
08819 awarp->warp.type = MAPPING_LINEAR_TYPE ;
08820 awarp->warp.mfor = to_al ;
08821 awarp->warp.mbac = TRANSPOSE_MAT(to_al) ; /* orthog^(-1) */
08822 awarp->warp.bvec = MATVEC(to_al,rr) ;
08823 awarp->warp.svec = rr ; NEGATE_FVEC3(awarp->warp.svec) ;
08824
08825 /* load bot & top with largest possible excursions from
08826 origin (the ALIGNBOX dimensions were added 3/25/95) */
08827
08828 LOAD_FVEC3(awarp->warp.bot,
08829 -ATLAS_ALIGNBOX_LAT,-ATLAS_ALIGNBOX_ANT,-ATLAS_ALIGNBOX_INF);
08830 LOAD_FVEC3(awarp->warp.top,
08831 ATLAS_ALIGNBOX_LAT, ATLAS_ALIGNBOX_POS, ATLAS_ALIGNBOX_SUP);
08832
08833 #ifdef AFNI_DEBUG
08834 STATUS("Original -> Aligned Map::") ;
08835 DUMP_LMAP(awarp->warp) ;
08836 #endif
08837
08838 } /* end of AC-PC alignment case */
08839 break ;
08840
08841 } /* end of switch on marker set type */
08842
08843 RETURN(warp) ;
08844 }
|
|
||||||||||||||||
|
Definition at line 6167 of file afni.c. References AFNI_marks_widgets::action_clear_pb, AFNI_marks_widgets::action_quality_pb, AFNI_marks_widgets::action_set_pb, THD_marker_set::aflags, AFNI_first_tog(), AFNI_marks_edits_CB(), AFNI_marks_quality_check(), AFNI_see_marks_CB(), AFNI_set_viewpoint(), Three_D_View::anat_now, AFNI_marks_widgets::changed, client_data, CLOSE_PANEL, AFNI_viewing_widgets::define_marks_pb, AFNI_marks_widgets::editable, AFNI_marks_widgets::edits_bbox, ENTRY, AFNI_view_info::i1, IM3D_VALID, AFNI_marks_widgets::inverted, AFNI_marks_widgets::isprimary, ISVALID_VIEW, AFNI_view_info::j2, AFNI_view_info::k3, LOAD_ANAT_VIEW, MARKACTION_NONE, THD_3dim_dataset::markers, AFNI_widget_set::marks, MARKS_MAXNUM, MCW_invert_widget(), MCW_popup_message(), MCW_set_bbox(), MCW_TIMER_KILL, MCW_USER_KILL, THD_marker_set::numdef, THD_marker_set::numset, AFNI_marks_widgets::old_visible, AFNI_marks_widgets::pop_clear_pb, AFNI_marks_widgets::pop_set_pb, AFNI_marks_widgets::poptog, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, AFNI_viewing_widgets::see_marks_bbox, SENSITIZE, STATUS, TEMP_IVEC3, THD_3dind_to_3dmm(), THD_write_3dim_dataset(), AFNI_marks_widgets::tog, AFNI_marks_widgets::transform_pb, tross_Append_History(), THD_marker_set::valid, AFNI_widget_set::view, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, WARPED_VIEW, THD_marker_set::xyz, and THD_fvec3::xyz. Referenced by AFNI_controller_panel_CB(), AFNI_define_CB(), AFNI_initialize_view(), and AFNI_marks_transform_CB().
06169 {
06170 Three_D_View * im3d = (Three_D_View *) client_data ;
06171 int itog , ipt , setmask , vwarp ;
06172 Boolean sens , transformable ;
06173 THD_marker_set * markers ;
06174 AFNI_marks_widgets * marks ;
06175 THD_fvec3 fv ;
06176
06177 ENTRY("AFNI_marks_action_CB") ;
06178
06179 /* sanity check */
06180
06181 if( ! IM3D_VALID(im3d) ) EXRETURN ;
06182
06183 marks = im3d->vwid->marks ;
06184
06185 /*------ done button (it used to exist) -----*/
06186
06187 if( w == NULL ){ /* close down */
06188
06189 Boolean redisplay ;
06190
06191 MCW_set_bbox( marks->edits_bbox , 0 ) ;
06192 AFNI_marks_edits_CB( NULL , (XtPointer) im3d , NULL ) ;
06193
06194 MCW_set_bbox( im3d->vwid->view->see_marks_bbox ,
06195 marks->old_visible ? 1 : 0 ) ;
06196 AFNI_see_marks_CB( NULL , (XtPointer) im3d , NULL ) ;
06197
06198 redisplay = ! marks->old_visible ;
06199
06200 for( ipt=0 ; ipt < MARKS_MAXNUM ; ipt++ ){ /* all display as */
06201 redisplay = ( redisplay || marks->isprimary[ipt] == True ) ;
06202 marks->isprimary[ipt] = False ; /* secondary now */
06203 }
06204
06205 CLOSE_PANEL(im3d,marks) ; /* close this panel */
06206
06207 if( redisplay )
06208 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ; /* redraw */
06209
06210 /* save markers as they exist now, if any changes made */
06211
06212 if( im3d->anat_now->markers != NULL && marks->changed ){
06213 #if 0
06214 (void) MCW_popup_message(
06215 im3d->vwid->view->define_marks_pb ,
06216 "Saved changed markers\nto dataset disk file." ,
06217 MCW_USER_KILL | MCW_TIMER_KILL ) ;
06218 #endif
06219
06220 tross_Append_History( im3d->anat_now , "AFNI: markers were edited" ) ;
06221 (void) THD_write_3dim_dataset( NULL,NULL , im3d->anat_now , False ) ;
06222 }
06223
06224 EXRETURN ;
06225 }
06226
06227 /*----- quality button (only on when all markers are defined) -----*/
06228
06229 if( w == marks->action_quality_pb ){
06230 transformable = AFNI_marks_quality_check(True,im3d) ;
06231 SENSITIZE( marks->transform_pb , transformable ) ;
06232 EXRETURN ;
06233 }
06234
06235 /*----- if here, either a Set or a Clear -----*/
06236
06237 markers = im3d->anat_now->markers ;
06238 if( markers == NULL ) EXRETURN ; /* should not happen */
06239
06240 /* find which point is active (i.e., which toggle is set, if any) */
06241
06242 itog = AFNI_first_tog( MARKS_MAXNUM , marks->tog ) ;
06243
06244 if( itog < 0 || ! marks->editable ){
06245 XBell(XtDisplay(w),100) ; /* none active --> beep and return */
06246 EXRETURN ;
06247 }
06248
06249 ipt = itog ; /* index of point to deal with */
06250
06251 /*----- set button pressed -----*/
06252
06253 if( w == marks->action_set_pb || w == marks->pop_set_pb ){
06254
06255 if( ! markers->valid[ipt] ) (markers->numset) ++ ; /* newly set */
06256
06257 if(PRINT_TRACING)
06258 { char str[256] ;
06259 sprintf(str,"set #%d numset=%d",ipt,markers->numset) ;
06260 STATUS(str) ; }
06261
06262 markers->valid[ipt] = True ;
06263
06264 LOAD_ANAT_VIEW(im3d) ; /* 02 Nov 1996 */
06265
06266 fv = THD_3dind_to_3dmm( im3d->anat_now , /* convert to mm */
06267 TEMP_IVEC3( im3d->vinfo->i1 ,
06268 im3d->vinfo->j2 ,
06269 im3d->vinfo->k3 ) ) ;
06270
06271 markers->xyz[ipt][0] = fv.xyz[0] ; /* mm in local x,y,z */
06272 markers->xyz[ipt][1] = fv.xyz[1] ;
06273 markers->xyz[ipt][2] = fv.xyz[2] ;
06274
06275 /* invert colors to mark that the point is set */
06276
06277 if( ! marks->inverted[itog] ){
06278 MCW_invert_widget( marks->tog[itog] ) ;
06279 MCW_invert_widget( marks->poptog[itog] ) ;
06280 marks->inverted[itog] = True ;
06281 }
06282
06283 marks->changed = True ; /* set or reset a marker --> a change */
06284 }
06285
06286 /*----- clear button pressed -----*/
06287
06288 else if( w == marks->action_clear_pb || w == marks->pop_clear_pb ){
06289
06290 if( ! markers->valid[ipt] ){
06291 XBell(XtDisplay(w),100) ; /* already clear */
06292 EXRETURN ;
06293 } else {
06294 (markers->numset) -- ; /* newly unset --> sub one from count */
06295 marks->changed = True ; /* cleared a set marker --> a change */
06296 }
06297
06298 if(PRINT_TRACING)
06299 { char str[256] ;
06300 sprintf(str,"clr #%d numset=%d",ipt,markers->numset) ;
06301 STATUS(str) ; }
06302
06303 markers->valid[ipt] = False ;
06304
06305 /* restore colors to mark that the point is unset */
06306
06307 if( marks->inverted[itog] ){
06308 MCW_invert_widget( marks->tog[itog] ) ;
06309 MCW_invert_widget( marks->poptog[itog] ) ;
06310 marks->inverted[itog] = False ;
06311 }
06312 }
06313
06314 /*--- allow transformation if all marks are set, etc. ---*/
06315
06316 vwarp = WARPED_VIEW(im3d->vinfo->view_type) ;
06317 transformable = marks->editable &&
06318 (markers->aflags[1] != MARKACTION_NONE) &&
06319 (markers->numdef == markers->numset) &&
06320 ISVALID_VIEW(vwarp) ;
06321
06322 SENSITIZE( marks->action_quality_pb , transformable ) ;
06323 SENSITIZE( marks->transform_pb , False ) ; /* require QC first */
06324
06325 /*--- force a redraw ---*/
06326
06327 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
06328 RESET_AFNI_QUIT(im3d) ;
06329 EXRETURN ;
06330 }
|
|
||||||||||||
|
||||||||||||||||
|
Definition at line 7674 of file afni.c. References AFNI_marks_widgets::action_clear_pb, AFNI_marks_widgets::action_quality_pb, AFNI_marks_widgets::action_set_pb, THD_marker_set::aflags, AFNI_set_tog(), Three_D_View::anat_now, client_data, AFNI_marks_widgets::editable, AFNI_marks_widgets::edits_bbox, ENTRY, IM3D_VALID, ISVALID_VIEW, MARKACTION_NONE, THD_3dim_dataset::markers, AFNI_widget_set::marks, MARKS_MAXNUM, MCW_val_bbox(), THD_marker_set::numdef, THD_marker_set::numset, AFNI_marks_widgets::pop_clear_pb, AFNI_marks_widgets::pop_set_pb, AFNI_marks_widgets::poptog, RESET_AFNI_QUIT, SENSITIZE, AFNI_marks_widgets::tog, AFNI_marks_widgets::tog_frame, AFNI_marks_widgets::transform_pb, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, and WARPED_VIEW. Referenced by AFNI_define_CB(), and AFNI_marks_action_CB().
07676 {
07677 Three_D_View * im3d = (Three_D_View *) client_data ;
07678 AFNI_marks_widgets * marks ;
07679 int bval , vwarp ;
07680 Boolean transformable ;
07681
07682 ENTRY("AFNI_marks_edits_CB") ;
07683
07684 if( ! IM3D_VALID(im3d) ) EXRETURN ;
07685
07686 marks = im3d->vwid->marks ;
07687 bval = MCW_val_bbox( marks->edits_bbox ) ;
07688
07689 marks->editable = (bval == 0) ? (False) : (True) ;
07690
07691 if( im3d->anat_now->markers == NULL ) EXRETURN ;
07692
07693 /*----- allow transformation if
07694 edits are allowed, AND
07695 the markers are flagged for it, AND
07696 all the markers are defined ----------*/
07697
07698 vwarp = WARPED_VIEW(im3d->vinfo->view_type) ;
07699
07700 transformable =
07701 marks->editable &&
07702 (im3d->anat_now->markers->aflags[1] != MARKACTION_NONE) &&
07703 (im3d->anat_now->markers->numdef == im3d->anat_now->markers->numset) &&
07704 ISVALID_VIEW(vwarp) ;
07705
07706 /* turn some buttons on or off, depending on editability */
07707
07708 SENSITIZE( marks->tog_frame , True ) ;
07709 SENSITIZE( marks->action_set_pb , marks->editable ) ;
07710 SENSITIZE( marks->action_clear_pb , marks->editable ) ;
07711 SENSITIZE( marks->pop_set_pb , marks->editable ) ;
07712 SENSITIZE( marks->pop_clear_pb , marks->editable ) ;
07713 SENSITIZE( marks->action_quality_pb , transformable ) ;
07714 SENSITIZE( marks->transform_pb , False ) ; /* require QC first */
07715
07716 if( ! marks->editable ){
07717 AFNI_set_tog( -1 , MARKS_MAXNUM , marks->tog ) ; /* none will */
07718 AFNI_set_tog( -1 , MARKS_MAXNUM , marks->poptog ) ; /* be "on" */
07719 }
07720
07721 RESET_AFNI_QUIT(im3d) ;
07722 EXRETURN ;
07723 }
|
|
||||||||||||
|
Definition at line 8861 of file afni.c. References ADD_ERROR, ADD_REPORT, AFNI_transform_vector(), Three_D_View::anat_now, ATLAS_AC_TO_LAT, ATLAS_AC_TO_PC, ATLAS_AC_TO_TOP, ATLAS_BOT_TO_AC, ATLAS_FRONT_TO_AC, ATLAS_PC_TO_BACK, BEEPIT, CROSS_FVEC3, DOT_FVEC3, DUMP_FVEC3, ELIDE_quality, ENTRY, AFNI_marks_widgets::frame, gamma, IMARK_ACPM, IMARK_ACSE, IMARK_MANT, IMARK_MINF, IMARK_MLEF, IMARK_MPOS, IMARK_MRIG, IMARK_MSA1, IMARK_MSA2, IMARK_MSUP, IMARK_PCIE, LOAD_FVEC3, THD_3dim_dataset::markers, AFNI_widget_set::marks, MARKSET_ALIGN, MARKSET_BOUNDING, MAX_ALLOWED_DEVIATION, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, MIN_ALLOWED_DEVIATION, MVEC, myXtFree, NORMALIZE_FVEC3, RETURN, SCLADD_FVEC3, SIZE_FVEC3, STATUS, SUB_FVEC3, THD_3dmm_to_dicomm(), THD_marker_set::type, Three_D_View::vwid, THD_3dim_dataset::warp_parent, THD_marker_set::xyz, and THD_fvec3::xyz. Referenced by AFNI_make_warp(), and AFNI_marks_action_CB().
08862 {
08863 THD_3dim_dataset * anat = im3d->anat_now ;
08864 THD_marker_set * markers = im3d->anat_now->markers ;
08865
08866 char * error_list ;
08867 int num_error , num_report ;
08868 char msg[128] ;
08869 Boolean good ;
08870
08871 ENTRY("AFNI_marks_quality_check") ;
08872
08873 /*--- for compiling a list of errors and/or reports ---*/
08874
08875 if( markers == NULL ){ BEEPIT ; RETURN(False) ; } /* should not happen */
08876
08877 error_list = XtNewString(
08878 " *** MARKERS QUALITY REPORT *** \n\n") ;
08879 num_error = 0 ;
08880 num_report = 0 ;
08881
08882 /*--- what we do depends on the kinds of markers we have ---*/
08883
08884 switch( markers->type ){
08885
08886 default: RETURN(False) ; /* something bad happened */
08887
08888 /*--- bounding box markers set ---*/
08889
08890 case MARKSET_BOUNDING:{
08891 THD_fvec3 mant,mpos,msup,minf,mrig,mlef , pcie ;
08892 float dist_sup , dist_inf , dist_ant , dist_med , dist_pos ,
08893 dist_lef , dist_rig ;
08894
08895 /* extract the marker vectors, put in Dicom coords */
08896
08897 mant = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MANT) ) ;
08898 mpos = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MPOS) ) ;
08899 msup = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MSUP) ) ;
08900 minf = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MINF) ) ;
08901 mrig = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MRIG) ) ;
08902 mlef = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MLEF) ) ;
08903
08904 /* convert Posterior Commissure from parent to current coords */
08905
08906 LOAD_FVEC3( pcie ,
08907 anat->warp_parent->markers->xyz[IMARK_PCIE][0] ,
08908 anat->warp_parent->markers->xyz[IMARK_PCIE][1] ,
08909 anat->warp_parent->markers->xyz[IMARK_PCIE][2] ) ;
08910
08911 pcie = THD_3dmm_to_dicomm( anat->warp_parent , pcie ) ;
08912 pcie = AFNI_transform_vector( anat->warp_parent , pcie , anat ) ;
08913
08914 /* compute distances between points in various directions */
08915
08916 dist_ant = -mant.xyz[1] ;
08917 dist_med = pcie.xyz[1] ;
08918 dist_pos = mpos.xyz[1] - pcie.xyz[1] ;
08919
08920 dist_sup = msup.xyz[2] ;
08921 dist_inf = -minf.xyz[2] ;
08922
08923 dist_lef = mlef.xyz[0] ;
08924 dist_rig = -mrig.xyz[0] ;
08925
08926 /* check anterior distance and report it */
08927
08928 if( dist_ant/ATLAS_FRONT_TO_AC < MIN_ALLOWED_DEVIATION ||
08929 dist_ant/ATLAS_FRONT_TO_AC > MAX_ALLOWED_DEVIATION )
08930 ADD_ERROR("The following measurement is outside the allowed range!\n");
08931
08932 sprintf(msg,"Front to Anterior commissure: %5.1f mm (Atlas:%5.1f)\n",
08933 dist_ant,ATLAS_FRONT_TO_AC) ;
08934 ADD_REPORT(msg) ;
08935
08936 /* medial */
08937
08938 #if 0
08939 if( dist_med/ATLAS_AC_TO_PC < MIN_ALLOWED_DEVIATION ||
08940 dist_med/ATLAS_AC_TO_PC > MAX_ALLOWED_DEVIATION )
08941 ADD_ERROR("The following measurement is outside the allowed range!\n");
08942 #endif
08943 sprintf(msg,"Intercommissural distance: %5.1f mm (Atlas:%5.1f)\n",
08944 dist_med,ATLAS_AC_TO_PC) ;
08945 ADD_REPORT(msg) ;
08946
08947
08948 /* posterior */
08949
08950 if( dist_pos/ATLAS_PC_TO_BACK < MIN_ALLOWED_DEVIATION ||
08951 dist_pos/ATLAS_PC_TO_BACK > MAX_ALLOWED_DEVIATION )
08952 ADD_ERROR("The following measurement is outside the allowed range!\n");
08953
08954 sprintf(msg,"Posterior commissure to back: %5.1f mm (Atlas:%5.1f)\n",
08955 dist_pos,ATLAS_PC_TO_BACK) ;
08956 ADD_REPORT(msg) ;
08957
08958 /* inferior */
08959
08960 if( dist_inf/ATLAS_BOT_TO_AC < MIN_ALLOWED_DEVIATION ||
08961 dist_inf/ATLAS_BOT_TO_AC > MAX_ALLOWED_DEVIATION )
08962 ADD_ERROR("The following measurement is outside the allowed range!\n");
08963
08964 sprintf(msg,"Bottom to Anterior commissure:%5.1f mm (Atlas:%5.1f)\n",
08965 dist_inf,ATLAS_BOT_TO_AC) ;
08966 ADD_REPORT(msg) ;
08967
08968 /* superior */
08969
08970 if( dist_sup/ATLAS_AC_TO_TOP < MIN_ALLOWED_DEVIATION ||
08971 dist_sup/ATLAS_AC_TO_TOP > MAX_ALLOWED_DEVIATION )
08972 ADD_ERROR("The following measurement is outside the allowed range!\n");
08973
08974 sprintf(msg,"Anterior commissure to top: %5.1f mm (Atlas:%5.1f)\n",
08975 dist_sup,ATLAS_AC_TO_TOP) ;
08976 ADD_REPORT(msg) ;
08977
08978 /* left */
08979
08980 if( dist_lef/ATLAS_AC_TO_LAT < MIN_ALLOWED_DEVIATION ||
08981 dist_lef/ATLAS_AC_TO_LAT > MAX_ALLOWED_DEVIATION )
08982 ADD_ERROR("The following measurement is outside the allowed range!\n");
08983
08984 sprintf(msg,"Anterior commissure to left: %5.1f mm (Atlas:%5.1f)\n",
08985 dist_lef,ATLAS_AC_TO_LAT) ;
08986 ADD_REPORT(msg) ;
08987
08988 /* right */
08989
08990 if( dist_rig/ATLAS_AC_TO_LAT < MIN_ALLOWED_DEVIATION ||
08991 dist_rig/ATLAS_AC_TO_LAT > MAX_ALLOWED_DEVIATION )
08992 ADD_ERROR("The following measurement is outside the allowed range!\n");
08993
08994 sprintf(msg,"Anterior commissure to right: %5.1f mm (Atlas:%5.1f)\n",
08995 dist_rig,ATLAS_AC_TO_LAT) ;
08996 ADD_REPORT(msg) ;
08997 }
08998 break ; /* end of Boundings marker case */
08999
09000 /*--- AC-PC alignment markers set ---*/
09001
09002 case MARKSET_ALIGN:{
09003 THD_fvec3 acsup , acpos , pcinf , msag1 , msag2 ,
09004 alpha1,alpha2,alpha,beta,gamma,rr1,rr2,rr , dif ;
09005 float size , slim ;
09006
09007 /* extract the marker vectors, put in Dicom coords */
09008
09009 acsup = THD_3dmm_to_dicomm( anat , MVEC(IMARK_ACSE) ) ;
09010 acpos = THD_3dmm_to_dicomm( anat , MVEC(IMARK_ACPM) ) ;
09011 pcinf = THD_3dmm_to_dicomm( anat , MVEC(IMARK_PCIE) ) ;
09012 msag1 = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MSA1) ) ;
09013 msag2 = THD_3dmm_to_dicomm( anat , MVEC(IMARK_MSA2) ) ;
09014
09015 /*-- check the points for proper distances between each other --*/
09016
09017 rr = SUB_FVEC3(acsup,acpos) ; size = SIZE_FVEC3(rr) ;
09018 if( size > 4.0 )
09019 ADD_ERROR("The two AC points are more than 4 mm apart.\n") ;
09020
09021 slim = MIN_ALLOWED_DEVIATION * ATLAS_AC_TO_PC ;
09022 rr = SUB_FVEC3(acsup,pcinf) ; size = SIZE_FVEC3(rr) ;
09023 if( size <= slim ){
09024 sprintf(msg, "The AC & PC points are separated by %5.2f mm\n"
09025 "which is closer than the minimum %5.2f mm!\n" ,
09026 size,slim ) ;
09027 ADD_ERROR(msg) ;
09028 }
09029
09030 rr = SUB_FVEC3(acsup,msag1) ; size = SIZE_FVEC3(rr) ;
09031 if( size < 20.0 )
09032 ADD_ERROR("The AC and 1st mid-sag points are closer than 20 mm.\n");
09033
09034 rr = SUB_FVEC3(acsup,msag2) ; size = SIZE_FVEC3(rr) ;
09035 if( size < 20.0 )
09036 ADD_ERROR("The AC and 2nd mid-sag points are closer than 20 mm.\n");
09037
09038 rr = SUB_FVEC3(msag1,msag2) ; size = SIZE_FVEC3(rr) ;
09039 if( size < 20.0 )
09040 ADD_ERROR("The two mid-sag points are closer than 20 mm.\n");
09041
09042 rr = SUB_FVEC3(pcinf,msag1) ; size = SIZE_FVEC3(rr) ;
09043 if( size < 20.0 )
09044 ADD_ERROR("The PC and 1st mid-sag points are closer than 20 mm.\n");
09045
09046 rr = SUB_FVEC3(pcinf,msag2) ; size = SIZE_FVEC3(rr) ;
09047 if( size < 20.0 )
09048 ADD_ERROR("The PC and 2nd mid-sag points are closer than 20 mm.\n");
09049
09050 /*--- compute the new y direction (beta) ---*/
09051
09052 beta = SUB_FVEC3(pcinf,acsup) ; beta = NORMALIZE_FVEC3(beta) ;
09053
09054 /*--- compute the new x direction (alpha) ---*/
09055
09056 rr = SUB_FVEC3(msag1,acsup) ;
09057 alpha1 = CROSS_FVEC3(beta,rr) ; alpha1 = NORMALIZE_FVEC3(alpha1) ;
09058
09059 rr = SUB_FVEC3(msag2,acsup) ;
09060 alpha2 = CROSS_FVEC3(beta,rr) ; alpha2 = NORMALIZE_FVEC3(alpha2) ;
09061
09062 size = DOT_FVEC3(alpha1,alpha2) ; /* angle < 2 degrees ? */
09063 if( size < 0.99939 ) /* (size = cos(angle) */
09064 ADD_ERROR("The AC + PC + mid-sag pts do not form a good plane.\n");
09065
09066 size = acos((double)size) * 180/3.14159265 ; /* report angle */
09067 sprintf(msg,
09068 "Angular deviation between AC+PC+mid-sag pts: %6.2f degrees\n",size);
09069 ADD_REPORT(msg) ;
09070
09071 alpha = SCLADD_FVEC3(0.5,alpha1,0.5,alpha2) ;
09072 alpha = NORMALIZE_FVEC3(alpha) ;
09073
09074 /*--- compute the new z direction (gamma) ---*/
09075
09076 gamma = CROSS_FVEC3(alpha,beta) ; gamma = NORMALIZE_FVEC3(gamma) ;
09077
09078 /*--- now, consider the ray from the AC posterior margin (acpos)
09079 in the gamma direction, and the ray from the AC superior
09080 edge (acsup) in the beta direction. Nominally, these rays
09081 should intersect. Find their points of closest approach
09082 (rr1,rr2). The average of these is the Talairach center
09083 of coordinates (rr). ------------------------------------*/
09084
09085 dif = SUB_FVEC3(acsup,acpos) ;
09086 size = DOT_FVEC3(dif,gamma) ;
09087 rr1 = SCLADD_FVEC3(1.0,acpos,size,gamma) ;
09088
09089 size = DOT_FVEC3(dif,beta) ;
09090 rr2 = SCLADD_FVEC3(1.0,acsup,-size,beta) ;
09091
09092 dif = SUB_FVEC3(rr1,rr2) ; size = SIZE_FVEC3(dif) ;
09093 if( size > 2.0 )
09094 ADD_ERROR("AC Talairach origin mismatch more than 2 mm!\n") ;
09095
09096 sprintf(msg,
09097 "Mismatch between AC-PC line and Talairach origin: %6.2f mm\n",size);
09098 ADD_REPORT(msg) ;
09099
09100 rr = SCLADD_FVEC3(0.5,rr1,0.5,rr2) ;
09101
09102 /*-- Use the trace of the rotation matrix to find
09103 the total rotation angle [suggested by M. Klosek] --*/
09104
09105 { float theta, costheta ;
09106
09107 costheta = 0.5 * sqrt(1.0+alpha.xyz[0]+beta.xyz[1]+gamma.xyz[2]) ;
09108 theta = 2.0 * acos(costheta) * 180/3.14159265 ;
09109 sprintf(msg,
09110 "Total rotation to align AC-PC and mid-sag: %6.2f degrees\n",theta) ;
09111 ADD_REPORT(msg) ;
09112 }
09113
09114 #ifdef AFNI_DEBUG
09115 STATUS("AC-PC alignment markers computation:") ;
09116 DUMP_FVEC3(" acsup ",acsup ) ;
09117 DUMP_FVEC3(" acpos ",acpos ) ;
09118 DUMP_FVEC3(" pcinf ",pcinf ) ;
09119 DUMP_FVEC3(" msag1 ",msag1 ) ;
09120 DUMP_FVEC3(" msag2 ",msag2 ) ;
09121 DUMP_FVEC3(" beta ",beta ) ;
09122 DUMP_FVEC3(" alpha1",alpha1) ;
09123 DUMP_FVEC3(" alpha2",alpha2) ;
09124 DUMP_FVEC3(" alpha ",alpha ) ;
09125 DUMP_FVEC3(" gamma ",gamma ) ;
09126 DUMP_FVEC3(" rr1 ",rr1 ) ;
09127 DUMP_FVEC3(" rr2 ",rr2 ) ;
09128 DUMP_FVEC3(" rr ",rr ) ;
09129 printf("\n") ;
09130 #endif
09131
09132 } /* end of AC-PC alignment case */
09133 break ;
09134
09135 } /* end of switch on marker set type */
09136
09137 if( num_error > 0 || (make_report && num_report > 0) ){
09138 (void) MCW_popup_message( im3d->vwid->marks->frame ,
09139 error_list ,
09140 MCW_USER_KILL | MCW_TIMER_KILL ) ;
09141 }
09142
09143 myXtFree( error_list ) ;
09144
09145 if( num_error > 0 && ! ELIDE_quality ) RETURN(False) ;
09146 RETURN(True) ;
09147 }
|
|
||||||||||||||||
|
Definition at line 8433 of file afni.c. References THD_marker_set::aflags, AFNI_andersonville(), AFNI_force_adoption(), AFNI_init_warp(), AFNI_make_descendants(), AFNI_make_warp(), AFNI_mark_for_death(), AFNI_marks_action_CB(), AFNI_purge_unused_dsets(), Three_D_View::anat_dset, Three_D_View::anat_now, AFNI_view_info::anat_num, THD_3dim_dataset::anat_parent, THD_3dim_dataset::anat_parent_idcode, THD_3dim_dataset::anat_parent_name, AF_options::auto_purge, BEEP_AND_RETURN, client_data, DSET_MARK_FOR_DEATH, THD_session::dsset, ENTRY, Three_D_View::fim_dset, AFNI_view_info::func_num, GLOBAL_argopt, GLOBAL_library, THD_3dim_dataset::idcode, IM3D_VALID, ISVALID_3DIM_DATASET, ISVALID_SESSION, ISVALID_VIEW, THD_3dim_dataset::kl, LAST_VIEW_TYPE, MARKACTION_WARP, THD_3dim_dataset::markers, MCW_strncpy, THD_session::num_dsset, THD_sessionlist::num_sess, AFNI_view_info::resam_vox, THD_3dim_dataset::self_name, SENSITIZE, AFNI_view_info::sess_num, SHOW_AFNI_READY, SINGLE_KILL, Three_D_View::ss_now, THD_sessionlist::ssar, AFNI_library_type::sslist, STATUS, THD_MAX_NAME, THD_write_3dim_dataset(), AFNI_widget_set::top_shell, tross_Append_History(), tross_Copy_History(), AFNI_widget_set::view, AFNI_viewing_widgets::view_bbox, VIEW_ORIGINAL_TYPE, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, AF_options::warp_4D, WARPED_VIEW, and MCW_bbox::wbut.
08435 {
08436 Three_D_View * im3d = (Three_D_View *) client_data ;
08437 THD_marker_set * markers ;
08438 THD_warp * warp ;
08439 THD_3dim_dataset * new_dset ;
08440 THD_session * ss ;
08441 int vnew , vvv , sss , aaa , fff , id ;
08442 float resam_size ;
08443 Widget wmsg ;
08444
08445 ENTRY("AFNI_marks_transform_CB") ;
08446
08447 /*--- sanity checks ---*/
08448
08449 if( ! IM3D_VALID(im3d) ) EXRETURN ;
08450
08451 markers = im3d->anat_now->markers ;
08452 if(markers == NULL || markers->aflags[1] != MARKACTION_WARP) BEEP_AND_RETURN ;
08453
08454 vnew = WARPED_VIEW(im3d->vinfo->view_type) ; /* view index of new dataset */
08455 if( !ISVALID_VIEW(vnew) ) BEEP_AND_RETURN ;
08456
08457 /*--- make warp ---*/
08458
08459 warp = AFNI_make_warp( im3d ) ;
08460 if( warp == NULL ) BEEP_AND_RETURN ;
08461
08462 /*--- create new dataset (empty at this point) ---*/
08463
08464 resam_size = im3d->vinfo->resam_vox ;
08465 new_dset = AFNI_init_warp( im3d , im3d->anat_now , warp , resam_size ) ;
08466 if( new_dset == NULL ) BEEP_AND_RETURN ;
08467
08468 { char his[128] ;
08469 tross_Copy_History( im3d->anat_now , new_dset ) ;
08470 sprintf(his,"afni: transformed to %s",VIEW_typestr[vnew]) ;
08471 tross_Append_History( new_dset , his ) ;
08472 }
08473
08474 /*----- This new dataset may replace a current dataset,
08475 and if so, THAT dataset may have a warp child,
08476 and so on. Mark those datasets for destruction,
08477 mark their anatomy children for destruction, and destroy them -----*/
08478
08479 vvv = vnew ;
08480 while( ISVALID_VIEW(vvv) && ISVALID_3DIM_DATASET(im3d->anat_dset[vvv]) ){
08481 DSET_MARK_FOR_DEATH( im3d->anat_dset[vvv] ) ;
08482 vvv = WARPED_VIEW(vvv) ;
08483 }
08484
08485 AFNI_mark_for_death(GLOBAL_library.sslist ) ; /* find descendants */
08486 AFNI_andersonville (GLOBAL_library.sslist , True ) ; /* kill (including files) */
08487
08488 /*----- Can now place the new dataset into its rightful place -----*/
08489
08490 sss = im3d->vinfo->sess_num ;
08491 aaa = im3d->vinfo->anat_num ;
08492 fff = im3d->vinfo->func_num ;
08493 GLOBAL_library.sslist->ssar[sss]->dsset[aaa][vnew] = new_dset ;
08494
08495 /* reload active datasets, to allow for destruction that may
08496 have occured (this code is copied from AFNI_initialize_view) */
08497
08498 for( id=0 ; id <= LAST_VIEW_TYPE ; id++ ){
08499 im3d->anat_dset[id] = GLOBAL_library.sslist->ssar[sss]->dsset[aaa][id] ;
08500 im3d->fim_dset[id] = GLOBAL_library.sslist->ssar[sss]->dsset[fff][id] ;
08501
08502 if( ISVALID_3DIM_DATASET(im3d->anat_dset[id]) )
08503 SENSITIZE( im3d->vwid->view->view_bbox->wbut[id], True ) ;
08504 else
08505 SENSITIZE( im3d->vwid->view->view_bbox->wbut[id], False) ;
08506 }
08507
08508 STATUS("writing new dataset") ;
08509
08510 (void) THD_write_3dim_dataset( NULL,NULL , new_dset , False ) ; /* header */
08511
08512 /*--- have transformed this anatomy dataset
08513 ==> if the input was the original view, then
08514 destroy any other marker sets in the original view
08515 and make their datasets anatomical children of this one ---*/
08516
08517 if( im3d->vinfo->view_type == VIEW_ORIGINAL_TYPE ){
08518 int id ;
08519 THD_3dim_dataset * dss ;
08520
08521 /* perform surgery on the anat datasets in this session */
08522
08523 STATUS("re-anat_parenting anatomical datasets in this session") ;
08524
08525 for( id=0 ; id < im3d->ss_now->num_dsset ; id++ ){
08526 dss = im3d->ss_now->dsset[id][0] ;
08527
08528 if( ! ISVALID_3DIM_DATASET(dss) || dss == im3d->anat_now ) continue ;
08529
08530 if( dss->markers != NULL ) SINGLE_KILL(dss->kl,dss->markers) ;
08531 dss->markers = NULL ;
08532
08533 if( dss->anat_parent == NULL ){
08534 dss->anat_parent = im3d->anat_now ;
08535 MCW_strncpy( dss->anat_parent_name ,
08536 im3d->anat_now->self_name , THD_MAX_NAME ) ;
08537 dss->anat_parent_idcode = im3d->anat_now->idcode ;
08538 }
08539 }
08540 }
08541
08542 /*--- now that we have a new potential parent (the warped dataset),
08543 and maybe some links to its warp_parent (done just above),
08544 try to make some descendants (followup warps) from it ---*/
08545
08546 AFNI_make_descendants( GLOBAL_library.sslist ) ;
08547
08548 /*--- clean up some stuff ---*/
08549
08550 if( GLOBAL_argopt.auto_purge == True ) AFNI_purge_unused_dsets() ;
08551
08552 /* Jan 31, 1995: force adoption of any dataset
08553 that was orphaned at Andersonville */
08554
08555 for( sss=0 ; sss < GLOBAL_library.sslist->num_sess ; sss++ ){
08556 ss = GLOBAL_library.sslist->ssar[sss] ;
08557 if( ISVALID_SESSION(ss) ) AFNI_force_adoption( ss , GLOBAL_argopt.warp_4D ) ;
08558 }
08559
08560 /*--- close marks panel and exit ---*/
08561
08562 #if 0
08563 XtSetSensitive( im3d->vwid->top_shell , True ) ;
08564 SHOW_AFNI_READY ;
08565 #endif
08566
08567 AFNI_marks_action_CB( NULL , (XtPointer) im3d , NULL ) ;
08568
08569 MPROBE ;
08570 EXRETURN ;
08571 }
|
|
||||||||||||||||
|
16 July 1997 * Definition at line 6059 of file afni.c. References AFNI_first_tog(), AFNI_set_tog(), AFNI_set_viewpoint(), Three_D_View::anat_now, client_data, ENTRY, THD_ivec3::ijk, IM3D_VALID, AFNI_marks_widgets::isprimary, LOAD_ANAT_VIEW, THD_3dim_dataset::markers, AFNI_widget_set::marks, MARKS_MAXNUM, THD_marker_set::numset, AFNI_marks_widgets::poptog, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, SAVE_VPT, TEMP_FVEC3, THD_3dmm_to_3dind(), AFNI_marks_widgets::tog, THD_marker_set::valid, Three_D_View::vwid, and THD_marker_set::xyz.
06061 {
06062 Three_D_View * im3d = (Three_D_View *) client_data ;
06063 XmToggleButtonCallbackStruct * cbs =
06064 (XmToggleButtonCallbackStruct *) call_data ;
06065
06066 int bval , ip , xx=-1 , yy=-1 , zz=-1 ;
06067 Widget * other_tog ;
06068
06069 ENTRY("AFNI_marktog_CB") ;
06070
06071 if( ! IM3D_VALID(im3d) || im3d->anat_now->markers == NULL ) EXRETURN ;
06072
06073 switch( cbs->reason ){
06074
06075 default: XBell(XtDisplay(w),100) ; EXRETURN ; /* error */
06076
06077 case XmCR_DISARM: /* button on the control panel */
06078 bval = AFNI_first_tog( MARKS_MAXNUM ,
06079 im3d->vwid->marks->tog ) ;
06080 other_tog = im3d->vwid->marks->poptog ;
06081 break ;
06082
06083 case XmCR_VALUE_CHANGED: /* button on the menu panel */
06084 bval = AFNI_first_tog( MARKS_MAXNUM ,
06085 im3d->vwid->marks->poptog ) ;
06086 other_tog = im3d->vwid->marks->tog ;
06087 break ;
06088 }
06089
06090 /* bval = index of toggle that is set (-1 if none)
06091 other_tog = pointer to other set of toggles;
06092 set those buttons to match now */
06093
06094 AFNI_set_tog( bval , MARKS_MAXNUM , other_tog ) ;
06095
06096 /* set point overlay colors based on bval */
06097
06098 for( ip=0 ; ip < MARKS_MAXNUM ; ip++ )
06099 im3d->vwid->marks->isprimary[ip] = False ;
06100
06101 if( bval >= 0 ){
06102 im3d->vwid->marks->isprimary[bval] = True ;
06103
06104 if( im3d->anat_now->markers->valid[bval] ){ /* jump to this point */
06105 THD_ivec3 ib ;
06106
06107 LOAD_ANAT_VIEW(im3d) ; /* 02 Nov 1996 */
06108 ib = THD_3dmm_to_3dind(
06109 im3d->anat_now ,
06110 TEMP_FVEC3( im3d->anat_now->markers->xyz[bval][0] ,
06111 im3d->anat_now->markers->xyz[bval][1] ,
06112 im3d->anat_now->markers->xyz[bval][2] )) ;
06113
06114 xx = ib.ijk[0] ; yy = ib.ijk[1] ; zz = ib.ijk[2] ; /* jump is below */
06115 SAVE_VPT(im3d) ; /* save current location as jumpback point */
06116 }
06117 }
06118
06119 if( im3d->anat_now->markers->numset > 0 ){
06120 AFNI_set_viewpoint( im3d , xx,yy,zz , REDISPLAY_OVERLAY ) ; /* redraw */
06121 }
06122
06123 RESET_AFNI_QUIT(im3d) ;
06124 EXRETURN ;
06125 }
|
|
||||||||||||||||
|
Definition at line 8255 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_jumpto_dicom(), AFNI_transform_vector(), Three_D_View::anat_dset, Three_D_View::anat_now, CAN_TALTO, MCW_choose_cbs::cval, Three_D_View::dc, MCW_DC::display, ENTRY, IM3D_VALID, LOAD_ANAT_VIEW, LOAD_FVEC3, mcwCR_string, POPDOWN_string_chooser, MCW_choose_cbs::reason, RESET_AFNI_QUIT, THD_mni_to_tta(), Three_D_View::type, VIEW_TALAIRACH_TYPE, THD_3dim_dataset::view_type, and THD_fvec3::xyz. Referenced by AFNI_imag_pop_CB().
08256 {
08257 Three_D_View * im3d = (Three_D_View *) cd ;
08258 float xx,yy,zz ;
08259 char dum1[32],dum2[32];
08260 int nn ;
08261 THD_fvec3 tv ;
08262
08263 ENTRY("AFNI_mnito_CB") ;
08264
08265 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
08266
08267 if( !CAN_TALTO(im3d) || cbs->reason != mcwCR_string ){ /* error */
08268 POPDOWN_string_chooser ;
08269 XBell( im3d->dc->display , 100 ) ;
08270 EXRETURN ;
08271 }
08272
08273 nn = sscanf( cbs->cval , "%f%[ ,]%f%[ ,]%f" , &xx,dum1,&yy,dum2,&zz ) ;
08274 if( nn != 5 ){ XBell( im3d->dc->display , 100 ) ; EXRETURN ; }
08275
08276 LOAD_ANAT_VIEW(im3d) ;
08277
08278 LOAD_FVEC3(tv,xx,yy,zz) ; /* MNI coords */
08279 tv = THD_mni_to_tta( tv ) ; /* Talairach coords */
08280
08281 /* transform from Talairach to current view, if needed */
08282
08283 if( im3d->anat_now->view_type != VIEW_TALAIRACH_TYPE )
08284 tv = AFNI_transform_vector( im3d->anat_dset[VIEW_TALAIRACH_TYPE] ,
08285 tv , im3d->anat_now ) ;
08286
08287 nn = AFNI_jumpto_dicom( im3d , tv.xyz[0], tv.xyz[1], tv.xyz[2] ) ;
08288 if( nn < 0 ) XBell( im3d->dc->display , 100 ) ;
08289
08290 RESET_AFNI_QUIT(im3d) ;
08291 EXRETURN ;
08292 }
|
|
|
Definition at line 10169 of file afni.c. References dset_ijk. Referenced by DSET2_func(), and DSETN_func().
10169 { return dset_ijk ; }
|
|
|
Definition at line 10170 of file afni.c. References dset_tin.
10170 { return dset_tin ; }
|
|
||||||||||||
|
Mar 1999: do it in an external routine, not here. * Definition at line 5525 of file afni.c. References FD_brick::a123, a2, abs, AFNI_func_overlay(), AFNI_make_tagmask(), AFNI_ttatlas_overlay(), AFNI_yesenv(), Three_D_View::anat_now, color, AFNI_view_info::crosshair_gap, AFNI_view_info::crosshair_ovcolor, AFNI_view_info::crosshair_visible, THD_3dim_dataset::daxes, Three_D_View::dc, FD_brick::del1, FD_brick::del2, FD_brick::del3, FD_brick::dset, MRI_IMAGE::dx, AFNI_ovtemplate::dx, MRI_IMAGE::dy, AFNI_ovtemplate::dy, MRI_IMAGE::dz, ENTRY, fb, AFNI_view_info::func_visible, AFNI_view_info::i1, THD_ivec3::ijk, IM3D_VALID, AFNI_marks_widgets::isprimary, ISQ_overlay(), AFNI_view_info::j2, AFNI_view_info::k3, KILL_1MRI, MRI_IMAGE::kind, LOAD_DSET_VIEWS, THD_3dim_dataset::markers, AFNI_widget_set::marks, MARKS_MAXNUM, MCW_grapher::mat, MAX, mri_free(), mri_new(), MRI_SHORT_PTR, myXtNew, FD_brick::n1, FD_brick::n2, THD_usertaglist::num, AFNI_ovtemplate::numpix, THD_marker_set::numset, MRI_IMAGE::nx, MRI_IMAGE::ny, AFNI_marks_widgets::ov_mask, AFNI_marks_widgets::ov_pcolor, AFNI_marks_widgets::ov_scolor, AFNI_marks_widgets::ov_visible, FD_brick::parent, AFNI_view_info::pts_color, AFNI_view_info::pts_visible, RETURN, AFNI_view_info::see_ttatlas, THD_usertag::set, STATUS, THD_usertaglist::tag, AFNI_marks_widgets::tag_visible, THD_3dim_dataset::tagset, TEMP_FVEC3, TEMP_IVEC3, THD_3dind_to_fdind(), THD_3dmm_to_3dind(), THD_dicomm_to_3dmm(), UNDERLAY_TO_GRAPHER, UNDERLAY_TO_OVERLAY, THD_marker_set::valid, VIEW_TALAIRACH_TYPE, THD_3dim_dataset::view_type, Three_D_View::vinfo, Three_D_View::vwid, THD_usertag::x, AFNI_view_info::xhairs_all, AFNI_view_info::xhairs_ndown, AFNI_view_info::xhairs_nskip, AFNI_view_info::xhairs_nup, AFNI_view_info::xhairs_orimask, AFNI_view_info::xhairs_periodic, AFNI_view_info::xhairs_show_montage, THD_dataxes::xxorient, THD_marker_set::xyz, THD_usertag::y, THD_dataxes::yyorient, THD_usertag::z, and THD_dataxes::zzorient. Referenced by AFNI_brick_to_mri().
05526 {
05527 Three_D_View * im3d = (Three_D_View *) br->parent ;
05528 MRI_IMAGE * im = NULL , * fov = NULL ;
05529 register short * oar ;
05530 int ii,jj , npix , xx,yy,zz , nx,ny , gap,ovc , icr,jcr,kcr ;
05531 Boolean ovgood ;
05532 THD_ivec3 ib ;
05533 THD_3dim_dataset * dset ;
05534 FD_brick * br_fim ;
05535 int do_xhar ; /* 22 Mar 2002 */
05536 MRI_IMAGE *rgbov = NULL ; /* 30 Jan 2003 */
05537
05538 ENTRY("AFNI_overlay") ;
05539
05540 if( ! IM3D_VALID(im3d) ) RETURN(NULL) ;
05541
05542 /*--- check if crosshairs, markers, or functions are visible ---*/
05543
05544 do_xhar = (im3d->vinfo->crosshair_visible && !AFNI_yesenv("AFNI_CROSSHAIR_LINES")) ;
05545
05546 dset = im3d->anat_now ;
05547
05548 ovgood = do_xhar ||
05549
05550 ( dset->markers != NULL &&
05551 (dset->markers->numset > 0) &&
05552 (im3d->vwid->marks->ov_visible == True) ) ||
05553
05554 ( dset->tagset != NULL &&
05555 dset->tagset->num > 0 &&
05556 (im3d->vwid->marks->tag_visible == True) ) ||
05557
05558 #ifdef ALLOW_DATASET_VLIST
05559 ( dset->pts != NULL && im3d->vinfo->pts_visible == True ) ||
05560 #endif
05561
05562 ( im3d->vinfo->func_visible == True ) ||
05563
05564 ( im3d->vinfo->see_ttatlas &&
05565 im3d->anat_now->view_type == VIEW_TALAIRACH_TYPE ) ;
05566
05567 if( ! ovgood ) RETURN(NULL) ;
05568
05569 /*-- at least one source of an overlay is present --*/
05570
05571 if(PRINT_TRACING)
05572 { char str[256] ; sprintf(str,"n1=%d n2=%d",br->n1,br->n2) ; STATUS(str) ; }
05573
05574 LOAD_DSET_VIEWS(im3d) ; /* 02 Nov 1996 */
05575
05576 /*----- get functional overlay, if desired -----*/
05577
05578 if( im3d->vinfo->func_visible ){
05579 br_fim = UNDERLAY_TO_OVERLAY(im3d,br) ;
05580 fov = AFNI_func_overlay( n , br_fim ) ;
05581 if( fov != NULL && fov->kind == MRI_rgb ){ /* 30 Jan 2003: */
05582 rgbov = fov ; fov = NULL ; /* save RGB overlay for later */
05583 }
05584 }
05585
05586 /*----- 25 Jul 2001: get TT atlas overlay, if desired and possible -----*/
05587
05588 if( im3d->vinfo->see_ttatlas &&
05589 im3d->anat_now->view_type == VIEW_TALAIRACH_TYPE ){
05590
05591 MRI_IMAGE * tov ;
05592
05593 int ax_1 = br->a123.ijk[0] ;
05594 int ax_2 = br->a123.ijk[1] ;
05595 int ax_3 = br->a123.ijk[2] ;
05596
05597 tov = AFNI_ttatlas_overlay( im3d , n , ax_1 , ax_2 , ax_3 , fov ) ;
05598 if( tov != NULL && tov != fov ){
05599 if( fov != NULL ) mri_free(fov) ; /* should not happen */
05600 fov = tov ;
05601 }
05602 }
05603
05604 /*----- now set up overlay image as the functional overlay
05605 (if present), or as a new blank image (otherwise). -----*/
05606
05607 if( fov != NULL ){
05608
05609 if(PRINT_TRACING)
05610 { char str[256] ;
05611 sprintf(str,"new overlay from AFNI_func_overlay: nx=%d ny=%d\n",fov->nx,fov->ny) ;
05612 STATUS(str) ; }
05613
05614 im = fov ; ovgood = True ;
05615 oar = MRI_SHORT_PTR(im) ;
05616 } else {
05617 STATUS("new overlay is created de novo") ;
05618 im = mri_new( br->n1 , br->n2 , MRI_short ) ; ovgood = False ;
05619 oar = MRI_SHORT_PTR(im) ;
05620 }
05621
05622 nx = im->nx ;
05623 ny = im->ny ;
05624 npix = nx * ny ;
05625 im->dx = br->del1 ; /* load dimensions (not that anyone cares) */
05626 im->dy = br->del2 ;
05627 im->dz = br->del3 ;
05628
05629 /*----- put crosshairs on, if desired -----*/
05630
05631 if( do_xhar ){
05632 MCW_grapher * grapher = UNDERLAY_TO_GRAPHER(im3d,br) ;
05633
05634 ib = THD_3dind_to_fdind( br ,
05635 TEMP_IVEC3( im3d->vinfo->i1 ,
05636 im3d->vinfo->j2 ,
05637 im3d->vinfo->k3 ) ) ;
05638
05639 /** April 1996: Only put crosshairs on if image number
05640 matches current slice number of viewpoint.
05641 (This allows for the montage multislice view) **/
05642
05643 /** July 1996: Allow for multiple crosshairs to indicate
05644 the location of montage multislice views. **/
05645
05646 /** Aug 1996: Allow for periodic (wrap) or non-periodic montages.
05647 Also, if in "Single" mode and also are graphing,
05648 then only draw the grapher frame, not the crosshairs. **/
05649
05650 /** Dec 1998: Allow for user to turn off some directions of crosshairs **/
05651
05652 if( n == ib.ijk[2] || im3d->vinfo->xhairs_all ){
05653 int jp,ip , jcen,icen , gappp ;
05654 int idown,iup,iskip , jdown,jup,jskip , imon,jmon ;
05655 int a1 = br->a123.ijk[0] , /* x axis of the brick? */
05656 ax = abs(a1) - 1 ; /* 0,1,2 for dataset x,y,z */
05657 int a2 = br->a123.ijk[1] , /* y axis of the brick? */
05658 ay = abs(a2) - 1 ; /* 0,1,2 for dataset x,y,z */
05659 int a3 = br->a123.ijk[2] , /* z axis of the brick? */
05660 az = abs(a3) - 1 ; /* 0,1,2 for dataset x,y,z */
05661
05662 /* 31 Dec 1998: spatial orientations of image axes */
05663
05664 int ox = (ax==0) ? br->dset->daxes->xxorient :
05665 (ax==1) ? br->dset->daxes->yyorient : br->dset->daxes->zzorient ;
05666
05667 int oy = (ay==0) ? br->dset->daxes->xxorient :
05668 (ay==1) ? br->dset->daxes->yyorient : br->dset->daxes->zzorient ;
05669
05670 ovc = im3d->vinfo->crosshair_ovcolor ;
05671 gap = (grapher==NULL) ? im3d->vinfo->crosshair_gap : (grapher->mat+1)/2 ;
05672 icen = ib.ijk[0] ;
05673 jcen = ib.ijk[1] ;
05674
05675 /** initialize montage steps **/
05676
05677 if( im3d->vinfo->xhairs_show_montage ){ /* in "Multi" mode */
05678 iskip = im3d->vinfo->xhairs_nskip.ijk[ax] + 1 ;
05679 jskip = im3d->vinfo->xhairs_nskip.ijk[ay] + 1 ;
05680 if( a1 > 0 ){
05681 idown = im3d->vinfo->xhairs_ndown.ijk[ax] ;
05682 iup = im3d->vinfo->xhairs_nup.ijk[ax] ;
05683 } else {
05684 iup = im3d->vinfo->xhairs_ndown.ijk[ax] ;
05685 idown = im3d->vinfo->xhairs_nup.ijk[ax] ;
05686 }
05687 if( a2 > 0 ){
05688 jdown = im3d->vinfo->xhairs_ndown.ijk[ay] ;
05689 jup = im3d->vinfo->xhairs_nup.ijk[ay] ;
05690 } else {
05691 jup = im3d->vinfo->xhairs_ndown.ijk[ay] ;
05692 jdown = im3d->vinfo->xhairs_nup.ijk[ay] ;
05693 }
05694
05695 if(PRINT_TRACING)
05696 { char str[256] ;
05697 sprintf(str,"montage xhairs: ax =%d ay =%d az =%d",ax,ay,az) ; STATUS(str);
05698 sprintf(str," iskip=%d idown=%d iup=%d",iskip,idown,iup); STATUS(str);
05699 sprintf(str," jskip=%d jdown=%d jup=%d",jskip,jdown,jup); STATUS(str);
05700 sprintf(str,"orimask=%d ox=%d oy=%d",im3d->vinfo->xhairs_orimask,ox,oy); STATUS(str);
05701 }
05702
05703 } else { /* in "Single" Mode */
05704 idown = iup = jdown = jup = iskip = jskip = 0 ;
05705 if( grapher != NULL ){ idown=-(iup+1); jdown=-(jup+1); } /* skip lines? */
05706 }
05707
05708 /* draw vertical lines first */
05709
05710 if( (im3d->vinfo->xhairs_orimask & (1<<oy)) != 0 ){ /* 31 Dec 1998 */
05711 for( imon=-idown ; imon <= iup ; imon++ ){
05712 icr = icen + imon * iskip ;
05713
05714 if( im3d->vinfo->xhairs_periodic ){
05715 while( icr < 0 ) icr += nx ;
05716 while( icr >= nx ) icr -= nx ;
05717 } else {
05718 if( icr < 0 || icr >= nx ) continue ;
05719 }
05720
05721 gappp = (abs(icr-icen) <= gap) ? gap : -1 ; /* no gap if far from center */
05722
05723 /* if lines are closely packed, only do alternate pixels */
05724
05725 if( idown+iup > 0 && iskip == 1 && icr != icen ){
05726 for( jj=(imon+idown)%2 ; jj < ny ; jj+=2 )
05727 if( abs(jj-jcen) > gappp ) oar[icr+nx*jj] = ovc ;
05728 } else {
05729 for( jj=0 ; jj < ny ; jj++ )
05730 if( abs(jj-jcen) > gappp ) oar[icr+nx*jj] = ovc ;
05731 }
05732 }
05733 }
05734
05735 /* draw horizontal lines */
05736
05737 if( (im3d->vinfo->xhairs_orimask & (1<<ox)) != 0 ){ /* 31 Dec 1998 */
05738 for( jmon=-jdown ; jmon <= jup ; jmon++ ){
05739 jcr = jcen + jmon * jskip ;
05740 if( im3d->vinfo->xhairs_periodic ){
05741 while( jcr < 0 ) jcr += ny ;
05742 while( jcr >= ny ) jcr -= ny ;
05743 } else {
05744 if( jcr < 0 || jcr >= ny ) continue ;
05745 }
05746
05747 gappp = (abs(jcr-jcen) <= gap) ? gap : -1 ; /* no gap if far from center */
05748
05749 /* if lines are closely packed, only do alternate pixels */
05750
05751 if( jdown+jup > 0 && jskip == 1 && jcr != jcen ){
05752 for( ii=(jmon+jdown)%2 ; ii < nx ; ii+=2 )
05753 if( abs(ii-icen) > gappp ) oar[ii+nx*jcr] = ovc ;
05754 } else {
05755 for( ii=0 ; ii < nx ; ii++ )
05756 if( abs(ii-icen) > gappp ) oar[ii+nx*jcr] = ovc ;
05757 }
05758 }
05759 }
05760
05761 /* draw grapher frame, if needed */
05762
05763 if( grapher != NULL ){
05764 int gs = gap , gb = (grapher->mat +2)/2 ;
05765
05766 jcr = jcen ; icr = icen ;
05767
05768 ip = icr - gb ; if( ip < 0 ) ip += nx ;
05769 ii = icr + gs ; if( ii >= nx ) ii -= nx ;
05770 for( jj=jcr-gb ; jj <= jcr+gs ; jj++ ){
05771 jp = jj ; if( jp < 0 ) jp += ny ;
05772 else if( jp >= ny ) jp -= ny ;
05773 oar[ip+nx*jp] = ovc ;
05774 oar[ii+nx*jp] = ovc ;
05775 }
05776
05777 jp = jcr - gb ; if( jp < 0 ) jp += ny ;
05778 jj = jcr + gs ; if( jj >= ny ) jj -= ny ;
05779 for( ii=icr-gb ; ii <= icr+gs ; ii++ ){
05780 ip = ii ; if( ip < 0 ) ip += nx ;
05781 else if( ip >= nx ) ip -= nx ;
05782 oar[ip+nx*jp] = ovc ;
05783 oar[ip+nx*jj] = ovc ;
05784 }
05785 } /* end if "if grapher exists" */
05786
05787 ovgood = True ;
05788 } /* end of "if correct slice" */
05789
05790 } /* end of crosshairs */
05791
05792 /*----- put markers on, if desired -----*/
05793
05794 if( im3d->anat_now->markers != NULL &&
05795 im3d->anat_now->markers->numset > 0 &&
05796 (im3d->vwid->marks->ov_visible == True) ){
05797
05798 THD_marker_set * markers = im3d->anat_now->markers ;
05799 AFNI_marks_widgets * marks = im3d->vwid->marks ;
05800 AFNI_ovtemplate * tem = &(marks->ov_mask) ;
05801 int xbase , ybase , zbase , color ;
05802 THD_ivec3 ib ;
05803
05804 /* do secondary points first */
05805
05806 color = marks->ov_scolor ;
05807
05808 for( jj=0 ; jj < MARKS_MAXNUM ; jj++ ){
05809 if( markers->valid[jj] && /* is point set? */
05810 color > 0 && /* will show up? */
05811 !marks->isprimary[jj] ){ /* is secondary? */
05812
05813 ib = THD_3dmm_to_3dind( br->dset ,
05814 TEMP_FVEC3( markers->xyz[jj][0] ,
05815 markers->xyz[jj][1] ,
05816 markers->xyz[jj][2] ) ) ;
05817 ib = THD_3dind_to_fdind( br , ib ) ;
05818
05819 xbase = ib.ijk[0] ; /* coordinates */
05820 ybase = ib.ijk[1] ; /* in and out */
05821 zbase = ib.ijk[2] ; /* of plane */
05822
05823 if( zbase == n ){ /* in this display plane */
05824 ovgood = True ;
05825 for( ii=0 ; ii < tem->numpix ; ii++ ){
05826 xx = xbase + tem->dx[ii] ;
05827 yy = ybase + tem->dy[ii] ;
05828 if( xx >= 0 && xx < nx && yy >=0 && yy < ny )
05829 oar[xx+nx*yy] = color ;
05830 }
05831 }
05832 } /* end if point set, and secondary */
05833 } /* end for loop over all secondary points */
05834
05835 /* duplicate above for primary points */
05836
05837 color = marks->ov_pcolor ;
05838
05839 for( jj=0 ; jj < MARKS_MAXNUM ; jj++ ){
05840 if( markers->valid[jj] && /* is point set? */
05841 color > 0 && /* will show up? */
05842 marks->isprimary[jj] ){ /* is primary? */
05843
05844 ib = THD_3dmm_to_3dind( br->dset ,
05845 TEMP_FVEC3( markers->xyz[jj][0] ,
05846 markers->xyz[jj][1] ,
05847 markers->xyz[jj][2] ) ) ;
05848 ib = THD_3dind_to_fdind( br , ib ) ;
05849
05850 xbase = ib.ijk[0] ; /* coordinates */
05851 ybase = ib.ijk[1] ; /* in and out */
05852 zbase = ib.ijk[2] ; /* of plane */
05853
05854 if( zbase == n ){ /* in this display plane */
05855 ovgood = True ;
05856 for( ii=0 ; ii < tem->numpix ; ii++ ){
05857 xx = xbase + tem->dx[ii] ;
05858 yy = ybase + tem->dy[ii] ;
05859 if( xx >= 0 && xx < nx && yy >=0 && yy < ny )
05860 oar[xx+nx*yy] = color ;
05861 }
05862 }
05863 } /* end if point set, and primary */
05864 } /* end for loop over all secondary points */
05865
05866 } /* end if markers to be shown */
05867
05868 /*----- put tags on, if desired -----*/
05869
05870 if( im3d->anat_now->tagset != NULL &&
05871 im3d->anat_now->tagset->num > 0 &&
05872 (im3d->vwid->marks->tag_visible == True) ){
05873
05874 static AFNI_ovtemplate * tem = NULL ;
05875 static int npold = -1 ;
05876
05877 THD_usertaglist * tl = im3d->anat_now->tagset ;
05878 int xbase , ybase , zbase , color , np ;
05879 THD_ivec3 ib ;
05880 THD_fvec3 fb ;
05881
05882 if( tem == NULL ) tem = myXtNew(AFNI_ovtemplate) ; /* once only */
05883 np = MAX(nx,ny)/64 ; np = MAX(np,2) ;
05884 if( np != npold ){ npold = np ; AFNI_make_tagmask(np,0,tem) ; }
05885
05886 color = im3d->vwid->marks->ov_pcolor ; /* doesn't have its own color */
05887
05888 for( jj=0 ; jj < tl->num ; jj++ ){
05889 if( tl->tag[jj].set && color > 0 ){
05890
05891 fb = THD_dicomm_to_3dmm( br->dset, TEMP_FVEC3( tl->tag[jj].x ,
05892 tl->tag[jj].y ,
05893 tl->tag[jj].z ) );
05894 ib = THD_3dmm_to_3dind( br->dset , fb ) ;
05895 ib = THD_3dind_to_fdind( br , ib ) ;
05896
05897 xbase = ib.ijk[0] ; /* coordinates */
05898 ybase = ib.ijk[1] ; /* in and out */
05899 zbase = ib.ijk[2] ; /* of plane */
05900
05901 if( zbase == n ){ /* in this display plane */
05902 ovgood = True ;
05903 for( ii=0 ; ii < tem->numpix ; ii++ ){
05904 xx = xbase + tem->dx[ii] ;
05905 yy = ybase + tem->dy[ii] ;
05906 if( xx >= 0 && xx < nx && yy >=0 && yy < ny )
05907 oar[xx+nx*yy] = color ;
05908 }
05909 }
05910 }
05911 }
05912 } /* end if tags to be shown */
05913
05914 #ifdef ALLOW_DATASET_VLIST
05915 /*----- May 1995: additional points (single pixels) -----*/
05916
05917 if( im3d->vinfo->pts_visible &&
05918 dset->pts != NULL &&
05919 im3d->vinfo->pts_color > 0 ){
05920
05921 int color , jj ;
05922 THD_ivec3 ib ;
05923
05924 color = im3d->vinfo->pts_color ;
05925
05926 for( jj=0 ; jj < dset->pts->num ; jj++ ){
05927 ib = THD_3dind_to_fdind( br , dset->pts->ijk[jj] ) ;
05928 if( ib.ijk[2] == n ){
05929 oar[ ib.ijk[0] + nx * ib.ijk[1] ] = color ;
05930 ovgood = True ;
05931 }
05932 }
05933 }
05934 #endif
05935
05936 /*----- return overlay (kill it if nothing happened) -----*/
05937
05938 if( !ovgood ) KILL_1MRI(im) ;
05939
05940 /* 30 Jan 2003:
05941 If the functional overlay is in RGB format,
05942 then must meld that with the short color index image */
05943
05944 if( rgbov != NULL ){
05945 if( im != NULL ){
05946 MRI_IMAGE *qim ;
05947 qim = ISQ_overlay( im3d->dc , rgbov , im , 1.0 ) ;
05948 mri_free(rgbov); mri_free(im); rgbov = qim;
05949 }
05950 im = rgbov ;
05951 }
05952
05953 RETURN( im ) ;
05954 }
|
|
||||||||||||
|
Definition at line 382 of file afni.c. References AFMALL, AFNI_setenv(), AFNI_syntax(), AFNI_yesenv(), AF_options::allow_rt, argc, AF_options::auto_purge, COM_com, COM_num, AFNI_library_type::cord, AF_options::datum, AF_options::destruct, AF_options::dy, AF_options::dz, AF_options::elide_quality, AF_options::enable_suma, ENTRY, ERROR_message(), FatalError, THD_coorder::first, AF_options::first_file_arg, AF_options::gamma, getenv(), GLOBAL_argopt, GLOBAL_library, AF_options::gsfac, AF_options::ignore, INIT_ignore, INIT_posfunc, INIT_purge, INIT_tlrc_big, AF_options::install_cmap, AF_options::keep_logo, AF_options::layout_fname, AF_options::left_is_left, MAIN_argc, MAIN_argv, MAIN_shell, MCW_strncpy, AF_options::ncolor, AF_options::no_frivolities, AF_options::noplugins, AF_options::noplugouts, AF_options::orient_code, AF_options::plugout_code, AF_options::port_niml, AF_options::pos_func, prepend_string_to_args(), AF_options::read_1D, AF_options::read_dsets, AF_options::read_images, AF_options::read_sessions, AF_options::read_tim, AF_options::recurse, AF_options::resize_images, AF_options::script_fname, THD_coorder::second, SESSTRAIL, AF_options::skip_afnirc, strtod(), THD_coorder_fill(), THD_is_file(), THD_coorder::third, AF_options::title_name, AF_options::tlrc_big, AF_options::unique_dcs, AF_options::warp_4D, AF_options::xtwarns, THD_coorder::xxsign, AF_options::yes_niml, THD_coorder::yysign, and THD_coorder::zzsign. Referenced by main().
00383 {
00384 int narg = 1 ;
00385 char * env_orient , * env ;
00386 int argc=in_argc , new_argc ; /* 18 Nov 1999 */
00387 char ** argv=in_argv , ** new_argv=NULL ;
00388
00389 ENTRY("AFNI_parse_args") ;
00390
00391 if( argc > 1 && strncmp(argv[1],"-help",2) == 0 ) AFNI_syntax() ;
00392
00393 GLOBAL_argopt.dz = 1.0 ; /* set up defaults */
00394 GLOBAL_argopt.dy = 1.0 ;
00395 GLOBAL_argopt.ignore = INIT_ignore ;
00396 GLOBAL_argopt.elide_quality = 0 ; /* Dec 1997 */
00397 GLOBAL_argopt.no_frivolities = 0 ; /* 01 Aug 1998 */
00398 GLOBAL_argopt.install_cmap = 0 ; /* 14 Sep 1998 */
00399 GLOBAL_argopt.read_1D = 1 ; /* 27 Jan 2000 */
00400
00401 GLOBAL_argopt.enable_suma = 1 ; /* 29 Aug 2001 */
00402
00403 GLOBAL_argopt.yes_niml = AFNI_yesenv("AFNI_NIML_START") ;
00404 GLOBAL_argopt.port_niml = 0 ; /* 10 Dec 2002 */
00405
00406 #if 0
00407 GLOBAL_argopt.allow_rt = 0 ; /* April 1997 */
00408 #else /* 09 Oct 2000 */
00409 GLOBAL_argopt.allow_rt = AFNI_yesenv("AFNI_REALTIME_Activate") ;
00410 GLOBAL_argopt.no_frivolities = (GLOBAL_argopt.allow_rt != 0) ;
00411 #endif
00412
00413 SESSTRAIL = 1 ;
00414 env = getenv( "AFNI_SESSTRAIL" ) ;
00415 if( env != NULL ){
00416 SESSTRAIL = strtol(env,NULL,10) ;
00417 if( SESSTRAIL < 0 ) SESSTRAIL = 0 ; /* 24 Aug 2000 */
00418 }
00419
00420 GLOBAL_argopt.elide_quality = AFNI_yesenv("AFNI_MARKERS_NOQUAL") ;
00421
00422 /* 24 Sep 2000: get the default layout name (add $HOME) */
00423
00424 { char * lf = getenv("AFNI_LAYOUT_FILE") ;
00425 if( lf != NULL ){
00426 char * eh = getenv("HOME") , * ff ;
00427 int ll = strlen(lf) + 8 ;
00428 if( eh != NULL ) ll += strlen(eh) ;
00429 ff = AFMALL(char, ll) ;
00430 if( eh != NULL && lf[0] != '/' ){ strcpy(ff,eh) ; strcat(ff,"/") ; }
00431 else { ff[0] = '\0' ; }
00432 strcat(ff,lf) ;
00433 GLOBAL_argopt.layout_fname = ff ;
00434 }
00435 }
00436
00437 /* 21 Jan 2003: get the startup script name */
00438
00439 { char *lf = getenv("AFNI_STARTUP_SCRIPT") ;
00440 if( lf == NULL ) lf = ".afni.startup_script" ;
00441 if( lf != NULL ){
00442 char *eh = NULL , *ff ;
00443 int ll = strlen(lf) + 8 ;
00444 if( !THD_is_file(lf) && lf[0] != '/' ) eh = getenv("HOME") ;
00445 if( eh != NULL ) ll += strlen(eh) ;
00446 ff = AFMALL(char, ll) ;
00447 if( eh != NULL ){ strcpy(ff,eh) ; strcat(ff,"/") ; }
00448 else { ff[0] = '\0' ; }
00449 strcat(ff,lf) ;
00450 GLOBAL_argopt.script_fname = ff ;
00451 }
00452 }
00453
00454 /*-- 18 Nov 1999: Allow setting of options from environment --*/
00455
00456 env = getenv( "AFNI_OPTIONS" ) ;
00457 if( env != NULL )
00458 prepend_string_to_args( env, in_argc, in_argv, &new_argc, &new_argv ) ;
00459 if( new_argv != NULL ){
00460 MAIN_argc = argc = new_argc ;
00461 MAIN_argv = argv = new_argv ;
00462 }
00463
00464 #ifdef ALLOW_PLUGINS
00465 GLOBAL_argopt.noplugins = AFNI_yesenv( "AFNI_NOPLUGINS" ) ;
00466 GLOBAL_argopt.noplugouts = !AFNI_yesenv( "AFNI_YESPLUGOUTS" ) ;
00467 #endif
00468
00469 env_orient = getenv( "AFNI_ORIENT" ) ;
00470
00471 GLOBAL_argopt.read_sessions = True ; /* exactly one of these should be True */
00472 GLOBAL_argopt.read_images = False ;
00473 GLOBAL_argopt.read_dsets = False ; /* 17 Mar 2000 */
00474
00475 GLOBAL_argopt.datum = ILLEGAL_TYPE ;
00476
00477 GLOBAL_argopt.gamma = INIT_gamma ;
00478 GLOBAL_argopt.gsfac = 0.0 ;
00479 GLOBAL_argopt.ncolor = INIT_ngray ;
00480 #if MMAP_THRESHOLD > 0
00481 GLOBAL_argopt.auto_purge = INIT_purge ;
00482 #else
00483 GLOBAL_argopt.auto_purge = True ;
00484 #endif
00485 GLOBAL_argopt.resize_images = False ; /* False means all images must match */
00486 GLOBAL_argopt.keep_logo = False ; /* For making pretty pictures? */
00487 GLOBAL_argopt.pos_func = INIT_posfunc ;/* Positive valued functions? */
00488 GLOBAL_argopt.recurse = 0 ; /* Recurse on session directories? */
00489 GLOBAL_argopt.xtwarns = False ; /* True means keep Xt warnings turned on */
00490 GLOBAL_argopt.destruct = False ; /* True means allow overwrite of datasets */
00491 /* (Not yet properly implemented!) */
00492
00493 GLOBAL_argopt.tlrc_big = INIT_tlrc_big ; /* use the big Talairach box? */
00494 #ifndef WARP_4D
00495 GLOBAL_argopt.warp_4D = False ;
00496 #else
00497 GLOBAL_argopt.warp_4D = True ;
00498 #endif
00499
00500 GLOBAL_argopt.unique_dcs = False ; /* 06 Nov 1996 */
00501
00502 strcpy(GLOBAL_argopt.orient_code,"---") ;
00503
00504 strcpy(GLOBAL_argopt.title_name,"AFNI") ; /* default title bar name */
00505
00506 GLOBAL_argopt.left_is_left = AFNI_yesenv( "AFNI_LEFT_IS_LEFT" ) ;
00507
00508 GLOBAL_argopt.read_tim = 0 ; /* 19 Oct 1999 */
00509
00510 while( narg < argc ){
00511
00512 if( argv[narg][0] != '-' ) break ; /* no - ==> quit */
00513
00514 #ifdef USE_TRACING
00515 if( strncmp(argv[narg],"-trace",5) == 0 ){
00516 DBG_trace = 1 ;
00517 narg++ ; continue ;
00518 }
00519 if( strncmp(argv[narg],"-TRACE",5) == 0 ){ /* 23 Aug 1998 */
00520 DBG_trace = 2 ;
00521 if( MAIN_shell != NULL )
00522 XSynchronize(XtDisplay(MAIN_shell),TRUE) ; /* 01 Dec 1999 */
00523 narg++ ; continue ;
00524 }
00525 #endif
00526
00527 /*----- -Dname=val -- set environment variable [22 Mar 2005] -----*/
00528
00529 if( strncmp(argv[narg],"-D",2) == 0 && strchr(argv[narg],'=') != NULL ){
00530 (void) AFNI_setenv( argv[narg]+2 ) ;
00531 narg++ ; continue ; /* go to next arg */
00532 }
00533
00534 /*----- -layout (23 Sep 2000) -----*/
00535
00536 if( strcmp(argv[narg],"-layout") == 0 ){
00537 if( narg+1 >= argc ) FatalError("need an argument after -layout!") ;
00538 GLOBAL_argopt.layout_fname = argv[++narg] ; /* just a pointer */
00539 narg++ ; continue ; /* go to next arg */
00540 }
00541
00542 /*----- -no1D option (27 Jan 2000) ----- */
00543
00544 if( strncmp(argv[narg],"-no1D",5) == 0 ){
00545 GLOBAL_argopt.read_1D = 0 ;
00546 narg++ ; continue ; /* go to next arg */
00547 }
00548
00549 /*----- -skip_afnirc option (14 Jul 1998) -----*/
00550
00551 if( strncmp(argv[narg],"-skip_afnirc",12) == 0 ){
00552 GLOBAL_argopt.skip_afnirc = 1 ;
00553 narg++ ; continue ; /* go to next arg */
00554 }
00555
00556 /*----- -rt option -----*/
00557
00558 if( strncmp(argv[narg],"-rt",3) == 0 ){
00559 GLOBAL_argopt.allow_rt = -1 ;
00560 GLOBAL_argopt.no_frivolities = 1 ;
00561 #if 0
00562 #ifdef USE_TRACING
00563 DBG_trace = 0 ; /* 26 Jan 2001 */
00564 #endif
00565 #endif
00566 narg++ ; continue ; /* go to next arg */
00567 }
00568
00569 if( strncmp(argv[narg],"-nort",5) == 0 ){ /* 09 Oct 2000 */
00570 GLOBAL_argopt.allow_rt = 0 ;
00571 GLOBAL_argopt.no_frivolities = 0 ;
00572 narg++ ; continue ; /* go to next arg */
00573 }
00574
00575 /*----- -noqual -----*/
00576
00577 if( strncmp(argv[narg],"-noqual",6) == 0 ){
00578 GLOBAL_argopt.elide_quality = 1 ;
00579 narg++ ; continue ; /* go to next arg */
00580 }
00581
00582 /*---- -agni [29 Aug 2001] or -suma -----*/
00583
00584 if( strcmp(argv[narg],"-agni")==0 || strcmp(argv[narg],"-suma")==0 ){
00585 fprintf(stderr,"\n-agni/-suma are now turned on by default\n") ;
00586 GLOBAL_argopt.enable_suma = 1 ;
00587 narg++ ; continue ; /* go to next arg */
00588 }
00589
00590 /*---- -com ccc [29 Jul 2005] ----*/
00591
00592 if( strcmp(argv[narg],"-com") == 0 ){
00593 int ll ;
00594 if( ++narg >= argc ) FatalError("need an argument after -com!");
00595 ll = strlen(argv[narg]) ;
00596 if( ll > 255 ) ERROR_message("argument after -com is too long!" );
00597 else if( ll < 3 ) ERROR_message("argument after -com is too short!");
00598 else COM_com[ COM_num++ ] = argv[narg] ;
00599
00600 narg++ ; continue ; /* go to next arg */
00601 }
00602
00603 /*---- -niml [28 Feb 2002] -----*/
00604
00605 if( strcmp(argv[narg],"-niml") == 0 ){
00606 if( GLOBAL_argopt.yes_niml )
00607 fprintf(stderr,"\n-niml is already turned on\n") ;
00608 GLOBAL_argopt.yes_niml++ ;
00609 narg++ ; continue ; /* go to next arg */
00610 }
00611
00612 /*---- -np port [10 Dec 2002] ----*/
00613
00614 if( strcmp(argv[narg],"-np") == 0 ){
00615 float val ;
00616 if( narg+1 >= argc ) FatalError("need an argument after -np!");
00617
00618 val = strtod( argv[++narg] , NULL ) ;
00619 if( val >= 1024 && val <= 65535 ) GLOBAL_argopt.port_niml = (int)val ;
00620 else fprintf(stderr,
00621 "\n*** WARNING: -np %s is illegal!\n", argv[narg]);
00622 narg++ ; continue ; /* go to next arg */
00623 }
00624
00625 if( strcmp(argv[narg],"-noniml") == 0 ){
00626 GLOBAL_argopt.yes_niml-- ;
00627 if( GLOBAL_argopt.yes_niml < 0 ) GLOBAL_argopt.yes_niml = 0 ;
00628 narg++ ; continue ; /* go to next arg */
00629 }
00630
00631 /*----- -tbar 'name' option -----*/
00632
00633 if( strncmp(argv[narg],"-tbar",5) == 0 ){
00634 if( narg+1 >= argc ) FatalError("need an argument after -tbar!");
00635 MCW_strncpy(GLOBAL_argopt.title_name,argv[++narg],32) ;
00636 narg++ ; continue ; /* go to next arg */
00637 }
00638
00639 /*----- -xtwarns option -----*/
00640
00641 if( strncmp(argv[narg],"-xtwarns",6) == 0 ){
00642 GLOBAL_argopt.xtwarns = True ;
00643 narg++ ; continue ; /* go to next arg */
00644 }
00645
00646 /*----- -destruct option -----*/
00647
00648 if( strncmp(argv[narg],"-destruct",6) == 0 ){ /** has no effect at present **/
00649 fprintf(stderr,"\n*** -destruct option not implemented at present! ***\n") ;
00650 GLOBAL_argopt.destruct = False ;
00651 narg++ ; continue ; /* go to next arg */
00652 }
00653
00654 /*----- -posfunc option -----*/
00655
00656 if( strncmp(argv[narg],"-posfunc",6) == 0 ){
00657 GLOBAL_argopt.pos_func = True ;
00658 narg++ ; continue ; /* go to next arg */
00659 }
00660
00661 /*----- -R option -----*/
00662
00663 if( strncmp(argv[narg],"-R",2) == 0 ){
00664 int ll = strlen(argv[narg]) ;
00665 if( ll == 2 ) GLOBAL_argopt.recurse = 999 ;
00666 else {
00667 ll = strtol( argv[narg]+2 , NULL , 10 ) ;
00668 if( ll > 0 ) GLOBAL_argopt.recurse = ll ;
00669 else FatalError("illegal -R option!") ;
00670 }
00671 narg++ ; continue ; /* go to next arg */
00672 }
00673
00674 /*----- -tlrc_big option -----*/
00675
00676 if( strncmp(argv[narg],"-tlrc_big",7) == 0 ){
00677 GLOBAL_argopt.tlrc_big = True ;
00678 narg++ ; continue ; /* go to next arg */
00679 }
00680
00681 /*----- -unique option (06 Nov 1996) -----*/
00682
00683 if( strncmp(argv[narg],"-unique",5) == 0 ){
00684 GLOBAL_argopt.unique_dcs = True ;
00685 narg++ ; continue ; /* go to next arg */
00686 }
00687
00688 /*----- -install option (14 Sep 1998) -----*/
00689
00690 if( strncmp(argv[narg],"-install",5) == 0 ){
00691 GLOBAL_argopt.install_cmap = True ;
00692 narg++ ; continue ; /* go to next arg */
00693 }
00694
00695 #ifndef WARP_4D
00696 /*----- -warp_4D option -----*/
00697
00698 if( strncmp(argv[narg],"-warp_4D",7) == 0 ){
00699 GLOBAL_argopt.warp_4D = True ;
00700 narg++ ; continue ; /* go to next arg */
00701 }
00702 #endif
00703
00704 /*----- -tlrc_small option -----*/
00705
00706 if( strncmp(argv[narg],"-tlrc_small",7) == 0 ){
00707 GLOBAL_argopt.tlrc_big = False ;
00708 narg++ ; continue ; /* go to next arg */
00709 }
00710
00711 /*----- -logo option -----*/
00712
00713 if( strncmp(argv[narg],"-logo",4) == 0 ){
00714 GLOBAL_argopt.keep_logo = True ;
00715 narg++ ; continue ; /* go to next arg */
00716 }
00717
00718 /*----- -resize option -----*/
00719
00720 if( strncmp(argv[narg],"-resize",4) == 0 ){
00721 GLOBAL_argopt.resize_images = True ;
00722 narg++ ; continue ; /* go to next arg */
00723 }
00724
00725 /*----- -purge option -----*/
00726
00727 if( strncmp(argv[narg],"-purge",4) == 0 ){
00728 GLOBAL_argopt.auto_purge = True ;
00729 narg++ ; continue ; /* go to next arg */
00730 }
00731
00732 #ifdef ALLOW_PLUGINS
00733 /*----- -noplugins option -----*/
00734
00735 if( strncmp(argv[narg],"-noplugins",10) == 0 ){
00736 GLOBAL_argopt.noplugins = 1 ;
00737 narg++ ; continue ; /* go to next arg */
00738 }
00739
00740 /*----- -noplugouts option -----*/
00741
00742 if( strncmp(argv[narg],"-noplugouts",10) == 0 ){
00743 GLOBAL_argopt.noplugouts = 1 ;
00744 narg++ ; continue ; /* go to next arg */
00745 }
00746
00747 /*----- -yesplugouts option -----*/
00748
00749 if( strncmp(argv[narg],"-yesplugouts",10) == 0 ){
00750 GLOBAL_argopt.noplugouts = 0 ;
00751 GLOBAL_argopt.plugout_code = 0 ;
00752 narg++ ; continue ; /* go to next arg */
00753 }
00754
00755 /*----- -yesplugouts option -----*/
00756
00757 if( strncmp(argv[narg],"-YESplugouts",10) == 0 ){
00758 GLOBAL_argopt.noplugouts = 0 ;
00759 GLOBAL_argopt.plugout_code = 1 ;
00760 narg++ ; continue ; /* go to next arg */
00761 }
00762 #endif
00763
00764 /*----- -flipim option -----*/
00765
00766 if( strncmp(argv[narg],"-flipim",5) == 0 ){
00767 GLOBAL_argopt.left_is_left = 0 ;
00768 narg++ ; continue ; /* go to next arg */
00769 }
00770
00771 /*----- -noflipim option -----*/
00772
00773 if( strncmp(argv[narg],"-noflipim",5) == 0 ){
00774 GLOBAL_argopt.left_is_left = 1 ;
00775 narg++ ; continue ; /* go to next arg */
00776 }
00777
00778 /*----- -orient code option -----*/
00779
00780 if( strncmp(argv[narg],"-orient",4) == 0 ){
00781 if( narg+1 >= argc ) FatalError("need an argument after -orient!");
00782
00783 MCW_strncpy(GLOBAL_argopt.orient_code,argv[++narg],4) ;
00784 narg++ ; continue ; /* go to next arg */
00785 }
00786
00787 /*----- -ignore # option -----*/
00788
00789 if( strncmp(argv[narg],"-ignore",4) == 0 ){
00790 float val ;
00791 if( narg+1 >= argc ) FatalError("need an argument after -ignore!");
00792
00793 val = strtod( argv[++narg] , NULL ) ;
00794 if( val >= 0 ) GLOBAL_argopt.ignore = (int) val ;
00795 else fprintf(stderr,
00796 "\n*** WARNING: -ignore value %s illegal\n", argv[narg]);
00797
00798 narg++ ; continue ; /* go to next arg */
00799 }
00800
00801 /*----- -im1 # option [must come before '-im' option!] -----*/
00802
00803 if( strncmp(argv[narg],"-im1",4) == 0 ){
00804 float val ;
00805 if( narg+1 >= argc ) FatalError("need an argument after -im1!");
00806
00807 val = strtod( argv[++narg] , NULL ) ;
00808 if( val >= 1 ) GLOBAL_argopt.ignore = (int) (val-1.0) ;
00809 else fprintf(stderr,
00810 "\n*** WARNING: -ignore value %s illegal\n", argv[narg]);
00811
00812 narg++ ; continue ; /* go to next arg */
00813 }
00814
00815
00816 /*----- -dy # option -----*/
00817
00818 if( strncmp(argv[narg],"-dy",3) == 0 ){
00819 float val ;
00820 if( narg+1 >= argc ) FatalError("need an argument after -dy!");
00821
00822 val = strtod( argv[++narg] , NULL ) ;
00823 if( val > 0 ) GLOBAL_argopt.dy = val ;
00824 else fprintf(stderr,
00825 "\n*** WARNING: -dy value %s illegal\n", argv[narg]);
00826
00827 narg++ ; continue ; /* go to next arg */
00828 }
00829
00830 /*----- -dz # option -----*/
00831
00832 if( strncmp(argv[narg],"-dz",3) == 0 ){
00833 float val ;
00834 if( narg+1 >= argc ) FatalError("need an argument after -dz!");
00835
00836 val = strtod( argv[++narg] , NULL ) ;
00837 if( val > 0 ) GLOBAL_argopt.dz = val ;
00838 else fprintf(stderr,
00839 "\n*** WARNING: -dz value %s illegal\n", argv[narg]);
00840
00841 narg++ ; continue ; /* go to next arg */
00842 }
00843
00844 /*----- -gamma # option -----*/
00845
00846 if( strncmp(argv[narg],"-gamma",4) == 0 ){
00847 float val ;
00848 if( narg+1 >= argc ) FatalError("need an argument after -gamma!");
00849
00850 val = strtod( argv[++narg] , NULL ) ;
00851 if( val > 0 ) GLOBAL_argopt.gamma = val ;
00852 else fprintf(stderr,
00853 "\n*** WARNING: -gamma value %s illegal\n", argv[narg]);
00854
00855 narg++ ; continue ; /* go to next arg */
00856 }
00857
00858 #ifdef USE_GSFAC
00859 /*----- -gsfac # option -----*/
00860
00861 if( strncmp(argv[narg],"-gsfac",4) == 0 ){
00862 float val ;
00863 if( narg+1 >= argc ) FatalError("need an argument after -gsfac!");
00864
00865 val = strtod( argv[++narg] , NULL ) ;
00866 if( val != 0 ) GLOBAL_argopt.gsfac = val ;
00867 else fprintf(stderr,
00868 "\n*** WARNING: -gsfac value %s illegal\n", argv[narg]);
00869
00870 narg++ ; continue ; /* go to next arg */
00871 }
00872 #endif
00873
00874 /*----- -datum type option -----*/
00875
00876 if( strncmp(argv[narg],"-datum",6) == 0 ){
00877 if( ++narg >= argc ) FatalError("need an argument after -datum!") ;
00878
00879 if( strcmp(argv[narg],"short") == 0 ){
00880 GLOBAL_argopt.datum= MRI_short ;
00881 } else if( strcmp(argv[narg],"float") == 0 ){
00882 GLOBAL_argopt.datum= MRI_float ;
00883 } else if( strcmp(argv[narg],"complex") == 0 ){
00884 GLOBAL_argopt.datum= MRI_complex ;
00885 } else if( strcmp(argv[narg],"byte") == 0 ){
00886 GLOBAL_argopt.datum= MRI_byte ;
00887 } else {
00888 char buf[256] ;
00889 sprintf(buf,"-datum of type '%s' is not supported in AFNI!",
00890 argv[narg] ) ;
00891 FatalError(buf) ;
00892 }
00893 narg++ ; continue ; /* go to next arg */
00894 }
00895
00896 /*----- -ncolor # option -----*/
00897
00898 if( strncmp(argv[narg],"-ncolor",3) == 0 ){
00899 float val ;
00900 if( narg+1 >= argc ) FatalError("need an argument after -ncolor!");
00901
00902 val = strtod( argv[++narg] , NULL ) ;
00903 if( val > 2 ) GLOBAL_argopt.ncolor = val ;
00904 else fprintf(stderr,
00905 "\n*** WARNING: -ncolor value %s illegal\n", argv[narg]);
00906
00907 narg++ ; continue ; /* go to next arg */
00908 }
00909
00910 /*----- -dset option [17 Mar 2000] -----*/
00911
00912 if( strncmp(argv[narg],"-dset",5) == 0 ){
00913 GLOBAL_argopt.read_images = False ;
00914 GLOBAL_argopt.read_sessions = False ;
00915 GLOBAL_argopt.read_dsets = True ;
00916 narg++ ; continue ; /* go to next arg */
00917 }
00918
00919 /*----- -im option -----*/
00920
00921 if( strncmp(argv[narg],"-im",3) == 0 ){
00922 GLOBAL_argopt.read_images = True ;
00923 GLOBAL_argopt.read_sessions = False ;
00924 GLOBAL_argopt.read_dsets = False ; /* 17 Mar 2000 */
00925 narg++ ; continue ; /* go to next arg */
00926 }
00927
00928 /*----- -tim option [19 Oct 1999] -----*/
00929
00930 if( strncmp(argv[narg],"-tim",4)==0 || strncmp(argv[narg],"-zim",4)==0 ){
00931 int ll=strlen(argv[narg]) , nn ;
00932
00933 GLOBAL_argopt.read_images = True ;
00934 GLOBAL_argopt.read_sessions = False ;
00935 GLOBAL_argopt.read_dsets = False ; /* 17 Mar 2000 */
00936 GLOBAL_argopt.read_tim = 1 ;
00937
00938 if( ll > 5 && argv[narg][4] == ':' ){ /* 20 Oct 1999 */
00939 nn = strtol( argv[narg]+5 , NULL , 10 ) ;
00940 if( nn > 1 ){
00941 GLOBAL_argopt.read_tim = nn ; /* will be nz or nt */
00942 } else {
00943 fprintf(stderr,"** Error: illegal value in %s\n",argv[narg]);
00944 exit(1) ;
00945 }
00946 }
00947
00948 /* negate flag for time-order first (-tim) vs z-order first (-zim) */
00949
00950 if( strncmp(argv[narg],"-tim",4)==0 && GLOBAL_argopt.read_tim > 1 )
00951 GLOBAL_argopt.read_tim = - GLOBAL_argopt.read_tim ;
00952
00953 narg++ ; continue ; /* go to next arg */
00954 }
00955
00956 /*----- -nomall option -----*/
00957
00958 if( strncmp(argv[narg],"-nomall",5) == 0 ){ /* was handled in main() */
00959 narg++ ; continue ; /* go to next arg */
00960 }
00961
00962 /*----- -q option -----*/
00963
00964 if( strcmp(argv[narg],"-q") == 0 ){ /* was handled in main() */
00965 narg++ ; continue ; /* go to next arg */
00966 }
00967
00968 /*----- -- option -----*/
00969
00970 if( strcmp(argv[narg],"--") == 0 ){
00971 narg++ ; break ; /* end of args */
00972 }
00973
00974 /*----- if we get here, bad news for America! -----*/
00975
00976 fprintf(stderr,"\n*** Unknown option %s ***",argv[narg]) ;
00977 fprintf(stderr,"\n*** Try 'afni -help' for a list of command line options.\n") ;
00978 exit(1) ;
00979
00980 } /* end of loop over argv's starting with '-' */
00981
00982 #if 0
00983 #ifdef USE_TRACING
00984 if( ALLOW_real_time ) DBG_trace = 0 ; /* 26 Jan 2001 */
00985 #endif
00986 #endif
00987
00988 /** 16 July 1997: orientation code change **/
00989
00990 if( GLOBAL_argopt.orient_code[0] == '-' ){
00991 if( GLOBAL_argopt.read_images )
00992 strcpy(GLOBAL_argopt.orient_code,"ASL") ;
00993 else if( env_orient != NULL )
00994 MCW_strncpy(GLOBAL_argopt.orient_code,env_orient,4) ;
00995 else
00996 strcpy(GLOBAL_argopt.orient_code,"RAI") ;
00997 }
00998
00999 THD_coorder_fill( GLOBAL_argopt.orient_code , &GLOBAL_library.cord ) ;
01000
01001 #if 0
01002 fprintf(stderr,"\ncoorder: signs = %d %d %d order = %d %d %d\n" ,
01003 GLOBAL_library.cord.xxsign ,
01004 GLOBAL_library.cord.yysign ,
01005 GLOBAL_library.cord.zzsign ,
01006 GLOBAL_library.cord.first ,
01007 GLOBAL_library.cord.second ,
01008 GLOBAL_library.cord.third ) ;
01009 #endif
01010
01011 GLOBAL_argopt.first_file_arg = narg ; /* rest of args must be files (I hope) */
01012
01013 EXRETURN ;
01014 }
|
|
|
Definition at line 8184 of file afni.c. References AFNI_widget_set::imag, MCW_unregister_help(), MCW_unregister_hint(), AFNI_imaging_widgets::pop_whereami_twin, Three_D_View::vwid, and MCW_textwin::wtext. Referenced by AFNI_imag_pop_CB().
08185 {
08186 if( im3d == NULL ) return ;
08187
08188 MCW_unregister_hint( im3d->vwid->imag->pop_whereami_twin->wtext ) ;
08189 MCW_unregister_help( im3d->vwid->imag->pop_whereami_twin->wtext ) ;
08190
08191 im3d->vwid->imag->pop_whereami_twin = NULL ;
08192 return ;
08193 }
|
|
||||||||||||
|
initialize signed pbar panes * Definition at line 10026 of file afni.c. References MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, and NUM_SONNETS. Referenced by AFNI_sonnet_CB().
10027 {
10028 char buf[2048] ; int jj=MCW_USER_KILL ;
10029
10030 if( w == NULL ) return ;
10031
10032 if( ii < 1 || ii > NUM_SONNETS ){
10033 ii = (lrand48()&NUM_SONNETS) + 1 ;
10034 jj |= MCW_TIMER_KILL ;
10035 }
10036
10037 sprintf( buf , " * %d *\n" , ii ) ;
10038 strcat( buf , sonnets[ii-1] ) ;
10039 (void) MCW_popup_message( w , buf , jj ) ;
10040 return ;
10041 }
|
|
|
Definition at line 6494 of file afni.c. References Three_D_View::anat_now, AFNI_library_type::controllers, THD_session::dsset, ENTRY, Three_D_View::fim_now, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, FIRST_VIEW_TYPE, GLOBAL_library, IM3D_VALID, ISVALID_SESSIONLIST, LAST_VIEW_TYPE, MAX_CONTROLLERS, THD_session::num_dsset, THD_sessionlist::num_sess, PURGE_DSET, THD_sessionlist::ssar, and AFNI_library_type::sslist. Referenced by AFNI_drive_purge_memory(), AFNI_misc_CB(), and AFNI_purge_unused_dsets().
06495 {
06496 int icc , iss , idd , ivv ;
06497 Three_D_View * im3d ;
06498 THD_session * sess ;
06499 THD_sessionlist * ssl = GLOBAL_library.sslist ;
06500 THD_3dim_dataset * dset ;
06501
06502 ENTRY("AFNI_purge_dsets") ;
06503
06504 /*-- sanity check --*/
06505
06506 if( ! ISVALID_SESSIONLIST(ssl) || ssl->num_sess <= 0 ) EXRETURN ;
06507
06508 /*-- for each session in the list --*/
06509
06510 for( iss=0 ; iss < ssl->num_sess ; iss++ ){
06511 sess = ssl->ssar[iss] ;
06512
06513 /*-- for each anat dataset in the session --*/
06514
06515 for( idd=0 ; idd < sess->num_dsset ; idd++ ){
06516 for( ivv=FIRST_VIEW_TYPE ; ivv <= LAST_VIEW_TYPE ; ivv++ ){
06517
06518 dset = sess->dsset[idd][ivv] ;
06519 if( dset == NULL ) continue ;
06520 if( doall ){ PURGE_DSET(dset) ; continue ; }
06521
06522 /*-- for each controller now running --*/
06523
06524 for( icc=0 ; icc < MAX_CONTROLLERS ; icc++ ){
06525 im3d = GLOBAL_library.controllers[icc] ;
06526 if( IM3D_VALID(im3d) &&
06527 ((dset==im3d->anat_now) ||
06528 (dset==im3d->fim_now) ||
06529 (dset==im3d->fimdata->fimdset)) ) break ;
06530 }
06531
06532 /*-- if didn't find it, purge it --*/
06533 if( icc == MAX_CONTROLLERS ){ PURGE_DSET(dset) ; }
06534 }
06535 }
06536
06537 } /* end of loop over sessions */
06538 EXRETURN ;
06539 }
|
|
|
Definition at line 6489 of file afni.c. References AFNI_purge_dsets(). Referenced by AFNI_closedown_3dview(), AFNI_initialize_view(), AFNI_marks_transform_CB(), main(), and RT_tell_afni_one().
06490 {
06491 AFNI_purge_dsets( 0 ) ;
06492 }
|
|
||||||||||||||||
|
Definition at line 1707 of file afni.c. References AFNI_controller_clonify(), AFNI_count_controllers(), AFNI_quit_timeout_CB(), AFNI_speak(), CLOSE_CONTROLLER, ENTRY, GLOBAL_argopt, IM3D_OPEN, AF_options::keep_logo, MCW_set_widget_label(), AFNI_widget_set::picture, PICTURE_OFF, PICTURE_ON, AFNI_widget_set::prog, AFNI_program_widgets::quit_first, AFNI_program_widgets::quit_pb, random_goodbye(), STATUS, AFNI_widget_set::top_shell, and Three_D_View::vwid.
01708 {
01709 Three_D_View * im3d = (Three_D_View *) cd ;
01710 XmPushButtonCallbackStruct * pbcbs = (XmPushButtonCallbackStruct *) cbs ;
01711
01712 ENTRY("AFNI_quit_CB") ;
01713
01714 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
01715
01716 /* NULL widget --> reset button to lowercase */
01717
01718 if( wcall == NULL ){
01719 if( im3d->vwid->prog->quit_first == False ){
01720 MCW_set_widget_label( im3d->vwid->prog->quit_pb , "done " ) ;
01721 im3d->vwid->prog->quit_first = True ;
01722 if( im3d->vwid->picture != NULL && !GLOBAL_argopt.keep_logo )
01723 PICTURE_OFF( im3d ) ;
01724 }
01725 EXRETURN ;
01726 }
01727
01728 /* Press of button with Shift or Control key pressed --> Death Now */
01729
01730 if( pbcbs != NULL &&
01731 pbcbs->event != NULL &&
01732 pbcbs->event->type == ButtonRelease &&
01733 ((XButtonEvent *)(pbcbs->event))->state & /* note single & here! */
01734 (ShiftMask|ControlMask|Button2Mask|Button3Mask) ){
01735
01736 XtCloseDisplay( XtDisplay(im3d->vwid->top_shell) ) ;
01737 AFNI_speak(random_goodbye(),0) ;
01738 exit(0) ;
01739 }
01740
01741 /* First press --> just change button label */
01742
01743 if( wcall == im3d->vwid->prog->quit_pb && im3d->vwid->prog->quit_first ){
01744 MCW_set_widget_label( im3d->vwid->prog->quit_pb , "DONE " ) ;
01745 im3d->vwid->prog->quit_first = False ;
01746 if( im3d->vwid->picture != NULL ) PICTURE_ON( im3d ) ;
01747
01748 /* if not re-pressed in 5 seconds, will reset to lowercase */
01749
01750 (void) XtAppAddTimeOut(
01751 XtWidgetToApplicationContext(im3d->vwid->prog->quit_pb) ,
01752 5000 , AFNI_quit_timeout_CB , im3d ) ;
01753
01754 EXRETURN ;
01755 }
01756
01757 /* close window callback OR button already uppercase --> close window */
01758
01759 /* if no controller windows will be left, exit the program */
01760
01761 if( AFNI_count_controllers() <= 1 ){
01762 XtCloseDisplay( XtDisplay(im3d->vwid->top_shell) ) ;
01763 AFNI_speak(random_goodbye(),0) ;
01764 STATUS("calling exit(0) -- farewell cruel world!") ;
01765 exit(0) ;
01766
01767 } else { /* otherwise, patch up the other windows and continue */
01768
01769 CLOSE_CONTROLLER(im3d) ; /* close window */
01770 AFNI_controller_clonify() ; /* let other controllers know */
01771 }
01772 EXRETURN ;
01773 }
|
|
||||||||||||
|
Definition at line 1780 of file afni.c. References client_data, ENTRY, and RESET_AFNI_QUIT. Referenced by AFNI_quit_CB().
01781 {
01782 Three_D_View * im3d = (Three_D_View *) client_data ;
01783 ENTRY("AFNI_quit_timeout_CB") ;
01784 RESET_AFNI_QUIT(im3d) ;
01785 EXRETURN ;
01786 }
|
|
||||||||||||
|
Set the grayscale range in the image window, maybe. [04 Nov 2003] -------------------------------------------------------------------------- Definition at line 5256 of file afni.c. References AFNI_yesenv(), AFNI_view_info::anat_index, Three_D_View::anat_now, Three_D_View::b123_ulay, THD_statistics::bstat, drive_MCW_imseq(), FD_brick::dset, EQUIV_DSETS, AFNI_view_info::fim_index, Three_D_View::fim_now, IM3D_OPEN, ISQ_VALID, isqDR_setrange, ISVALID_BSTAT, ISVALID_STATISTIC, THD_brick_stats::max, THD_brick_stats::min, THD_3dim_dataset::stats, and Three_D_View::vinfo. Referenced by AFNI_setup_viewing(), AFNI_view_xyz_CB(), and ENV_globalrange().
05257 {
05258 float rng[3] = { 0.0f, 0.0f, 0.0f } ;
05259 int ival ;
05260 FD_brick *br ;
05261 THD_3dim_dataset *ds ;
05262
05263 if( !IM3D_OPEN(im3d) || !ISQ_VALID(seq) ) return ;
05264 if( !AFNI_yesenv("AFNI_IMAGE_GLOBALRANGE") ) return ;
05265
05266 br = (FD_brick *)im3d->b123_ulay ; if( br == NULL ) return ;
05267 ds = br->dset ; if( ds == NULL ) return ;
05268
05269 if( EQUIV_DSETS(ds,im3d->anat_now) ) /* underlay dataset */
05270 ival = im3d->vinfo->anat_index ;
05271 else if( EQUIV_DSETS(ds,im3d->fim_now) ) /* overlay dataset */
05272 ival = im3d->vinfo->fim_index ;
05273 else
05274 ival = 0 ; /* shouldn't happen */
05275
05276 if( ISVALID_STATISTIC(ds->stats) && ISVALID_BSTAT(ds->stats->bstat[ival]) ){
05277 rng[0] = ds->stats->bstat[ival].min ;
05278 rng[1] = ds->stats->bstat[ival].max ;
05279 }
05280
05281 drive_MCW_imseq( seq , isqDR_setrange , (XtPointer) rng ) ;
05282 return ;
05283 }
|
|
||||||||||||
|
Definition at line 2768 of file afni.c. References ADN_none, ADN_ntt, ADN_ttdel, AFNI_GOOD_DTYPE, 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_keywords, THD_datablock::brick_lab, THD_diskptr::brick_name, THD_datablock::brick_stataux, THD_datablock::brick_statcode, THD_diskptr::byte_order, DATABLOCK_MEM_MALLOC, DATABLOCK_TYPE, DATAXES_TYPE, AF_options::datum, 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_BRICK, DSET_lock, MRI_IMAGE::dw, MRI_IMAGE::dx, MRI_IMAGE::dy, AF_options::dy, MRI_IMAGE::dz, AF_options::dz, EDIT_dset_items(), EMPTY_STRING, ENTRY, FatalError, THD_diskptr::filecode, free, FREE_IMARR, THD_3dim_dataset::func_type, GEN_ANAT_TYPE, GLOBAL_argopt, THD_diskptr::header_name, THD_3dim_dataset::idcode, MRI_IMARR::imarr, INIT_KILL, THD_3dim_dataset::keywords, KILL_1MRI, MRI_IMAGE::kind, THD_3dim_dataset::kl, THD_datablock::kl, THD_3dim_dataset::label1, THD_3dim_dataset::label2, malloc, THD_datablock::malloc_type, THD_3dim_dataset::markers, MCW_new_idcode, MCW_strncpy, MIN, mri_data_pointer(), mri_datum_size(), mri_fix_data_pointer(), mri_free(), mri_imcount(), mri_read_file(), mri_resize(), mri_to_mri(), myXtNew, THD_datablock::natr, THD_datablock::natr_alloc, MRI_IMARR::num, THD_diskptr::nvals, THD_datablock::nvals, MRI_IMAGE::nx, THD_dataxes::nxx, MRI_IMAGE::ny, THD_dataxes::nyy, nz, THD_dataxes::nzz, OR3OK, ORCODE, AF_options::orient_code, THD_datablock::parent, THD_dataxes::parent, THD_diskptr::prefix, THD_diskptr::rank, AF_options::read_tim, REPORT_PROGRESS, AF_options::resize_images, RETURN, THD_3dim_dataset::self_name, THD_3dim_dataset::self_warp, THD_3dim_dataset::stats, THD_diskptr::storage_mode, STORAGE_UNDEFINED, THD_3dim_dataset::tagset, THD_3dim_dataset::taxis, THD_3dim_dataset::tcat_len, THD_3dim_dataset::tcat_list, THD_3dim_dataset::tcat_num, THD_get_write_order(), THD_init_datablock_brick(), THD_MAX_LABEL, THD_MAX_NAME, THD_diskptr::type, THD_datablock::type, THD_dataxes::type, THD_3dim_dataset::type, THD_3dim_dataset::view_type, THD_diskptr::viewcode, THD_3dim_dataset::vox_warp, THD_3dim_dataset::warp, THD_3dim_dataset::warp_parent, THD_3dim_dataset::warp_parent_idcode, THD_3dim_dataset::warp_parent_name, THD_3dim_dataset::wod_daxes, THD_3dim_dataset::wod_flag, THD_dataxes::xxdel, THD_dataxes::xxorg, THD_dataxes::xxorient, THD_dataxes::yydel, THD_dataxes::yyorg, THD_dataxes::yyorient, ZERO_IDCODE, ZERO_STAT_AUX, THD_dataxes::zzdel, THD_dataxes::zzorg, and THD_dataxes::zzorient. Referenced by AFNI_read_inputs().
02769 {
02770 MRI_IMAGE * im , * shim ;
02771 char * bar ;
02772 register int npix , ii ;
02773 int nx , ny , nz , lf , kz , kim ;
02774 MRI_IMARR * arr ;
02775 char str[256] ;
02776 THD_3dim_dataset * dset ;
02777 int datum = GLOBAL_argopt.datum , dsize ;
02778
02779 int nvals , nzz , nzin=0 ; /* 19 Oct 1999 */
02780 float dx=0.0, dy=0.0 , dz=0.0 ; /* 29 Jul 2002 */
02781
02782 ENTRY("AFNI_read_images") ;
02783
02784 /*----- see if there are any images to read! -----*/
02785
02786 if( nf < 1 ) FatalError("*** No images on command line!? ***") ;
02787
02788 /* count total number of images */
02789
02790 nz = 0 ;
02791 for( lf=0 ; lf < nf ; lf++ ){
02792 ii = mri_imcount( fname[lf] ) ;
02793 if( ii == 0 ){
02794 sprintf(str,"*** Illegal image file specifier: %s",fname[lf]) ;
02795 FatalError(str) ;
02796 }
02797 nz += ii ;
02798 }
02799 if( nz == 1 ) nz = 2 ; /* special case for just one image */
02800
02801 /*--- read 1st file to get sizes ---*/
02802
02803 arr = mri_read_file( fname[0] ) ;
02804 if( arr == NULL || arr->num == 0 ){
02805 sprintf(str,"*** cannot read first image file: %s",fname[0]) ;
02806 FatalError(str) ;
02807 }
02808
02809 im = arr->imarr[0] ;
02810 nx = im->nx ;
02811 ny = im->ny ; npix = nx * ny ;
02812
02813 if( im->dw > 0.0 ){
02814 dx = fabs(im->dx); dy = fabs(im->dy); dz = fabs(im->dz); /* 29 Jul 2002 */
02815 }
02816
02817 if( datum < 0 ) datum = im->kind ;
02818 if( ! AFNI_GOOD_DTYPE(datum) )
02819 FatalError("*** Illegal datum type found ***") ;
02820
02821 dsize = mri_datum_size( (MRI_TYPE) datum ) ;
02822 bar = (char *) malloc( dsize * nx*ny*nz ) ;
02823 if( bar == NULL ){
02824 fprintf(stderr,"\n** Can't malloc memory for image input!\a\n") ;
02825 exit(1) ;
02826 }
02827
02828 /*--- read all files, convert if needed, put in the cube ---*/
02829
02830 kz = 0 ;
02831 for( lf=0 ; lf < nf ; lf++ ){
02832
02833 /** read the file (except the first, which we already have **/
02834
02835 if( lf != 0 ){
02836 arr = mri_read_file( fname[lf] ) ;
02837 if( arr == NULL || arr->num == 0 ){
02838 sprintf(str,"*** cannot read image file: %s",fname[lf]) ;
02839 FatalError(str) ;
02840 }
02841 }
02842
02843 /** for each image in file ... **/
02844
02845 for( kim=0 ; kim < arr->num ; kim++ ){
02846 im = arr->imarr[kim] ;
02847
02848 /** check if image matches dimensions of first slice **/
02849
02850 if( im->nx != nx || im->ny != ny ){
02851 if( ! GLOBAL_argopt.resize_images ){
02852 sprintf(str, "*** image size mismatch:\n"
02853 " *** expected nx=%d ny=%d but got nx=%d ny=%d in file %s" ,
02854 nx,ny,im->nx,im->ny , fname[lf] ) ;
02855 FatalError(str) ;
02856 } else {
02857 MRI_IMAGE * rim ;
02858 rim = mri_resize( im , nx , ny ) ;
02859 mri_free( im ) ;
02860 im = rim ;
02861 }
02862 }
02863
02864 /** check if image data type matches the kind we want **/
02865
02866 if( im->kind == datum ){
02867 shim = im ;
02868 } else {
02869 shim = mri_to_mri( datum , im ) ;
02870 if( shim == NULL ) FatalError("*** Illegal convert! ***") ;
02871 mri_free( im ) ;
02872 }
02873
02874 /** copy bytes from slice into the "bar" brick **/
02875
02876 memcpy( bar + dsize*npix*kz , mri_data_pointer(shim) , dsize*npix ) ;
02877 kz++ ;
02878
02879 KILL_1MRI(shim) ;
02880 if( kz%10 == 5 ) REPORT_PROGRESS(".") ;
02881 }
02882 FREE_IMARR(arr) ; /* not DESTROY_IMARR, since images are already gone */
02883 }
02884
02885 /*** special case of one input image ***/
02886
02887 if( kz == 1 && nz == 2 ){
02888 memcpy( bar + dsize*npix , bar , dsize*npix ) ;
02889 }
02890
02891 /*** tell the user what all we've read ***/
02892
02893 sprintf(str,": nx=%d ny=%d nslice=%d (%s)",nx,ny,nz,MRI_TYPE_name[datum]) ;
02894 REPORT_PROGRESS(str) ;
02895
02896 /*- 19 Oct 1999: if we are doing a -tim read,
02897 then have to setup the time and z dimensions -*/
02898
02899 if( GLOBAL_argopt.read_tim != 0 ){
02900
02901 if( GLOBAL_argopt.read_tim > 0 ){ /* 20 Oct 1999 */
02902 nzin = nzz = GLOBAL_argopt.read_tim ; /* -zim:nzz */
02903 nvals = nz / nzz ;
02904
02905 if( nvals*nzz != nz )
02906 fprintf(stderr,
02907 "\n** Warning: -zim:%d does not evenly divide"
02908 "number of 2D slices read=%d\n",
02909 nzz , nz ) ;
02910
02911 } else {
02912 nvals = - GLOBAL_argopt.read_tim ; /* -tim:nvals */
02913 nzin = nzz = nz / nvals ;
02914
02915 if( nvals*nzz != nz )
02916 fprintf(stderr,
02917 "\n** Warning: -tim:%d does not evenly divide"
02918 "number of 2D slices read=%d\n",
02919 nvals , nz ) ;
02920 }
02921
02922 if( nvals == 1 ){
02923 fprintf(stderr,
02924 "\n** Error: -tim or -zim has only 1 point in time!\n") ;
02925 exit(1) ;
02926 }
02927
02928 if( nzz == 1 ) nzz = 2 ; /* can't have just 1 slice */
02929
02930 } else { /* the old code */
02931 nvals = 1 ;
02932 nzz = nz ;
02933 }
02934
02935 /*--- now create the rest of the data structure, as far as we can ---*/
02936
02937 dset = myXtNew( THD_3dim_dataset ) ;
02938 dset->dblk = myXtNew( THD_datablock ) ;
02939 dset->daxes = myXtNew( THD_dataxes ) ;
02940 dset->dblk->diskptr = myXtNew( THD_diskptr ) ;
02941 dset->markers = NULL ;
02942 dset->warp = NULL ;
02943 dset->vox_warp = NULL ;
02944 dset->self_warp = NULL ; /* 26 Aug 2002 */
02945 dset->warp_parent = NULL ;
02946 dset->anat_parent = NULL ;
02947 dset->stats = NULL ;
02948 dset->death_mark = 0 ;
02949 dset->tcat_list = NULL ; /* 04 Aug 2004 */
02950 dset->tcat_num = 0 ;
02951 dset->tcat_len = NULL ;
02952 dset->taxis = NULL ;
02953 dset->tagset = NULL ; /* Oct 1998 */
02954 ZERO_STAT_AUX( dset ) ;
02955 #ifdef ALLOW_DATASET_VLIST
02956 dset->pts = NULL ;
02957 #endif
02958
02959 INIT_KILL(dset->kl) ;
02960 INIT_KILL(dset->dblk->kl) ;
02961
02962 dset->dblk->diskptr->type = DISKPTR_TYPE ;
02963 dset->dblk->diskptr->rank = 3 ;
02964 dset->dblk->diskptr->nvals = nvals ; /* modified 19 Oct 1999 */
02965 dset->dblk->diskptr->dimsizes[0] = nx ;
02966 dset->dblk->diskptr->dimsizes[1] = ny ;
02967 dset->dblk->diskptr->dimsizes[2] = nzz ; /* modified 19 Oct 1999 */
02968 dset->dblk->diskptr->storage_mode = STORAGE_UNDEFINED ;
02969 dset->dblk->diskptr->byte_order = THD_get_write_order() ; /* 25 April 1998 */
02970
02971 EMPTY_STRING(dset->dblk->diskptr->prefix) ;
02972 EMPTY_STRING(dset->dblk->diskptr->viewcode) ;
02973 EMPTY_STRING(dset->dblk->diskptr->filecode) ;
02974 EMPTY_STRING(dset->dblk->diskptr->directory_name) ;
02975 EMPTY_STRING(dset->dblk->diskptr->header_name) ;
02976 EMPTY_STRING(dset->dblk->diskptr->brick_name) ;
02977
02978 dset->dblk->type = DATABLOCK_TYPE ;
02979 dset->dblk->nvals = nvals ; /* modified 19 Oct 1999 */
02980
02981 /** here is where we attach "bar" to the dataset **/
02982
02983 dset->dblk->malloc_type = DATABLOCK_MEM_MALLOC ;
02984 dset->dblk->brick_fac = NULL ; /* let THD_init_datablock_brick do these */
02985 dset->dblk->brick_bytes = NULL ;
02986 dset->dblk->brick = NULL ;
02987
02988 DSET_lock(dset) ; /* Feb 1998: lock into memory */
02989
02990 dset->dblk->brick_lab = NULL ; /* 30 Nov 1997 */
02991 dset->dblk->brick_keywords = NULL ;
02992 dset->dblk->brick_statcode = NULL ;
02993 dset->dblk->brick_stataux = NULL ;
02994 dset->keywords = NULL ;
02995
02996 THD_init_datablock_brick( dset->dblk , datum , NULL ) ;
02997
02998 if( nvals == 1 ){
02999
03000 mri_fix_data_pointer( bar , DSET_BRICK(dset,0) ) ; /* the attachment! */
03001
03002 } else { /* 19 Oct 1999: make up a lot of bricks and attach them all */
03003 /* 20 Oct 1999: allow for the 3rd dimension as well */
03004
03005 int iv , jj , kk ;
03006 char * qbar ;
03007
03008 for( iv=0 ; iv < nvals ; iv++ ){
03009 qbar = (char *) malloc( dsize*npix*nzz ) ; /* space for nzz slices */
03010
03011 if( GLOBAL_argopt.read_tim > 0 ){
03012 for( jj=0 ; jj < nzz ; jj++ ){ /* copy slices */
03013 kk = MIN(jj,nzin-1) ;
03014 memcpy( qbar + jj*dsize*npix ,
03015 bar + (iv*nzin+kk)*dsize*npix , dsize*npix ) ;
03016 }
03017 } else {
03018 for( jj=0 ; jj < nzz ; jj++ ){ /* copy slices */
03019 kk = MIN(jj,nzin-1) ;
03020 memcpy( qbar + jj*dsize*npix ,
03021 bar + (kk*nvals+iv)*dsize*npix , dsize*npix ) ;
03022 }
03023 }
03024
03025 mri_fix_data_pointer( qbar , DSET_BRICK(dset,iv) ) ;
03026 }
03027
03028 free(bar) ; /* not needed no more no how */
03029
03030 EDIT_dset_items( dset , ADN_ntt,nvals , ADN_ttdel,1.0 , ADN_none ) ;
03031 }
03032
03033 dset->dblk->natr = dset->dblk->natr_alloc = 0 ;
03034 dset->dblk->atr = NULL ;
03035 dset->dblk->parent = (XtPointer) dset ;
03036
03037 dset->daxes->type = DATAXES_TYPE ;
03038 dset->daxes->nxx = nx ;
03039 dset->daxes->nyy = ny ;
03040 dset->daxes->nzz = nzz ; /* modified 19 Oct 1999 */
03041 dset->daxes->xxdel = 1.0 ; /* arbitary units */
03042 dset->daxes->yydel = GLOBAL_argopt.dy ; /* these allow user to alter */
03043 dset->daxes->zzdel = GLOBAL_argopt.dz ; /* the images' aspect ratio */
03044 dset->daxes->xxorg = dset->daxes->yyorg = dset->daxes->zzorg = 0.0 ;
03045 dset->daxes->parent= (XtPointer) dset ;
03046
03047 if( dx > 0.0 ) dset->daxes->xxdel = dx ; /* 29 Jul 2002 */
03048 if( dy > 0.0 ) dset->daxes->yydel = dy ;
03049 if( dz > 0.0 ) dset->daxes->zzdel = dz ;
03050
03051 dset->idcode = MCW_new_idcode() ;
03052 ZERO_IDCODE(dset->anat_parent_idcode) ;
03053 ZERO_IDCODE(dset->warp_parent_idcode) ;
03054
03055 /* set the daxes orientation codes from the command line argument */
03056
03057 #define ORCODE(aa) \
03058 ( (aa)=='R' ? ORI_R2L_TYPE : (aa)=='L' ? ORI_L2R_TYPE : \
03059 (aa)=='P' ? ORI_P2A_TYPE : (aa)=='A' ? ORI_A2P_TYPE : \
03060 (aa)=='I' ? ORI_I2S_TYPE : (aa)=='S' ? ORI_S2I_TYPE : ILLEGAL_TYPE )
03061
03062 #define OR3OK(x,y,z) ( ((x)&6) + ((y)&6) + ((z)&6) == 6 )
03063
03064 { char acod ;
03065 int xx,yy,zz ;
03066
03067 acod = toupper(GLOBAL_argopt.orient_code[0]) ; xx = ORCODE(acod) ;
03068 acod = toupper(GLOBAL_argopt.orient_code[1]) ; yy = ORCODE(acod) ;
03069 acod = toupper(GLOBAL_argopt.orient_code[2]) ; zz = ORCODE(acod) ;
03070
03071 if( xx < 0 || yy < 0 || zz < 0 || ! OR3OK(xx,yy,zz) )
03072 FatalError("Unusable -orient code!") ;
03073
03074 dset->daxes->xxorient = xx ;
03075 dset->daxes->yyorient = yy ;
03076 dset->daxes->zzorient = zz ;
03077 }
03078
03079 dset->wod_flag = False ; /* no warp-on-demand */
03080 dset->wod_daxes = NULL ; /* 02 Nov 1996 */
03081
03082 dset->type = GEN_ANAT_TYPE ;
03083 dset->view_type = dset->func_type = 0 ;
03084
03085 MCW_strncpy( dset->self_name , fname[0] , THD_MAX_NAME ) ;
03086 MCW_strncpy( dset->label1 , "Image Display Mode" , THD_MAX_LABEL ) ;
03087 EMPTY_STRING( dset->label2 ) ;
03088 EMPTY_STRING( dset->warp_parent_name ) ;
03089 EMPTY_STRING( dset->anat_parent_name ) ;
03090
03091 RETURN( dset ) ;
03092 }
|
|
||||||||||||
|
average * Definition at line 3772 of file afni.c. References ADDTO_IMARR, ADDTO_SARR, ADDTO_XTARR, ADN_datum_all, ADN_directory_name, ADN_func_type, ADN_malloc_type, ADN_none, ADN_ntt, ADN_nvals, ADN_nxyz, ADN_prefix, ADN_ttdel, ADN_ttdur, ADN_ttorg, ADN_tunits, ADN_type, ADN_view_type, ADN_xyzdel, ADN_xyzorg, AFNI_add_timeseries(), AFNI_append_sessions(), AFNI_force_adoption(), AFNI_make_descendants(), AFNI_read_images(), ANAT_EPI_TYPE, THD_string_array::ar, argc, BLANK_SESSION, BLANK_SESSIONLIST, DATABLOCK_MEM_MALLOC, destroy_Htable(), DESTROY_SARR, DSET_BRICK_BYTES, DSET_lock, DSET_MARK_FOR_IMMORTALITY, THD_session::dsset, EDIT_dset_items(), EDIT_empty_copy(), EDIT_substitute_brick(), ENTRY, FatalError, AF_options::first_file_arg, free, FREE_IMARR, FREE_XTARR, getenv(), GLOBAL_argopt, GLOBAL_library, GLOBAL_num_dsets, AFNI_library_type::have_dummy_dataset, HEAD_ANAT_TYPE, IC_DSET, IC_FLIM, THD_ivec3::ijk, IMARR_COUNT, IMARR_SUBIMAGE, INIT_IMARR, INIT_SARR, INIT_XTARR, ISVALID_DSET, LAST_VIEW_TYPE, THD_session::lastname, malloc, MCW_file_expand(), MCW_free_expand(), MCW_strncpy, MCW_warn_expand(), myXtNew, new_Htable(), THD_string_array::num, XtPointer_array::num, THD_session::num_dsset, THD_sessionlist::num_sess, THD_sessionlist::parent, THD_session::parent, PARENTIZE, qs, AF_options::read_1D, AF_options::read_dsets, AF_options::read_images, AF_options::read_sessions, AF_options::recurse, REFRESH, REPORT_PROGRESS, AFNI_library_type::session, SESSION_TYPE, SESSIONLIST_TYPE, THD_session::sessname, THD_sessionlist::ssar, AFNI_library_type::sslist, STATUS, subsume_Htable(), THD_check_idcodes(), THD_fetch_many_datasets(), THD_get_all_subdirs(), THD_get_many_timeseries(), THD_init_session(), THD_is_directory(), THD_MAX_NAME, THD_MAX_NUM_SESSION, THD_MAX_SESSION_SIZE, THD_normalize_flist(), THD_open_dataset(), THD_reconcile_parents(), AFNI_library_type::timeseries, THD_sessionlist::type, THD_session::type, UNITS_SEC_TYPE, VIEW_ORIGINAL_TYPE, THD_3dim_dataset::view_type, AF_options::warp_4D, THD_session::warptable, AFNI_library_type::warptable, XTARR_IC, XTARR_XT, and THD_fvec3::xyz. Referenced by MAIN_workprocess().
03773 {
03774 int id , last_color ;
03775 Boolean isfunc ;
03776
03777 ENTRY("AFNI_read_inputs") ;
03778
03779 /* create empty library of dataset sessions */
03780
03781 GLOBAL_library.sslist = myXtNew( THD_sessionlist ) ;
03782 GLOBAL_library.sslist->type = SESSIONLIST_TYPE ;
03783 BLANK_SESSIONLIST(GLOBAL_library.sslist) ;
03784 GLOBAL_library.sslist->parent = NULL ;
03785
03786 /*----- read files -----*/
03787
03788 if( GLOBAL_argopt.first_file_arg >= argc && GLOBAL_argopt.read_images ){
03789 FatalError("No image files on command line!!") ;
03790 }
03791
03792 /*--- read directly from images (the old-fashioned way) ---*/
03793
03794 if( GLOBAL_argopt.read_images ){
03795 THD_3dim_dataset *dset ;
03796 THD_session *new_ss ;
03797 int vv ;
03798 int gnim ; /* 16 Mar 1998: names from globbing */
03799 char **gname ;
03800
03801 MCW_warn_expand(1) ; /* 13 Jul 2001 */
03802
03803 MCW_file_expand( argc - GLOBAL_argopt.first_file_arg ,
03804 &(argv[GLOBAL_argopt.first_file_arg]) ,
03805 &gnim , &gname ) ;
03806
03807 MCW_warn_expand(0) ; /* 13 Jul 2001 */
03808
03809 if( gnim < 1 )
03810 FatalError("No valid filenames on command line?!" ) ;
03811
03812 dset = AFNI_read_images( gnim , gname ) ;
03813
03814 if( dset == NULL )
03815 FatalError("Could not form 3D dataset from images!" ) ;
03816
03817 MCW_free_expand( gnim , gname ) ;
03818
03819 /* set up minuscule session and session list */
03820
03821 new_ss = myXtNew( THD_session ) ;
03822 new_ss->type = SESSION_TYPE ;
03823 BLANK_SESSION(new_ss) ;
03824 new_ss->num_dsset = 1 ;
03825 new_ss->dsset[0][0] = dset ;
03826 new_ss->parent = NULL ;
03827
03828 MCW_strncpy( new_ss->sessname ,
03829 argv[GLOBAL_argopt.first_file_arg] , THD_MAX_NAME ) ;
03830 MCW_strncpy( new_ss->lastname ,
03831 argv[GLOBAL_argopt.first_file_arg] , THD_MAX_NAME ) ;
03832
03833 GLOBAL_library.sslist->num_sess = 1 ;
03834 GLOBAL_library.sslist->ssar[0] = new_ss ;
03835 GLOBAL_library.have_dummy_dataset = 1 ;
03836
03837 } /** end of images input **/
03838
03839 /*--- sessions of 3D datasets (from to3d or other AFNI programs) ---*/
03840
03841 else if( GLOBAL_argopt.read_sessions ){
03842
03843 char str[256] ;
03844 Boolean good ;
03845 int num_ss , qd , qs , vv=0 , no_args , jj , nskip_noanat=0 ;
03846 THD_string_array *flist , *dlist=NULL ;
03847 char *dname , *eee ;
03848 THD_session *new_ss ;
03849 int num_dsets=0 ; /* 04 Jan 2000 */
03850 THD_session *gss=NULL ; /* 11 May 2002: global session */
03851 THD_session *dss ; /* 28 Aug 2003: session for command-line datasets */
03852
03853 /*-- 20 Dec 2001: Try to read a "global" session --*/
03854 /*-- 11 May 2002: Move read global session up here --*/
03855
03856 eee = getenv( "AFNI_GLOBAL_SESSION" ) ; /* where it's supposed to be */
03857 if( eee != NULL ){
03858 gss =
03859 GLOBAL_library.session = THD_init_session( eee ); /* try to read datasets */
03860
03861 if( gss != NULL ){ /* got at least one */
03862 gss->parent = NULL ; /* parentize them */
03863 for( qd=0 ; qd < gss->num_dsset ; qd++ )
03864 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ){
03865 PARENTIZE( gss->dsset[qd][vv] , NULL ) ;
03866 DSET_MARK_FOR_IMMORTALITY( gss->dsset[qd][vv] ) ;
03867 }
03868 } else {
03869 sprintf(str,"\n*** No datasets in AFNI_GLOBAL_SESSION=%s",eee) ;
03870 REPORT_PROGRESS(str) ;
03871 }
03872 }
03873
03874 /* 28 Aug 2003:
03875 set up session for datasets from command line (vs. directories) */
03876
03877 dss = myXtNew( THD_session ) ;
03878 dss->type = SESSION_TYPE ;
03879 dss->parent = NULL ;
03880 BLANK_SESSION(dss) ;
03881 MCW_strncpy( dss->sessname , "from CLI" , THD_MAX_NAME ) ;
03882 MCW_strncpy( dss->lastname , "from CLI" , THD_MAX_NAME ) ;
03883
03884 /* now get the list of strings to read as directories */
03885
03886 num_ss = argc - GLOBAL_argopt.first_file_arg ;
03887 no_args = (num_ss < 1) ;
03888
03889 INIT_SARR(dlist) ;
03890 if( no_args ){
03891 if( GLOBAL_argopt.recurse > 0 ){
03892 STATUS("no args: recursion on ./") ;
03893 flist = THD_get_all_subdirs( GLOBAL_argopt.recurse , "./" ) ;
03894 if( flist != NULL ){
03895 for( jj=0 ; jj < flist->num ; jj++ ){
03896 ADDTO_SARR(dlist,flist->ar[jj]) ;
03897 }
03898 DESTROY_SARR(flist) ;
03899 }
03900 } else {
03901 STATUS("no args: using ./") ;
03902 ADDTO_SARR(dlist,"./") ;
03903 }
03904 } else {
03905 for( id=0 ; id < num_ss ; id++ ){
03906 if( GLOBAL_argopt.recurse > 0 ){
03907 flist = THD_get_all_subdirs( GLOBAL_argopt.recurse ,
03908 argv[GLOBAL_argopt.first_file_arg+id] ) ;
03909 if( flist != NULL ){
03910 for( jj=0 ; jj < flist->num ; jj++ ){
03911 ADDTO_SARR(dlist,flist->ar[jj]) ;
03912 }
03913 DESTROY_SARR(flist) ;
03914 }
03915 } else {
03916 ADDTO_SARR(dlist,argv[GLOBAL_argopt.first_file_arg+id]) ;
03917 }
03918 }
03919 }
03920
03921 if( dlist->num < 1 ) ADDTO_SARR(dlist,"./") ; /* just in case */
03922
03923 /** 09 Sep 1998: eliminate duplicates from the directory list **/
03924
03925 { THD_string_array * qlist ;
03926 STATUS("normalizing directory list") ;
03927 qlist = THD_normalize_flist( dlist ) ;
03928 if( qlist != NULL ){ DESTROY_SARR(dlist) ; dlist = qlist ; }
03929 }
03930
03931 REFRESH ;
03932
03933 /* read each session, set parents, put into session list */
03934
03935 num_ss = dlist->num ;
03936 for( id=0 ; id < num_ss ; id++ ){
03937
03938 if(PRINT_TRACING)
03939 { char str[256] ;
03940 sprintf(str,"try to read directory %s",dlist->ar[id]) ; STATUS(str) ; }
03941
03942 dname = dlist->ar[id] ; /* try to read datasets from */
03943 new_ss = THD_init_session( dname ) ; /* this directory name */
03944
03945 REFRESH ;
03946
03947 if( new_ss == NULL ){ /* 28 Aug 2003 */
03948 qd = dss->num_dsset ;
03949 if( qd < THD_MAX_SESSION_SIZE ){
03950 THD_3dim_dataset *dset = THD_open_dataset( dname ) ;
03951 if( dset != NULL ){
03952 dss->dsset[qd][dset->view_type] = dset ;
03953 dss->num_dsset ++ ;
03954 } else {
03955 fprintf(stderr,
03956 "\n** Couldn't open %s as session OR as dataset!" ,
03957 dname ) ;
03958 }
03959 }
03960 }
03961
03962 if( new_ss != NULL && new_ss->num_dsset > 0 ){ /* got something? */
03963
03964 /* set parent pointers */
03965
03966 new_ss->parent = NULL ;
03967 for( qd=0 ; qd < new_ss->num_dsset ; qd++ )
03968 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ )
03969 PARENTIZE( new_ss->dsset[qd][vv] , NULL ) ;
03970
03971 /* put the new session into place in the list of sessions */
03972
03973 GLOBAL_library.sslist->ssar[(GLOBAL_library.sslist->num_sess)++] = new_ss ;
03974
03975 sprintf(str,"\n session #%3d = %s ==> %d dataset%s" ,
03976 GLOBAL_library.sslist->num_sess ,
03977 new_ss->sessname , new_ss->num_dsset ,
03978 (new_ss->num_dsset > 1) ? "s" : " " ) ;
03979 REPORT_PROGRESS(str) ;
03980
03981 num_dsets += new_ss->num_dsset ;
03982
03983 /* 28 Aug 2002: add any inter-dataset warps to global warptable */
03984
03985 if( new_ss->warptable != NULL ){
03986 if( GLOBAL_library.warptable == NULL ) /* create global warptable */
03987 GLOBAL_library.warptable = new_Htable(101) ;
03988 subsume_Htable( new_ss->warptable , GLOBAL_library.warptable ) ;
03989 destroy_Htable( new_ss->warptable ) ;
03990 new_ss->warptable = NULL ;
03991 }
03992
03993 /* 11 May 2002: put global datasets into session now */
03994
03995 if( new_ss != NULL && gss != NULL )
03996 AFNI_append_sessions( new_ss , gss ) ;
03997
03998 /* if we've maxed out on sessions AND
03999 if this isn't the last command line argument ... */
04000
04001 if( GLOBAL_library.sslist->num_sess == THD_MAX_NUM_SESSION &&
04002 id < num_ss-1 ){
04003 sprintf(str,"\n *** reached max no. sessions (%d) ***",
04004 THD_MAX_NUM_SESSION) ;
04005 REPORT_PROGRESS(str) ;
04006 break ; /* exit the loop over id */
04007 }
04008 }
04009
04010 } /* end of id loop (over input directory names) */
04011
04012 /* 28 Aug 2003: if have dataset in session dss, use it */
04013
04014 if( dss->num_dsset > 0 ){
04015 if( GLOBAL_library.sslist->num_sess < THD_MAX_NUM_SESSION ){
04016 GLOBAL_library.sslist->ssar[(GLOBAL_library.sslist->num_sess)++] = dss ;
04017 num_dsets += dss->num_dsset ;
04018 sprintf(str,"\n session #%3d = %s ==> %d dataset%s" ,
04019 GLOBAL_library.sslist->num_sess, dss->sessname, dss->num_dsset,
04020 (dss->num_dsset > 1) ? "s" : " " ) ;
04021 REPORT_PROGRESS(str) ;
04022 if( gss != NULL ) AFNI_append_sessions( dss , gss ) ;
04023 } else {
04024 fprintf(stderr,"\n** Can't use command line datasets: session overflow!\n") ;
04025 free(dss) ;
04026 }
04027 } else {
04028 free(dss) ;
04029 }
04030
04031 /* 11 May 2002: if have global session but no others, use it */
04032
04033 if( gss != NULL && GLOBAL_library.sslist->num_sess == 0 ){
04034
04035 GLOBAL_library.sslist->ssar[(GLOBAL_library.sslist->num_sess)++] = gss ;
04036
04037 sprintf(str,"\n AFNI_GLOBAL_SESSION = %s %d datasets" ,
04038 gss->sessname , gss->num_dsset ) ;
04039
04040 num_dsets += gss->num_dsset ;
04041
04042 REPORT_PROGRESS(str) ;
04043 }
04044
04045 /** if nothing read at all, make up a dummy **/
04046
04047 GLOBAL_library.have_dummy_dataset = 0 ;
04048
04049 #define QQ_NXYZ 16
04050 #define QQ_NT 12
04051 #define QQ_FOV 240.0
04052
04053 if( GLOBAL_library.sslist->num_sess <= 0 ){
04054 byte * bar ; /* as opposed to a bite bar */
04055 int ii , nbar , jj ;
04056 THD_ivec3 nxyz ;
04057 THD_fvec3 fxyz , oxyz ;
04058 char *snam = dlist->ar[0] ; /* 10 Mar 2002 */
04059
04060 if( !THD_is_directory(snam) ) snam = "./" ;
04061
04062 REPORT_PROGRESS("\n*** No datasets or sessions input -- Dummy dataset created.") ;
04063
04064 /** manufacture a minimal session **/
04065
04066 new_ss = myXtNew( THD_session ) ;
04067 new_ss->type = SESSION_TYPE ;
04068 new_ss->parent = NULL ;
04069 BLANK_SESSION(new_ss) ;
04070 MCW_strncpy( new_ss->sessname , snam , THD_MAX_NAME ) ; /* pretend dummy session */
04071 MCW_strncpy( new_ss->lastname , snam , THD_MAX_NAME ) ; /* is first argv directory */
04072 GLOBAL_library.sslist->num_sess = 1 ;
04073 GLOBAL_library.sslist->ssar[0] = new_ss ;
04074 GLOBAL_library.have_dummy_dataset = 1 ;
04075
04076 /** manufacture a minimal dataset **/
04077
04078 new_ss->num_dsset = 1 ;
04079 new_ss->dsset[0][0] = EDIT_empty_copy(NULL) ;
04080 nxyz.ijk[0] = nxyz.ijk[1] = nxyz.ijk[2] = QQ_NXYZ ;
04081 fxyz.xyz[0] = fxyz.xyz[1] = fxyz.xyz[2] = QQ_FOV / QQ_NXYZ ;
04082 oxyz.xyz[0] = oxyz.xyz[1] = oxyz.xyz[2] = -0.5 * QQ_FOV ;
04083 ii = EDIT_dset_items( new_ss->dsset[0][0] ,
04084 ADN_datum_all , MRI_byte ,
04085 ADN_nxyz , nxyz ,
04086 ADN_xyzdel , fxyz ,
04087 ADN_xyzorg , oxyz ,
04088 ADN_directory_name, snam ,
04089 ADN_prefix , "Dummy" ,
04090 ADN_nvals , QQ_NT ,
04091 ADN_malloc_type , DATABLOCK_MEM_MALLOC,
04092 ADN_type , HEAD_ANAT_TYPE ,
04093 ADN_view_type , VIEW_ORIGINAL_TYPE ,
04094 ADN_func_type , ANAT_EPI_TYPE ,
04095 #if QQ_NT > 1
04096 ADN_ntt , QQ_NT ,
04097 ADN_ttdel , 1.0 ,
04098 ADN_ttorg , 0.0 ,
04099 ADN_ttdur , 0.0 ,
04100 ADN_tunits , UNITS_SEC_TYPE ,
04101 #endif
04102 ADN_none ) ;
04103 if( ii > 0 ){
04104 fprintf(stderr,"\n%d errors creating dummy dataset!\a\n",ii) ;
04105 exit(1) ;
04106 }
04107 DSET_lock(new_ss->dsset[0][0]) ; /* lock into memory */
04108
04109 nbar = DSET_BRICK_BYTES(new_ss->dsset[0][0],0) ;
04110
04111 #ifdef NO_FRIVOLITIES
04112 for( jj=0 ; jj < QQ_NT ; jj++ ){
04113 bar = (byte *) malloc( nbar ) ;
04114 bar[0] = (byte) (lrand48()%127) ;
04115 for( ii=1 ; ii < nbar ; ii++ )
04116 bar[ii] = bar[ii-1] + lrand48()%(jj+2) ;
04117 EDIT_substitute_brick( new_ss->dsset[0][0] , jj , MRI_byte , bar ) ;
04118 }
04119 #else
04120 { /* 11 Jun 1999: start of loading RWCOX images into dummy dataset */
04121 static byte rrr[QQ_NXYZ*QQ_NXYZ] = {
04122 0,0,0,0,10,94,135,135,135,135,135,135,135,135,135,135,
04123 0,0,0,32,216,255,255,255,255,255,255,255,255,255,255,255,
04124 0,0,4,171,255,255,255,255,255,255,255,255,255,255,255,255,
04125 0,0,22,255,255,255,255,241,162,75,75,140,255,255,255,255,
04126 0,0,22,255,255,255,255,100,0,0,0,92,255,255,255,255,
04127 0,0,22,255,255,255,255,71,0,0,0,92,255,255,255,255,
04128 0,0,13,213,255,255,255,234,193,105,105,160,255,255,255,255,
04129 0,0,0,95,255,255,255,255,255,255,255,255,255,255,255,255,
04130 0,0,0,0,75,209,255,255,255,250,239,245,255,255,255,255,
04131 0,0,0,0,22,220,255,255,255,105,0,92,255,255,255,255,
04132 0,0,0,0,118,255,255,255,243,45,0,92,255,255,255,255,
04133 0,0,0,21,228,255,255,255,157,0,0,92,255,255,255,255,
04134 0,0,0,124,255,255,255,255,63,0,0,92,255,255,255,255,
04135 0,0,18,237,255,255,255,205,11,0,0,92,255,255,255,255,
04136 0,0,73,255,255,255,255,85,0,0,0,92,255,255,255,255,
04137 0,6,128,134,134,134,134,37,0,0,0,48,134,134,134,134 } ;
04138
04139 static byte www[QQ_NXYZ*QQ_NXYZ] = {
04140 0,45,135,135,0,0,0,135,135,95,0,0,5,135,135,135,
04141 0,74,255,255,11,0,10,255,255,255,0,0,85,255,255,205,
04142 0,0,254,255,86,0,84,255,255,255,15,0,100,255,255,155,
04143 0,0,234,255,106,0,105,255,255,255,85,0,170,255,255,85,
04144 0,0,169,255,171,0,169,255,255,255,110,0,195,255,255,60,
04145 0,0,99,255,201,0,200,255,255,255,170,0,255,255,255,0,
04146 0,0,84,255,255,1,254,255,255,255,205,35,255,255,180,0,
04147 0,0,5,254,255,81,255,255,135,255,255,85,255,255,170,0,
04148 0,0,0,249,255,170,255,255,85,249,255,135,255,255,85,0,
04149 0,0,0,169,255,220,255,255,35,170,255,255,255,255,75,0,
04150 0,0,0,114,255,255,255,240,0,154,255,255,255,255,0,0,
04151 0,0,0,84,255,255,255,171,0,85,255,255,255,195,0,0,
04152 0,0,0,20,254,255,255,145,0,59,255,255,255,170,0,0,
04153 0,0,0,0,254,255,255,86,0,0,255,255,255,100,0,0,
04154 0,0,0,0,179,255,255,50,0,0,179,255,255,50,0,0,
04155 0,0,0,0,89,134,134,0,0,0,89,134,134,0,0,0 } ;
04156
04157 static byte ccc[QQ_NXYZ*QQ_NXYZ] = {
04158 0,0,0,0,2,94,160,255,255,219,135,92,9,0,0,0,
04159 0,0,0,17,165,255,255,255,255,255,255,255,214,41,2,0,
04160 0,0,4,128,255,255,255,255,255,255,255,255,255,255,38,0,
04161 0,0,22,255,255,255,242,108,75,111,244,255,255,255,167,2,
04162 0,0,116,255,255,255,202,0,0,0,113,255,255,255,255,44,
04163 0,0,94,165,165,165,72,0,0,0,15,223,255,255,255,131,
04164 0,0,0,0,0,0,0,0,0,0,0,216,255,255,255,183,
04165 0,0,0,0,0,0,0,0,0,0,0,216,255,255,255,255,
04166 0,0,0,0,0,0,0,0,0,0,0,216,255,255,255,247,
04167 0,0,0,0,0,0,0,0,0,0,0,216,255,255,255,131,
04168 0,0,94,166,166,136,0,0,0,0,55,241,255,255,255,131,
04169 0,0,116,255,255,242,85,0,0,0,114,255,255,255,255,44,
04170 0,0,15,225,255,255,243,109,76,112,244,255,255,255,166,2,
04171 0,0,0,109,255,255,255,255,255,255,255,255,255,217,31,0,
04172 0,0,0,3,105,219,255,255,255,255,255,255,162,28,0,0,
04173 0,0,0,0,0,9,97,134,225,160,134,91,2,0,0,0 } ;
04174
04175 static byte ooo[QQ_NXYZ*QQ_NXYZ] = {
04176 0,0,0,0,0,12,121,135,255,255,234,107,11,0,0,0,
04177 0,0,0,0,58,236,255,255,255,255,255,255,224,108,4,0,
04178 0,0,0,60,234,255,255,255,255,255,255,255,255,255,51,0,
04179 0,0,10,197,255,255,255,171,75,75,163,255,255,255,224,11,
04180 0,0,80,255,255,255,224,39,0,0,31,233,255,255,255,107,
04181 0,0,164,255,255,255,151,0,0,0,0,180,255,255,255,135,
04182 0,12,202,255,255,255,151,0,0,0,0,180,255,255,255,185,
04183 0,29,255,255,255,255,151,0,0,0,0,180,255,255,255,255,
04184 0,27,249,255,255,255,151,0,0,0,0,180,255,255,255,248,
04185 0,0,164,255,255,255,151,0,0,0,0,180,255,255,255,135,
04186 0,0,164,255,255,255,169,3,0,0,0,180,255,255,255,135,
04187 0,0,79,255,255,255,255,44,0,0,60,233,255,255,255,50,
04188 0,0,10,197,255,255,255,171,76,90,234,255,255,255,174,3,
04189 0,0,0,59,233,255,255,255,255,255,255,255,255,223,40,0,
04190 0,0,0,0,57,186,255,255,255,255,255,255,139,19,0,0,
04191 0,0,0,0,0,5,119,134,191,134,134,49,3,0,0,0 } ;
04192
04193 static byte xxx[QQ_NXYZ*QQ_NXYZ] = {
04194 0,0,21,131,135,135,135,8,0,0,3,100,135,135,135,128,
04195 0,0,0,108,255,255,255,86,0,0,115,255,255,255,255,121,
04196 0,0,0,21,216,255,255,213,0,19,223,255,255,255,187,5,
04197 0,0,0,0,92,244,255,255,114,114,255,255,255,234,58,0,
04198 0,0,0,0,0,174,255,255,252,230,255,255,255,130,0,0,
04199 0,0,0,0,0,58,244,255,255,255,255,255,228,29,0,0,
04200 0,0,0,0,0,0,118,255,255,255,255,255,74,0,0,0,
04201 0,0,0,0,0,0,55,248,255,255,255,199,3,0,0,0,
04202 0,0,0,0,0,5,170,255,255,255,255,227,32,0,0,0,
04203 0,0,0,0,0,104,255,255,255,255,255,255,140,5,0,0,
04204 0,0,0,0,13,217,255,255,252,215,255,255,255,67,0,0,
04205 0,0,0,0,159,255,255,255,212,23,233,255,255,187,7,0,
04206 0,0,0,81,241,255,255,255,85,0,72,255,255,255,66,0,
04207 0,0,16,206,255,255,255,212,0,0,8,193,255,255,237,12,
04208 0,0,94,255,255,255,255,86,0,0,0,73,255,255,255,121,
04209 0,14,129,134,134,134,85,1,0,0,0,3,106,134,134,127 } ;
04210
04211 static byte bob[QQ_NXYZ*QQ_NXYZ] = {
04212 0,0,0,60,101,133,155,165,173,161,112,54,0,0,0,0,
04213 0,48,104,139,141,144,154,164,162,183,195,162,76,0,0,0,
04214 0,111,126,119,120,132,146,174,172,194,222,226,195,88,0,0,
04215 70,112,100,90,108,123,175,222,229,242,247,249,246,195,50,0,
04216 54,53,75,87,110,129,161,219,247,249,250,250,250,241,76,0,
04217 53,55,93,112,116,124,151,212,243,249,250,250,249,228,103,0,
04218 52,62,97,134,131,125,126,154,213,242,250,250,248,200,121,0,
04219 50,66,89,140,130,120,125,130,151,172,187,209,242,221,174,99,
04220 46,71,106,150,132,79,77,111,145,133,108,159,231,247,203,174,
04221 110,124,134,140,114,95,78,104,211,232,205,231,250,250,221,167,
04222 103,115,150,146,126,104,102,120,170,215,209,202,245,250,245,103,
04223 62,115,140,151,136,116,102,108,110,172,225,138,184,243,123,0,
04224 0,56,94,122,143,128,106,106,91,122,166,113,146,197,50,0,
04225 0,0,0,60,140,139,119,120,117,124,164,160,152,71,0,0,
04226 0,0,0,0,69,124,138,131,120,168,227,194,81,0,0,0,
04227 0,0,0,0,0,49,69,103,131,153,141,54,0,0,0,0 } ;
04228
04229 static byte * rwcox[6] = { rrr,www,ccc,ooo,xxx,bob } ;
04230 int kk ;
04231
04232 for( jj=0 ; jj < QQ_NT ; jj++ ){
04233 bar = (byte *) malloc( nbar ) ;
04234 for( kk=0 ; kk < QQ_NXYZ ; kk++ )
04235 memcpy( bar + kk*QQ_NXYZ*QQ_NXYZ , rwcox[jj%6] , QQ_NXYZ*QQ_NXYZ ) ;
04236 EDIT_substitute_brick( new_ss->dsset[0][0] , jj , MRI_byte , bar ) ;
04237 }
04238 } /* end of loading RWCOX */
04239 #endif
04240
04241 PARENTIZE( new_ss->dsset[0][0] , NULL ) ;
04242
04243 } else { /* 04 Jan 2000: show total number of datasets */
04244
04245 sprintf(str,"\n dataset count = %d" , num_dsets ) ;
04246 GLOBAL_num_dsets = num_dsets ;
04247 REPORT_PROGRESS(str) ;
04248 }
04249
04250 /*** read all timeseries files from all directories ***/
04251
04252 STATUS("reading timeseries files") ;
04253
04254 /* 27 Jan 2000: allow skipping *.1D files from dataset directories */
04255
04256 GLOBAL_library.timeseries =
04257 THD_get_many_timeseries( (GLOBAL_argopt.read_1D) ? dlist : NULL ) ;
04258
04259 REFRESH ;
04260
04261 if( GLOBAL_library.timeseries == NULL )
04262 INIT_IMARR(GLOBAL_library.timeseries) ;
04263
04264 sprintf( str , "\n Time series = %d files read" ,
04265 IMARR_COUNT(GLOBAL_library.timeseries) ) ;
04266 REPORT_PROGRESS(str) ;
04267
04268 /*** throw away the list of directories that were scanned ***/
04269
04270 DESTROY_SARR(dlist) ;
04271
04272 /* assign the warp and anatomy parent pointers;
04273 then, make any datasets that don't exist but logically
04274 descend from the warp and anatomy parents just assigned */
04275
04276 if( !GLOBAL_library.have_dummy_dataset ){
04277
04278 STATUS("checking idcodes for duplicates") ;
04279 THD_check_idcodes( GLOBAL_library.sslist ) ; /* 08 Jun 1999 */
04280
04281 STATUS("reconciling parent pointers") ;
04282 THD_reconcile_parents( GLOBAL_library.sslist ) ;
04283
04284 STATUS("forcible adoption of unparented datasets") ;
04285 for( id=0 ; id < GLOBAL_library.sslist->num_sess ; id++ ){ /* functions w/o parents, */
04286 new_ss = GLOBAL_library.sslist->ssar[id] ; /* forcibly get one */
04287 AFNI_force_adoption( new_ss , GLOBAL_argopt.warp_4D ) ;
04288 }
04289
04290 } /* end of if don't have dummy dataset */
04291
04292 if( GLOBAL_library.session != NULL )
04293 AFNI_force_adoption( GLOBAL_library.session , GLOBAL_argopt.warp_4D ) ;
04294
04295 STATUS("making descendant datasets") ;
04296
04297 AFNI_make_descendants( GLOBAL_library.sslist ) ;
04298
04299 } /** end of sessions input **/
04300
04301 else if( GLOBAL_argopt.read_dsets ){ /* 17 Mar 2000 */
04302
04303 int nds = argc - GLOBAL_argopt.first_file_arg ;
04304 char str[256] ;
04305 THD_3dim_dataset * dset ;
04306 XtPointer_array * dsar ;
04307 MRI_IMARR * webtsar ; /* 26 Mar 2001 */
04308 THD_session * new_ss ;
04309 int ii,nerr=0,vv,nn , dd ;
04310
04311 if( nds <= 0 ){
04312 fprintf(stderr,"\a\n*** No datasets on command line?!\n"); exit(1);
04313 }
04314 nds = 0 ;
04315
04316 /* set up minuscule session and session list */
04317
04318 new_ss = myXtNew( THD_session ) ;
04319 new_ss->type = SESSION_TYPE ;
04320 BLANK_SESSION(new_ss) ;
04321 new_ss->parent = NULL ;
04322
04323 strcpy( new_ss->sessname , "." ) ;
04324 strcpy( new_ss->lastname , "." ) ;
04325
04326 GLOBAL_library.sslist->num_sess = 1 ;
04327 GLOBAL_library.sslist->ssar[0] = new_ss ;
04328 GLOBAL_library.have_dummy_dataset = 0 ;
04329
04330 /* read datasets from command line */
04331
04332 STATUS("reading commandline dsets") ;
04333
04334 INIT_IMARR(webtsar) ; /* 26 Mar 2001 */
04335
04336 for( ii=GLOBAL_argopt.first_file_arg ; ii < argc ; ii++ ){
04337
04338 /** 23 Mar 2001: modified code to deal with an array of
04339 datasets, rather than just one at a time **/
04340
04341 if( strstr(argv[ii],"://") != NULL &&
04342 strstr(argv[ii],"AFNILIST") != NULL ){ /** 23 Mar 2001: read from Web list **/
04343
04344 dsar = THD_fetch_many_datasets( argv[ii] ) ;
04345 if( dsar == NULL || dsar->num == 0 ){
04346 fprintf(stderr,"\a\n*** Can't read datasets from %s\n",argv[ii]) ;
04347 nerr++ ; continue ; /* next ii */
04348 }
04349
04350 } else { /** read from one file (local or Web), make a small array **/
04351
04352 dset = THD_open_dataset( argv[ii] ) ;
04353 if( dset == NULL ){
04354 fprintf(stderr,"\a\n*** Can't read dataset %s\n",argv[ii]) ;
04355 nerr++ ; continue ; /* next ii */
04356 }
04357 INIT_XTARR(dsar) ; ADDTO_XTARR(dsar,dset) ; XTARR_IC(dsar,0) = IC_DSET ;
04358 }
04359
04360 for( dd=0 ; dd < dsar->num ; dd++ ){ /* loop over all entries in array */
04361
04362 /* 26 Mar 2001: might get some 1D files, too */
04363
04364 if( XTARR_IC(dsar,dd) == IC_FLIM ){ /* save 1D file for later */
04365 MRI_IMAGE *im = (MRI_IMAGE *) XTARR_XT(dsar,dd) ;
04366 ADDTO_IMARR(webtsar,im) ;
04367 continue ; /* next one */
04368 }
04369 if( XTARR_IC(dsar,dd) != IC_DSET ){
04370 fprintf(stderr,"\n** Unknown filetype returned from %s\n",argv[ii]) ;
04371 nerr++ ; continue ; /* bad */
04372 }
04373
04374 /* get to here ==> have a dataset */
04375
04376 dset = (THD_3dim_dataset *) XTARR_XT(dsar,dd) ;
04377 if( !ISVALID_DSET(dset) ) continue ; /* bad */
04378 nds++ ; /* increment count of dataset */
04379 REFRESH ;
04380 vv = dset->view_type ;
04381 nn = new_ss->num_dsset ;
04382 if( nn >= THD_MAX_SESSION_SIZE ){
04383 fprintf(stderr,"\a\n*** too many datasets!\n") ;
04384 nerr++ ;
04385 } else {
04386 new_ss->dsset[nn][vv] = dset ;
04387 new_ss->num_dsset ++ ;
04388 }
04389 } /* end of loop over dd=datasets in dsar */
04390
04391 FREE_XTARR(dsar) ; /* don't need array no more */
04392
04393 } /* end of loop over ii=command line arguments past options */
04394
04395 if( nerr > 0 ){
04396 fprintf(stderr,"** FATAL ERRORS on input\n") ; exit(1) ; /* bad */
04397 }
04398
04399 sprintf(str,"\n dataset count = %d" , nds ) ;
04400 if( new_ss->num_dsset == 0 ){
04401 fprintf(stderr,"\n*** No datasets read from the list!\n") ;
04402 exit(1) ;
04403 }
04404 REPORT_PROGRESS(str) ;
04405
04406 STATUS("reading timeseries files") ;
04407
04408 GLOBAL_library.timeseries = THD_get_many_timeseries( NULL ) ;
04409
04410 REFRESH ;
04411
04412 if( GLOBAL_library.timeseries == NULL )
04413 INIT_IMARR(GLOBAL_library.timeseries) ;
04414
04415 /* 26 Mar 2001: store timeseries fetched from the Web */
04416
04417 for( dd=0 ; dd < IMARR_COUNT(webtsar) ; dd++ )
04418 AFNI_add_timeseries( IMARR_SUBIMAGE(webtsar,dd) ) ;
04419
04420 FREE_IMARR(webtsar) ;
04421
04422 sprintf( str , "\n Time series = %d files read" ,
04423 IMARR_COUNT(GLOBAL_library.timeseries) ) ;
04424 REPORT_PROGRESS(str) ;
04425
04426 /* assign the warp and anatomy parent pointers;
04427 then, make any datasets that don't exist but logically
04428 descend from the warp and anatomy parents just assigned */
04429
04430 STATUS("checking idcodes for duplicates") ;
04431
04432 THD_check_idcodes( GLOBAL_library.sslist ) ;
04433
04434 #if 0
04435 STATUS("reconciling parent pointers") ;
04436
04437 THD_reconcile_parents( GLOBAL_library.sslist ) ; /* parents from .HEAD files */
04438
04439 STATUS("forcible adoption of unparented datasets") ;
04440
04441 for( id=0 ; id < GLOBAL_library.sslist->num_sess ; id++ ){ /* functions w/o parents, */
04442 new_ss = GLOBAL_library.sslist->ssar[id] ; /* forcibly get one */
04443 AFNI_force_adoption( new_ss , GLOBAL_argopt.warp_4D ) ;
04444 }
04445 #endif
04446
04447 } /** end of read datasets from command line **/
04448
04449 else { /* should never occur! */
04450
04451 fprintf(stderr,"\a\n*** Illegal Usage configuration detected!\n"); exit(1);
04452 }
04453
04454 /** done at last **/
04455
04456 MPROBE ; EXRETURN ;
04457 }
|
|
|
Definition at line 5222 of file afni.c. References AFNI_process_funcdisplay(), AFNI_set_viewpoint(), and REDISPLAY_OVERLAY. Referenced by AFNI_fimmer_redisplay(), AFNI_inten_bbox_CB(), AFNI_inten_pbar_CB(), AFNI_palette_av_CB(), AFNI_palette_tran_CB(), AFNI_see_func_CB(), AFNI_thr_scale_CB(), AFNI_thresh_top_CB(), and PLUTO_dset_redisplay_mode().
05223 {
05224 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
05225 AFNI_process_funcdisplay( im3d ) ;
05226 }
|
|
||||||||||||
|
Add init function to last registered function. This function should be called just after AFNI_register_nD_function(). [21 Jul 2003] Definition at line 10138 of file afni.c. References MCW_function_list::func_init, generic_func, GLOBAL_library, MCW_function_list::num, AFNI_library_type::registered_0D, AFNI_library_type::registered_1D, AFNI_library_type::registered_2D, and AFNI_library_type::registered_slice_proj. Referenced by EXP0D_init(), and PLUGIN_init().
10139 {
10140 MCW_function_list * rlist ;
10141 int num ;
10142
10143 if( fin == NULL ) return ;
10144
10145 switch( nd ){
10146 default: return ;
10147
10148 case 0: rlist = &(GLOBAL_library.registered_0D) ; break ;
10149 case 1: rlist = &(GLOBAL_library.registered_1D) ; break ;
10150 case 2: rlist = &(GLOBAL_library.registered_2D) ; break ;
10151
10152 case -1: rlist= &(GLOBAL_library.registered_slice_proj) ; break ;
10153 }
10154
10155 num = rlist->num ; if( num <= 0 ) return ;
10156 rlist->func_init[num-1] = fin ;
10157 return ;
10158 }
|
|
||||||||||||||||||||
|
Put a function on the list of n-dimensional transformations
Definition at line 10082 of file afni.c. References flags, MCW_function_list::flags, MCW_function_list::func_code, MCW_function_list::func_data, MCW_function_list::func_init, MCW_function_list::funcs, generic_func, GLOBAL_library, MCW_function_list::labels, name, MCW_function_list::num, AFNI_library_type::registered_0D, AFNI_library_type::registered_1D, AFNI_library_type::registered_2D, AFNI_library_type::registered_slice_proj, and XtRealloc. Referenced by PLUGIN_init().
10084 {
10085 MCW_function_list * rlist ;
10086 int num ;
10087
10088 if( name == NULL || strlen(name) == 0 || func == NULL ) return ;
10089
10090 switch( nd ){
10091 default: return ;
10092
10093 case 0: rlist = &(GLOBAL_library.registered_0D) ; break ;
10094 case 1: rlist = &(GLOBAL_library.registered_1D) ; break ;
10095 case 2: rlist = &(GLOBAL_library.registered_2D) ; break ;
10096
10097 case -1: rlist= &(GLOBAL_library.registered_slice_proj) ; break ;
10098 }
10099
10100 num = rlist->num ;
10101
10102 if( num == 0 ){
10103 rlist->flags=NULL; rlist->labels=NULL; rlist->funcs=NULL;
10104 rlist->func_data=NULL; rlist->func_code=NULL; rlist->func_init=NULL;
10105 }
10106
10107 rlist->flags = (int *) XtRealloc( (char *)rlist->flags, sizeof(int)*(num+1) ) ;
10108
10109 rlist->labels = (char **) XtRealloc( (char *)rlist->labels ,
10110 sizeof(char *)*(num+1) ) ;
10111
10112 rlist->funcs = (generic_func **) XtRealloc( (char *)rlist->funcs ,
10113 sizeof(generic_func *)*(num+1) ) ;
10114
10115 rlist->func_data = (void **) XtRealloc( (char *)rlist->func_data ,
10116 sizeof(void *)*(num+1) ) ;
10117
10118 rlist->func_code = (int *) XtRealloc( (char *)rlist->func_code, sizeof(int)*(num+1) ) ;
10119
10120 rlist->func_init = (generic_func **) XtRealloc( (char *)rlist->func_init ,
10121 sizeof(generic_func *)*(num+1) ) ;
10122
10123 rlist->flags[num] = flags ;
10124 rlist->labels[num] = XtNewString(name) ;
10125 rlist->funcs[num] = func ;
10126 rlist->func_data[num] = NULL ;
10127 rlist->func_code[num] = nd ;
10128 rlist->func_init[num] = NULL ;
10129
10130 rlist->num = num+1 ;
10131 return ;
10132 }
|
|
||||||||||||
|
Definition at line 6336 of file afni.c. References AFNI_modify_viewing(), AFNI_widget_set::dmode, ENTRY, MCW_arrowval::fval, IM3D_VALID, AFNI_view_info::resam_vox, AFNI_datamode_widgets::resam_vox_av, RESET_AFNI_QUIT, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, AFNI_view_info::tempflag, Three_D_View::vinfo, and Three_D_View::vwid.
06337 {
06338 Three_D_View * im3d = (Three_D_View *) cd ;
06339
06340 ENTRY("AFNI_resam_vox_av_CB") ;
06341
06342 if( ! IM3D_VALID(im3d) ) EXRETURN ;
06343
06344 if( av == im3d->vwid->dmode->resam_vox_av ){
06345 im3d->vinfo->resam_vox = av->fval ;
06346 SHOW_AFNI_PAUSE ;
06347 im3d->vinfo->tempflag = 1 ;
06348 AFNI_modify_viewing( im3d , True ) ; /* redisplay */
06349 SHOW_AFNI_READY ;
06350 }
06351 RESET_AFNI_QUIT(im3d) ;
06352 EXRETURN ;
06353 }
|
|
||||||||||||||||
|
Definition at line 7727 of file afni.c. References AFNI_set_viewpoint(), client_data, ENTRY, IM3D_VALID, AFNI_widget_set::marks, MCW_val_bbox(), AFNI_marks_widgets::ov_visible, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, AFNI_viewing_widgets::see_marks_bbox, AFNI_marks_widgets::tag_visible, AFNI_widget_set::view, and Three_D_View::vwid. Referenced by AFNI_define_CB(), and AFNI_marks_action_CB().
07729 {
07730 Three_D_View * im3d = (Three_D_View *) client_data ;
07731 AFNI_marks_widgets * marks ;
07732 AFNI_viewing_widgets * view ;
07733 int bval ;
07734
07735 ENTRY("AFNI_see_marks_CB") ;
07736
07737 if( ! IM3D_VALID(im3d) ) EXRETURN ;
07738
07739 view = im3d->vwid->view ;
07740 marks = im3d->vwid->marks ;
07741 bval = MCW_val_bbox( view->see_marks_bbox ) ;
07742
07743 marks->tag_visible = marks->ov_visible = (bval == 0) ? (False) : (True) ;
07744
07745 if( w != NULL )
07746 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
07747
07748 RESET_AFNI_QUIT(im3d) ;
07749 EXRETURN ;
07750 }
|
|
||||||||||||||||
|
Definition at line 8236 of file afni.c. References AFNI_set_viewpoint(), Three_D_View::anat_now, AFNI_widget_set::func, MCW_val_bbox(), REDISPLAY_OVERLAY, AFNI_view_info::see_ttatlas, AFNI_function_widgets::see_ttatlas_bbox, VIEW_TALAIRACH_TYPE, THD_3dim_dataset::view_type, Three_D_View::vinfo, and Three_D_View::vwid.
08237 {
08238 Three_D_View * im3d = (Three_D_View *) cd ;
08239 int newsee = MCW_val_bbox(im3d->vwid->func->see_ttatlas_bbox) ;
08240
08241 if( newsee == im3d->vinfo->see_ttatlas ) return ;
08242
08243 im3d->vinfo->see_ttatlas = newsee ;
08244
08245 if( im3d->anat_now->view_type == VIEW_TALAIRACH_TYPE )
08246 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ; /* redraw */
08247
08248 return ;
08249 }
|
|
||||||||||||||||
|
here is where we attach "bar" to the dataset * Definition at line 3098 of file afni.c. References FD_brick::a123, abs, AFNI_crosshair_gap_CB(), AFNI_IGNORE_EVERYTHING, AFNI_IGNORE_NOTHING, AFNI_process_drawing(), AFNI_set_viewpoint(), AFNI_view_setter(), Three_D_View::anat_now, AFNI_widget_set::butx, AFNI_widget_set::buty, CLEAR_MONTAGE, AFNI_view_info::crosshair_visible, CURRENT_DAXES, ENTRY, ISQ_cbs::event, free, GRA_handle_keypress(), AFNI_view_info::i1, Three_D_View::ignore_seq_callbacks, THD_ivec3::ijk, IM3D_VALID, AFNI_widget_set::imag, AFNI_imaging_widgets::image_xyz_pb, AFNI_imaging_widgets::image_yzx_pb, AFNI_imaging_widgets::image_zxy_pb, INIT_bigscroll, INIT_BKGD_LAB, isqCR_appress, isqCR_button2_key, isqCR_button2_points, isqCR_buttonpress, isqCR_destroy, isqCR_dxminus, isqCR_dxplus, isqCR_dyminus, isqCR_dyplus, isqCR_force_redisplay, isqCR_getxynim, isqCR_keypress, isqCR_newimage, isqCR_newmontage, AFNI_view_info::j2, AFNI_view_info::k3, ISQ_cbs::key, LOAD_DSET_VIEWS, malloc, MCW_invert_widget(), myXtFree, FD_brick::n1, FD_brick::n2, FD_brick::n3, ISQ_cbs::nim, NORMAL_cursorize, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, MCW_imseq::parent, PLANAR_MODE, PLUTO_force_rebar(), PLUTO_force_redisplay(), AFNI_imaging_widgets::popmenu, ISQ_cbs::reason, REDISPLAY_OPTIONAL, REDISPLAY_OVERLAY, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, SAVE_VPT, STATUS, MCW_imseq::status, TEMP_IVEC3, THD_3dind_to_fdind(), THD_fdind_to_3dind(), UNDO_MODE, ISQ_cbs::userdata, VIEWER_TO_GRAPHER, Three_D_View::vinfo, Three_D_View::vwid, AFNI_view_info::xhairs_ndown, AFNI_view_info::xhairs_nskip, AFNI_view_info::xhairs_nup, AFNI_view_info::xhairs_show_montage, ISQ_cbs::xim, and ISQ_cbs::yim. Referenced by AFNI_brick_to_mri().
03099 {
03100 Three_D_View * im3d = (Three_D_View *) seq->parent ;
03101
03102 ENTRY("AFNI_seq_send_CB") ;
03103
03104 if(PRINT_TRACING)
03105 { char str[256] ; sprintf(str,"reason=%d",cbs->reason) ; STATUS(str) ; }
03106
03107 if( ! IM3D_VALID(im3d) ||
03108 ( im3d->ignore_seq_callbacks == AFNI_IGNORE_EVERYTHING
03109 && cbs->reason != isqCR_getxynim ) ) EXRETURN ;
03110
03111 switch( cbs->reason ){
03112
03113 default: break ;
03114
03115 case isqCR_destroy:{
03116 MCW_imseq * sxyz = im3d->s123 ,
03117 * syzx = im3d->s231 ,
03118 * szxy = im3d->s312 ;
03119 Widget w ;
03120 int a3 = br->a123.ijk[2] , /* z axis of the brick? */
03121 az = abs(a3) - 1 ; /* 0,1,2 for dataset x,y,z */
03122
03123 if( seq == sxyz ){
03124 w = im3d->vwid->imag->image_xyz_pb ; im3d->s123 = NULL ; }
03125 else if( seq == syzx ){
03126 w = im3d->vwid->imag->image_yzx_pb ; im3d->s231 = NULL ; }
03127 else if( seq == szxy ){
03128 w = im3d->vwid->imag->image_zxy_pb ; im3d->s312 = NULL ; }
03129 else
03130 EXRETURN ; /* something goofy happened? */
03131
03132 #if 1
03133 myXtFree( seq->status ) ; /* 28 Sep 1998: via Purify */
03134 #endif
03135 myXtFree( seq ) ;
03136 MCW_invert_widget(w) ; /* back to normal */
03137 NORMAL_cursorize(w) ; /* 20 Jul 2005 */
03138 INIT_BKGD_LAB(im3d) ;
03139 AFNI_view_setter(im3d,NULL) ;
03140
03141 /* July 1996: redraw if we just lost a crosshair montage
03142 (it would have been in the z direction of the brick) */
03143
03144 if( im3d->vinfo->xhairs_ndown.ijk[az] > 0 ||
03145 im3d->vinfo->xhairs_nup.ijk[az] > 0 ){
03146
03147 if(PRINT_TRACING)
03148 { char str[256] ;
03149 sprintf(str,"imseq close on axis %d --> lost xhairs in that direction",az) ;
03150 STATUS(str) ; }
03151
03152 CLEAR_MONTAGE(im3d,br) ;
03153
03154 if( im3d->vinfo->xhairs_show_montage &&
03155 im3d->ignore_seq_callbacks == AFNI_IGNORE_NOTHING ){
03156
03157 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
03158 }
03159 }
03160 }
03161 MPROBE ;
03162 break ; /* end of destroy */
03163
03164 case isqCR_buttonpress:{
03165 XButtonEvent *xev = (XButtonEvent *) cbs->event ;
03166
03167 if(PRINT_TRACING){
03168 char str[256] ;
03169 sprintf(str,"isqCR_buttonpress: button=%d state=%x",xev->button,xev->state) ;
03170 STATUS(str) ; }
03171
03172 im3d->vwid->butx = xev->x_root ; /* 17 May 2005 */
03173 im3d->vwid->buty = xev->y_root ;
03174 switch( xev->button ){
03175
03176 default: EXRETURN ; /* unused button */
03177
03178 case Button3:{ /* popup */
03179 XtVaSetValues( im3d->vwid->imag->popmenu ,
03180 XmNuserData , (XtPointer) seq , /* who */
03181 NULL ) ;
03182 XmMenuPosition( im3d->vwid->imag->popmenu , xev ) ; /* where */
03183 XtManageChild ( im3d->vwid->imag->popmenu ) ; /* pop */
03184 }
03185 break ;
03186
03187 case Button1:{
03188 THD_ivec3 id ;
03189
03190 /* April 1996: only use this button press if
03191 it is inside the confines of the brick */
03192
03193 if(PRINT_TRACING)
03194 { char str[256] ;
03195 sprintf(str,"Button1 at %d %d %d",
03196 cbs->xim,cbs->yim,cbs->nim) ; STATUS(str) ; }
03197
03198 if( cbs->xim >= 0 && cbs->xim < br->n1 &&
03199 cbs->yim >= 0 && cbs->yim < br->n2 &&
03200 cbs->nim >= 0 && cbs->nim < br->n3 ){
03201
03202 id = THD_fdind_to_3dind(
03203 br , TEMP_IVEC3(cbs->xim,cbs->yim,cbs->nim) );
03204
03205 if(PRINT_TRACING)
03206 { char str[256] ;
03207 sprintf(str," 3D dataset coordinates %d %d %d",
03208 id.ijk[0],id.ijk[1],id.ijk[2] ) ; STATUS(str) ; }
03209
03210 SAVE_VPT(im3d) ; /* save current location as jumpback */
03211
03212 if( im3d->ignore_seq_callbacks == AFNI_IGNORE_NOTHING ){
03213
03214 /* 20 Feb 2003: set plane from which viewpoint is controlled */
03215
03216 AFNI_view_setter(im3d,seq) ;
03217 AFNI_set_viewpoint(
03218 im3d , id.ijk[0] , id.ijk[1] , id.ijk[2] ,
03219 (im3d->vinfo->crosshair_visible==True) ?
03220 REDISPLAY_OVERLAY : REDISPLAY_OPTIONAL ) ;
03221 }
03222 }
03223 } /* end of button 1 */
03224 break ;
03225 } /* end of switch on which button */
03226 }
03227 break ; /* end of button press */
03228
03229 case isqCR_newimage:{
03230 THD_ivec3 id ;
03231
03232 id = THD_fdind_to_3dind( br, TEMP_IVEC3(-99999,-99999,cbs->nim) );
03233
03234 if(PRINT_TRACING)
03235 { char str[256] ;
03236 sprintf(str,"newimage input %d -> %d %d %d",
03237 cbs->nim , id.ijk[0],id.ijk[1],id.ijk[2] ) ;
03238 STATUS(str) ; }
03239
03240 if( im3d->ignore_seq_callbacks == AFNI_IGNORE_NOTHING ){
03241
03242 /* 20 Feb 2003: set plane from which viewpoint is controlled */
03243
03244 AFNI_view_setter(im3d,seq) ;
03245 AFNI_set_viewpoint(
03246 im3d , id.ijk[0] , id.ijk[1] , id.ijk[2] ,
03247 (im3d->vinfo->crosshair_visible==True) ?
03248 REDISPLAY_OVERLAY : REDISPLAY_OPTIONAL ) ;
03249 }
03250 }
03251 break ; /* end of new image */
03252
03253 /** July 1996: an image viewer changed montage layout **/
03254
03255 case isqCR_newmontage:{
03256 THD_ivec3 * minf = (THD_ivec3 *) cbs->userdata ;
03257 int ndown = minf->ijk[0], nup = minf->ijk[1], nskip = minf->ijk[2] ;
03258 int a3 = br->a123.ijk[2] , /* z axis of the brick? */
03259 az = abs(a3) - 1 ; /* 0,1,2 for dataset x,y,z */
03260
03261 if(PRINT_TRACING)
03262 { char str[256] ;
03263 sprintf(str,"newmontage: ndown=%d nup=%d nskip=%d a3=%d (on axis az=%d)",
03264 ndown,nup,nskip,a3,az) ; STATUS(str) ; }
03265
03266 im3d->vinfo->xhairs_nskip.ijk[az] = nskip ;
03267
03268 if( a3 > 0 ){
03269 im3d->vinfo->xhairs_ndown.ijk[az] = ndown ;
03270 im3d->vinfo->xhairs_nup.ijk[az] = nup ;
03271 } else {
03272 im3d->vinfo->xhairs_ndown.ijk[az] = nup ;
03273 im3d->vinfo->xhairs_nup.ijk[az] = ndown ;
03274 }
03275
03276 if( im3d->ignore_seq_callbacks == AFNI_IGNORE_NOTHING )
03277 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
03278 }
03279 break ;
03280
03281 /* 30 Dec 1998: return the current focus position */
03282
03283 case isqCR_getxynim:{
03284 THD_ivec3 ib ;
03285
03286 ib = THD_3dind_to_fdind( br , TEMP_IVEC3( im3d->vinfo->i1 ,
03287 im3d->vinfo->j2 ,
03288 im3d->vinfo->k3 ) ) ;
03289
03290 cbs->xim = ib.ijk[0] ; cbs->yim = ib.ijk[1] ; cbs->nim = ib.ijk[2] ;
03291 }
03292 break ; /* end of getxynim */
03293
03294 /* Arrowpad stuff */
03295
03296 case isqCR_appress:{
03297 if( im3d->ignore_seq_callbacks == AFNI_IGNORE_NOTHING ){
03298 AFNI_view_setter(im3d,seq) ;
03299 AFNI_crosshair_gap_CB( NULL , (XtPointer) im3d ) ;
03300 }
03301 }
03302 break ; /* end of arrowpad center key press */
03303
03304 case isqCR_dxplus:
03305 case isqCR_dxminus:
03306 case isqCR_dyplus:
03307 case isqCR_dyminus:{
03308 THD_ivec3 ib , id ;
03309 XButtonEvent * xev = (XButtonEvent *) cbs->event ;
03310 int step = 1 ;
03311 THD_dataxes *daxes ;
03312
03313 if( xev != NULL &&
03314 ( xev->type == ButtonPress ||
03315 xev->type == ButtonRelease ) &&
03316 (xev->state & (ShiftMask | ControlMask)) ) step = INIT_bigscroll ;
03317
03318 ib = THD_3dind_to_fdind( br , TEMP_IVEC3( im3d->vinfo->i1 ,
03319 im3d->vinfo->j2 ,
03320 im3d->vinfo->k3 ) ) ;
03321 switch( cbs->reason ){
03322 case isqCR_dxplus: ib.ijk[0] += step ; break ;
03323 case isqCR_dxminus: ib.ijk[0] -= step ; break ;
03324 case isqCR_dyplus: ib.ijk[1] += step ; break ;
03325 case isqCR_dyminus: ib.ijk[1] -= step ; break ;
03326 }
03327
03328 id = THD_fdind_to_3dind( br , ib ) ;
03329
03330 /* 13 May 2003: allow for wraparound */
03331
03332 LOAD_DSET_VIEWS(im3d) ; /* 20 Nov 2003 */
03333 daxes = CURRENT_DAXES(im3d->anat_now) ;
03334 if( id.ijk[0] < 0 ) id.ijk[0] += daxes->nxx ;
03335 else if( id.ijk[0] >= daxes->nxx ) id.ijk[0] -= daxes->nxx ;
03336 if( id.ijk[1] < 0 ) id.ijk[1] += daxes->nyy ;
03337 else if( id.ijk[1] >= daxes->nyy ) id.ijk[1] -= daxes->nyy ;
03338 if( id.ijk[2] < 0 ) id.ijk[2] += daxes->nzz ;
03339 else if( id.ijk[2] >= daxes->nzz ) id.ijk[2] -= daxes->nzz ;
03340
03341 if( im3d->ignore_seq_callbacks == AFNI_IGNORE_NOTHING ){
03342
03343 /* 20 Feb 2003: set plane from which viewpoint is controlled */
03344
03345 AFNI_view_setter(im3d,seq) ;
03346 AFNI_set_viewpoint(
03347 im3d , id.ijk[0] , id.ijk[1] , id.ijk[2] ,
03348 (im3d->vinfo->crosshair_visible==True) ?
03349 REDISPLAY_OVERLAY : REDISPLAY_OPTIONAL ) ;
03350 }
03351 }
03352 break ; /* end of arrowpad arrow press */
03353
03354 case isqCR_keypress:{
03355 #if 0
03356 MCW_grapher * grapher = VIEWER_TO_GRAPHER(im3d,seq) ;
03357 if( grapher != NULL ){
03358 char buf[2] ;
03359 buf[0] = cbs->key ; buf[1] = '\0' ;
03360 GRA_handle_keypress( grapher , buf , cbs->event ) ;
03361 }
03362 #endif
03363 }
03364 break ; /* end of keyboard press */
03365
03366 /*--- 20 Feb 2003: keypress while in button2 mode ---*/
03367
03368 case isqCR_button2_key:{
03369 KeySym ks = (KeySym) cbs->key ;
03370
03371 switch( ks ){
03372 case XK_Delete:
03373 AFNI_process_drawing( im3d , UNDO_MODE , 0,NULL,NULL,NULL ) ;
03374 break ;
03375 }
03376 }
03377 break ; /* end of button2 mode keypress */
03378
03379 /*--- Feb 1998: list of coordinates from button2 drawing ---*/
03380
03381 case isqCR_button2_points:{
03382 int npts = cbs->key , zim = cbs->nim ;
03383 int * xyout = (int *) cbs->userdata ;
03384 THD_ivec3 id ;
03385 int nvec , ii , xim,yim , fixed_plane ;
03386 int * xdset , * ydset , * zdset ;
03387
03388 if( zim >= 0 && zim < br->n3 && npts > 0 ){ /* if input is good */
03389
03390 /* make space for translated coordinates */
03391
03392 xdset = (int *) malloc( npts * sizeof(int) ) ;
03393 ydset = (int *) malloc( npts * sizeof(int) ) ;
03394 zdset = (int *) malloc( npts * sizeof(int) ) ;
03395
03396 /* translate coordinates to dataset xyz indices,
03397 casting out any that are outside the dataset brick */
03398
03399 nvec = 0 ;
03400 for( ii=0 ; ii < npts ; ii++ ){
03401 xim = xyout[2*ii] ; yim = xyout[2*ii+1] ;
03402
03403 /* skip points not in the volume */
03404
03405 if( xim >= 0 && xim < br->n1 && yim >= 0 && yim < br->n2 ){
03406
03407 id = THD_fdind_to_3dind( br , TEMP_IVEC3(xim,yim,zim) );
03408 xdset[nvec] = id.ijk[0] ;
03409 ydset[nvec] = id.ijk[1] ;
03410 zdset[nvec] = id.ijk[2] ;
03411
03412 /* skip sequentially duplicate points */
03413
03414 if( nvec == 0 ||
03415 xdset[nvec] != xdset[nvec-1] ||
03416 ydset[nvec] != ydset[nvec-1] ||
03417 zdset[nvec] != zdset[nvec-1] ) nvec++ ;
03418 }
03419 }
03420
03421 /* send coordinates to processing routine */
03422
03423 fixed_plane = abs(br->a123.ijk[2]) ;
03424
03425 if( nvec > 0 ) AFNI_process_drawing( im3d ,
03426 PLANAR_MODE+fixed_plane ,
03427 nvec,xdset,ydset,zdset ) ;
03428
03429 /* free coordinate memory */
03430
03431 free(xdset) ; free(ydset) ; free(zdset) ;
03432 }
03433 }
03434 break ; /* end of button2 coordinates */
03435
03436 /*--- 22 Aug 1998: redraw everything ---*/
03437
03438 case isqCR_force_redisplay:{
03439 AFNI_view_setter(im3d,seq) ;
03440 PLUTO_force_redisplay() ; /* see afni_plugin.c */
03441 PLUTO_force_rebar() ; /* ditto [23 Aug 1998] */
03442 }
03443 break ; /* end of forced redisplay */
03444
03445 } /* end of switch on reason for call */
03446
03447 EXRETURN ;
03448 }
|
|
|
Definition at line 9641 of file afni.c. References AFNI_DEFAULT_CURSOR, AFNI_WAITING_CURSOR, AFNI_library_type::controllers, ENTRY, MCW_grapher::fdw_graph, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, GLOBAL_argopt, GLOBAL_library, GRA_REALZ, IM3D_OPEN, AFNI_view_info::inverted_pause, ISQ_REALZ, AF_options::keep_logo, MAX_CONTROLLERS, MCW_invert_widget(), NORMAL_cursorize, AFNI_widget_set::picture, PICTURE_OFF, PICTURE_ON, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, AFNI_widget_set::top_form, AFNI_widget_set::top_shell, Three_D_View::vinfo, Three_D_View::vwid, WATCH_cursorize, and MCW_imseq::wtop.
09642 {
09643 Three_D_View * im3d ;
09644 int id ;
09645
09646 ENTRY("AFNI_set_cursor") ;
09647
09648 for( id=0 ; id < MAX_CONTROLLERS ; id++ ){
09649 im3d = GLOBAL_library.controllers[id] ;
09650 if( IM3D_OPEN(im3d) ){
09651 switch( cursor_code ){
09652
09653 default:
09654 case AFNI_DEFAULT_CURSOR:
09655 NORMAL_cursorize( im3d->vwid->top_shell ) ;
09656
09657 if( ISQ_REALZ(im3d->s123) )
09658 NORMAL_cursorize( im3d->s123->wtop ) ;
09659
09660 if( ISQ_REALZ(im3d->s231) )
09661 NORMAL_cursorize( im3d->s231->wtop ) ;
09662
09663 if( ISQ_REALZ(im3d->s312) )
09664 NORMAL_cursorize( im3d->s312->wtop ) ;
09665
09666 if( GRA_REALZ(im3d->g123) )
09667 NORMAL_cursorize( im3d->g123->fdw_graph ) ;
09668
09669 if( GRA_REALZ(im3d->g231) )
09670 NORMAL_cursorize( im3d->g231->fdw_graph ) ;
09671
09672 if( GRA_REALZ(im3d->g312) )
09673 NORMAL_cursorize( im3d->g312->fdw_graph ) ;
09674
09675 if( im3d->vinfo->inverted_pause ){
09676 im3d->vinfo->inverted_pause = False ;
09677 if( im3d->vwid->picture != NULL ){
09678 if( !GLOBAL_argopt.keep_logo ) PICTURE_OFF(im3d) ;
09679 } else
09680 MCW_invert_widget( im3d->vwid->top_form ) ;
09681 }
09682
09683 break ;
09684
09685 case AFNI_WAITING_CURSOR:
09686 WATCH_cursorize( im3d->vwid->top_shell ) ;
09687
09688 if( ISQ_REALZ(im3d->s123) )
09689 WATCH_cursorize( im3d->s123->wtop ) ;
09690
09691 if( ISQ_REALZ(im3d->s231) )
09692 WATCH_cursorize( im3d->s231->wtop ) ;
09693
09694 if( ISQ_REALZ(im3d->s312) )
09695 WATCH_cursorize( im3d->s312->wtop ) ;
09696
09697 if( GRA_REALZ(im3d->g123) )
09698 WATCH_cursorize( im3d->g123->fdw_graph ) ;
09699
09700 if( GRA_REALZ(im3d->g231) )
09701 WATCH_cursorize( im3d->g231->fdw_graph ) ;
09702
09703 if( GRA_REALZ(im3d->g312) )
09704 WATCH_cursorize( im3d->g312->fdw_graph ) ;
09705
09706 if( ! im3d->vinfo->inverted_pause ){
09707 im3d->vinfo->inverted_pause = True ;
09708 if( im3d->vwid->picture != NULL )
09709 PICTURE_ON(im3d) ;
09710 else
09711 MCW_invert_widget( im3d->vwid->top_form ) ;
09712 }
09713
09714 break ;
09715 }
09716
09717 XSync( XtDisplay(im3d->vwid->top_shell) , False ) ;
09718 XmUpdateDisplay( im3d->vwid->top_shell ) ;
09719 }
09720 }
09721
09722 EXRETURN ;
09723 }
|
|
||||||||||||||||
|
Definition at line 6127 of file afni.c. References ENTRY. Referenced by AFNI_marks_edits_CB(), and AFNI_marktog_CB().
06128 {
06129 int ib ;
06130
06131 ENTRY("AFNI_set_tog") ;
06132
06133 for( ib=0 ; ib < ntog ; ib++ )
06134 XmToggleButtonSetState( tog[ib] , ib==nset , False ) ;
06135
06136 EXRETURN ;
06137 }
|
|
||||||||||||||||||||
|
Set a value label when the nsl-th image is in "im". ------------------------------------------------------------------------------- Definition at line 2692 of file afni.c. References AV_fval_to_char(), AFNI_imaging_widgets::do_bkgd_lab, ENTRY, complex::i, AFNI_view_info::i1, THD_ivec3::ijk, IM3D_VALID, AFNI_widget_set::imag, AFNI_view_info::j2, AFNI_view_info::k3, MRI_IMAGE::kind, MRI_BYTE_2D, MRI_COMPLEX_2D, MRI_FLOAT_2D, MRI_INT_2D, MRI_RGB_PTR, MRI_SHORT_2D, MRI_IMAGE::nx, FD_brick::parent, complex::r, TEMP_IVEC3, THD_3dind_to_fdind(), Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_brick_to_mri(), and AFNI_func_overlay().
02693 {
02694 Three_D_View * im3d = (Three_D_View *) br->parent ;
02695 THD_ivec3 ib ;
02696
02697 ENTRY("AFNI_set_valabel") ;
02698
02699 if( ! IM3D_VALID(im3d) || ! im3d->vwid->imag->do_bkgd_lab ||
02700 im == NULL || blab == NULL ) EXRETURN ;
02701
02702 /* convert current voxel index location to FD_brick indexes */
02703
02704 ib = THD_3dind_to_fdind( br , TEMP_IVEC3( im3d->vinfo->i1 ,
02705 im3d->vinfo->j2 ,
02706 im3d->vinfo->k3 ) ) ;
02707
02708 /* if the input image slice index (nsl) doesn't match the current
02709 location of the crosshairs, then we don't care about this image */
02710
02711 if( nsl != ib.ijk[2] ) EXRETURN ;
02712
02713 /* otherwise, extract a value from the image and put into blab */
02714
02715 switch( im->kind ){
02716
02717 case MRI_byte:{
02718 int val = MRI_BYTE_2D(im , ib.ijk[0],ib.ijk[1]) ;
02719 sprintf( blab , "%6d" , val ) ;
02720 }
02721 break ;
02722
02723 case MRI_short:{
02724 int val = MRI_SHORT_2D(im , ib.ijk[0],ib.ijk[1]) ;
02725 sprintf( blab , "%6d" , val ) ;
02726 }
02727 break ;
02728
02729 case MRI_int:{
02730 int val = MRI_INT_2D(im , ib.ijk[0],ib.ijk[1]) ;
02731 sprintf( blab , "%6d" , val ) ;
02732 }
02733 break ;
02734
02735 case MRI_float:{
02736 float val = MRI_FLOAT_2D(im , ib.ijk[0],ib.ijk[1]) ;
02737 AV_fval_to_char(val,blab) ;
02738 }
02739 break ;
02740
02741 case MRI_complex:{
02742 int iblab ;
02743 complex val ;
02744 val = MRI_COMPLEX_2D(im , ib.ijk[0],ib.ijk[1]) ;
02745 AV_fval_to_char(val.r,blab) ; iblab = strlen(blab) ;
02746 if( val.i >= 0.0 ) blab[iblab++] = '+' ;
02747 AV_fval_to_char(val.i,blab+iblab) ; iblab = strlen(blab) ;
02748 blab[iblab++] = 'I' ; blab[iblab++] = '\0' ;
02749 }
02750 break ;
02751
02752 case MRI_rgb:{
02753 byte *rgb = MRI_RGB_PTR(im) ;
02754 int ii = ib.ijk[0] + im->nx * ib.ijk[1] ;
02755 sprintf(blab,"(%d,%d,%d)",(int)rgb[3*ii],(int)rgb[3*ii+1],(int)rgb[3*ii+2]) ;
02756 }
02757 break ;
02758
02759 }
02760 EXRETURN ;
02761 }
|
|
||||||||||||||||||||||||
|
Definition at line 5318 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_crosshair_relabel(), AFNI_do_bkgd_lab(), AFNI_IGNORE_EVERYTHING, AFNI_IGNORE_NOTHING, AFNI_lock_carryout(), AFNI_noenv(), AFNI_process_redisplay(), AFNI_process_viewpoint(), AFNI_ttatlas_query(), AFNI_view_info::anat_index, Three_D_View::anat_now, AFNI_view_info::anat_val, Three_D_View::b123_ulay, Three_D_View::b231_ulay, Three_D_View::b312_ulay, CURRENT_DAXES, drive_MCW_grapher(), drive_MCW_imseq(), DSET_NUM_TIMES, DUMP_IVEC3, ENTRY, free, AFNI_view_info::func_val, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, graDR_redraw, graDR_setindex, i1, AFNI_view_info::i1, Three_D_View::ignore_seq_callbacks, THD_ivec3::ijk, IM3D_OPEN, AFNI_widget_set::imag, isqDR_display, isqDR_overlay, ISVALID_3DIM_DATASET, AFNI_view_info::j2, AFNI_view_info::k3, LOAD_DSET_VIEWS, LOAD_IVEC3, MCW_textwin_alter(), MCW_grapher::never_drawn, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, AFNI_imaging_widgets::pop_whereami_twin, REDISPLAY_ALL, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, STATUS, THD_3dind_to_3dmm(), THD_3dind_to_fdind(), THD_3dmm_to_dicomm(), AFNI_view_info::thr_val, AFNI_view_info::time_index, Three_D_View::type, Three_D_View::vinfo, Three_D_View::vwid, AFNI_view_info::xi, THD_fvec3::xyz, AFNI_view_info::yj, and AFNI_view_info::zk. Referenced by AFNI_bucket_CB(), AFNI_crosshair_color_CB(), AFNI_crosshair_gap_CB(), AFNI_crosshair_visible_CB(), AFNI_define_CB(), AFNI_do_many_writes(), AFNI_drive_set_ijk(), AFNI_gra_send_CB(), AFNI_imag_pop_CB(), AFNI_initialize_view(), AFNI_jumpto_dicom(), AFNI_jumpto_ijk(), AFNI_lock_carryout(), AFNI_marks_action_CB(), AFNI_marks_disp_av_CB(), AFNI_marktog_CB(), AFNI_misc_CB(), AFNI_modify_viewing(), AFNI_process_plugout(), AFNI_redisplay(), AFNI_redisplay_func(), AFNI_see_marks_CB(), AFNI_see_ttatlas_CB(), AFNI_seq_send_CB(), AFNI_surf_bbox_CB(), AFNI_surf_redraw_CB(), AFNI_talto_CB(), AFNI_underlay_CB(), AFNI_view_xyz_CB(), AFNI_write_dataset_CB(), AFNI_xhall_bbox_CB(), PLUTO_dset_redisplay_mode(), and PLUTO_force_redisplay().
05320 {
05321 int old_i1 , old_j2 , old_k3 , i1,j2,k3 ;
05322 int dim1,dim2,dim3 , isq_driver , do_lock , new_xyz ;
05323 int newti ; /* 24 Jan 2001 */
05324
05325 THD_dataxes * daxes ;
05326 THD_fvec3 fv ;
05327 THD_ivec3 old_ib , new_ib , old_id , new_id ;
05328
05329 ENTRY("AFNI_set_viewpoint") ;
05330
05331 if(PRINT_TRACING)
05332 { char str[256] ;
05333 sprintf(str,"input xx=%d yy=%d zz=%d",xx,yy,zz) ;
05334 STATUS(str) ; }
05335
05336 if( ! IM3D_OPEN(im3d) || ! ISVALID_3DIM_DATASET(im3d->anat_now) ) EXRETURN ;
05337
05338 /** 02 Nov 1996:
05339 Attach view-specific dataxes and warps to the datasets **/
05340
05341 LOAD_DSET_VIEWS(im3d) ;
05342
05343 /** find if input points are inside axes of current display **/
05344
05345 daxes = CURRENT_DAXES(im3d->anat_now) ;
05346 dim1 = daxes->nxx ; dim2 = daxes->nyy ; dim3 = daxes->nzz ;
05347
05348 old_i1 = im3d->vinfo->i1 ;
05349 old_j2 = im3d->vinfo->j2 ;
05350 old_k3 = im3d->vinfo->k3 ;
05351
05352 i1 = im3d->vinfo->i1 = (xx < 0 || xx >= dim1) ? (old_i1) : xx ;
05353 j2 = im3d->vinfo->j2 = (yy < 0 || yy >= dim2) ? (old_j2) : yy ;
05354 k3 = im3d->vinfo->k3 = (zz < 0 || zz >= dim3) ? (old_k3) : zz ;
05355
05356 /** determine redisplay mode for image viewers **/
05357
05358 new_xyz =
05359 do_lock = !( i1 == old_i1 && j2 == old_j2 && k3 == old_k3 ) ; /* 11 Nov 1996 */
05360
05361 if( !redisplay_option && !new_xyz ) EXRETURN;
05362
05363 isq_driver = (redisplay_option == REDISPLAY_ALL) ? isqDR_display
05364 : isqDR_overlay ;
05365
05366 if( !AFNI_noenv("AFNI_VALUE_LABEL") && new_xyz &&
05367 (im3d->s123 == NULL || im3d->s231 == NULL || im3d->s312 == NULL) )
05368 isq_driver = isqDR_display ; /* 08 Mar 2002 */
05369
05370 LOAD_IVEC3(old_id,old_i1,old_j2,old_k3) ;
05371 LOAD_IVEC3(new_id, i1, j2, k3) ;
05372
05373 #ifdef AFNI_DEBUG
05374 STATUS(" ") ;
05375 DUMP_IVEC3(" old_id",old_id) ;
05376 DUMP_IVEC3(" new_id",new_id) ;
05377 #endif
05378
05379 if( im3d->type == AFNI_3DDATA_VIEW ){
05380 fv = THD_3dind_to_3dmm( im3d->anat_now , new_id ) ;
05381 fv = THD_3dmm_to_dicomm( im3d->anat_now , fv ) ;
05382 im3d->vinfo->xi = fv.xyz[0] ; /* set display coords */
05383 im3d->vinfo->yj = fv.xyz[1] ; /* to Dicom standard */
05384 im3d->vinfo->zk = fv.xyz[2] ;
05385 }
05386
05387 /* clear labels */
05388
05389 im3d->vinfo->func_val[0] = im3d->vinfo->thr_val[0] = '\0' ;
05390 if( do_lock || isq_driver==isqDR_display )
05391 im3d->vinfo->anat_val[0] = '\0';
05392 if( !AFNI_noenv( "AFNI_VALUE_LABEL") ) AFNI_do_bkgd_lab( im3d ) ;
05393
05394 /*--- redraw images now ---*/
05395
05396 im3d->ignore_seq_callbacks = AFNI_IGNORE_EVERYTHING ;
05397
05398 if( im3d->s123 != NULL || im3d->g123 != NULL ){
05399 int xyzm[4] ;
05400
05401 old_ib = THD_3dind_to_fdind( im3d->b123_ulay , old_id ) ;
05402 new_ib = THD_3dind_to_fdind( im3d->b123_ulay , new_id ) ;
05403
05404 #ifdef AFNI_DEBUG
05405 STATUS(" ") ;
05406 DUMP_IVEC3(" redraw s123 old_ib",old_ib) ;
05407 DUMP_IVEC3(" new_ib",new_ib) ;
05408 #endif
05409
05410 if( redisplay_option || old_ib.ijk[2] != new_ib.ijk[2] )
05411 drive_MCW_imseq( im3d->s123 ,
05412 isq_driver , (XtPointer) new_ib.ijk[2] ) ;
05413
05414
05415 xyzm[0] = new_ib.ijk[0] ; xyzm[1] = new_ib.ijk[1] ;
05416 xyzm[2] = new_ib.ijk[2] ; xyzm[3] = 0 ;
05417
05418 if( im3d->g123 != NULL && ( im3d->g123->never_drawn ||
05419 redisplay_option == REDISPLAY_ALL || new_xyz ) )
05420 drive_MCW_grapher( im3d->g123 , graDR_redraw , (XtPointer) xyzm ) ;
05421 }
05422
05423 if( im3d->s231 != NULL || im3d->g231 != NULL ){
05424 int xyzm[4] ;
05425
05426 old_ib = THD_3dind_to_fdind( im3d->b231_ulay , old_id ) ;
05427 new_ib = THD_3dind_to_fdind( im3d->b231_ulay , new_id ) ;
05428
05429 #ifdef AFNI_DEBUG
05430 STATUS(" ") ;
05431 DUMP_IVEC3(" redraw s231 old_ib",old_ib) ;
05432 DUMP_IVEC3(" new_ib",new_ib) ;
05433 #endif
05434
05435 if( redisplay_option || old_ib.ijk[2] != new_ib.ijk[2] )
05436 drive_MCW_imseq( im3d->s231 ,
05437 isq_driver , (XtPointer) new_ib.ijk[2] ) ;
05438
05439 xyzm[0] = new_ib.ijk[0] ; xyzm[1] = new_ib.ijk[1] ;
05440 xyzm[2] = new_ib.ijk[2] ; xyzm[3] = 0 ;
05441
05442 if( im3d->g231 != NULL && ( im3d->g231->never_drawn ||
05443 redisplay_option == REDISPLAY_ALL || new_xyz ) )
05444 drive_MCW_grapher( im3d->g231 , graDR_redraw , (XtPointer) xyzm ) ;
05445 }
05446
05447 if( im3d->s312 != NULL || im3d->g312 != NULL ){
05448 int xyzm[4] ;
05449
05450 old_ib = THD_3dind_to_fdind( im3d->b312_ulay , old_id ) ;
05451 new_ib = THD_3dind_to_fdind( im3d->b312_ulay , new_id ) ;
05452
05453 #ifdef AFNI_DEBUG
05454 STATUS(" ") ;
05455 DUMP_IVEC3(" redraw s312 old_ib",old_ib) ;
05456 DUMP_IVEC3(" new_ib",new_ib) ;
05457 #endif
05458
05459 if( redisplay_option || old_ib.ijk[2] != new_ib.ijk[2] )
05460 drive_MCW_imseq( im3d->s312 ,
05461 isq_driver , (XtPointer) new_ib.ijk[2] ) ;
05462
05463 xyzm[0] = new_ib.ijk[0] ; xyzm[1] = new_ib.ijk[1] ;
05464 xyzm[2] = new_ib.ijk[2] ; xyzm[3] = 0 ;
05465
05466 if( im3d->g312 != NULL && ( im3d->g312->never_drawn ||
05467 redisplay_option == REDISPLAY_ALL || new_xyz ) )
05468 drive_MCW_grapher( im3d->g312 , graDR_redraw , (XtPointer) xyzm ) ;
05469 }
05470
05471 im3d->ignore_seq_callbacks = AFNI_IGNORE_NOTHING ;
05472
05473 /*--- redraw coordinate display now ---*/
05474
05475 if( redisplay_option || new_xyz ){
05476 AFNI_crosshair_relabel( im3d ) ; /* 12 Mar 2004: moved this to a function, too */
05477 AFNI_do_bkgd_lab( im3d ) ; /* 08 Mar 2002: moved labelizing to function */
05478 }
05479
05480 /* 24 Jan 2001: set grapher index based on type of dataset */
05481
05482 #if 0
05483 if( DSET_NUM_TIMES(im3d->anat_now) > 1 )
05484 newti = im3d->vinfo->time_index ;
05485 else
05486 #endif
05487 newti = im3d->vinfo->anat_index ;
05488
05489 if( newti >= 0 ){
05490 drive_MCW_grapher( im3d->g123, graDR_setindex, (XtPointer)newti );
05491 drive_MCW_grapher( im3d->g231, graDR_setindex, (XtPointer)newti );
05492 drive_MCW_grapher( im3d->g312, graDR_setindex, (XtPointer)newti );
05493 }
05494
05495 if( do_lock ) /* 11 Nov 1996 */
05496 AFNI_lock_carryout( im3d ) ; /* 04 Nov 1996 */
05497
05498 /** Feb 1998: if desired, send coordinates to receiver **/
05499 /** Mar 1999: do it in an external routine, not here. **/
05500
05501 if( new_xyz ) AFNI_process_viewpoint( im3d ) ;
05502 else AFNI_process_redisplay( im3d ) ;
05503
05504 if( new_xyz && im3d->vwid->imag->pop_whereami_twin != NULL ){
05505
05506 char * tlab = AFNI_ttatlas_query( im3d ) ;
05507
05508 if( tlab == NULL ){
05509 MCW_textwin_alter( im3d->vwid->imag->pop_whereami_twin ,
05510 "\n*** Can't compute Talairach coordinates now ***\n");
05511 } else {
05512 MCW_textwin_alter( im3d->vwid->imag->pop_whereami_twin , tlab ) ;
05513 free(tlab) ;
05514 }
05515 }
05516
05517 EXRETURN ;
05518 }
|
|
||||||||||||
|
Definition at line 6778 of file afni.c. References AFNI_controller_index(), AFNI_find_warp(), AFNI_noenv(), AFNI_process_timeindex(), AFNI_range_setter(), AFNI_reset_func_range(), AFNI_set_thr_pval(), AFNI_transform_vector(), AFNI_underlay_CB(), AFNI_update_surface_widgets(), ALLOW_COMPUTE_FIM, AFNI_function_widgets::anat_buck_av, Three_D_View::anat_dset, AFNI_view_info::anat_index, Three_D_View::anat_now, AFNI_datamode_widgets::anat_resam_av, AFNI_view_info::anat_resam_mode, Three_D_View::anat_voxwarp, Three_D_View::anat_wod_flag, AFNI_datamode_widgets::anatmode_bbox, AV_assign_ival(), AV_SENSITIZE, Three_D_View::b123_anat, Three_D_View::b123_fim, Three_D_View::b231_anat, Three_D_View::b231_fim, Three_D_View::b312_anat, Three_D_View::b312_fim, AFNI_function_widgets::buck_frame, AFNI_function_widgets::buck_rowcol, CAN_TALTO, THD_3dim_dataset::daxes, AFNI_viewing_widgets::define_func_pb, AF_options::destruct, AFNI_widget_set::dmode, DMODE_BRICK, DMODE_BRICK_BVAL, DMODE_WOD_BVAL, DSET_BRICK_LABEL, DSET_BRICK_STATCODE, DSET_GRAPHABLE, DSET_INMEMORY, DSET_NUM_TIMES, DSET_NVALS, DSET_WRITEABLE, ENTRY, EQUIV_DATAXES, AFNI_function_widgets::fim_buck_av, AFNI_view_info::fim_index, Three_D_View::fim_now, Three_D_View::fim_selfwarp, Three_D_View::fim_voxwarp, Three_D_View::fim_wod_flag, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, FIX_SCALE_SIZE, FIX_SCALE_VALUE, MCW_arrowval::fmax, AFNI_view_info::force_anat_wod, AFNI_view_info::force_func_wod, AFNI_widget_set::func, FUNC_FIM_TYPE, AFNI_datamode_widgets::func_resam_av, AFNI_view_info::func_resam_mode, AFNI_view_info::func_threshold, THD_3dim_dataset::func_type, AFNI_datamode_widgets::funcmode_bbox, GLOBAL_argopt, IM3D_VALID, AFNI_widget_set::imag, MCW_arrowval::imax, ISVALID_3DIM_DATASET, LAST_VIEW_TYPE, LOAD_ANAT_VIEW, LOAD_FUNC_VIEW, MAX, MAX_CONTROLLERS, MCW_set_bbox(), MCW_set_widget_label(), myXtFree, FD_brick::parent, AFNI_imaging_widgets::pop_mnito_pb, AFNI_imaging_widgets::pop_sumato_pb, AFNI_imaging_widgets::pop_talto_pb, AFNI_imaging_widgets::pop_ttren_pb, AFNI_imaging_widgets::pop_whereami_pb, refit_MCW_optmenu(), FD_brick::resam_code, AFNI_view_info::resam_vox, AFNI_datamode_widgets::resam_vox_av, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, AFNI_viewing_widgets::see_func_bbox, AFNI_function_widgets::see_ttatlas_bbox, SENSITIZE, SESSION_HAS_SUMA, Three_D_View::ss_now, STATUS, AFNI_view_info::tempflag, THD_3dmm_to_3dind(), THD_3dmm_to_dicomm(), THD_dicomm_to_3dmm(), THD_edit_dataxes(), THD_setup_bricks(), AFNI_function_widgets::thr_buck_av, AFNI_view_info::thr_index, AFNI_function_widgets::thr_label, AFNI_datamode_widgets::thr_resam_av, FD_brick::thr_resam_code, AFNI_view_info::thr_resam_mode, AFNI_function_widgets::thr_rowcol, AFNI_function_widgets::thr_scale, AFNI_view_info::time_index, AFNI_imaging_widgets::time_index_av, AFNI_view_info::time_on, top, AFNI_view_info::top_index, THD_warp::type, UNDERLAY_ALLFUNC, UNDERLAY_ANAT, AFNI_function_widgets::underlay_bbox, AFNI_view_info::underlay_type, AFNI_widget_set::view, VIEW_TALAIRACH_TYPE, AFNI_view_info::view_type, THD_3dim_dataset::view_type, Three_D_View::vinfo, Three_D_View::vwid, MCW_bbox::wbut, Three_D_View::wod_daxes, AFNI_datamode_widgets::write_anat_pb, AFNI_datamode_widgets::write_func_pb, MCW_arrowval::wrowcol, MCW_bbox::wrowcol, and MCW_bbox::wtop. Referenced by AFNI_bucket_CB(), AFNI_initialize_view(), and AFNI_modify_viewing().
06779 {
06780 FD_brick ** fbr ;
06781 XmString xstr ;
06782 Boolean same , dont_fix_pts , writer ,
06783 anat_brick_possible , func_brick_possible ;
06784 int val , top ;
06785
06786 static THD_3dim_dataset *old_fim = NULL ; /* 12 Dec 2001 */
06787 static Three_D_View *old_im3d = NULL ; /* 29 Jan 2002 */
06788 static THD_3dim_dataset *old_anat = NULL ; /* 12 Dec 2001 */
06789
06790 ENTRY("AFNI_setup_viewing") ;
06791
06792 if( ! IM3D_VALID(im3d) ) EXRETURN ;
06793
06794 /*-----------------------------------------------------*/
06795 /*--- set up the anat w-o-d axes and viewing bricks ---*/
06796
06797 anat_brick_possible = DSET_INMEMORY(im3d->anat_now) ;
06798
06799 /*- The Ides of March, 2000: allow switching back to "view brick" -*/
06800
06801 if( anat_brick_possible &&
06802 im3d->vinfo->force_anat_wod &&
06803 im3d->vinfo->tempflag == 0 &&
06804 !AFNI_noenv("AFNI_VIEW_ANAT_BRICK") ){
06805
06806 STATUS("setting anatmode_bbox back to 'View ULay Data Brick'") ;
06807 im3d->vinfo->force_anat_wod = 0 ;
06808 MCW_set_bbox( im3d->vwid->dmode->anatmode_bbox , DMODE_BRICK_BVAL ) ;
06809 }
06810
06811 im3d->anat_wod_flag = ( im3d->vinfo->force_anat_wod || /* 02 Nov 1996 */
06812 !anat_brick_possible ) ;
06813
06814 if( im3d->anat_wod_flag ) /* 02 Nov 1996 */
06815 THD_edit_dataxes( im3d->vinfo->resam_vox ,
06816 im3d->anat_now->daxes , im3d->wod_daxes ) ;
06817 else
06818 *(im3d->wod_daxes) = *(im3d->anat_now->daxes) ;
06819
06820 im3d->anat_voxwarp->type =
06821 im3d->fim_voxwarp->type = ILLEGAL_TYPE ; /* 02 Nov 1996 */
06822
06823 LOAD_ANAT_VIEW(im3d) ; /* 02 Nov 1996 */
06824
06825 fbr = THD_setup_bricks( im3d->anat_now ) ;
06826 if( fbr == NULL ){
06827 fprintf(stderr,"THD_setup_bricks of anat_now fails!\n") ; EXRETURN ;
06828 }
06829 myXtFree(im3d->b123_anat) ; im3d->b123_anat = fbr[0] ;
06830 myXtFree(im3d->b231_anat) ; im3d->b231_anat = fbr[1] ;
06831 myXtFree(im3d->b312_anat) ; im3d->b312_anat = fbr[2] ;
06832 myXtFree(fbr) ;
06833
06834 im3d->b123_anat->parent =
06835 im3d->b231_anat->parent =
06836 im3d->b312_anat->parent = (XtPointer) im3d ;
06837
06838 im3d->b123_anat->resam_code =
06839 im3d->b231_anat->resam_code =
06840 im3d->b312_anat->resam_code = im3d->vinfo->anat_resam_mode ;
06841
06842 im3d->b123_anat->thr_resam_code = /* 30 Jul 2003 */
06843 im3d->b231_anat->thr_resam_code =
06844 im3d->b312_anat->thr_resam_code = im3d->vinfo->anat_resam_mode ;
06845
06846 /* 30 Nov 1997: don't go past end of dataset */
06847
06848 if( im3d->vinfo->anat_index >= DSET_NVALS(im3d->anat_now) )
06849 im3d->vinfo->anat_index = DSET_NVALS(im3d->anat_now) - 1 ;
06850
06851 /*-----------------------------------------------------*/
06852 /*--- set up the func w-o-d axes and viewing bricks ---*/
06853
06854 if( ISVALID_3DIM_DATASET(im3d->fim_now) ){ /* that is, if we have func */
06855
06856 STATUS("function brick setup") ;
06857
06858 /*-- access data in dataset im3d->fim_now IF AND ONLY IF
06859 1) its actual data axes are the same as the wod_daxes
06860 2) it has actual data
06861 3) the user hasn't officially declared for warp-on-demand
06862 4) the dataset doesn't have a warp to bring it into
06863 alignment with the current anat dataset (self_warp) --*/
06864
06865 STATUS("deciding whether to use function WOD") ;
06866
06867 func_brick_possible =
06868 EQUIV_DATAXES( im3d->fim_now->daxes , im3d->wod_daxes ) && /* 02 Nov 1996 */
06869 DSET_INMEMORY( im3d->fim_now ) ;
06870
06871 /*- 27 Aug 2002: see if there is a self_warp from
06872 fim_now back to anat_now; if so, install it;
06873 this is a coordinate-to-coordinate tranformation,
06874 and requires warp-on-demand viewing -*/
06875
06876 { THD_warp *swarp = AFNI_find_warp( im3d->anat_now , im3d->fim_now ) ;
06877 im3d->fim_selfwarp = swarp ; /* transform from fim to anat coords */
06878 if( swarp != NULL ) func_brick_possible = 0 ; /* require warp-on-demand */
06879 }
06880
06881 /*- The Ides of March, 2000: allow switching back to "view brick" -*/
06882
06883
06884 if( func_brick_possible &&
06885 ( ( im3d->vinfo->force_func_wod &&
06886 im3d->vinfo->tempflag == 0 &&
06887 !AFNI_noenv("AFNI_VIEW_FUNC_BRICK") ) ||
06888 ( !im3d->anat_wod_flag && /* 08 Aug 2003 */
06889 im3d->anat_now == im3d->fim_now ) ) ){
06890
06891 STATUS("setting funcmode_bbox back to 'View Func Data Brick'") ;
06892 im3d->vinfo->force_func_wod = 0 ;
06893 MCW_set_bbox( im3d->vwid->dmode->funcmode_bbox , DMODE_BRICK_BVAL ) ;
06894 }
06895
06896 if( func_brick_possible && ! im3d->vinfo->force_func_wod ){
06897 STATUS("not forcing function WOD") ;
06898 im3d->fim_wod_flag = False ; /* 02 Nov 1996 */
06899 } else {
06900 STATUS("forcing function WOD") ;
06901 im3d->fim_wod_flag = True ; /* 02 Nov 1996 */
06902 }
06903
06904 LOAD_FUNC_VIEW(im3d) ; /* 02 Nov 1996 */
06905
06906 fbr = THD_setup_bricks( im3d->fim_now ) ;
06907 if( fbr == NULL ){
06908 fprintf(stderr,"THD_setup_bricks of fim_now fails!\n") ; EXRETURN ;
06909 }
06910 myXtFree(im3d->b123_fim) ; im3d->b123_fim = fbr[0] ;
06911 myXtFree(im3d->b231_fim) ; im3d->b231_fim = fbr[1] ;
06912 myXtFree(im3d->b312_fim) ; im3d->b312_fim = fbr[2] ;
06913 myXtFree(fbr) ;
06914
06915 im3d->b123_fim->parent =
06916 im3d->b231_fim->parent =
06917 im3d->b312_fim->parent = (XtPointer) im3d ;
06918
06919 im3d->b123_fim->resam_code =
06920 im3d->b231_fim->resam_code =
06921 im3d->b312_fim->resam_code = im3d->vinfo->func_resam_mode ;
06922
06923 im3d->b123_fim->thr_resam_code = /* 09 Dec 1997 */
06924 im3d->b231_fim->thr_resam_code =
06925 im3d->b312_fim->thr_resam_code = im3d->vinfo->thr_resam_mode ;
06926
06927 /* 30 Nov 1997: don't go past end of bucket */
06928
06929 if( im3d->vinfo->fim_index >= DSET_NVALS(im3d->fim_now) )
06930 im3d->vinfo->fim_index = DSET_NVALS(im3d->fim_now) - 1 ;
06931
06932 if( im3d->vinfo->thr_index >= DSET_NVALS(im3d->fim_now) )
06933 im3d->vinfo->thr_index = DSET_NVALS(im3d->fim_now) - 1 ;
06934
06935 /* first time in for this controller,
06936 set thr_index to 1 if have sub-brick #1 [29 Jul 2003] */
06937
06938 { static int first=1, ffim[MAX_CONTROLLERS] ; int qq ;
06939 if( first ){
06940 first=0; for( qq=0; qq < MAX_CONTROLLERS; qq++ ) ffim[qq]=1;
06941 }
06942 qq = AFNI_controller_index(im3d) ;
06943 if( ffim[qq] && im3d->vinfo->thr_index == 0 && DSET_NVALS(im3d->fim_now) > 1 ){
06944 im3d->vinfo->thr_index = 1 ; ffim[qq] = 0 ;
06945 }
06946 }
06947
06948 } else { /* 29 Jul 2003: no longer possible */
06949
06950 STATUS("no function dataset") ;
06951
06952 myXtFree(im3d->b123_fim) ; im3d->b123_fim = NULL ;
06953 myXtFree(im3d->b231_fim) ; im3d->b231_fim = NULL ;
06954 myXtFree(im3d->b312_fim) ; im3d->b312_fim = NULL ;
06955
06956 func_brick_possible = False ;
06957 }
06958
06959 /*------------------------------------------------------------------*/
06960 /*--- set widget sensitivity based on kind of data now available ---*/
06961
06962 STATUS("turning widgets on and/or off:") ;
06963
06964 /*--- datamode controls ---*/
06965
06966 STATUS(" -- datamode widgets") ;
06967
06968 if( anat_brick_possible ){
06969 SENSITIZE( im3d->vwid->dmode->anatmode_bbox->wbut[DMODE_BRICK] , True ) ;
06970 } else {
06971 SENSITIZE( im3d->vwid->dmode->anatmode_bbox->wbut[DMODE_BRICK] , False ) ;
06972 MCW_set_bbox( im3d->vwid->dmode->anatmode_bbox , DMODE_WOD_BVAL ) ;
06973 im3d->vinfo->force_anat_wod = 1 ;
06974 }
06975
06976 if( func_brick_possible ){
06977 SENSITIZE( im3d->vwid->dmode->funcmode_bbox->wbut[DMODE_BRICK] , True ) ;
06978 } else {
06979 SENSITIZE( im3d->vwid->dmode->funcmode_bbox->wbut[DMODE_BRICK] , False ) ;
06980 MCW_set_bbox( im3d->vwid->dmode->funcmode_bbox , DMODE_WOD_BVAL ) ;
06981 im3d->vinfo->force_func_wod = 1 ;
06982 }
06983
06984 AV_SENSITIZE( im3d->vwid->dmode->anat_resam_av , im3d->anat_wod_flag ) ;
06985
06986 AV_SENSITIZE( im3d->vwid->dmode->resam_vox_av , im3d->anat_wod_flag ) ;
06987
06988 /* Jan 31, 1995: don't allow writes of datasets without warp parents */
06989 /* Jun 22, 1995: allow it if destruct mode is actuated! */
06990
06991 if( GLOBAL_argopt.destruct ){ /* not currently implemented */
06992 writer = True ;
06993 } else {
06994 writer = (Boolean) DSET_WRITEABLE(im3d->anat_now) ; /* mod 26 Mar 2001 */
06995 }
06996
06997 SENSITIZE( im3d->vwid->dmode->write_anat_pb , writer ) ;
06998
06999 if( GLOBAL_argopt.destruct ){ /* not currently implemented */
07000 writer = (Boolean) ISVALID_3DIM_DATASET(im3d->fim_now) ;
07001 } else {
07002 writer = (Boolean) DSET_WRITEABLE(im3d->fim_now) ; /* mod 26 Mar 2001 */
07003 }
07004
07005 SENSITIZE( im3d->vwid->dmode->write_func_pb , writer ) ;
07006
07007 /*--- function controls (always see them) ---*/
07008
07009 { Boolean have_fim = ISVALID_3DIM_DATASET(im3d->fim_now) ;
07010 Boolean have_thr = have_fim ;
07011
07012 static int first=1, zfim[MAX_CONTROLLERS] ; int qq ;
07013 if( first ){
07014 first=0; for( qq=0; qq < MAX_CONTROLLERS; qq++ ) zfim[qq]=1;
07015 }
07016
07017 STATUS(" -- function widgets ON") ;
07018
07019 SENSITIZE( im3d->vwid->view->define_func_pb , True ) ; /* always on */
07020 SENSITIZE( im3d->vwid->view->see_func_bbox->wtop , True ) ;
07021
07022 /* setup threshold slider to be always on */
07023
07024 XtManageChild( im3d->vwid->func->thr_rowcol ) ;
07025 qq = AFNI_controller_index(im3d) ;
07026 if( zfim[qq] && im3d->fim_now != NULL && im3d->fim_now->func_type == FUNC_FIM_TYPE ){
07027 STATUS(" -- set threshold to zero for FIM (once only)") ;
07028 XmScaleSetValue( im3d->vwid->func->thr_scale , 0 ) ;
07029 im3d->vinfo->func_threshold = 0.0 ; zfim[qq] = 0 ;
07030 }
07031 FIX_SCALE_SIZE(im3d) ; FIX_SCALE_VALUE(im3d) ;
07032
07033 /* turn on various ways of making function into underlay */
07034
07035 SENSITIZE( im3d->vwid->func->underlay_bbox->wbut[UNDERLAY_ALLFUNC],
07036 have_fim ) ;
07037
07038 /* set underlay type back to anat if no function */
07039
07040 if( ! have_fim ) im3d->vinfo->underlay_type = UNDERLAY_ANAT ;
07041
07042 /* allow resample control only if we are using w-o-d */
07043
07044 AV_SENSITIZE( im3d->vwid->dmode->func_resam_av,
07045 have_fim && im3d->fim_wod_flag ) ;
07046
07047 AV_SENSITIZE( im3d->vwid->dmode->thr_resam_av, /* 09 Dec 1997 */
07048 have_fim && im3d->fim_wod_flag ) ;
07049
07050 /** Mar 1996: modify the threshold scale stuff **/
07051 /** Oct 1996: increase decim by 1 to allow for
07052 new precision 0..999 of scale (used to be 0..99) **/
07053 /** Nov 1997: the scale precision is now set by macro THR_TOP_EXPON,
07054 and its settings are done in routine AFNI_set_thresh_top **/
07055
07056 if( have_thr ){
07057 int iv = im3d->vinfo->thr_index , jj ;
07058
07059 jj = DSET_BRICK_STATCODE(im3d->fim_now,iv) ;
07060 if( jj > 0 )
07061 MCW_set_widget_label( im3d->vwid->func->thr_label ,
07062 FUNC_label[jj] ) ;
07063 else
07064 MCW_set_widget_label( im3d->vwid->func->thr_label ,
07065 DSET_BRICK_LABEL(im3d->fim_now,iv) ) ;
07066 }
07067
07068 /* set the pval label at the bottom of the scale */
07069
07070 AFNI_set_thr_pval( im3d ) ;
07071
07072 /*** 29 Jul 2003: always do buckets now ***/
07073
07074 XtManageChild( im3d->vwid->func->anat_buck_av->wrowcol ) ;
07075 XtManageChild( im3d->vwid->func->fim_buck_av->wrowcol ) ;
07076 XtManageChild( im3d->vwid->func->thr_buck_av->wrowcol ) ;
07077
07078 /** 12 Dec 2001: only refit menus if dataset has changed **/
07079
07080 if( have_fim && (im3d->fim_now != old_fim || im3d != old_im3d) ){
07081 refit_MCW_optmenu( im3d->vwid->func->fim_buck_av ,
07082 0 , /* new minval */
07083 DSET_NVALS(im3d->fim_now)-1 , /* new maxval */
07084 im3d->vinfo->fim_index , /* new inival */
07085 0 , /* new decim? */
07086 AFNI_bucket_label_CB , /* text routine */
07087 im3d->fim_now /* text data */
07088 ) ;
07089 refit_MCW_optmenu( im3d->vwid->func->thr_buck_av ,
07090 0 , /* new minval */
07091 DSET_NVALS(im3d->fim_now)-1 , /* new maxval */
07092 im3d->vinfo->thr_index , /* new inival */
07093 0 , /* new decim? */
07094 AFNI_bucket_label_CB , /* text routine */
07095 im3d->fim_now /* text data */
07096 ) ;
07097 }
07098
07099 if( im3d->anat_now != old_anat || im3d != old_im3d ){
07100 refit_MCW_optmenu( im3d->vwid->func->anat_buck_av ,
07101 0 , /* new minval */
07102 DSET_NVALS(im3d->anat_now)-1 , /* new maxval */
07103 im3d->vinfo->anat_index , /* new inival */
07104 0 , /* new decim? */
07105 AFNI_bucket_label_CB , /* text routine */
07106 im3d->anat_now /* text data */
07107 ) ;
07108 }
07109
07110 XtManageChild( im3d->vwid->func->buck_rowcol ) ; /* make itvisible */
07111 XtManageChild( im3d->vwid->func->buck_frame ) ;
07112 }
07113
07114 /*--- set the function type bboxes based on the current
07115 viewing set up (which may have changed due to lack of function) ---*/
07116
07117 STATUS(" -- function underlay widgets") ;
07118
07119 MCW_set_bbox( im3d->vwid->func->underlay_bbox ,
07120 1 << im3d->vinfo->underlay_type ) ;
07121
07122 /*--------------------------------------------------------*/
07123 /*--- 3/24/95: deal with the new range widgets in func ---*/
07124
07125 AFNI_reset_func_range( im3d ) ;
07126
07127 #ifdef ALLOW_DATASET_VLIST
07128 /*---------------------------------------------------------*/
07129 /*--- May 1995: if points exist in some other dataset ---*/
07130 /*--- associated with this one, but not here, ---*/
07131 /*--- transform the points to this dataset. ---*/
07132
07133 dont_fix_pts = ! rescaled ; /* if didn't rescale, don't need to fix */
07134
07135 if( im3d->anat_now->pts == NULL ){
07136 int ii ;
07137 THD_3dim_dataset * dset_orig = NULL ;
07138 THD_fvec3 fv ;
07139
07140 STATUS(" -- scanning for points in other datasets") ;
07141 for( ii=0 ; ii <= LAST_VIEW_TYPE ; ii++ ){
07142 if( ISVALID_3DIM_DATASET(im3d->anat_dset[ii]) &&
07143 im3d->anat_dset[ii]->pts != NULL &&
07144 im3d->anat_dset[ii]->pts_original == True ){
07145
07146 dset_orig = im3d->anat_dset[ii] ;
07147 break ;
07148 }
07149 }
07150
07151 if( dset_orig != NULL ){
07152 STATUS(" -- processing points in other dataset") ;
07153
07154 dont_fix_pts = True ; /* fixing here, so not later */
07155 im3d->anat_now->pts_original = False ;
07156 INIT_VLIST( im3d->anat_now->pts , im3d->anat_now ) ;
07157
07158 for( ii=0 ; ii < dset_orig->pts->num ; ii++ ){
07159 fv = THD_3dmm_to_dicomm( dset_orig , dset_orig->pts->xyz[ii] ) ;
07160 fv = AFNI_transform_vector( dset_orig , fv , im3d->anat_now ) ;
07161 fv = THD_dicomm_to_3dmm( im3d->anat_now , fv ) ;
07162 ADD_FVEC_TO_VLIST( im3d->anat_now->pts , fv ) ;
07163 }
07164 }
07165 }
07166
07167 /*--------------------------------------------------*/
07168 /*--- May 1995: if points exist in this dataset, ---*/
07169 /*--- load their 3dind coordinates. ---*/
07170
07171 if( im3d->anat_now->pts != NULL && ! dont_fix_pts ){
07172 int ii ;
07173 STATUS(" -- processing points in this dataset") ;
07174
07175 for( ii=0 ; ii < im3d->anat_now->pts->num ; ii++ )
07176 im3d->anat_now->pts->ijk[ii] =
07177 THD_3dmm_to_3dind( im3d->anat_now , im3d->anat_now->pts->xyz[ii] ) ;
07178 }
07179 #endif /* ALLOW_DATASET_VLIST */
07180
07181 /*------ 06 Mar 2002: turn "SUMA to" on image popup on or off ------*/
07182
07183 if( im3d->vwid->imag->pop_sumato_pb != NULL ){
07184 if( SESSION_HAS_SUMA(im3d->ss_now) )
07185 XtManageChild( im3d->vwid->imag->pop_sumato_pb ) ;
07186 else
07187 XtUnmanageChild( im3d->vwid->imag->pop_sumato_pb ) ;
07188 }
07189
07190 /*------ 01 May 2002: turn "Jump to (MNI)" on or off ------*/
07191
07192 if( im3d->vwid->imag->pop_mnito_pb != NULL ){
07193 if( CAN_TALTO(im3d) )
07194 XtManageChild( im3d->vwid->imag->pop_mnito_pb ) ;
07195 else
07196 XtUnmanageChild( im3d->vwid->imag->pop_mnito_pb ) ;
07197 }
07198
07199 /*-------------------------------------------------------------------*/
07200 /*--- Sep 1995: turn Talairach to button on image popup on or off ---*/
07201
07202 STATUS(" -- managing talairach_to button") ;
07203
07204 if( im3d->vwid->imag->pop_talto_pb != NULL ){
07205 if( CAN_TALTO(im3d) ){
07206 XtSetSensitive( im3d->vwid->imag->pop_talto_pb , True ) ;
07207 if( im3d->vwid->imag->pop_whereami_pb != NULL )
07208 XtSetSensitive( im3d->vwid->imag->pop_whereami_pb , True ); /* 10 Jul 2001 */
07209 if( im3d->vwid->imag->pop_ttren_pb != NULL )
07210 XtSetSensitive( im3d->vwid->imag->pop_ttren_pb , /* 12 Jul 2001 */
07211 im3d->vinfo->view_type==VIEW_TALAIRACH_TYPE); /* 01 Aug 2001 */
07212 } else {
07213 XtSetSensitive( im3d->vwid->imag->pop_talto_pb, False ) ;
07214 if( im3d->vwid->imag->pop_whereami_pb != NULL )
07215 XtSetSensitive( im3d->vwid->imag->pop_whereami_pb, False ); /* 10 Jul 2001 */
07216 if( im3d->vwid->imag->pop_ttren_pb != NULL )
07217 XtSetSensitive( im3d->vwid->imag->pop_ttren_pb , False ); /* 12 Jul 2001 */
07218 }
07219 }
07220
07221 /*--- 25 Jul 2001: sensitize 'See TT Atlas Regions' button ---*/
07222
07223 #if 1
07224 XtSetSensitive( im3d->vwid->func->see_ttatlas_bbox->wrowcol ,
07225 (Boolean)( im3d->anat_now->view_type == VIEW_TALAIRACH_TYPE &&
07226 TT_retrieve_atlas() != NULL ) ) ;
07227 #else
07228 XtSetSensitive( im3d->vwid->func->see_ttatlas_bbox->wrowcol , False ) ;
07229 #endif
07230
07231 /*------------------------------------*/
07232 /*--- May 1996: Time index control ---*/
07233 /*--- Mar 1997: Allow FIM also ---*/
07234
07235 top = DSET_NUM_TIMES(im3d->anat_now) ;
07236 if( ISVALID_3DIM_DATASET(im3d->fim_now) )
07237 top = MAX( top , DSET_NUM_TIMES(im3d->fim_now) ) ;
07238
07239 if( top > 1 ){
07240 MCW_arrowval *tav = im3d->vwid->imag->time_index_av ;
07241 STATUS(" -- turning time index control on") ;
07242
07243 AV_SENSITIZE( tav , True ) ; im3d->vinfo->time_on = 1 ;
07244 tav->fmax = tav->imax = top - 1 ; im3d->vinfo->top_index = top ;
07245 if( im3d->vinfo->time_index > tav->imax ){
07246 im3d->vinfo->time_index = tav->imax ;
07247 AV_assign_ival( tav , tav->imax ) ;
07248 AFNI_process_timeindex(im3d) ; /* 29 Jan 2003 */
07249 }
07250 } else {
07251 STATUS(" -- turning time index control off") ;
07252 AV_SENSITIZE( im3d->vwid->imag->time_index_av , False ) ;
07253 im3d->vinfo->time_on = 0 ;
07254 }
07255
07256 /*--------------------------------------------------------------*/
07257 /*--- 19 Nov 1996: Set FIM-able dataset to this, if possible ---*/
07258
07259 if( DSET_GRAPHABLE(im3d->anat_now) )
07260 im3d->fimdata->fimdset = im3d->anat_now ;
07261
07262 ALLOW_COMPUTE_FIM(im3d) ;
07263
07264 /*----------------------------------------------------------------*/
07265 /*--- 19 Aug 2002: enable/disable surface chooser button, etc. ---*/
07266
07267 AFNI_update_surface_widgets( im3d ) ;
07268
07269 /*------------------------------------------*/
07270 /*--- attach to viewing windows (if any) ---*/
07271
07272 AFNI_underlay_CB( NULL , (XtPointer) im3d , NULL ) ;
07273
07274 /* 04 Nov 2003: set range for image grayscaling? */
07275
07276 AFNI_range_setter( im3d , im3d->s123 ) ;
07277 AFNI_range_setter( im3d , im3d->s231 ) ;
07278 AFNI_range_setter( im3d , im3d->s312 ) ;
07279
07280 im3d->vinfo->tempflag = 0 ;
07281
07282 old_im3d = im3d ;
07283 old_fim = im3d->fim_now ; /* remembrance */
07284 old_anat = im3d->anat_now ;
07285
07286 EXRETURN ;
07287 }
|
|
|
signal handler for fatal errors * Definition at line 1058 of file afni.c. References TRACEBACK. Referenced by main().
01059 {
01060 char * sname ;
01061 static volatile int fff=0 ;
01062 if( fff ) _exit(1) ; else fff = 1 ;
01063 switch(sig){
01064 default: sname = "unknown" ; break ;
01065 case SIGINT: sname = "SIGINT" ; break ;
01066 case SIGPIPE: sname = "SIGPIPE" ; break ;
01067 case SIGSEGV: sname = "SIGSEGV" ; break ;
01068 case SIGBUS: sname = "SIGBUS" ; break ;
01069 case SIGTERM: sname = "SIGTERM" ; break ;
01070 }
01071 fprintf(stderr,"\nFatal Signal %d (%s) received\n",sig,sname); fflush(stderr);
01072 TRACEBACK ;
01073 fprintf(stderr,"*** Program Abort ***\n") ; fflush(stderr) ;
01074 exit(1) ;
01075 }
|
|
||||||||||||||||
|
Definition at line 10045 of file afni.c. References AFNI_popup_sonnet(), AFNI_sonnet_CB(), client_data, AFNI_program_widgets::hidden_sonnet_pb, IM3D_VALID, MCW_choose_cbs::ival, MCW_choose_integer(), mcwCR_integer, NO_frivolities, NUM_SONNETS, AFNI_widget_set::picture, AFNI_widget_set::prog, MCW_choose_cbs::reason, and Three_D_View::vwid. Referenced by AFNI_sonnet_CB().
10046 {
10047 Three_D_View * im3d = (Three_D_View *) client_data ;
10048 MCW_choose_cbs * cbs ;
10049
10050 if( NO_frivolities || !IM3D_VALID(im3d) ) return ;
10051
10052 if( w == im3d->vwid->prog->hidden_sonnet_pb ){ /* start the process */
10053
10054 MCW_choose_integer( im3d->vwid->picture ,
10055 "Sonnet " ,
10056 1 , NUM_SONNETS , sonnet_index+1 ,
10057 AFNI_sonnet_CB , (XtPointer) im3d ) ;
10058 return ;
10059 }
10060
10061 /** if get to here, finish the process **/
10062
10063 cbs = (MCW_choose_cbs *) call_data ;
10064 if( cbs->reason != mcwCR_integer ){ /* error */
10065 XBell( XtDisplay(w) , 100 ) ; return ;
10066 }
10067
10068 AFNI_popup_sonnet( im3d->vwid->picture , cbs->ival ) ;
10069 return ;
10070 }
|
|
|
done at last * Definition at line 4463 of file afni.c. References MCW_pbar::bigmode, ENTRY, AFNI_widget_set::func, GLOBAL_library, IM3D_VALID, AFNI_function_widgets::inten_pbar, MCW_function_list::num, MCW_pbar::panew, AFNI_function_widgets::pbar_transform0D_av, AFNI_function_widgets::pbar_transform0D_func, AFNI_function_widgets::pbar_transform0D_index, AFNI_function_widgets::pbar_transform2D_av, AFNI_function_widgets::pbar_transform2D_func, AFNI_function_widgets::pbar_transform2D_index, POPUP_cursorize, refit_MCW_optmenu(), AFNI_library_type::registered_0D, AFNI_library_type::registered_2D, Three_D_View::vwid, and MCW_arrowval::wrowcol.
04464 {
04465 static int old_0D_num=0 , old_2D_num=0 ;
04466
04467 ENTRY("AFNI_startup_3dview") ;
04468
04469 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04470
04471 /* the pbar Tran 0D menu */
04472
04473 if( GLOBAL_library.registered_0D.num != old_0D_num ){
04474 old_0D_num = GLOBAL_library.registered_0D.num ;
04475 refit_MCW_optmenu( im3d->vwid->func->pbar_transform0D_av ,
04476 0 , /* new minval */
04477 GLOBAL_library.registered_0D.num , /* new maxval */
04478 0 , /* new inival */
04479 0 , /* new decim? */
04480 ISQ_transform_label , /* text func */
04481 &(GLOBAL_library.registered_0D) /* text data */
04482 ) ;
04483 XtManageChild( im3d->vwid->func->pbar_transform0D_av->wrowcol ) ;
04484 } else {
04485 if( old_0D_num == 0 )
04486 XtUnmanageChild( im3d->vwid->func->pbar_transform0D_av->wrowcol ) ;
04487 }
04488
04489 im3d->vwid->func->pbar_transform0D_index = 0 ;
04490 im3d->vwid->func->pbar_transform0D_func = NULL ;
04491
04492 /* the pbar Tran 2D menu */
04493
04494 if( GLOBAL_library.registered_2D.num != old_2D_num ){
04495 old_2D_num = GLOBAL_library.registered_2D.num ;
04496 refit_MCW_optmenu( im3d->vwid->func->pbar_transform2D_av ,
04497 0 , /* new minval */
04498 GLOBAL_library.registered_2D.num , /* new maxval */
04499 0 , /* new inival */
04500 0 , /* new decim? */
04501 ISQ_transform_label , /* text func */
04502 &(GLOBAL_library.registered_2D) /* text data */
04503 ) ;
04504 XtManageChild( im3d->vwid->func->pbar_transform2D_av->wrowcol ) ;
04505 } else {
04506 if( old_2D_num == 0 )
04507 XtUnmanageChild( im3d->vwid->func->pbar_transform2D_av->wrowcol ) ;
04508 }
04509
04510 im3d->vwid->func->pbar_transform2D_index = 0 ;
04511 im3d->vwid->func->pbar_transform2D_func = NULL ;
04512
04513 /* 08 Apr 2005: the cursor on the pbar? */
04514
04515 if( im3d->vwid->func->inten_pbar->bigmode )
04516 POPUP_cursorize( im3d->vwid->func->inten_pbar->panew ) ;
04517
04518 /* Hey Rocky! Watch me pull a rabbit out of my hat! */
04519
04520 EXRETURN ;
04521 }
|
|
||||||||||||
|
Definition at line 1796 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_driver(), AFNI_init_niml(), AFNI_make_update_script(), AFNI_noenv(), AFNI_version_check(), client_data, COM_com, COM_num, AFNI_widget_set::dmode, ENTRY, free, GLOBAL_argopt, AFNI_widget_set::imag, iochan_sleep(), logo_pixmap, MCW_help_CB(), MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, AFNI_datamode_widgets::misc_niml_pb, AFNI_widget_set::picture, PICTURE_OFF, PICTURE_SET, AF_options::port_niml, RESET_AFNI_QUIT, SHOW_AFNI_READY, THD_freemegabytes(), THD_trailname(), AFNI_widget_set::top_shell, AFNI_imaging_widgets::topper, Three_D_View::type, vers_pixmap, Three_D_View::vwid, and AF_options::yes_niml. Referenced by MAIN_workprocess().
01797 {
01798 Three_D_View * im3d = (Three_D_View *) client_data ;
01799 int vv ;
01800
01801 ENTRY("AFNI_startup_timeout_CB") ;
01802
01803 /* make sure help window is popped down */
01804
01805 MCW_help_CB(NULL,NULL,NULL) ;
01806
01807 /* NIML listening on [moved here 17 Mar 2002] */
01808
01809 if( MAIN_im3d->type == AFNI_3DDATA_VIEW && GLOBAL_argopt.yes_niml ){
01810 AFNI_init_niml() ;
01811 XtSetSensitive(MAIN_im3d->vwid->dmode->misc_niml_pb,False) ;
01812 } else if( GLOBAL_argopt.port_niml > 0 ){ /* 10 Dec 2002 */
01813 fprintf(stderr,"*** WARNING: -np was given, but NIML is turned off.\n") ;
01814 }
01815
01816 if( !AFNI_noenv("AFNI_STARTUP_WARNINGS") ){ /* 22 Jul 2003 */
01817
01818 #ifdef LESSTIF_VERSION /* 13 Jan 2003: If LessTif was used for this AFNI */
01819
01820 (void) MCW_popup_message( MAIN_im3d->vwid->picture ,
01821 " \n"
01822 "*** WARNING: ***\n"
01823 "*** This copy of AFNI was ***\n"
01824 "*** built using the LessTif ***\n"
01825 "*** library. You will find ***\n"
01826 "*** problems; AFNI is best ***\n"
01827 "*** when built using Motif ***\n"
01828 "*** or OpenMotif! ***\n" ,
01829 MCW_USER_KILL | MCW_TIMER_KILL ) ;
01830 #endif
01831
01832 #ifdef BAD_BUTTON3_POPUPS /* 21 Jul 2003: If this is a stupid system */
01833
01834 (void) MCW_popup_message( MAIN_im3d->vwid->imag->topper,
01835 " \n"
01836 "*** WARNING: ***\n"
01837 "*** This computer system has ***\n"
01838 "*** a bug with Button-3 popup ***\n"
01839 "*** menus -- to use a button ***\n"
01840 "*** on such a menu, you have ***\n"
01841 "*** to keep Button-3 pressed ***\n"
01842 "*** down and then click the ***\n"
01843 "*** menu button with Button-1 ***\n"
01844 "*** at the same time. ***\n" ,
01845 MCW_USER_KILL | MCW_TIMER_KILL ) ;
01846 #endif
01847 }
01848
01849 /* 21 Nov 2002: check the AFNI version */
01850
01851 vv = AFNI_version_check() ; /* nada if AFNI_start_version_check() inactive */
01852
01853 if( vv && vers_pixmap != XmUNSPECIFIED_PIXMAP ){ /* 08 Aug 2005 */
01854 int pp ;
01855 for( pp=0 ; pp < 19 ; pp++ ){ /* and flash it a few times */
01856 PICTURE_SET(im3d,vers_pixmap) ;
01857 XmUpdateDisplay(im3d->vwid->top_shell); iochan_sleep(166);
01858 PICTURE_OFF(im3d) ;
01859 XmUpdateDisplay(im3d->vwid->top_shell); iochan_sleep(166);
01860 }
01861 logo_pixmap = vers_pixmap ; /* replace logo with version warning */
01862 }
01863
01864 #ifdef SHSTRING
01865 if( vv ){ /* 20 Nov 2003: if version check shows a mismatch */
01866 char *sname = AFNI_make_update_script() ;
01867
01868 if( sname != NULL ){
01869 char *cpt , *ddd ; int nn ;
01870 ddd = strdup(sname) ; cpt = THD_trailname(ddd,0) ; *cpt = '\0' ;
01871 cpt = THD_trailname(sname,0) ;
01872 fprintf(stderr,
01873 "\n"
01874 "*===================================================\n"
01875 "* A script to update AFNI binaries has been created.\n"
01876 "* To use it, quit AFNI now, then try the commands\n"
01877 "pushd %s\n"
01878 "source %s\n"
01879 "popd\n"
01880 "*===================================================\n" ,
01881 ddd , cpt ) ;
01882 free((void *)ddd) ;
01883 nn = THD_freemegabytes(sname) ;
01884 if( nn >= 0 && nn <= 300 ){
01885 fprintf(stderr,
01886 "* HOWEVER: you only have %d Mbytes free, which won't\n"
01887 "* won't be enough to download and install\n"
01888 "* the updated set of AFNI binaries!\n"
01889 "*===================================================\n" ,
01890 nn ) ;
01891 }
01892 } else {
01893 fprintf(stderr,
01894 "\n"
01895 "*==================================================\n"
01896 "* Can't create script for updating AFNI\n"
01897 "* binaries in your AFNI directory.\n"
01898 "* You'll have to get your sysadmin to help, or\n"
01899 "* do it yourself. AFNI can be downloaded from\n"
01900 "* http://afni.nimh.nih.gov/afni/download *OR*\n"
01901 "* ftp://afni.nimh.nih.gov/tgz\n"
01902 "* You want file " SHSTRING ".tgz\n"
01903 "*==================================================\n" ) ;
01904 }
01905 }
01906 #endif
01907
01908 /* finish up getting AFNI ready to be presented to the world */
01909
01910 SHOW_AFNI_READY ;
01911 RESET_AFNI_QUIT(im3d) ;
01912 PICTURE_OFF(im3d) ;
01913
01914 /* 29 Jul 2005: run any driver commands from the command line */
01915
01916 for( vv=0 ; vv < COM_num ; vv++ ) AFNI_driver( COM_com[vv] ) ;
01917
01918 MPROBE ; /* check mcw_malloc() for integrity */
01919 EXRETURN ;
01920 }
|
|
||||||||||||
|
Definition at line 10164 of file afni.c. References dset_ijk, and dset_tin. Referenced by plot_graphs().
|
|
||||||||||||||||
|
Definition at line 8402 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_jumpto_dicom(), MCW_choose_cbs::cval, Three_D_View::dc, MCW_DC::display, ENTRY, IM3D_VALID, SUMA_surface::ixyz, mcwCR_string, MCW_choose_cbs::reason, RESET_AFNI_QUIT, SESSION_HAS_SUMA, Three_D_View::ss_now, THD_session::su_surf, SUMA_find_node_id(), Three_D_View::type, SUMA_ixyz::x, SUMA_ixyz::y, and SUMA_ixyz::z. Referenced by AFNI_imag_pop_CB().
08403 {
08404 Three_D_View * im3d = (Three_D_View *) cd ;
08405 int nn , ii ;
08406
08407 ENTRY("AFNI_sumato_CB") ;
08408
08409 if( !IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
08410 if( cbs->reason != mcwCR_string ) EXRETURN ;
08411 if( !SESSION_HAS_SUMA(im3d->ss_now) ) EXRETURN ;
08412
08413 nn = -1 ;
08414 sscanf( cbs->cval , "%d" , &nn ) ;
08415 ii = SUMA_find_node_id( im3d->ss_now->su_surf[0] , nn ) ;
08416 if( ii < 0 ){ XBell(im3d->dc->display,100); EXRETURN; }
08417
08418 (void) AFNI_jumpto_dicom( im3d ,
08419 im3d->ss_now->su_surf[0]->ixyz[ii].x ,
08420 im3d->ss_now->su_surf[0]->ixyz[ii].y ,
08421 im3d->ss_now->su_surf[0]->ixyz[ii].z ) ;
08422
08423 RESET_AFNI_QUIT(im3d) ;
08424 EXRETURN ;
08425 }
|
|
||||||||||||||||
|
Definition at line 6457 of file afni.c. References AFNI_first_tog(), AFNI_initialize_view(), Three_D_View::anat_dset, Three_D_View::anat_now, client_data, ENTRY, IM3D_VALID, LAST_VIEW_TYPE, POPDOWN_strlist_chooser, RESET_AFNI_QUIT, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, 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_drive_set_view().
06459 {
06460 Three_D_View * im3d = (Three_D_View *) client_data ;
06461 int bval ;
06462
06463 ENTRY("AFNI_switchview_CB") ;
06464
06465 if( ! IM3D_VALID(im3d) ) EXRETURN ;
06466
06467 bval = AFNI_first_tog( LAST_VIEW_TYPE+1 ,
06468 im3d->vwid->view->view_bbox->wbut ) ;
06469
06470 if( bval < 0 || bval == im3d->vinfo->view_type ) EXRETURN ;
06471 if( im3d->anat_dset[bval] == NULL ) EXRETURN ;
06472
06473 SHOW_AFNI_PAUSE ;
06474
06475 POPDOWN_strlist_chooser ; /* might be choosing datasets */
06476
06477 im3d->vinfo->view_type = bval ; /* set the new view type */
06478 AFNI_initialize_view( im3d->anat_now , im3d ) ; /* and initialize it */
06479
06480 SHOW_AFNI_READY ;
06481 RESET_AFNI_QUIT(im3d) ;
06482 EXRETURN ;
06483 }
|
|
|
Definition at line 113 of file afni.c. References ALLOW_PLUGINS, ANNOUNCEMENT, CALC_HELP_STRING, DEFAULT_NGRAY, MASTER_HELP_STRING, MMAP_THRESHOLD, THD_MAX_NUM_SESSION, THD_MAX_SESSION_SIZE, USING_MCW_MALLOC, and WARP_4D. Referenced by AFNI_parse_args(), and main().
00114 {
00115 printf(
00116 ANNOUNCEMENT
00117
00118 "----------------------------------------------------------------\n"
00119 "USAGE 1: read in sessions of 3D datasets (created by to3d, etc.)\n"
00120 "----------------------------------------------------------------\n"
00121 " afni [options] [session_directory ...]\n"
00122 "\n"
00123 #if MMAP_THRESHOLD > 0
00124 " -purge Conserve memory by purging data to disk.\n"
00125 " [Use this if you run out of memory when running AFNI.]\n"
00126 " [This will slow the code down, so use only if needed.]\n"
00127 #endif
00128 " -posfunc Set up the color 'pbar' to use only positive function values.\n"
00129 " -R Recursively search each session_directory for more session\n"
00130 " subdirectories.\n"
00131 " WARNING: This will descend the entire filesystem hierarchy from\n"
00132 " each session_directory given on the command line. On a\n"
00133 " large disk, this may take a long time. To limit the\n"
00134 " recursion to 5 levels (for example), use -R5.\n"
00135 " -ignore N Tells the program to 'ignore' the first N points in\n"
00136 " time series for graphs and FIM calculations.\n"
00137 " -im1 N Tells the program to use image N as the first one for\n"
00138 " graphs and FIM calculations (same as '-ignore N-1')\n"
00139 " -tlrc_small These options set whether to use the 'small' or 'big'\n"
00140 " -tlrc_big Talairach brick size. The compiled in default for\n"
00141 " the program is now 'big', unlike AFNI 1.0x.\n"
00142 #ifndef WARP_4D
00143 " -warp_4D Allows the program to Talairach transform and write\n"
00144 " to disk 3D+time datasets. Note that the resulting\n"
00145 " disk files will be gigantic (100s of Megabytes).\n"
00146 #endif
00147 " -no1D Tells AFNI not to read *.1D timeseries files from\n"
00148 " the dataset directories. The *.1D files in the\n"
00149 " directories listed in the AFNI_TSPATH environment\n"
00150 " variable will still be read (if this variable is\n"
00151 " not set, then './' will be scanned for *.1D files.)\n"
00152 "\n"
00153 " -noqual Tells AFNI not to enforce the 'quality' checks when\n"
00154 " making the transformations to +acpc and +tlrc.\n"
00155 " -unique Tells the program to create a unique set of colors\n"
00156 " for each AFNI controller window. This allows\n"
00157 " different datasets to be viewed with different\n"
00158 " grayscales or colorscales. Note that -unique\n"
00159 " will only work on displays that support 12 bit\n"
00160 " PseudoColor (e.g., SGI workstations) or TrueColor.\n"
00161 " -orient code Tells afni the orientation in which to display\n"
00162 " x-y-z coordinates (upper left of control window).\n"
00163 " The code must be 3 letters, one each from the\n"
00164 " pairs {R,L} {A,P} {I,S}. The first letter gives\n"
00165 " the orientation of the x-axis, the second the\n"
00166 " orientation of the y-axis, the third the z-axis:\n"
00167 " R = right-to-left L = left-to-right\n"
00168 " A = anterior-to-posterior P = posterior-to-anterior\n"
00169 " I = inferior-to-superior S = superior-to-inferior\n"
00170 " The default code is RAI ==> DICOM order. This can\n"
00171 " be set with the environment variable AFNI_ORIENT.\n"
00172 " As a special case, using the code 'flipped' is\n"
00173 " equivalent to 'LPI' (this is for Steve Rao).\n"
00174 #ifdef ALLOW_PLUGINS
00175 " -noplugins Tells the program not to load plugins.\n"
00176 " (Plugins can also be disabled by setting the\n"
00177 " environment variable AFNI_NOPLUGINS.)\n"
00178 " -yesplugouts Tells the program to listen for plugouts.\n"
00179 " (Plugouts can also be enabled by setting the\n"
00180 " environment variable AFNI_YESPLUGOUTS.)\n"
00181 " -YESplugouts Makes the plugout code print out lots of messages\n"
00182 " (useful for debugging a new plugout).\n"
00183 " -noplugouts Tells the program NOT to listen for plugouts.\n"
00184 " (This option is available to override\n"
00185 " the AFNI_YESPLUGOUTS environment variable.)\n"
00186 #endif
00187 " -skip_afnirc Tells the program NOT to read the file .afnirc\n"
00188 " in the home directory. See README.setup for\n"
00189 " details on the use of .afnirc for initialization.\n"
00190 " -layout fn Tells AFNI to read the initial windows layout from\n"
00191 " file 'fn'. If this option is not given, then\n"
00192 " environment variable AFNI_LAYOUT_FILE is used.\n"
00193 " If neither is present, then AFNI will do whatever\n"
00194 " it feels like.\n"
00195 "\n"
00196 " -niml If present, turns on listening for NIML-formatted\n"
00197 " data from SUMA. Can also be turned on by setting\n"
00198 " environment variable AFNI_NIML_START to YES.\n"
00199 " -np port If present, sets the NIML socket port number to 'port'.\n"
00200 " This must be an integer between 1024 and 65535,\n"
00201 " and must be the same as the '-np port' number given\n"
00202 " to SUMA. [default = 53211]\n"
00203 "\n"
00204 " -com ccc This option lets you specify 'command strings' to\n"
00205 " drive AFNI after the program startup is completed.\n"
00206 " Legal command strings are described in the file\n"
00207 " README.driver. More than one '-com' option can\n"
00208 " be used, and the commands will be executed in\n"
00209 " the order they are given on the command line.\n"
00210 " N.B.: Most commands to AFNI contain spaces, so the 'ccc'\n"
00211 " command strings will need to be enclosed in quotes.\n"
00212 "\n"
00213 " * If no session_directories are given, then the program will use\n"
00214 " the current working directory (i.e., './').\n"
00215 " * The maximum number of sessions is now set to %d.\n"
00216 " * The maximum number of datasets per session is %d.\n"
00217 " * To change these maximums, you must edit file '3ddata.h' and then\n"
00218 " recompile this program.\n"
00219
00220 , THD_MAX_NUM_SESSION , THD_MAX_SESSION_SIZE
00221 ) ;
00222
00223 printf(
00224 "\n"
00225 "-----------------------------------------------------\n"
00226 "USAGE 2: read in images for 'quick and dirty' viewing\n"
00227 "-----------------------------------------------------\n"
00228 "(Most advanced features of AFNI will be disabled.)\n"
00229 "\n"
00230 " afni -im [options] im1 im2 im3 ...\n"
00231 "\n"
00232 " -im Flag to read in images instead of 3D datasets\n"
00233 " (Talaraich and functional stuff won't work)\n"
00234 " -dy yratio Tells afni the downscreen pixel size is 'yratio' times\n"
00235 " the across-screen (x) pixel dimension (default=1.0)\n"
00236 " -dz zratio Tells afni the slice thickness is 'zratio' times\n"
00237 " the x pixel dimension (default=1.0)\n"
00238 " -orient code Tells afni the orientation of the input images.\n"
00239 " The code must be 3 letters, one each from the\n"
00240 " pairs {R,L} {A,P} {I,S}. The first letter gives\n"
00241 " the orientation of the x-axis, the second the\n"
00242 " orientation of the y-axis, the third the z-axis:\n"
00243 " R = right-to-left L = left-to-right\n"
00244 " A = anterior-to-posterior P = posterior-to-anterior\n"
00245 " I = inferior-to-superior S = superior-to-inferior\n"
00246 " (the default code is ASL ==> sagittal images).\n"
00247 " Note that this use of '-orient' is different from\n"
00248 " the use when viewing datasets.\n"
00249 " -resize Tells afni that all images should be resized to fit\n"
00250 " the size of the first one, if they don't already fit\n"
00251 " (by default, images must all 'fit' or afni will stop)\n"
00252 " -datum type Tells afni to convert input images into the type given:\n"
00253 " byte, short, float, complex are the legal types.\n"
00254 " The image files (im1 ...) are the same formats as accepted by to3d.\n"
00255 "\n"
00256 " New image display options (alternatives to -im) [19 Oct 1999]:\n"
00257 " -tim These options tell AFNI to arrange the input images\n"
00258 " -tim:<nt> into a internal time-dependent dataset. Suppose that\n"
00259 " -zim:<nz> there are N input 2D slices on the command line.\n"
00260 " * -tim alone means these are N points in time (1 slice).\n"
00261 " * -tim:<nt> means there are nt points in time (nt is\n"
00262 " an integer > 1), so there are N/nt slices in space,\n"
00263 " and the images on the command line are input in\n"
00264 " time order first (like -time:tz in to3d).\n"
00265 " * -zim:<nz> means there are nz slices in space (nz is\n"
00266 " an integer > 1), so there are N/nz points in time,\n"
00267 " and the images on the command line are input in\n"
00268 " slice order first (like -time:zt in to3d).\n"
00269 "\n"
00270 " N.B.: You may wish to use the -ignore option to set the number of\n"
00271 " initial points to ignore in the time series graph if you use\n"
00272 " -tim or -zim, since there is no way to change this from\n"
00273 " within an AFNI run (the FIM menus are disabled).\n"
00274 " N.B.: The program 'aiv' (AFNI image viewer) can also be used to\n"
00275 " look at images.\n"
00276 ) ;
00277
00278 printf(
00279 "\n"
00280 "-------------------------------------------------------\n"
00281 "USAGE 3: read in datasets specified on the command line\n"
00282 "-------------------------------------------------------\n"
00283 "\n"
00284 " afni -dset [options] dname1 dname2 ...\n"
00285 "\n"
00286 "where 'dname1' is the name of a dataset, etc. With this option, only\n"
00287 "the chosen datasets are read in, and they are all put in the same\n"
00288 "'session'. Follower datasets are not created.\n"
00289 "\n"
00290 MASTER_HELP_STRING
00291 "\n"
00292 CALC_HELP_STRING
00293 ) ;
00294
00295 printf(
00296 "\n"
00297 "-------------------------------\n"
00298 "GENERAL OPTIONS (for any usage)\n"
00299 "-------------------------------\n"
00300 "\n"
00301 " -q Tells afni to be 'quiet' on startup\n"
00302 " -Dname=val Sets environment variable 'name' to 'val' inside AFNI;\n"
00303 " will supersede any value set in .afnirc.\n"
00304 " -gamma gg Tells afni that the gamma correction factor for the\n"
00305 " monitor is 'gg' (default gg is 1.0; greater than\n"
00306 " 1.0 makes the image contrast larger -- this may\n"
00307 " also be adjusted interactively)\n"
00308 " -install Tells afni to install a new X11 Colormap. This only\n"
00309 " means something for PseudoColor displays. Also, it\n"
00310 " usually cause the notorious 'technicolor' effect.\n"
00311 " -ncolors nn Tells afni to use 'nn' gray levels for the image\n"
00312 " displays (default is %d)\n"
00313 " -xtwarns Tells afni to show any Xt warning messages that may\n"
00314 " occur; the default is to suppress these messages.\n"
00315 " -tbar name Uses 'name' instead of 'AFNI' in window titlebars.\n"
00316 " -flipim and The '-flipim' option tells afni to display images in the\n"
00317 " -noflipim 'flipped' radiology convention (left on the right).\n"
00318 " The '-noflipim' option tells afni to display left on\n"
00319 " the left, as neuroscientists generally prefer. This\n"
00320 " latter mode can also be set by the Unix environment\n"
00321 " variable 'AFNI_LEFT_IS_LEFT'. The '-flipim' mode is\n"
00322 " the default.\n"
00323 #ifdef USE_TRACING
00324 " -trace Turns routine call tracing on, for debugging purposes.\n"
00325 " -TRACE Turns even more verbose tracing on, for more debugging.\n"
00326 #endif
00327 #ifdef USING_MCW_MALLOC
00328 " -nomall Disables use of the mcw_malloc() library routines.\n"
00329 #endif
00330 "\n"
00331 "N.B.: Many of these options, as well as the initial color set up,\n"
00332 " can be controlled by appropriate X11 resources. See the\n"
00333 " file AFNI.Xdefaults for instructions and examples.\n"
00334
00335 , DEFAULT_NGRAY
00336 ) ;
00337
00338 printf(
00339 "\n"
00340 "----------\n"
00341 "REFERENCES\n"
00342 "----------\n"
00343 "The following papers describe some of the components of the AFNI package.\n"
00344 "\n"
00345 "RW Cox. AFNI: Software for analysis and visualization of functional\n"
00346 " magnetic resonance neuroimages. Computers and Biomedical Research,\n"
00347 " 29: 162-173, 1996.\n"
00348 "\n"
00349 " * The first AFNI paper, and the one I prefer you cite if you want to\n"
00350 " refer to the AFNI package as a whole.\n"
00351 "\n"
00352 "RW Cox, A Jesmanowicz, and JS Hyde. Real-time functional magnetic\n"
00353 " resonance imaging. Magnetic Resonance in Medicine, 33: 230-236, 1995.\n"
00354 "\n"
00355 " * The first paper on realtime FMRI; describes the algorithm used in\n"
00356 " 3dfim+, the interactive FIM calculations, and in the realtime plugin.\n"
00357 "\n"
00358 "RW Cox and JS Hyde. Software tools for analysis and visualization of\n"
00359 " FMRI Data. NMR in Biomedicine, 10: 171-178, 1997.\n"
00360 "\n"
00361 " * A second paper about AFNI and design issues for FMRI software tools.\n"
00362 "\n"
00363 "RW Cox and A Jesmanowicz. Real-time 3D image registration for\n"
00364 " functional MRI. Magnetic Resonance in Medicine, 42: 1014-1018, 1999.\n"
00365 "\n"
00366 " * Describes the algorithm used for image registration in 3dvolreg\n"
00367 " and in the realtime plugin.\n"
00368 "\n"
00369 "ZS Saad, KM Ropella, RW Cox, and EA DeYoe. Analysis and use of FMRI\n"
00370 " response delays. Human Brain Mapping, 13: 74-93, 2001.\n"
00371 "\n"
00372 " * Describes the algorithm used in 3ddelay (cf. '3ddelay -help').\n"
00373 ) ;
00374
00375 printf("\n") ; exit(0) ;
00376 }
|
|
||||||||||||||||
|
Definition at line 8123 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_set_viewpoint(), AFNI_transform_vector(), Three_D_View::anat_dset, Three_D_View::anat_now, CAN_TALTO, CURRENT_DAXES, Three_D_View::dc, MCW_DC::display, ENTRY, THD_ivec3::ijk, IM3D_VALID, MCW_choose_cbs::ival, LOAD_ANAT_VIEW, LOAD_FVEC3, mcwCR_integer, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, POPDOWN_strlist_chooser, MCW_choose_cbs::reason, REDISPLAY_ALL, SAVE_VPT, THD_3dmm_to_3dind(), THD_dicomm_to_3dmm(), TTO_COUNT, TTO_current, TTO_list, Three_D_View::type, VIEW_TALAIRACH_TYPE, THD_3dim_dataset::view_type, TTO_point::xx, TTO_point::yy, and TTO_point::zz. Referenced by AFNI_imag_pop_CB().
08124 {
08125 Three_D_View * im3d = (Three_D_View *) cd ;
08126 THD_dataxes * daxes ;
08127 float xx,yy,zz ;
08128 int nn , ii,jj,kk ;
08129 THD_fvec3 fv,tv ; THD_ivec3 iv ;
08130
08131 ENTRY("AFNI_talto_CB") ;
08132
08133 /* check for errors */
08134
08135 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
08136
08137 if( !CAN_TALTO(im3d) ||
08138 cbs->reason != mcwCR_integer ){
08139
08140 POPDOWN_strlist_chooser ;
08141 XBell( im3d->dc->display , 100 ) ;
08142 EXRETURN ;
08143 }
08144
08145 nn = cbs->ival ;
08146 if( nn < 0 || nn >= TTO_COUNT ) EXRETURN ;
08147 TTO_current = nn ;
08148
08149 /* transform point from Dicom to local coords and go there */
08150
08151 xx = TTO_list[nn].xx ; yy = TTO_list[nn].yy ; zz = TTO_list[nn].zz ;
08152
08153 LOAD_ANAT_VIEW(im3d) ; /* 02 Nov 1996 */
08154
08155 LOAD_FVEC3(tv,xx,yy,zz) ; /* Talairach coords */
08156
08157 /* 09 Jul 2001: if not now viewing in Talairach coordinates,
08158 then transform vector to current coordinates */
08159
08160 if( im3d->anat_now->view_type != VIEW_TALAIRACH_TYPE )
08161 tv = AFNI_transform_vector( im3d->anat_dset[VIEW_TALAIRACH_TYPE] ,
08162 tv , im3d->anat_now ) ;
08163
08164 fv = THD_dicomm_to_3dmm( im3d->anat_now , tv ) ;
08165 iv = THD_3dmm_to_3dind ( im3d->anat_now , fv ) ;
08166 ii = iv.ijk[0] ; jj = iv.ijk[1] ; kk = iv.ijk[2] ;
08167
08168 daxes = CURRENT_DAXES(im3d->anat_now) ;
08169 if( ii >= 0 && ii < daxes->nxx &&
08170 jj >= 0 && jj < daxes->nyy && kk >= 0 && kk < daxes->nzz ){
08171
08172 SAVE_VPT(im3d) ;
08173 AFNI_set_viewpoint( im3d , ii,jj,kk , REDISPLAY_ALL ) ; /* jump */
08174 } else {
08175 XBell( im3d->dc->display , 100 ) ;
08176 }
08177 EXRETURN ;
08178 }
|
|
||||||||||||
|
||||||||||||||||
|
Definition at line 7323 of file afni.c. References AFNI_backward_warp_vector(), AFNI_find_warp(), AFNI_forward_warp_vector(), THD_3dim_dataset::anat_parent, VIEW_ORIGINAL_TYPE, THD_3dim_dataset::view_type, THD_3dim_dataset::warp, and THD_3dim_dataset::warp_parent. Referenced by AFNI_initialize_view(), AFNI_lock_carryout(), AFNI_make_warp(), AFNI_marks_quality_check(), AFNI_mnito_CB(), AFNI_setup_viewing(), AFNI_talto_CB(), AFNI_ttatlas_query(), and DRAW_ttatlas_CB().
07326 {
07327 if( old_dset==NULL || new_dset==NULL || old_dset==new_dset ) return old_fv ;
07328
07329 if( old_dset == new_dset->warp_parent ){
07330
07331 return AFNI_forward_warp_vector( new_dset->warp , old_fv ) ;
07332
07333 } else if( old_dset->warp_parent == new_dset ){
07334
07335 return AFNI_backward_warp_vector( old_dset->warp , old_fv ) ;
07336
07337 } else if( old_dset->warp_parent == new_dset->warp_parent &&
07338 old_dset->warp_parent != NULL ){
07339
07340 THD_fvec3 par_fv ;
07341 par_fv = AFNI_backward_warp_vector( old_dset->warp , old_fv ) ;
07342 return AFNI_forward_warp_vector ( new_dset->warp , par_fv ) ;
07343 }
07344
07345 /*-- 09 Jul 2001:
07346 If old_dset is in +tlrc/+acpc and new_dset is in +orig,
07347 see if can find anat_parent to do the job for us --*/
07348
07349 if( new_dset->view_type == VIEW_ORIGINAL_TYPE &&
07350 old_dset->view_type != VIEW_ORIGINAL_TYPE &&
07351 old_dset->anat_parent != NULL &&
07352 old_dset->anat_parent->warp_parent != NULL ){
07353
07354 return AFNI_backward_warp_vector( old_dset->anat_parent->warp , old_fv ) ;
07355 }
07356
07357 /*-- If old_dset is +orig and new_dset is +tlrc/+acpc, try anat_parent --*/
07358
07359 if( old_dset->view_type == VIEW_ORIGINAL_TYPE &&
07360 new_dset->view_type != VIEW_ORIGINAL_TYPE &&
07361 new_dset->anat_parent != NULL &&
07362 new_dset->anat_parent->warp_parent != NULL ){
07363
07364 return AFNI_forward_warp_vector( new_dset->anat_parent->warp , old_fv ) ;
07365 }
07366
07367 /*-- 28 Aug 2002: see if there is a special warp between datasets --*/
07368
07369 { THD_warp *swarp = AFNI_find_warp(new_dset,old_dset) ;
07370 if( swarp != NULL ) return AFNI_forward_warp_vector( swarp , old_fv ) ;
07371 swarp = AFNI_find_warp(old_dset,new_dset) ;
07372 if( swarp != NULL ) return AFNI_backward_warp_vector( swarp, old_fv ) ;
07373 }
07374
07375 /*-- default is no change --*/
07376
07377 return old_fv ;
07378 }
|
|
|
Definition at line 8197 of file afni.c. References AFNI_transform_vector(), Three_D_View::anat_dset, Three_D_View::anat_now, CAN_TALTO, IM3D_OPEN, LOAD_FVEC3, TT_load_atlas(), TT_whereami(), VIEW_TALAIRACH_TYPE, THD_3dim_dataset::view_type, Three_D_View::vinfo, AFNI_view_info::xi, THD_fvec3::xyz, AFNI_view_info::yj, and AFNI_view_info::zk. Referenced by AFNI_imag_pop_CB(), and AFNI_set_viewpoint().
08198 {
08199 static int have_TT = -1 ;
08200
08201 if( !IM3D_OPEN(im3d) || !CAN_TALTO(im3d) ) return NULL ;
08202
08203 /*-- make sure we have the TT atlas --*/
08204
08205 if( have_TT == -1 ){
08206 have_TT = TT_load_atlas() ;
08207 if( !have_TT ) return NULL ;
08208 }
08209
08210 if( have_TT ){
08211 THD_fvec3 tv ; char *tlab ;
08212
08213 /*-- current position --*/
08214
08215 LOAD_FVEC3(tv,im3d->vinfo->xi,im3d->vinfo->yj,im3d->vinfo->zk) ;
08216
08217 /*-- transform to Talairach, if needed --*/
08218
08219 if( im3d->anat_now->view_type != VIEW_TALAIRACH_TYPE )
08220 tv = AFNI_transform_vector( im3d->anat_now , tv ,
08221 im3d->anat_dset[VIEW_TALAIRACH_TYPE] ) ;
08222
08223 /*-- get result string --*/
08224
08225 tlab = TT_whereami( tv.xyz[0] , tv.xyz[1] , tv.xyz[2] ) ;
08226 return tlab ;
08227 }
08228
08229 return NULL ;
08230 }
|
|
||||||||||||
|
Define the view_setter code, which says which image viewer plane was used to set the current viewpoint. [26 Feb 2003] -------------------------------------------------------------------------- Definition at line 5290 of file afni.c. References AXIAL, CORONAL, IM3D_OPEN, ISQ_REALZ, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, SAGITTAL, AFNI_view_info::view_setter, and Three_D_View::vinfo. Referenced by AFNI_gra_send_CB(), AFNI_imag_pop_CB(), AFNI_initialize_view(), AFNI_seq_send_CB(), and AFNI_view_xyz_CB().
05291 {
05292 MCW_imseq *sxyz, *syzx, *szxy ;
05293 int val=-1 ;
05294
05295 if( !IM3D_OPEN(im3d) ) return ;
05296
05297 sxyz = im3d->s123 ; syzx = im3d->s231 ; szxy = im3d->s312 ;
05298
05299 if( !ISQ_REALZ(seq) ){
05300 int code = 4*(sxyz!=NULL) + 2*(syzx!=NULL) + (szxy!=NULL) ;
05301 switch(code){
05302 case 4: val = AXIAL ; break ;
05303 case 2: val = SAGITTAL; break ;
05304 case 1: val = CORONAL ; break ;
05305 }
05306 } else {
05307 if( seq == sxyz ) val = AXIAL ;
05308 else if( seq == syzx ) val = SAGITTAL;
05309 else if( seq == szxy ) val = CORONAL ;
05310 }
05311
05312 im3d->vinfo->view_setter = val ;
05313 return ;
05314 }
|
|
||||||||||||||||
|
Definition at line 4885 of file afni.c. References afni16_pixmap, AFNI_arrowpad_help, AFNI_arrowpad_hint, AFNI_brick_to_mri(), AFNI_controller_index(), AFNI_image_help, AFNI_IMAGES_VIEW, AFNI_range_setter(), AFNI_set_viewpoint(), AFNI_toggle_drawing(), AFNI_view_setter(), AFNI_yesenv(), Three_D_View::b123_ulay, Three_D_View::b231_ulay, Three_D_View::b312_ulay, THD_statistics::bstat, client_data, Three_D_View::dc, drive_MCW_grapher(), drive_MCW_imseq(), FD_brick::dset, DSET_GRAPHABLE, ENTRY, MCW_grapher::fdw_graph, Three_D_View::fimdata, AFNI_fimmer_type::fimref, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, getenv(), GLOBAL_argopt, GRA_REALZ, graDR_addref_ts, graDR_fim_disable, graDR_icon, graDR_mirror, graDR_polort, graDR_realize, graDR_setglobalbaseline, graDR_setignore, graDR_setindex, graDR_title, AFNI_imaging_widgets::graph_xyz_pb, AFNI_imaging_widgets::graph_yzx_pb, AFNI_imaging_widgets::graph_zxy_pb, IM3D_VALID, AFNI_widget_set::imag, AFNI_imaging_widgets::image_xyz_pb, AFNI_imaging_widgets::image_yzx_pb, AFNI_imaging_widgets::image_zxy_pb, INIT_BKGD_LAB, AFNI_fimmer_type::init_ignore, ISQ_DEFAULT_OPT, ISQ_REALZ, ISQ_RNG_MINTOMAX, isqDR_arrowpadhint, isqDR_arrowpadon, isqDR_bgicon, isqDR_icon, isqDR_ignore_redraws, isqDR_imhelptext, isqDR_options, isqDR_periodicmont, isqDR_realize, isqDR_setimsave, isqDR_setopacity, isqDR_title, isqDR_winfosides, ISVALID_BSTAT, ISVALID_STATISTIC, AF_options::left_is_left, MCW_invert_widget(), MIN, THD_brick_stats::min, ISQ_options::mirror, FD_brick::n1, FD_brick::n2, THD_statistics::nbstat, new_MCW_grapher(), open_MCW_imseq(), MCW_grapher::parent, AFNI_fimmer_type::polort, POPUP_cursorize, REDISPLAY_ALL, RESET_AFNI_QUIT, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, ISQ_options::scale_range, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, THD_3dim_dataset::stats, STATUS, strtod(), AFNI_view_info::time_index, Three_D_View::type, Three_D_View::vinfo, Three_D_View::vwid, Three_D_View::window_title, MCW_imseq::wtop, and AFNI_view_info::xhairs_periodic. Referenced by AFNI_drive_open_window(), and AFNI_startup_layout_CB().
04887 {
04888 Three_D_View * im3d = (Three_D_View *) client_data ;
04889 MCW_imseq * sxyz , * syzx , * szxy , ** snew = NULL ;
04890 MCW_grapher * gxyz , * gyzx , * gzxy , ** gnew = NULL ;
04891 Widget pboff , pb_xyz , pb_yzx , pb_zxy ;
04892 Widget groff , gr_xyz , gr_yzx , gr_zxy ;
04893 FD_brick * brnew ;
04894 int mirror=0 ;
04895 int m2m=0 ; /* 04 Nov 2003 */
04896
04897 ENTRY("AFNI_view_xyz_CB") ;
04898
04899 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04900
04901 sxyz = im3d->s123 ; gxyz = im3d->g123 ;
04902 syzx = im3d->s231 ; gyzx = im3d->g231 ;
04903 szxy = im3d->s312 ; gzxy = im3d->g312 ;
04904
04905 pb_xyz = im3d->vwid->imag->image_xyz_pb ;
04906 pb_yzx = im3d->vwid->imag->image_yzx_pb ;
04907 pb_zxy = im3d->vwid->imag->image_zxy_pb ;
04908
04909 gr_xyz = im3d->vwid->imag->graph_xyz_pb ;
04910 gr_yzx = im3d->vwid->imag->graph_yzx_pb ;
04911 gr_zxy = im3d->vwid->imag->graph_zxy_pb ;
04912
04913 /* handle case of button press of already
04914 open window by bringing that window to the top */
04915
04916 if( w == pb_xyz && sxyz != NULL ){
04917 if( ISQ_REALZ(sxyz) )
04918 XMapRaised( XtDisplay(sxyz->wtop) , XtWindow(sxyz->wtop) ) ;
04919 EXRETURN ;
04920 } else if( w == pb_yzx && syzx != NULL ){
04921 if( ISQ_REALZ(syzx) )
04922 XMapRaised( XtDisplay(syzx->wtop) , XtWindow(syzx->wtop) ) ;
04923 EXRETURN ;
04924 } else if( w == pb_zxy && szxy != NULL ){
04925 if( ISQ_REALZ(szxy) )
04926 XMapRaised( XtDisplay(szxy->wtop) , XtWindow(szxy->wtop) ) ;
04927 EXRETURN ;
04928 } else if( w == gr_xyz && gxyz != NULL ){
04929 if( GRA_REALZ(gxyz) )
04930 XMapRaised( XtDisplay(gxyz->fdw_graph) , XtWindow(gxyz->fdw_graph) ) ;
04931 EXRETURN ;
04932 } else if( w == gr_yzx && gyzx != NULL ){
04933 if( GRA_REALZ(gyzx) )
04934 XMapRaised( XtDisplay(gyzx->fdw_graph) , XtWindow(gyzx->fdw_graph) ) ;
04935 EXRETURN ;
04936 } else if( w == gr_zxy && gzxy != NULL ){
04937 if( GRA_REALZ(gzxy) )
04938 XMapRaised( XtDisplay(gzxy->fdw_graph) , XtWindow(gzxy->fdw_graph) ) ;
04939 EXRETURN ;
04940 }
04941
04942 /* button pressed and window not open, so prepare to open it */
04943
04944 m2m = AFNI_yesenv("AFNI_IMAGE_MINTOMAX") ;
04945
04946 if( w == pb_xyz && sxyz == NULL ){ /* axial image */
04947 snew = &(im3d->s123) ;
04948 brnew = im3d->b123_ulay ;
04949 pboff = pb_xyz ;
04950 mirror= GLOBAL_argopt.left_is_left ;
04951
04952 } else if( w == pb_yzx && syzx == NULL ){ /* sagittal image */
04953 snew = &(im3d->s231) ;
04954 brnew = im3d->b231_ulay ;
04955 pboff = pb_yzx ;
04956
04957 } else if( w == pb_zxy && szxy == NULL ){ /* coronal image */
04958 snew = &(im3d->s312) ;
04959 brnew = im3d->b312_ulay ;
04960 pboff = pb_zxy ;
04961 mirror= GLOBAL_argopt.left_is_left ;
04962
04963 } else if( w == gr_xyz && gxyz == NULL ){ /* axial graph */
04964 gnew = &(im3d->g123) ;
04965 brnew = im3d->b123_ulay ;
04966 pboff = gr_xyz ;
04967 mirror= GLOBAL_argopt.left_is_left ;
04968
04969 } else if( w == gr_yzx && gyzx == NULL ){ /* sagittal graph */
04970 gnew = &(im3d->g231) ;
04971 brnew = im3d->b231_ulay ;
04972 pboff = gr_yzx ;
04973
04974 } else if( w == gr_zxy && gzxy == NULL ){ /* coronal graph */
04975 gnew = &(im3d->g312) ;
04976 brnew = im3d->b312_ulay ;
04977 pboff = gr_zxy ;
04978 mirror= GLOBAL_argopt.left_is_left ;
04979
04980 } else
04981 EXRETURN ; /* something funny */
04982
04983 /** Mar 1997: don't open if x or y dimension is 1 **/
04984
04985 if( snew != NULL && (brnew->n1 < 2 || brnew->n2 < 2) ) EXRETURN ;
04986
04987 SHOW_AFNI_PAUSE ;
04988
04989 if( snew != NULL ){
04990 STATUS("opening an image window") ;
04991 MCW_invert_widget(pboff) ;
04992 POPUP_cursorize(pboff) ; /* 20 Jul 2005 */
04993 *snew = open_MCW_imseq( im3d->dc, AFNI_brick_to_mri, (XtPointer) brnew ) ;
04994
04995 (*snew)->parent = (XtPointer) im3d ;
04996
04997 INIT_BKGD_LAB(im3d) ;
04998
04999 drive_MCW_imseq( *snew, isqDR_imhelptext, (XtPointer) AFNI_image_help ) ;
05000 drive_MCW_imseq( *snew, isqDR_arrowpadon, (XtPointer) AFNI_arrowpad_help ) ;
05001 drive_MCW_imseq( *snew, isqDR_arrowpadhint , (XtPointer) AFNI_arrowpad_hint );
05002 STATUS("realizing new image viewer") ;
05003 drive_MCW_imseq( *snew, isqDR_ignore_redraws, (XtPointer) 1 ) ; /* 16 Aug 2002 */
05004 drive_MCW_imseq( *snew, isqDR_realize, NULL ) ;
05005 drive_MCW_imseq( *snew, isqDR_title, (XtPointer) im3d->window_title ) ;
05006 drive_MCW_imseq( *snew, isqDR_periodicmont,
05007 (XtPointer)(int) im3d->vinfo->xhairs_periodic );
05008
05009 /* 09 Oct 1998: force L-R mirroring on axial and coronal images? */
05010 /* 04 Nov 2003: or min-to-max on grayscaling? */
05011
05012 if( mirror | m2m ){
05013 ISQ_options opt ;
05014
05015 STATUS("setting image view to be L-R mirrored") ;
05016
05017 ISQ_DEFAULT_OPT(opt) ;
05018 if( mirror ) opt.mirror = TRUE ;
05019 if( m2m ) opt.scale_range = ISQ_RNG_MINTOMAX ;
05020 drive_MCW_imseq( *snew,isqDR_options ,(XtPointer) &opt ) ;
05021 }
05022
05023 #if 0
05024 /* 23 Jan 2003: set opacity? */
05025
05026 { char *eee = getenv("AFNI_DEFAULT_OPACITY") ;
05027 if( eee != NULL ){
05028 int opval = (int) strtod( eee , NULL ) ;
05029 if( opval > 0 && opval <= 9 )
05030 drive_MCW_imseq( *snew , isqDR_setopacity , (XtPointer)opval ) ;
05031 }
05032 }
05033
05034 /* 23 Jan 2003: set default save? */
05035
05036 drive_MCW_imseq( *snew , isqDR_setimsave ,
05037 (XtPointer)getenv("AFNI_DEFAULT_IMSAVE") ) ;
05038 #endif
05039
05040 #ifdef USE_SIDES
05041 #define LL 0
05042 #define RR 1
05043 #define AA 2
05044 #define PP 3
05045 #define SS 4
05046 #define II 5
05047 if( !AFNI_yesenv("AFNI_NO_SIDES_LABELS") ){
05048 static char * ssix[6] = { "Left" , "Right" ,
05049 "Anterior" , "Posterior" ,
05050 "Superior" , "Inferior" } ;
05051 char * ws[4] ;
05052
05053 if( *snew == im3d->s123 ){
05054 ws[0] = ssix[RR]; ws[1] = ssix[AA]; ws[2] = ssix[LL]; ws[3] = ssix[PP];
05055 } else if( *snew == im3d->s231 ){
05056 ws[0] = ssix[AA]; ws[1] = ssix[SS]; ws[2] = ssix[PP]; ws[3] = ssix[II];
05057 } else if( *snew == im3d->s312 ){
05058 ws[0] = ssix[RR]; ws[1] = ssix[SS]; ws[2] = ssix[LL]; ws[3] = ssix[II];
05059 } else {
05060 ws[0] = ws[1] = ws[2] = ws[3] = NULL ;
05061 }
05062
05063 STATUS("setting image viewer 'sides'") ;
05064
05065 drive_MCW_imseq( *snew,isqDR_winfosides,(XtPointer)ws ) ;
05066 }
05067 #undef LL
05068 #undef RR
05069 #undef AA
05070 #undef PP
05071 #undef SS
05072 #undef II
05073 #endif
05074
05075 AFNI_toggle_drawing( im3d ) ;
05076
05077 #ifndef DONT_INSTALL_ICONS
05078 if( afni48_good ){
05079 Pixmap pm = XmUNSPECIFIED_PIXMAP ;
05080
05081 if( w == pb_xyz ) pm = afni48axi_pixmap ;
05082 else if( w == pb_yzx ) pm = afni48sag_pixmap ;
05083 else if( w == pb_zxy ) pm = afni48cor_pixmap ;
05084
05085 drive_MCW_imseq( *snew, isqDR_icon , (XtPointer) pm ) ;
05086 }
05087 #endif
05088 { int ii=AFNI_controller_index(im3d) ;
05089 if( ii >= 0 )
05090 drive_MCW_imseq( *snew, isqDR_bgicon, (XtPointer)afni16_pixmap[ii] ) ;
05091 }
05092
05093 drive_MCW_imseq( *snew, isqDR_ignore_redraws, (XtPointer) 0 ) ; /* 16 Aug 2002 */
05094
05095 AFNI_view_setter ( im3d , *snew ) ;
05096 AFNI_range_setter( im3d , *snew ) ; /* 04 Nov 2003 */
05097
05098 } /* end of creating a new image viewer */
05099
05100 /** Don't forget to send information like the reference timeseries ... **/
05101
05102 if( gnew != NULL && DSET_GRAPHABLE(brnew->dset) ){
05103 MCW_grapher * gr ;
05104
05105 STATUS("opening a graph window") ;
05106
05107 MCW_invert_widget(pboff) ;
05108 POPUP_cursorize(pboff) ; /* 20 Jul 2005 */
05109 gr = new_MCW_grapher( im3d->dc , AFNI_brick_to_mri , (XtPointer) brnew ) ;
05110 drive_MCW_grapher( gr, graDR_title, (XtPointer) im3d->window_title );
05111 drive_MCW_grapher( gr, graDR_addref_ts, (XtPointer) im3d->fimdata->fimref );
05112 drive_MCW_grapher( gr, graDR_setignore, (XtPointer) im3d->fimdata->init_ignore );
05113 drive_MCW_grapher( gr, graDR_polort, (XtPointer) im3d->fimdata->polort );
05114 drive_MCW_grapher( gr, graDR_setindex , (XtPointer) im3d->vinfo->time_index );
05115
05116 if( im3d->type == AFNI_IMAGES_VIEW )
05117 drive_MCW_grapher( gr , graDR_fim_disable , NULL ) ; /* 19 Oct 1999 */
05118
05119 if( mirror ) /* 12 Jul 2000 */
05120 drive_MCW_grapher( gr , graDR_mirror , (XtPointer) 1 ) ;
05121
05122 /* 07 Aug 2001: set global baseline level, if possible */
05123
05124 if( ISVALID_STATISTIC(brnew->dset->stats) ){
05125 char *eee = getenv( "AFNI_GRAPH_GLOBALBASE" ) ; /* 08 Mar 2002 */
05126 if( eee == NULL ){ /* skip this? */
05127 float vbot=WAY_BIG ; int ii ;
05128 for( ii=0 ; ii < brnew->dset->stats->nbstat ; ii++ )
05129 if( ISVALID_BSTAT(brnew->dset->stats->bstat[ii]) )
05130 vbot = MIN( vbot , brnew->dset->stats->bstat[ii].min ) ;
05131
05132 if( vbot < WAY_BIG )
05133 drive_MCW_grapher( gr, graDR_setglobalbaseline, (XtPointer)&vbot );
05134 }
05135 }
05136
05137 STATUS("realizing new grapher") ;
05138
05139 drive_MCW_grapher( gr , graDR_realize , NULL ) ;
05140
05141 *gnew = gr ;
05142 (*gnew)->parent = (XtPointer) im3d ;
05143
05144 #ifndef DONT_INSTALL_ICONS
05145 if( afni48_good ){
05146 Pixmap pm = XmUNSPECIFIED_PIXMAP ;
05147
05148 if( w == gr_xyz ) pm = afni48graaxi_pixmap ;
05149 else if( w == gr_yzx ) pm = afni48grasag_pixmap ;
05150 else if( w == gr_zxy ) pm = afni48gracor_pixmap ;
05151
05152 drive_MCW_grapher( gr , graDR_icon , (XtPointer) pm ) ;
05153 }
05154 #endif
05155 } /* end of creating a new graph viewer */
05156
05157 /*-- force a jump to the viewpoint of the current location --*/
05158
05159 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_ALL ) ;
05160
05161 SHOW_AFNI_READY ;
05162 RESET_AFNI_QUIT(im3d) ;
05163
05164 MPROBE ;
05165 EXRETURN ;
05166 }
|
|
||||||||||||||||||||
|
Definition at line 5180 of file afni.c. References ENTRY, ev, event, MCW_grapher::fdw_graph, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, GETWIN, GRA_REALZ, AFNI_imaging_widgets::graph_xyz_pb, AFNI_imaging_widgets::graph_yzx_pb, AFNI_imaging_widgets::graph_zxy_pb, IM3D_VALID, AFNI_widget_set::imag, AFNI_imaging_widgets::image_xyz_pb, AFNI_imaging_widgets::image_yzx_pb, AFNI_imaging_widgets::image_zxy_pb, ISQ_REALZ, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, Three_D_View::vwid, and MCW_imseq::wtop.
05182 {
05183 Three_D_View *im3d = (Three_D_View *)cd ;
05184 XButtonEvent *event=(XButtonEvent *)ev ;
05185
05186 MCW_imseq *sxyz , *syzx , *szxy ;
05187 MCW_grapher *gxyz , *gyzx , *gzxy ;
05188 Widget pb_xyz , pb_yzx , pb_zxy ;
05189 Widget gr_xyz , gr_yzx , gr_zxy ;
05190
05191 ENTRY("AFNI_viewbut_EV") ;
05192
05193 if( ev->type != ButtonPress || !IM3D_VALID(im3d) ) EXRETURN ;
05194 if( event->button != Button3 ) EXRETURN ;
05195
05196 sxyz = im3d->s123 ; gxyz = im3d->g123 ; /* viewer structs */
05197 syzx = im3d->s231 ; gyzx = im3d->g231 ;
05198 szxy = im3d->s312 ; gzxy = im3d->g312 ;
05199
05200 pb_xyz = im3d->vwid->imag->image_xyz_pb ; /* buttons */
05201 pb_yzx = im3d->vwid->imag->image_yzx_pb ;
05202 pb_zxy = im3d->vwid->imag->image_zxy_pb ;
05203
05204 gr_xyz = im3d->vwid->imag->graph_xyz_pb ;
05205 gr_yzx = im3d->vwid->imag->graph_yzx_pb ;
05206 gr_zxy = im3d->vwid->imag->graph_zxy_pb ;
05207
05208 /* if the input Widget matches a button, and the item is open, get it */
05209
05210 if( w == pb_xyz && ISQ_REALZ(sxyz) ) GETWIN(sxyz->wtop) ;
05211 else if( w == pb_yzx && ISQ_REALZ(syzx) ) GETWIN(syzx->wtop) ;
05212 else if( w == pb_zxy && ISQ_REALZ(szxy) ) GETWIN(szxy->wtop) ;
05213 else if( w == gr_xyz && GRA_REALZ(gxyz) ) GETWIN(gxyz->fdw_graph) ;
05214 else if( w == gr_yzx && GRA_REALZ(gyzx) ) GETWIN(gyzx->fdw_graph) ;
05215 else if( w == gr_zxy && GRA_REALZ(gzxy) ) GETWIN(gzxy->fdw_graph) ;
05216
05217 EXRETURN ;
05218 }
|
|
||||||||||||||||
|
Definition at line 4692 of file afni.c. References client_data, drive_MCW_imseq(), ENTRY, IM3D_VALID, AFNI_widget_set::imag, isqDR_periodicmont, MCW_val_bbox(), RESET_AFNI_QUIT, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, Three_D_View::vinfo, Three_D_View::vwid, AFNI_imaging_widgets::wrap_bbox, and AFNI_view_info::xhairs_periodic.
04694 {
04695 Three_D_View * im3d = (Three_D_View *) client_data ;
04696 int bval ;
04697
04698 ENTRY("AFNI_wrap_bbox_CB") ;
04699
04700 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04701
04702 bval = MCW_val_bbox( im3d->vwid->imag->wrap_bbox ) ;
04703
04704 if( (Boolean) bval == im3d->vinfo->xhairs_periodic ) EXRETURN ;
04705
04706 im3d->vinfo->xhairs_periodic = (Boolean) bval ;
04707
04708 if( w != NULL ){
04709 drive_MCW_imseq( im3d->s123, isqDR_periodicmont, (XtPointer) bval );
04710 drive_MCW_imseq( im3d->s231, isqDR_periodicmont, (XtPointer) bval );
04711 drive_MCW_imseq( im3d->s312, isqDR_periodicmont, (XtPointer) bval );
04712 }
04713
04714 RESET_AFNI_QUIT(im3d) ;
04715 EXRETURN ;
04716 }
|
|
||||||||||||
|
Avoid fatal X11 errors. Definition at line 1025 of file afni.c. Referenced by main().
01025 { return 0; }
|
|
||||||||||||||||
|
Definition at line 4720 of file afni.c. References AFNI_set_viewpoint(), client_data, AFNI_view_info::crosshair_visible, ENTRY, IM3D_VALID, AFNI_widget_set::imag, MCW_val_bbox(), REDISPLAY_OVERLAY, RESET_AFNI_QUIT, Three_D_View::vinfo, Three_D_View::vwid, AFNI_view_info::xhairs_all, and AFNI_imaging_widgets::xhall_bbox.
04722 {
04723 Three_D_View * im3d = (Three_D_View *) client_data ;
04724 int bval ;
04725
04726 ENTRY("AFNI_xhall_bbox_CB") ;
04727
04728 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04729
04730 bval = MCW_val_bbox( im3d->vwid->imag->xhall_bbox ) ;
04731
04732 if( (Boolean) bval == im3d->vinfo->xhairs_all ) EXRETURN ;
04733
04734 im3d->vinfo->xhairs_all = (Boolean) bval ;
04735
04736 if( im3d->vinfo->crosshair_visible ){
04737 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
04738 }
04739
04740 RESET_AFNI_QUIT(im3d) ;
04741 EXRETURN ;
04742 }
|
|
||||||||||||||||
|
Check if a particular option is present; 1=yes, 0=no. [15 Jan 2004] --------------------------------------------------------------------------- Definition at line 1082 of file afni.c. Referenced by main().
01083 {
01084 int ii , lt ;
01085 if( targ == NULL || *targ == '\0' || ns <= 0 || ss == NULL ) return 0 ;
01086 lt = strlen(targ) ;
01087 for( ii=0 ; ii < ns ; ii++ )
01088 if( ss[ii] != NULL && strncmp(ss[ii],targ,lt) == 0 ) return 1 ;
01089 return 0 ;
01090 }
|
|
|
and plugouts! * Definition at line 1685 of file afni.c.
01686 {
01687 fprintf(stderr,"\n**** Fatal Error ****\n %s\n",str) ;
01688 sleep(1) ; exit(1) ;
01689 }
|
|
||||||||||||
|
convert DTIStudio fiber format data to SUMA segment data Definition at line 1097 of file afni.c. References AFNI_get_friend(), AFNI_handler(), AFNI_load_defaults(), AFNI_logger(), AFNI_mark_environ_done(), AFNI_parse_args(), AFNI_process_environ(), AFNI_process_setup(), AFNI_purge_unused_dsets(), AFNI_sigfunc(), AFNI_start_version_check(), AFNI_syntax(), AFNI_VERBOSE, AFNI_xerrhandler(), AFNI_yesenv(), ALLOW_real_time, AF_options::allow_rt, ANNOUNCEMENT, argc, check_string(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, AFNI_library_type::dc, MCW_DC::depth, dump_PBAR_palette_table(), ENABLE_LOCK, enable_mcw_malloc(), eqn(), FALLback, free, AF_options::gamma, getenv(), GLOBAL_argopt, GLOBAL_library, GPT, AFNI_library_type::hints_on, AFNI_library_type::ijk_lock, INIT_ncolovr, AF_options::install_cmap, machdep(), MAIN_app, MAIN_argc, MAIN_argv, MAIN_shell, MAIN_workprocess(), mainENTRY, malloc, MAX_CONTROLLERS, MCW_disable_help(), MCW_new_DC(), AF_options::ncolor, AFNI_library_type::plugins, PLUTO_register_workproc(), AF_options::quiet, REPORT_PROGRESS, AFNI_library_type::session, SET_FIM_bkthr, SETUP_INIT_MODE, AF_options::skip_afnirc, STATUS, strtod(), THD_load_datablock_verbose(), THD_set_freeup(), AFNI_library_type::time_lock, AF_options::unique_dcs, MCW_DC::visual_class, AFNI_library_type::warptable, and AF_options::xtwarns.
01098 {
01099 int ii ;
01100
01101 /*--- help the pitiful user? ---*/
01102
01103 if( argc > 1 && strncmp(argv[1],"-help",2) == 0 ) AFNI_syntax() ;
01104
01105 /** 15 Jan 2004: check for -skip_afnirc right away **/
01106
01107 GLOBAL_argopt.skip_afnirc = check_string("-skip_afnirc",argc,argv) ;
01108 if( GLOBAL_argopt.skip_afnirc ) AFNI_mark_environ_done() ;
01109
01110 /*--- Initialize some stuff ---*/
01111
01112 machdep() ; /* RWCox: 20 Apr 2001 */
01113 THD_load_datablock_verbose(1) ; /* 21 Aug 2002 */
01114
01115 #ifdef CATCH_SIGNALS
01116 signal(SIGINT ,AFNI_sigfunc) ; /* may be superseded by mainENTRY below */
01117 signal(SIGBUS ,AFNI_sigfunc) ;
01118 signal(SIGSEGV,AFNI_sigfunc) ;
01119 signal(SIGTERM,AFNI_sigfunc) ;
01120 #endif
01121
01122 /** Check for -version [15 Aug 2003] **/
01123
01124 if( check_string("-ver",argc,argv) || check_string("--ver",argc,argv) ){
01125 printf("Version " VERSION "\n") ;
01126 #ifdef SHSTRING
01127 printf( "[[Precompiled binary " SHSTRING ": " __DATE__ "]]\n" ) ;
01128 #endif
01129 exit(0) ;
01130 }
01131
01132 /** just print the SHOWOFF string [26 Oct 2004] **/
01133
01134 if( check_string("-show",argc,argv) || check_string("--show",argc,argv) ){
01135 #ifdef SHSTRING
01136 printf( SHSTRING "\n" ) ;
01137 #else
01138 printf("Unknown\n") ;
01139 #endif
01140 exit(0) ;
01141 }
01142
01143 /** debug stuff **/
01144
01145 #ifdef USING_MCW_MALLOC
01146 if( !check_string("-nomall",argc,argv) && !check_string("-rt",argc,argv) )
01147 enable_mcw_malloc() ;
01148 #endif
01149
01150 #ifdef USE_TRACING
01151 if( check_string("-trace",argc,argv) ) DBG_trace = 1 ;
01152 if( check_string("-TRACE",argc,argv) ) DBG_trace = 2 ;
01153 #endif
01154
01155 #if 0
01156 #ifdef USE_TRACING
01157 if( ALLOW_real_time ) DBG_trace = 0 ; /* 26 Jan 2001 */
01158 #endif
01159 #endif
01160
01161 /** 25 Oct 2001: check for -q (quiet) option right away **/
01162
01163 GLOBAL_argopt.quiet = AFNI_yesenv("AFNI_QUIET") ;
01164 if( AFNI_VERBOSE && check_string("-q",argc,argv) ) GLOBAL_argopt.quiet = 1;
01165
01166 /** 12 Dec 2002: scan for "-rt" now,
01167 to see if we want to start the version check **/
01168
01169 GLOBAL_argopt.allow_rt = check_string("-rt",argc,argv) ;
01170
01171 if( !GLOBAL_argopt.quiet && !ALLOW_real_time )
01172 AFNI_start_version_check() ; /* 21 Nov 2002 */
01173
01174 /** set default values of some environment variables [22 Jun 2004] **/
01175
01176 { char **ed , *eqn ;
01177 static char *edef[] = {
01178 "AFNI_SUMA_LINECOLOR" , "blue3" ,
01179 "AFNI_CROSSHAIR_LINES" , "YES" ,
01180 "AFNI_ALWAYS_LOCK" , "YES" ,
01181 "AFNI_IMAGE_SAVESQUARE" , "YES" ,
01182 #ifdef DARWIN
01183 "AFNI_X11_REDECORATE" , "NO" , /* 27 Dec 2004 */
01184 #endif
01185
01186 #if 0
01187 "AFNI_IMAGE_LABEL_MODE" , "1" ,
01188 "AFNI_IMAGE_LABEL_SIZE" , "2" ,
01189 "AFNI_IMAGE_LABEL_SETBACK" , "01" ,
01190 "AFNI_IMAGE_LABEL_COLOR" , "yellow" ,
01191 #endif
01192 NULL } ;
01193
01194 for( ed=edef ; *ed != NULL && *(ed+1) != NULL ; ed+=2 ){
01195 if( getenv(*ed) == NULL ){
01196 eqn = (char *)malloc(128) ;
01197 sprintf(eqn,"%s=%s",*ed,*(ed+1)) ; putenv(eqn) ;
01198 }
01199 }
01200 }
01201
01202 /** Start the debug traceback stuff **/
01203
01204 mainENTRY("AFNI:main") ; /* 26 Jan 2001: replace ENTRY w/ mainENTRY */
01205
01206 /** set the function to call if run out of memory when creating datasets **/
01207
01208 THD_set_freeup( AFNI_purge_unused_dsets ) ; /* 18 Oct 2001 */
01209
01210 #if 0
01211 if( argc > 1 ) AFNI_logger("afni",argc,argv) ; /* 14 Aug 2001 */
01212 #endif
01213
01214 srand48((long)time(NULL)) ; /* initialize random number generator */
01215
01216 REPORT_PROGRESS( "\n" ) ; /* 02 Dec 2000 */
01217 REPORT_PROGRESS( ANNOUNCEMENT ) ;
01218
01219 /*-- Be friendly --*/
01220
01221 #ifdef USE_FRIENDS
01222 { char * sf = AFNI_get_friend() ;
01223 REPORT_PROGRESS( sf ) ;
01224 REPORT_PROGRESS( "\n\n" ) ;
01225 if( check_string("-friend",argc,argv) ) exit(0) ;
01226 }
01227 #endif
01228
01229 /*-------------------------------------------------------------*/
01230 /*------------ initialize the controllers list ----------------*/
01231
01232 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ )
01233 GLOBAL_library.controllers[ii] = NULL ;
01234 GLOBAL_library.dc = NULL ;
01235
01236 GLOBAL_library.controller_lock = 0 ; ENABLE_LOCK ;
01237 GLOBAL_library.time_lock = 0 ; /* 03 Nov 1998 */
01238 GLOBAL_library.ijk_lock = 0 ; /* 11 Sep 2000 */
01239 SET_FIM_bkthr(10.0) ; /* 02 Jun 1999 */
01240
01241 GLOBAL_library.hints_on = 0 ; /* 07 Aug 1999 */
01242
01243 #ifdef ALLOW_PLUGINS
01244 GLOBAL_library.plugins = NULL ;
01245 #endif
01246
01247 GLOBAL_library.session = NULL ; /* 20 Dec 2001 */
01248 GLOBAL_library.warptable = NULL ; /* 28 Aug 2002 */
01249
01250 /*--------------------------------------------------------------------*/
01251 /*--- initialize X, toplevel window, defaults, and display context ---*/
01252
01253 REPORT_PROGRESS("Initializing: X11");
01254
01255 MAIN_shell = XtVaAppInitialize( &MAIN_app , "AFNI" , NULL , 0 ,
01256 &argc , argv , FALLback , NULL ) ;
01257
01258 if( MAIN_shell == NULL ){
01259 fprintf(stderr,"\n*** Cannot initialize X11 ***\n") ; exit(1) ;
01260 }
01261 if( DBG_trace == 2 ){ /* 01 Dec 1999 */
01262 XSynchronize(XtDisplay(MAIN_shell),TRUE) ;
01263 STATUS("XSynchronize is enabled") ;
01264 }
01265
01266 MAIN_argc = argc ; MAIN_argv = argv ; /* what's left after XtVaAppInit */
01267
01268 REPORT_PROGRESS(".") ;
01269
01270 /*-- 04 Jun 1999: modify order of loading arguments and defaults --*/
01271
01272 if( ! GLOBAL_argopt.skip_afnirc ){
01273 char *sysenv = getenv("AFNI_SYSTEM_AFNIRC") ; /* 12 Apr 2000 */
01274 if( sysenv != NULL ) AFNI_process_environ(sysenv) ; /* 12 Apr 2000 */
01275
01276 AFNI_process_environ(NULL) ; /* 07 Jun 1999 */
01277 } else {
01278 AFNI_mark_environ_done() ; /* 16 Apr 2000 */
01279 }
01280
01281 AFNI_load_defaults( MAIN_shell ) ;
01282
01283 if( ! GLOBAL_argopt.skip_afnirc ){ /* this line added 14 Jul 1998 */
01284 char * home = getenv("HOME") ; char fname[256] ;
01285 char * sysenv = getenv("AFNI_SYSTEM_AFNIRC") ; /* 12 Apr 2000 */
01286
01287 GPT = NULL ; /* 19 Dec 1997 */
01288
01289 if( sysenv != NULL ) /* 12 Apr 2000 */
01290 AFNI_process_setup( sysenv , SETUP_INIT_MODE , NULL ) ;
01291
01292 if( home != NULL ){ strcpy(fname,home) ; strcat(fname,"/.afnirc") ; }
01293 else { strcpy(fname,".afnirc") ; }
01294 AFNI_process_setup( fname , SETUP_INIT_MODE , NULL ) ;
01295
01296 #ifdef AFNI_DEBUG
01297 home = dump_PBAR_palette_table(0) ;
01298 if( home != NULL ){ puts(home) ; free(home) ; }
01299 #endif
01300
01301 } else { /* these lines also 14 Jul 1998 */
01302 REPORT_PROGRESS( "[skip .afnirc]" ) ;
01303 }
01304
01305 AFNI_parse_args( argc , argv ) ; /* after Xt init above, only my args left */
01306
01307 /* disable X11 and Xt error messages and crashes (we hope) */
01308
01309 (void) XSetErrorHandler( AFNI_xerrhandler ) ; /* 26 Jun 2003 */
01310 (void) XtAppSetErrorHandler(MAIN_app,AFNI_handler) ;
01311
01312 if( GLOBAL_argopt.xtwarns == False )
01313 (void) XtAppSetWarningHandler(MAIN_app,AFNI_handler) ; /* turn off */
01314
01315 /* FIM background threshold */
01316
01317 { char * lenv = getenv("AFNI_FIM_BKTHR") ; /* 04 Jun 1999 */
01318 if( lenv != NULL ){
01319 float bk = strtod(lenv,NULL) ;
01320 if( bk >= 0.0 && bk < 100.0 ) SET_FIM_bkthr(bk) ;
01321 }
01322 }
01323
01324 /* locking? */
01325
01326 if( AFNI_yesenv("AFNI_ALWAYS_LOCK") ){
01327 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ )
01328 GLOBAL_library.controller_lock |= (1<<ii) ;
01329 }
01330
01331 /*-- now create first display context: MAIN_dc --*/
01332
01333 GLOBAL_library.dc = MAIN_dc =
01334 MCW_new_DC( MAIN_shell , GLOBAL_argopt.ncolor ,
01335 INIT_ncolovr , INIT_colovr , INIT_labovr ,
01336 GLOBAL_argopt.gamma , GLOBAL_argopt.install_cmap ) ;
01337
01338 if( MAIN_dc->depth < 9 && MAIN_dc->visual_class != TrueColor && GLOBAL_argopt.unique_dcs ){
01339 GLOBAL_argopt.unique_dcs = False ;
01340 REPORT_PROGRESS("[-unique off]") ;
01341 }
01342
01343 /*------------------------------------*/
01344 /*------- take it away, Goldie -------*/
01345 /*------------------------------------*/
01346
01347 #if 0
01348 (void) XtAppAddWorkProc( MAIN_app, MAIN_workprocess, NULL ) ;
01349 #else
01350 PLUTO_register_workproc( MAIN_workprocess , NULL ) ;
01351 #endif
01352
01353 MCW_disable_help() ;
01354
01355 STATUS("start XtAppMainLoop") ;
01356
01357 XtAppMainLoop(MAIN_app) ;
01358 exit(0) ;
01359 }
|
|
|
Definition at line 1373 of file afni.c. References AFNI_3DDATA_VIEW, AFNI_fimmer_setref(), AFNI_IMAGES_VIEW, AFNI_init_plugouts(), AFNI_initialize_controller(), AFNI_initialize_view(), AFNI_noenv(), AFNI_plugin_button(), AFNI_read_inputs(), AFNI_register_0D_function, AFNI_register_1D_funcstr, AFNI_register_1D_function, AFNI_register_2D_function, AFNI_register_fimfunc(), AFNI_register_slice_proj, AFNI_speak(), AFNI_splashdown(), AFNI_splashup(), AFNI_startup_timeout_CB(), AFNI_yesenv(), ALLOW_real_time, AFNI_program_widgets::clone_pb, COMPRESS_LASTCODE, AFNI_library_type::controllers, AFNI_library_type::cord, COX_clock_time(), AFNI_widget_set::dmode, Three_D_View::dummied, ENTRY, far, generic_func, getenv(), GLOBAL_argopt, GLOBAL_library, AFNI_library_type::have_dummy_dataset, AFNI_library_type::hints_on, huber_func(), iochan_sleep(), AF_options::layout_fname, MAIN_app, MAIN_argc, MAIN_argv, MAIN_shell, MCW_enable_help(), MCW_help_CB(), MCW_hint_toggle(), MCW_set_bbox(), AFNI_datamode_widgets::misc_hints_bbox, AFNI_datamode_widgets::misc_hints_pb, AFNI_datamode_widgets::misc_plugout_pb, mri_add_name(), MRI_FLOAT_PTR, mri_read_1D(), new_AFNI_controller(), AF_options::noplugins, AF_options::noplugouts, MCW_function_list::num, MRI_IMAGE::nvox, OPEN_CONTROLLER, THD_coorder::orcode, PICTURE_ON, PLUG_get_many_plugins(), AFNI_library_type::plugins, AFNI_widget_set::prog, AF_options::read_images, AFNI_library_type::registered_0D, AFNI_library_type::registered_1D, AFNI_library_type::registered_2D, AFNI_library_type::registered_fim, AFNI_library_type::registered_slice_proj, REPORT_PROGRESS, RETURN, AF_options::script_fname, STATUS, strtod(), THD_enviro_write_compression(), THD_trailname(), AFNI_widget_set::top_shell, TRUST_host(), Three_D_View::type, and Three_D_View::vwid. Referenced by main().
01374 {
01375 static int MAIN_calls = 0 ; /* controls what happens */
01376 static int nosplash = 0 , nodown = 0 ;
01377 static double eltime=0.0 , max_splash=2.0 ;
01378 int ii ;
01379
01380 ENTRY("MAIN_workprocess") ; /* 23 Jan 2001: added ENTRY/RETURN to this routine */
01381
01382 if(PRINT_TRACING){ char str[256]; sprintf(str,"MAIN_calls=%d",MAIN_calls); STATUS(str); }
01383
01384 switch( MAIN_calls ){
01385
01386 /*============================================================================
01387 This code is executed at the end (when MAIN_calls gets too big).
01388 ============================================================================*/
01389
01390 default:{
01391 STATUS("default call") ;
01392
01393 if( nosplash || nodown ) RETURN(True) ;
01394 if( !nodown &&
01395 COX_clock_time()-eltime >= max_splash ){ AFNI_splashdown(); RETURN(True); }
01396 }
01397 break ;
01398
01399 /*============================================================================
01400 Stuff to popup the AFNI splash screen (see afni_splash.[ch]).
01401 ============================================================================*/
01402
01403 case 0:{
01404 STATUS("call 0") ;
01405
01406 #ifdef NO_FRIVOLITIES
01407 nosplash = 1 ;
01408 #else
01409 nosplash = AFNI_yesenv("AFNI_NOSPLASH") ;
01410 #endif
01411 if( !nosplash ){
01412 char * hh ;
01413 AFNI_splashup() ; eltime = COX_clock_time() ;
01414 hh = getenv("AFNI_SPLASHTIME") ;
01415 if( hh != NULL ) max_splash = strtod(hh,NULL) ;
01416 }
01417 }
01418 break ;
01419
01420 /*** For the Mac users! ***/
01421
01422 case 1:
01423 AFNI_speak("[[volm 0.65; inpt PHON; rate -10; pbas +5]]1AEf=nnnIY",0) ; /* fall thru */
01424
01425 case 2:
01426 case 3:
01427 case 4:
01428 case 5:
01429 case 6:
01430 case 7:
01431 case 8:
01432 case 9:
01433 case 10:
01434 STATUS("sleep call") ;
01435 if( !nosplash) iochan_sleep(1) ; /* waste time to let splash popup */
01436 break ;
01437
01438 /*============================================================================
01439 Next, create the first AFNI controller window.
01440 ============================================================================*/
01441
01442 case 11:{
01443
01444 int do_images ; /* 19 Oct 1999 */
01445
01446 STATUS("call 11") ;
01447
01448 REPORT_PROGRESS(". Widgets") ;
01449
01450 MCW_enable_help() ;
01451
01452 do_images = GLOBAL_argopt.read_images ;
01453
01454 MAIN_im3d = new_AFNI_controller( MAIN_shell , MAIN_dc ,
01455 do_images ? AFNI_IMAGES_VIEW
01456 : AFNI_3DDATA_VIEW ) ;
01457
01458 GLOBAL_library.controllers[0] = MAIN_im3d ;
01459
01460 REPORT_PROGRESS(".") ;
01461
01462 /* Always turn off Drag-n-Drop (courtesy the Motif FAQ) */
01463
01464 XtVaSetValues( XmGetXmDisplay(XtDisplay(MAIN_im3d->vwid->top_shell)) ,
01465 XmNdragInitiatorProtocolStyle , XmDRAG_NONE ,
01466 XmNdragReceiverProtocolStyle , XmDRAG_NONE ,
01467 NULL ) ;
01468 }
01469 break ;
01470
01471 /*============================================================================
01472 Next, read the input files (may take a while).
01473 ============================================================================*/
01474
01475 case 12:{
01476
01477 STATUS("call 12") ;
01478
01479 REPORT_PROGRESS(". Input files:") ;
01480
01481 AFNI_read_inputs( MAIN_argc , MAIN_argv ) ;
01482
01483 if( GLOBAL_library.have_dummy_dataset && MAIN_im3d->type == AFNI_3DDATA_VIEW ){
01484 XtSetSensitive( MAIN_im3d->vwid->prog->clone_pb , False ) ;
01485 MAIN_im3d->dummied = 1 ; /* 27 Jan 2004 */
01486 }
01487 }
01488 break ;
01489
01490 /*============================================================================
01491 Next, setup the plugins, and things like that ...
01492 ============================================================================*/
01493
01494 case 13:{
01495
01496 STATUS("call 13") ;
01497
01498 GLOBAL_library.registered_0D.num = 0 ; /* initialize registry */
01499 GLOBAL_library.registered_1D.num = 0 ; /* initialize registry */
01500 GLOBAL_library.registered_2D.num = 0 ; /* initialize registry */
01501
01502 GLOBAL_library.registered_fim.num = 0 ; /* 30 Jan 2000 */
01503
01504 GLOBAL_library.registered_slice_proj.num = 0 ; /* 31 Jan 2002 */
01505
01506 /* these functions are now in afni_transforms.c [01 Feb 2002] */
01507
01508 AFNI_register_0D_function( "Log10" , log10_func ) ;
01509 AFNI_register_0D_function( "SSqrt" , ssqrt_func ) ;
01510
01511 AFNI_register_1D_function( "Median3" , median3_func) ;
01512 AFNI_register_1D_function( "OSfilt3" , osfilt3_func) ;
01513 AFNI_register_1D_function( "|FFT()|" , absfft_func ) ;
01514
01515 AFNI_register_2D_function( "Median9" , median9_box_func ) ;
01516 AFNI_register_2D_function( "Winsor9" , winsor9_box_func ) ;
01517 AFNI_register_2D_function( "OSfilt9" , osfilt9_box_func ) ;
01518
01519 AFNI_register_2D_function( "Median21", median21_box_func );
01520 AFNI_register_2D_function( "Winsor21", winsor21_box_func );
01521
01522 AFNI_register_2D_function( "|FFT2D|", fft2D_func );
01523
01524 /* 01 Feb 2000: see afni_fimfunc.c */
01525
01526 AFNI_register_fimfunc("Spearman CC",1,(generic_func *)spearman_fimfunc,NULL);
01527 AFNI_register_fimfunc("Quadrant CC",1,(generic_func *)quadrant_fimfunc,NULL);
01528
01529 /* 31 Jan 2002 */
01530
01531 AFNI_register_slice_proj( "Minimum" , min_proj ) ;
01532 AFNI_register_slice_proj( "Maximum" , max_proj ) ;
01533 AFNI_register_slice_proj( "Mean" , mean_proj ) ;
01534
01535 AFNI_register_slice_proj( "Median" , qmed_float ) ; /* in cs_qmed.c */
01536
01537 AFNI_register_slice_proj( "Extreme" , extreme_proj ) ; /* 02 Feb 2002 */
01538
01539 #ifdef HUBERIZE
01540 AFNI_register_1D_funcstr( "Huber Fit" , huber_func ) ;
01541 #endif
01542
01543 /** plugins at last! **/
01544
01545 #ifdef ALLOW_PLUGINS
01546 if( MAIN_im3d->type == AFNI_3DDATA_VIEW ){
01547 int nplug = 0 ;
01548 char str[128] ;
01549
01550 if( ! GLOBAL_argopt.noplugins ){
01551 STATUS("initialize plugins") ;
01552 GLOBAL_library.plugins = PLUG_get_many_plugins( MAIN_argv[0] ) ;
01553 AFNI_plugin_button( MAIN_im3d ) ;
01554 }
01555
01556 if( GLOBAL_library.plugins != NULL ) nplug = GLOBAL_library.plugins->num ;
01557 sprintf(str,"\n Plugins = %d libraries read",nplug) ;
01558 REPORT_PROGRESS(str) ;
01559 if( nplug == 0 && ! GLOBAL_argopt.noplugins ) /* 18 May 2005 */
01560 REPORT_PROGRESS(
01561 "\n ** Your Unix path must include the AFNI binary directory"
01562 "\n ** OR you must setenv AFNI_PLUGINPATH to that directory!");
01563
01564 /** and plugouts! **/
01565
01566 if( !GLOBAL_argopt.noplugouts ){ /* June 1997 */
01567 AFNI_init_plugouts() ;
01568 if( MAIN_im3d->vwid->dmode->misc_plugout_pb != NULL ) /* 07 Nov 2001 */
01569 XtSetSensitive(MAIN_im3d->vwid->dmode->misc_plugout_pb,False) ;
01570 REPORT_PROGRESS("\n Plugouts = listening for connections") ;
01571 }
01572 }
01573 #endif
01574
01575 }
01576 break ;
01577
01578 /*============================================================================
01579 Next, do the initial setup on entering the initial view.
01580 ============================================================================*/
01581
01582 case 14:{
01583
01584 STATUS("call 14") ;
01585
01586 OPEN_CONTROLLER( MAIN_im3d ) ;
01587
01588 AFNI_initialize_controller( MAIN_im3d ) ; /* decide what to see */
01589 AFNI_initialize_view( NULL , MAIN_im3d ) ; /* set up to see it */
01590
01591 /*--- Other small and quick startup stuff before AFNI can go ---*/
01592
01593 MCW_help_CB( MAIN_im3d->vwid->top_shell,NULL,NULL ); /* initialize help */
01594
01595 { char str[64] ;
01596 sprintf(str,"\n -orient = %s", GLOBAL_library.cord.orcode ) ;
01597 REPORT_PROGRESS(str) ;
01598 }
01599
01600 /* initialize hints */
01601
01602 GLOBAL_library.hints_on = !AFNI_noenv("AFNI_HINTS") ;
01603 if( !GLOBAL_library.hints_on ) MCW_hint_toggle() ;
01604
01605 if( MAIN_im3d->vwid->dmode->misc_hints_pb != NULL )
01606 MCW_set_bbox( MAIN_im3d->vwid->dmode->misc_hints_bbox ,
01607 GLOBAL_library.hints_on ) ;
01608
01609 /* Feb 1998: setup write compression from environment */
01610 /* (read de-compression always works) */
01611
01612 ii = THD_enviro_write_compression() ;
01613 if( ii >= 0 && ii <= COMPRESS_LASTCODE ){
01614 char str[64] ;
01615 sprintf(str,"\n write compress= %s", COMPRESS_enviro[ii]) ;
01616 REPORT_PROGRESS(str) ;
01617 }
01618
01619 if( ALLOW_real_time > 0 )
01620 REPORT_PROGRESS("\nRT: realtime plugin is active") ;
01621
01622 /* 23 Sep 2000: this function will be called 0.123 seconds
01623 from now to initialize the window layouts */
01624
01625 if( GLOBAL_argopt.layout_fname != NULL &&
01626 MAIN_im3d->type == AFNI_3DDATA_VIEW ){
01627
01628 (void) XtAppAddTimeOut( MAIN_app , 123 ,
01629 AFNI_startup_layout_CB , GLOBAL_argopt.layout_fname ) ;
01630
01631 nodown = 1 ; /* splashdown will be done in AFNI_startup_layout_CB */
01632 }
01633
01634 /* 21 Jan 2003: this function will be called 0.246 seconds
01635 from now to run the startup script, if any */
01636
01637 if( GLOBAL_argopt.script_fname != NULL &&
01638 MAIN_im3d->type == AFNI_3DDATA_VIEW ){
01639
01640 (void) XtAppAddTimeOut( MAIN_app , 246 ,
01641 AFNI_startup_script_CB , GLOBAL_argopt.script_fname ) ;
01642 }
01643
01644 /* this function will be called 1.234 seconds from now to finalize
01645 anything else that needs fixing up once AFNI is fully started */
01646
01647 PICTURE_ON(MAIN_im3d) ;
01648 (void) XtAppAddTimeOut( MAIN_app, 1234, AFNI_startup_timeout_CB, MAIN_im3d ) ;
01649
01650 (void) TRUST_host(NULL) ; /* 21 Feb 2001: initialize trust mechanism */
01651
01652 /* see if there is an initial FIM ideal timeseries */
01653
01654 { char *eee = getenv( "AFNI_FIM_IDEAL" ) ;
01655 static MRI_IMAGE *tsim ;
01656 tsim = mri_read_1D( eee ) ;
01657 if( tsim != NULL ){
01658 float *far = MRI_FLOAT_PTR(tsim) ; int ii ; char *tname ;
01659 for( ii=0 ; ii < tsim->nvox ; ii++ )
01660 if( fabs(far[ii]) >= 33333.0 ) far[ii] = WAY_BIG ;
01661 tname = THD_trailname(eee,1) ;
01662 mri_add_name( tname , tsim ) ;
01663 AFNI_fimmer_setref( MAIN_im3d , tsim ) ;
01664 }
01665 }
01666
01667 REPORT_PROGRESS("\n") ;
01668 }
01669 break ;
01670
01671 /*============================================================================*/
01672 #if 0
01673 case 15:{ /* not used at present, but ready to be added when needed */
01674 STATUS("call 15") ;
01675 }
01676 break ;
01677 #endif
01678 }
01679
01680 MAIN_calls++ ; RETURN(False) ;
01681 }
|
|
|
Definition at line 1693 of file afni.c. Referenced by AFNI_quit_CB().
01694 {
01695 static char *bye[] = { "[[volm 0.64]] Farewell",
01696 "[[volm 0.64]] Goodbye" ,
01697 "[[volm 0.64]] Until next time" } ;
01698 int nn = sizeof(bye)/sizeof(char *) ;
01699 return bye[ lrand48() % nn ] ;
01700 }
|
Variable Documentation
|
|
Initial value: "Click arrows to scroll crosshair position\n" "Click button to open/close crosshair gap " Definition at line 4871 of file afni.c. Referenced by AFNI_view_xyz_CB(). |
|
|
Initial value: {
"Scroll crosshairs down" ,
"Scroll crosshairs up" ,
"Scroll crosshairs left" ,
"Scroll crosshairs right" ,
"Close/open crosshairs gap"
}Definition at line 4875 of file afni.c. Referenced by AFNI_view_xyz_CB(). |
|
|
Initial value: "Button 1: Set crosshair location\n" "Button 3: Pop up image menu\n\n" "Shift/Ctrl/Alt + Button 3\n" "will open up the Disp/Mont/Save\n" "control panels, respectively.\n\n" "Shift+Button2: drag crop region\n\n" "q = close window (=Done)\n" "z = zoom out Z = zoom in\n" "p = panning mode on & off\n" "> = Page Up = forward 1 image\n" "< = Page Down = backward 1 image\n" "v/V = Video up/down\n" "r/R = Ricochet up/down\n" "Left/Right/Up/Down arrow keys\n" " move crosshairs OR pan image\n" Definition at line 4854 of file afni.c. Referenced by AFNI_view_xyz_CB(). |
|
|
Definition at line 107 of file afni.c. Referenced by AFNI_parse_args(), and AFNI_startup_timeout_CB(). |
|
|
Definition at line 106 of file afni.c. Referenced by AFNI_parse_args(), and AFNI_startup_timeout_CB(). |
|
|
Definition at line 10162 of file afni.c. Referenced by AFNI_needs_dset_ijk(), and AFNI_store_dset_index(). |
|
|
Definition at line 10162 of file afni.c. Referenced by AFNI_needs_dset_tin(), and AFNI_store_dset_index(). |
|
|
Initial value:
{ "AFNI*fontList: 9x15bold=charset1" ,
"AFNI*pbar*fontList: 6x10=charset1" ,
"AFNI*imseq*fontList: 7x13=charset1" ,
"AFNI*background: gray25" ,
"AFNI*menu*background: gray15" ,
"AFNI*borderColor: gray25" ,
"AFNI*foreground: yellow" ,
"AFNI*borderWidth: 0" ,
"AFNI*troughColor: blue3" ,
"AFNI*XmLabel.translations: #override<Btn2Down>:" ,
"AFNI*help*background: black" ,
"AFNI*help*foreground: #ffff88" ,
"AFNI*help*helpborder: False" ,
"AFNI*help*waitPeriod: 1066" ,
"AFNI*help*fontList: 9x15bold=charset1" ,
"AFNI*cluefont: 9x15bold" ,
"AFNI*help*cancelWaitPeriod: 333" ,
NULL }Definition at line 1033 of file afni.c. Referenced by main(). |
|
|
Definition at line 92 of file afni.c. Referenced by AFNI_define_CB(), main(), and MAIN_workprocess(). |
|
|
Definition at line 97 of file afni.c. Referenced by AFNI_parse_args(), main(), and MAIN_workprocess(). |
|
|
Definition at line 98 of file afni.c. Referenced by AFNI_parse_args(), main(), and MAIN_workprocess(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 96 of file afni.c. Referenced by AFNI_parse_args(), main(), and MAIN_workprocess(). |