Doxygen Source Code Documentation
afni.h File Reference
#include "mrilib.h"#include "imseq.h"#include "xutil.h"#include "pbar.h"#include "afni_graph.h"#include "afni_pcor.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>#include <time.h>#include <Xm/Separator.h>#include <Xm/Display.h>#include <Xm/CascadeB.h>#include "logo.h"#include "AFNI_label.h"#include "afni_plugin.h"#include "afni_setup.h"#include "afni_warp.h"#include "sonnets.h"Go to the source code of this file.
Define Documentation
|
|
|
Definition at line 1345 of file afni.h. Referenced by AFNI_set_cursor(). |
|
|
Definition at line 810 of file afni.h. Referenced by AFNI_gra_send_CB(), AFNI_seq_send_CB(), AFNI_set_viewpoint(), and AFNI_underlay_CB(). |
|
|
Definition at line 808 of file afni.h. Referenced by AFNI_gra_send_CB(), AFNI_make_wid2(), AFNI_seq_send_CB(), AFNI_set_viewpoint(), and AFNI_underlay_CB(). |
|
|
Definition at line 809 of file afni.h. Referenced by AFNI_underlay_CB(). |
|
|
Definition at line 797 of file afni.h. Referenced by AFNI_crosshair_label(), AFNI_view_xyz_CB(), and MAIN_workprocess(). |
|
|
|
|
|
Definition at line 1827 of file afni.h. Referenced by MAIN_workprocess(). |
|
|
Definition at line 1837 of file afni.h. Referenced by MAIN_workprocess(). |
|
|
Definition at line 1829 of file afni.h. Referenced by F1D_init(), and MAIN_workprocess(). |
|
|
Definition at line 1831 of file afni.h. Referenced by F2D_init(), MAIN_workprocess(), and PLUGIN_init(). |
|
|
Definition at line 1834 of file afni.h. Referenced by MAIN_workprocess(). |
|
|
|
|
|
Value: ( MCW_set_bbox( (iq)->vwid->view->see_func_bbox, 0), \ AFNI_see_func_CB( NULL , (XtPointer)(iq) , NULL ) ) |
|
|
Value: ( MCW_set_bbox( (iq)->vwid->view->see_func_bbox, 1 ), \ AFNI_see_func_CB( NULL , (XtPointer)(iq) , NULL ) ) Definition at line 1104 of file afni.h. Referenced by AFNI_fimmer_execute(), and DRAW_finalize_dset_CB(). |
|
|
Value: do{ if( ! (iq)->vinfo->func_visible ){ \ MCW_set_bbox( (iq)->vwid->view->see_func_bbox, 1 ) ; \ (iq)->vinfo->func_visible = True ; \ } } while(0) Definition at line 1110 of file afni.h. Referenced by RT_tell_afni_one(). |
|
|
Value: do{ if( (iq)->vinfo->view_type != (vv) ){ \ MCW_set_bbox( (iq)->vwid->view->view_bbox , 1 << (vv) ) ; \ (iq)->vinfo->view_type = (vv) ; \ } } while(0) ; Definition at line 1122 of file afni.h. Referenced by RT_tell_afni_one(). |
|
|
Value: do{ if( (iq)->vinfo->view_type != (vv) ){ \ MCW_set_bbox( (iq)->vwid->view->view_bbox , 1 << (vv) ) ; \ AFNI_switchview_CB( NULL , (XtPointer)(iq) , NULL ) ; \ } } while(0) ; |
|
|
Definition at line 1013 of file afni.h. Referenced by main(), and PLUTO_report(). |
|
|
Definition at line 1346 of file afni.h. Referenced by AFNI_set_cursor(). |
|
|
Definition at line 318 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 316 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 319 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
|
|
|
Definition at line 317 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 314 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 315 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 312 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 310 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 311 of file afni.h. Referenced by AFNI_crosshair_visible_CB(), and AFNI_startup_layout_CB(). |
|
|
Definition at line 790 of file afni.h. Referenced by AFNI_fimmer_setignore(), AFNI_fimmer_setort(), AFNI_fimmer_setpolort(), AFNI_fimmer_setref(), and AFNI_setup_viewing(). |
|
|
Definition at line 1008 of file afni.h. Referenced by main(), MAIN_workprocess(), and PLUGIN_init(). |
|
|
Definition at line 272 of file afni.h. Referenced by AFNI_get_xhair_node(), and AFNI_view_setter(). |
|
|
|
|
|
|
Value: ( (q3d)->vinfo->view_type == VIEW_TALAIRACH_TYPE || \ AFNI_can_transform_vector( \ (q3d)->anat_dset[VIEW_TALAIRACH_TYPE] , (q3d)->anat_now ) ) Definition at line 1758 of file afni.h. Referenced by AFNI_imag_pop_CB(), AFNI_mnito_CB(), AFNI_setup_viewing(), AFNI_talto_CB(), AFNI_ttatlas_query(), DRAW_main(), and DRAW_ttatlas_CB(). |
|
|
Value: ( (iq)->fimdata->fimref = NULL , \
(iq)->fimdata->fimort = NULL , \
(iq)->fimdata->fimdset = NULL , \
(iq)->fimdata->refadd_count = 0 , \
(iq)->fimdata->polort = INIT_fim_polort , \
(iq)->fimdata->init_ignore = GLOBAL_argopt.ignore )Definition at line 751 of file afni.h. Referenced by AFNI_closedown_3dview(). |
|
|
Value: do{ int bz = abs((bb)->a123.ijk[2])-1 ; \ (iq)->vinfo->xhairs_ndown.ijk[bz] = \ (iq)->vinfo->xhairs_nup.ijk[bz] = \ (iq)->vinfo->xhairs_nskip.ijk[bz] = 0 ; } while(0) Definition at line 184 of file afni.h. Referenced by AFNI_seq_send_CB(), and AFNI_underlay_CB(). |
|
|
Definition at line 893 of file afni.h. Referenced by AFNI_drive_close_window(), and AFNI_quit_CB(). |
|
|
Value: { XtUnmanageChild( (iq)->vwid-> panel ->frame ) ; \
if( (iq)->vwid->view-> panel ## _pb_inverted ){ \
MCW_invert_widget( (iq)->vwid->view->define_ ## panel ## _pb ) ; \
(iq)->vwid->view-> panel ## _pb_inverted = False ; } }Definition at line 408 of file afni.h. Referenced by AFNI_controller_panel_CB(), AFNI_define_CB(), and AFNI_marks_action_CB(). |
|
|
Definition at line 274 of file afni.h. Referenced by AFNI_get_xhair_node(), and AFNI_view_setter(). |
|
|
color definitions and their labels (for 'choosers') * |
|
|
|
|
|
Definition at line 104 of file afni.h. Referenced by AFNI_autorange_label(), and AFNI_make_wid2(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1849 of file afni.h. Referenced by AFNI_syntax(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1005 of file afni.h. Referenced by AFNI_initialize_view(), and AFNI_modify_viewing(). |
|
|
Definition at line 106 of file afni.h. Referenced by AFNI_do_many_writes(), AFNI_setup_viewing(), and AFNI_write_dataset_CB(). |
|
|
Definition at line 109 of file afni.h. Referenced by AFNI_anatmode_CB(), AFNI_funcmode_CB(), and AFNI_setup_viewing(). |
|
|
|
|
|
Definition at line 110 of file afni.h. Referenced by AFNI_setup_viewing(). |
|
|
Definition at line 1020 of file afni.h. Referenced by AFNI_thr_scale_CB(). |
|
|
Definition at line 1397 of file afni.h. Referenced by AFNI_process_drawing(), and AFNI_receive_control(). |
|
|
Definition at line 1396 of file afni.h. Referenced by AFNI_make_wid2(), AFNI_process_drawing(), AFNI_receive_control(), and AFNI_receive_destroy(). |
|
|
Definition at line 1411 of file afni.h. Referenced by AFNI_receive_control(), and DRAW_mode_CB(). |
|
|
Definition at line 1399 of file afni.h. Referenced by AFNI_process_drawing(), and AFNI_receive_control(). |
|
|
Definition at line 1407 of file afni.h. Referenced by AFNI_receive_control(), DRAW_color_CB(), and DRAW_finalize_dset_CB(). |
|
|
Definition at line 1398 of file afni.h. Referenced by AFNI_process_drawing(), and AFNI_receive_control(). |
|
|
Definition at line 1410 of file afni.h. Referenced by AFNI_receive_control(), DRAW_quit_CB(), and r_save_dataset_as(). |
|
|
Definition at line 1409 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1408 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1426 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1425 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1429 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1428 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1009 of file afni.h. Referenced by AFNI_marks_quality_check(). |
|
|
Definition at line 1006 of file afni.h. Referenced by AFNI_initialize_view(), AFNI_modify_viewing(), and main(). |
|
|
Definition at line 1437 of file afni.h. Referenced by AFNI_receive_control(), DRAW_done_CB(), DRAW_quit_CB(), DSET2_dset_recv(), DSETN_dset_recv(), RCREND_done_CB(), REND_done_CB(), and TTget_main(). |
|
|
Definition at line 712 of file afni.h. Referenced by AFNI_fimmer_compute(), and GRA_fim_CB(). |
|
|
Definition at line 718 of file afni.h. Referenced by AFNI_fimmer_compute(). |
|
|
Definition at line 715 of file afni.h. Referenced by AFNI_fimmer_compute(). |
|
|
Definition at line 713 of file afni.h. Referenced by AFNI_fimmer_compute(). |
|
|
Definition at line 716 of file afni.h. Referenced by AFNI_fimmer_compute(), and GRA_fim_CB(). |
|
|
Definition at line 724 of file afni.h. Referenced by AFNI_new_fim_menu(), and GRA_fim_CB(). |
|
|
Definition at line 726 of file afni.h. Referenced by AFNI_new_fim_menu(), and GRA_fim_CB(). |
|
|
Definition at line 717 of file afni.h. Referenced by AFNI_fimmer_compute(), and GRA_fim_CB(). |
|
|
Definition at line 714 of file afni.h. Referenced by AFNI_fimmer_compute(), and GRA_fim_CB(). |
|
|
Definition at line 720 of file afni.h. Referenced by AFNI_fimmer_compute(), and GRA_fim_CB(). |
|
|
Definition at line 722 of file afni.h. Referenced by AFNI_fimmer_compute(). |
|
|
|
|
|
Definition at line 721 of file afni.h. Referenced by AFNI_fimmer_compute(). |
|
|
Value: do{ int sel_height ; XtPointer sel_ptr ; \ XtVaGetValues( (iqqq)->vwid->func->thr_scale , \ XmNuserData , &sel_ptr , NULL ) ; \ sel_height = (int) sel_ptr ; \ XtVaSetValues( (iqqq)->vwid->func->thr_scale , \ XmNheight , sel_height , NULL ) ; \ XtManageChild((iqqq)->vwid->func->thr_scale) ; \ } while(0) Definition at line 522 of file afni.h. Referenced by AFNI_define_CB(), AFNI_do_bkgd_lab(), AFNI_drive_set_pbar_all(), AFNI_drive_set_pbar_number(), AFNI_inten_av_CB(), AFNI_inten_bbox_CB(), AFNI_pbar_CB(), AFNI_set_pbar_top_CB(), AFNI_set_thresh_top(), AFNI_setup_viewing(), AFNI_thr_scale_CB(), and load_PBAR_palette_array(). |
|
|
Definition at line 551 of file afni.h. Referenced by AFNI_define_CB(), AFNI_set_thresh_top(), AFNI_setup_viewing(), AFNI_thr_scale_CB(), and AFNI_thr_scale_drag_CB(). |
|
|
Definition at line 1420 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1419 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1010 of file afni.h. Referenced by AFNI_finalize_read_palette_CB(), AFNI_palette_av_CB(), AFNI_palette_label_CB(), AFNI_process_setup(), dump_PBAR_palette_table(), main(), RCREND_func_widgets(), RCREND_palette_av_CB(), RCREND_pbarmenu_EV(), REND_func_widgets(), REND_palette_av_CB(), and REND_pbarmenu_EV(). |
|
|
Value: (((gg)==(iq)->g123) ? (iq)->s123 : \
((gg)==(iq)->g231) ? (iq)->s231 : \
((gg)==(iq)->g312) ? (iq)->s312 : NULL)Definition at line 905 of file afni.h. Referenced by AFNI_gra_send_CB(). |
|
|
Definition at line 531 of file afni.h. Referenced by AFNI_define_CB(), AFNI_drive_set_pbar_all(), AFNI_drive_set_pbar_number(), AFNI_inten_av_CB(), AFNI_inten_bbox_CB(), AFNI_pbar_CB(), AFNI_set_pbar_top_CB(), and load_PBAR_palette_array(). |
|
|
Value: AFNI_hintize_pbar( (iq)->vwid->func->inten_pbar , \ ((iq)->vinfo->fim_range != 0.0) \ ? (iq)->vinfo->fim_range \ : (iq)->vinfo->fim_autorange ) Definition at line 1259 of file afni.h. Referenced by AFNI_reset_func_range(), and AFNI_underlay_CB(). |
|
|
|
|
|
|
|
Value: do{ int qq = ((iq)->s123!=NULL) + ((iq)->s231!=NULL) + ((iq)->s312!=NULL); \ if( qq >= BKGD_COUNT || (qq > 0 && !AFNI_noenv("AFNI_VALUE_LABEL")) ){ \ (iq)->vwid->imag->do_bkgd_lab = True ; \ } else { \ (iq)->vwid->imag->do_bkgd_lab = False ; \ XtUnmanageChild(im3d->vwid->imag->pop_bkgd_lab) ; \ XtUnmanageChild(im3d->vwid->func->bkgd_lab) ; \ FIX_SCALE_SIZE(im3d) ; \ } break ; } while(0) Definition at line 299 of file afni.h. Referenced by AFNI_seq_send_CB(), and AFNI_view_xyz_CB(). |
|
|
|
|
|
|
|
|
Definition at line 284 of file afni.h. Referenced by AFNI_define_CB(), AFNI_marks_action_CB(), AFNI_marks_edits_CB(), and AFNI_marks_transform_CB(). |
|
|
Definition at line 97 of file afni.h. Referenced by AFNI_underlay_CB(). |
|
|
Value: do{ (iq)->anat_now->wod_daxes = (iq)->wod_daxes ; \ (iq)->anat_now->wod_flag = (iq)->anat_wod_flag ; \ (iq)->anat_now->vox_warp = (iq)->anat_voxwarp ; \ } while(0) Definition at line 852 of file afni.h. Referenced by AFNI_initialize_view(), AFNI_jumpto_dicom(), AFNI_jumpto_ijk(), AFNI_lock_carryout(), AFNI_marks_action_CB(), AFNI_marktog_CB(), AFNI_mnito_CB(), AFNI_modify_viewing(), AFNI_setup_viewing(), and AFNI_talto_CB(). |
|
|
Definition at line 866 of file afni.h. Referenced by AFNI_brick_to_mri(), AFNI_func_overlay(), AFNI_overlay(), AFNI_seq_send_CB(), AFNI_set_viewpoint(), and AFNI_write_dataset_CB(). |
|
|
Value: do{ if( ISVALID_3DIM_DATASET((iq)->fim_now) ){ \ (iq)->fim_now->wod_daxes = (iq)->wod_daxes ; \ (iq)->fim_now->wod_flag = (iq)->fim_wod_flag ; \ (iq)->fim_now->vox_warp = (iq)->fim_voxwarp ; \ (iq)->fim_now->self_warp = (iq)->fim_selfwarp ; \ } } while(0) Definition at line 858 of file afni.h. Referenced by AFNI_setup_viewing(). |
|
|
|
|
|
|
Definition at line 1853 of file afni.h. Referenced by AFNI_drive_add_overlay_color(), AFNI_load_defaults(), and AFNI_process_setup(). |
|
|
|
|
|
|
|
|
Definition at line 288 of file afni.h. Referenced by AFNI_load_defaults(). |
|
|
Definition at line 1011 of file afni.h. Referenced by AFNI_sonnet_CB(), and PLUGIN_seq_send_CB(). |
|
|
Value: do{ XtRealizeWidget((iq)->vwid->top_shell) ; \ while(XtWindow((iq)->vwid->top_shell)==(Window)NULL) ; \ AFNI_startup_3dview(iq); (iq)->opened = 1; \ } while(0) Definition at line 887 of file afni.h. Referenced by AFNI_drive_open_window(), and MAIN_workprocess(). |
|
|
Value: { XtManageChild( (iq)->vwid-> panel ->frame ) ; \
if( ! (iq)->vwid->view-> panel ## _pb_inverted ){ \
MCW_invert_widget( (iq)->vwid->view->define_ ## panel ## _pb ) ; \
(iq)->vwid->view-> panel ## _pb_inverted = True ; } \
XMapRaised( XtDisplay( (iq)->vwid-> panel ->frame ) , \
XtWindow( (iq)->vwid-> panel ->frame ) ) ; }Definition at line 400 of file afni.h. Referenced by AFNI_define_CB(). |
|
|
Definition at line 199 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 193 of file afni.h. Referenced by AFNI_crosshair_visible_CB(), get_xhair_points(), RCREND_xhair_overlay(), RCREND_xhair_underlay(), REND_xhair_overlay(), and REND_xhair_underlay(). |
|
|
Definition at line 198 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 194 of file afni.h. Referenced by AFNI_crosshair_visible_CB(), get_xhair_points(), RCREND_xhair_overlay(), RCREND_xhair_underlay(), REND_xhair_overlay(), and REND_xhair_underlay(). |
|
|
Definition at line 192 of file afni.h. Referenced by AFNI_crosshair_visible_CB(), get_xhair_points(), RCREND_xhair_overlay(), RCREND_xhair_underlay(), REND_xhair_overlay(), and REND_xhair_underlay(). |
|
|
Definition at line 196 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 197 of file afni.h. Referenced by AFNI_crosshair_visible_CB(). |
|
|
Definition at line 1423 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1422 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
|
|
|
Definition at line 512 of file afni.h. Referenced by AFNI_drive_set_pbar_sign(), and AFNI_inten_bbox_CB(). |
|
|
Definition at line 513 of file afni.h. Referenced by AFNI_inten_bbox_CB(). |
|
|
Value: do{ if( (im)->type == AFNI_3DDATA_VIEW ) \ XtVaSetValues((im)->vwid->picture,XmNlabelPixmap,XmUNSPECIFIED_PIXMAP,NULL ); \ } while(0) Definition at line 699 of file afni.h. Referenced by AFNI_quit_CB(), AFNI_set_cursor(), and AFNI_startup_timeout_CB(). |
|
|
Value: do{ if( (im)->type == AFNI_3DDATA_VIEW ) \ XtVaSetValues((im)->vwid->picture,XmNlabelPixmap,logo_pixmap,NULL); \ } while(0) Definition at line 694 of file afni.h. Referenced by AFNI_quit_CB(), AFNI_set_cursor(), and MAIN_workprocess(). |
|
|
Value: do{ if( (im)->type == AFNI_3DDATA_VIEW ) \ XtVaSetValues((im)->vwid->picture,XmNlabelPixmap,(px),NULL ); \ } while(0) Definition at line 704 of file afni.h. Referenced by AFNI_startup_timeout_CB(). |
|
|
Definition at line 1456 of file afni.h. Referenced by AFNI_seq_send_CB(), and DRAW_receiver(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 515 of file afni.h. Referenced by AFNI_range_bbox_CB(), AFNI_reset_func_range(), and AFNI_set_func_autorange(). |
|
|
Definition at line 516 of file afni.h. Referenced by AFNI_range_bbox_CB(). |
|
|
Definition at line 1392 of file afni.h. Referenced by AFNI_receive_control(), and AFNI_receive_init(). |
|
|
Definition at line 1445 of file afni.h. Referenced by AFNI_process_alteration(), DRAW_receiver(), DSET2_dset_recv(), and DSETN_dset_recv(). |
|
|
Definition at line 1444 of file afni.h. Referenced by AFNI_receive_destroy(), and DRAW_receiver(). |
|
|
Definition at line 1382 of file afni.h. Referenced by AFNI_process_drawing(), AFNI_receive_control(), AFNI_toggle_drawing(), and DRAW_finalize_dset_CB(). |
|
|
Definition at line 1446 of file afni.h. Referenced by AFNI_process_drawnotice(), RCREND_xhair_recv(), and REND_xhair_recv(). |
|
|
Definition at line 1385 of file afni.h. Referenced by AFNI_process_drawnotice(), AFNI_receive_control(), RCREND_main(), and REND_main(). |
|
|
Definition at line 1447 of file afni.h. Referenced by AFNI_process_dsetchange(), DRAW_receiver(), DSET2_dset_recv(), DSETN_dset_recv(), RCREND_xhair_recv(), and REND_xhair_recv(). |
|
|
Definition at line 1386 of file afni.h. Referenced by AFNI_process_dsetchange(), AFNI_receive_control(), DRAW_finalize_dset_CB(), DSET2_main(), DSETN_main(), RCREND_main(), and REND_main(). |
|
|
Definition at line 1450 of file afni.h. Referenced by AFNI_process_funcdisplay(). |
|
|
Definition at line 1389 of file afni.h. Referenced by AFNI_init_niml(), AFNI_process_funcdisplay(), and AFNI_receive_control(). |
|
|
|
|
|
Definition at line 1384 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1441 of file afni.h. Referenced by AFNI_process_drawing(), and DRAW_receiver(). |
|
|
Definition at line 1449 of file afni.h. Referenced by AFNI_process_redisplay(). |
|
|
Definition at line 1388 of file afni.h. Referenced by AFNI_process_redisplay(), and AFNI_receive_control(). |
|
|
Definition at line 1451 of file afni.h. Referenced by AFNI_process_timeindex(), and RCREND_xhair_recv(). |
|
|
Definition at line 1390 of file afni.h. Referenced by AFNI_process_timeindex(), AFNI_receive_control(), and RCREND_main(). |
|
|
|
|
|
|
|
|
Definition at line 1442 of file afni.h. Referenced by AFNI_process_viewpoint(), RCREND_xhair_recv(), REND_xhair_recv(), and TTget_recv(). |
|
|
Definition at line 1383 of file afni.h. Referenced by AFNI_init_niml(), AFNI_process_viewpoint(), AFNI_receive_control(), RCREND_main(), REND_main(), and TTget_main(). |
|
|
Definition at line 1237 of file afni.h. Referenced by AFNI_bucket_CB(), AFNI_drive_set_ijk(), AFNI_initialize_view(), AFNI_jumpto_dicom(), AFNI_jumpto_ijk(), AFNI_lock_carryout(), AFNI_modify_viewing(), AFNI_process_plugout(), AFNI_set_viewpoint(), AFNI_talto_CB(), AFNI_underlay_CB(), AFNI_view_xyz_CB(), PLUTO_dset_redisplay_mode(), and PLUTO_force_redisplay(). |
|
|
Definition at line 1235 of file afni.h. Referenced by AFNI_gra_send_CB(), AFNI_seq_send_CB(), AFNI_thr_scale_CB(), PLUTO_dset_redisplay(), and PLUTO_dset_redisplay_mode(). |
|
|
|
Definition at line 1417 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1416 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
|
Definition at line 273 of file afni.h. Referenced by AFNI_get_xhair_node(), and AFNI_view_setter(). |
|
|
Value: ( (iqq)->vinfo->i1_old = (iqq)->vinfo->i1 , \
(iqq)->vinfo->j2_old = (iqq)->vinfo->j2 , \
(iqq)->vinfo->k3_old = (iqq)->vinfo->k3 )Definition at line 278 of file afni.h. Referenced by AFNI_imag_pop_CB(), AFNI_initialize_view(), AFNI_jumpto_dicom(), AFNI_jumpto_ijk(), AFNI_lock_carryout(), AFNI_marktog_CB(), AFNI_modify_viewing(), AFNI_seq_send_CB(), and AFNI_talto_CB(). |
|
|
Definition at line 1012 of file afni.h. Referenced by AFNI_parse_args(), AFNI_set_window_titles(), AFNI_update_surface_widgets(), AFNI_write_many_dataset_CB(), ENV_init(), ENV_sesstrail(), make_PLUGIN_dataset_link(), PLUTO_commandstring(), and TAG_get_dset_CB(). |
|
|
Definition at line 1003 of file afni.h. Referenced by GRA_bkthr_choose_CB(), and main(). |
|
|
|
|
Definition at line 1455 of file afni.h. Referenced by AFNI_gra_send_CB(), and DRAW_receiver(). |
|
|
|
|
|
Definition at line 1018 of file afni.h. Referenced by AFNI_brick_to_mri(), and AFNI_process_plugout(). |
|
|
Definition at line 1015 of file afni.h. Referenced by RT_finish_dataset(), and RT_process_xevents(). |
|
|
Definition at line 1016 of file afni.h. Referenced by RT_process_xevents(), RT_registration_2D_atend(), RT_registration_2D_realtime(), RT_registration_3D_atend(), RT_registration_3D_realtime(), and RT_tell_afni_one(). |
|
|
|
Definition at line 457 of file afni.h. Referenced by AFNI_set_thr_pval(), RCREND_func_widgets(), RCREND_set_thr_pval(), REND_func_widgets(), and REND_set_thr_pval(). |
|
|
Definition at line 459 of file afni.h. Referenced by AFNI_drive_set_threshnew(), AFNI_drive_set_threshold(), AFNI_set_thresh_top(), AFNI_thrdrag_lock_carryout(), RCREND_func_widgets(), RCREND_state_to_widgets(), RCREND_thresh_top_CB(), REND_func_widgets(), REND_state_to_widgets(), and REND_thresh_top_CB(). |
|
|
Definition at line 461 of file afni.h. Referenced by AFNI_drive_set_threshnew(). |
|
|
|
|
|
Definition at line 1435 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1434 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1495 of file afni.h. Referenced by AFNI_imag_pop_CB(), AFNI_talto_CB(), DRAW_make_widgets(), TT_whereami(), and TTRR_setup_widgets(). |
|
|
|
|
|
|
|
|
Definition at line 1488 of file afni.h. Referenced by AFNI_imag_pop_CB(). |
|
|
Definition at line 1487 of file afni.h. Referenced by AFNI_imag_pop_CB(). |
|
|
Definition at line 1783 of file afni.h. Referenced by AFNI_ttatlas_overlay(), DRAW_ttatlas_CB(), RCREND_overlay_ttatlas(), and REND_overlay_ttatlas(). |
|
|
Definition at line 1781 of file afni.h. Referenced by AFNI_ttatlas_overlay(), DRAW_ttatlas_CB(), RCREND_overlay_ttatlas(), and REND_overlay_ttatlas(). |
|
|
Definition at line 1782 of file afni.h. Referenced by AFNI_ttatlas_overlay(), DRAW_ttatlas_CB(), RCREND_overlay_ttatlas(), and REND_overlay_ttatlas(). |
|
|
|
|
|
Definition at line 1779 of file afni.h. Referenced by AFNI_ttatlas_overlay(), RCREND_overlay_ttatlas(), and REND_overlay_ttatlas(). |
|
|
Definition at line 1778 of file afni.h. Referenced by AFNI_ttatlas_overlay(), RCREND_overlay_ttatlas(), and REND_overlay_ttatlas(). |
|
|
Definition at line 1776 of file afni.h. Referenced by AFNI_ttatlas_overlay(), RCREND_overlay_ttatlas(), and REND_overlay_ttatlas(). |
|
|
Definition at line 1775 of file afni.h. Referenced by TTRR_get_params(). |
|
|
Definition at line 90 of file afni.h. Referenced by AFNI_setup_viewing(), and AFNI_underlay_CB(). |
|
|
|
|
|
Definition at line 89 of file afni.h. Referenced by AFNI_brick_to_mri(), AFNI_make_wid2(), AFNI_setup_viewing(), and AFNI_underlay_CB(). |
|
|
|
|
|
|
|
|
|
|
|
Value: (((bb)==(iq)->b123_ulay) ? (iq)->g123 : \
((bb)==(iq)->b231_ulay) ? (iq)->g231 : \
((bb)==(iq)->b312_ulay) ? (iq)->g312 : NULL)Definition at line 913 of file afni.h. Referenced by AFNI_brick_to_mri(), and AFNI_overlay(). |
|
|
Value: (((bb)==(iq)->b123_ulay) ? (iq)->b123_fim : \
((bb)==(iq)->b231_ulay) ? (iq)->b231_fim : \
((bb)==(iq)->b312_ulay) ? (iq)->b312_fim : NULL)Definition at line 917 of file afni.h. Referenced by AFNI_overlay(). |
|
|
Value: (((bb)==(iq)->b123_ulay) ? (iq)->s123 : \
((bb)==(iq)->b231_ulay) ? (iq)->s231 : \
((bb)==(iq)->b312_ulay) ? (iq)->s312 : NULL) |
|
|
Definition at line 1459 of file afni.h. Referenced by AFNI_seq_send_CB(), and DRAW_receiver(). |
|
|
Value: do { GLOBAL_library.have_dummy_dataset = 0 ; \ XtSetSensitive(GLOBAL_library.controllers[0]->vwid->prog->clone_pb,True); \ } while(0) Definition at line 1022 of file afni.h. Referenced by AFNI_finalize_read_sess_CB(), AFNI_finalize_read_Web_CB(), process_NIML_AFNI_dataset(), and RT_tell_afni_one(). |
|
|
Value: ( IM3D_OPEN(iq) && (iq)->type == AFNI_3DDATA_VIEW && \ DSET_GRAPHABLE((iq)->fimdata->fimdset) && \ (iq)->fimdata->fimref != NULL && \ (iq)->fimdata->fimref->kind == MRI_float && \ (iq)->fimdata->fimref->nx >= DSET_NUM_TIMES((iq)->fimdata->fimdset) ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Value: (((ss)==(iq)->s123) ? (iq)->g123 : \
((ss)==(iq)->s231) ? (iq)->g231 : \
((ss)==(iq)->s312) ? (iq)->g312 : NULL)Definition at line 901 of file afni.h. Referenced by AFNI_seq_send_CB(). |
|
|
Definition at line 1414 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
Definition at line 1413 of file afni.h. Referenced by AFNI_receive_control(). |
|
|
|
|
|
Definition at line 29 of file afni.h. Referenced by AFNI_syntax(). |
|
|
Definition at line 283 of file afni.h. Referenced by AFNI_define_CB(), AFNI_init_warp(), AFNI_marks_action_CB(), AFNI_marks_edits_CB(), and AFNI_marks_transform_CB(). |
Function Documentation
|
||||||||||||||||||||
|
Definition at line 91 of file afni_transforms.c. References CABS, csfft_cox(), csfft_nextup(), dt, free, get_linear_trend(), complex::i, malloc, complex::r, and vec.
00092 {
00093 static complex *cx=NULL ;
00094 static int ncx=0 , numold=0 ;
00095 float f0,f1 ;
00096 int ii ;
00097
00098 if( num < 2 ) return ;
00099 if( num > numold ){
00100 numold = num ;
00101 ncx = csfft_nextup(numold) ;
00102 if( cx != NULL ) free(cx) ;
00103 cx = (complex *) malloc(sizeof(complex)*ncx) ;
00104 }
00105
00106 get_linear_trend( num , vec , &f0,&f1 ) ; /* thd_detrend.c */
00107
00108 for( ii=0 ; ii < num ; ii++ ){ cx[ii].r = vec[ii]-(f0+f1*ii); cx[ii].i = 0.0; }
00109 for( ; ii < ncx ; ii++ ){ cx[ii].r = cx[ii].i = 0.0 ; }
00110
00111 csfft_cox( -1 , ncx , cx ) ; /* csfft.c */
00112
00113 vec[0] = 0.0 ;
00114 for( ii=1 ; ii < num ; ii++ ) vec[ii] = CABS(cx[ii]) ;
00115
00116 return ;
00117 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 772 of file afni_receive.c. References abs, ENTRY, malloc, x2, y1, and z1. Referenced by AFNI_process_drawing().
00774 {
00775 int * xut , * yut , * zut ;
00776 int nut , iin , jout , nall ;
00777 int x1,y1,z1 , x2,y2,z2 , dx,dy,dz , adx,ady,adz , xlast,ylast,zlast ;
00778 float fdxyz , fdx,fdy,fdz , fx,fy,fz ;
00779
00780 ENTRY("AFNI_3d_linefill") ;
00781
00782 /* sanity check */
00783
00784 if( nin <= 0 || xin == NULL || yin == NULL || zin == NULL ){
00785 *nout = 0 ; *xout = *yout = *zout = NULL ; EXRETURN ;
00786 }
00787
00788 /* trivial case */
00789
00790 if( nin == 1 ){
00791 nut = 1 ; *nout = nut ;
00792 xut = (int *) malloc(sizeof(int)) ; xut[0] = xin[0] ; *xout = xut ;
00793 yut = (int *) malloc(sizeof(int)) ; yut[0] = yin[0] ; *yout = yut ;
00794 zut = (int *) malloc(sizeof(int)) ; zut[0] = zin[0] ; *zout = zut ;
00795 EXRETURN ;
00796 }
00797
00798 /* setup to scan through lines */
00799
00800 nall = nin ;
00801 xut = (int *) malloc( sizeof(int) * nall ) ;
00802 yut = (int *) malloc( sizeof(int) * nall ) ;
00803 zut = (int *) malloc( sizeof(int) * nall ) ;
00804 nut = 0 ;
00805
00806 #undef ADDPT
00807 #define ADDPT(i,j,k) \
00808 do{ if( nut == nall ){ \
00809 nall += 128 ; \
00810 xut = (int *) realloc( xut , sizeof(int) * nall ) ; \
00811 yut = (int *) realloc( yut , sizeof(int) * nall ) ; \
00812 zut = (int *) realloc( zut , sizeof(int) * nall ) ; \
00813 } \
00814 xut[nut] = xlast = (i) ; \
00815 yut[nut] = ylast = (j) ; \
00816 zut[nut] = zlast = (k) ; nut++ ; } while(0)
00817
00818 /* draw line from point #iin to #iin+1 */
00819
00820 x2 = xin[0] ; y2 = yin[0] ; z2 = zin[0] ;
00821 for( iin=0 ; iin < nin-1 ; iin++ ){
00822 x1 = x2 ; y1 = y2 ; z1 = z2 ;
00823 x2 = xin[iin+1] ; y2 = yin[iin+1] ; z2 = zin[iin+1] ;
00824 dx = x2 - x1 ; dy = y2 - y1 ; dz = z2 - z1 ;
00825 adx = abs(dx) ; ady = abs(dy) ; adz = abs(dz) ;
00826
00827 /* add start point to list */
00828
00829 ADDPT(x1,y1,z1) ;
00830
00831 /* special case: neighbors ==> skip to next line */
00832
00833 if( adx <= 1 && ady <= 1 && adz <= 1 ) continue ;
00834
00835 /* OK, we have to do work (moan) */
00836
00837 #define SFRAC 0.495
00838
00839 fdxyz = adx + ady + adz ; /* Manhattan distance */
00840 fdx = SFRAC * dx / fdxyz ; /* steps */
00841 fdy = SFRAC * dy / fdxyz ;
00842 fdz = SFRAC * dz / fdxyz ;
00843
00844 /* step thru in small increments,
00845 adding new integer points, and stopping at line's end */
00846
00847 #if 0
00848 fprintf(stderr,"linefill: from %d %d %d to %d %d %d\n",
00849 x1,y1,z1 , x2,y2,z2 ) ;
00850 #endif
00851
00852 fx = x1+fdx+0.499 ; fy = y1+fdy+0.499 ; fz = z1+fdz+0.499 ;
00853 do {
00854 fx = fx + fdx ; fy = fy + fdy ; fz = fz + fdz ;
00855 x1 = (int) fx ; y1 = (int) fy ; z1 = (int) fz ;
00856
00857 #if 0
00858 fprintf(stderr," at %d %d %d\n",x1,y1,z1) ;
00859 #endif
00860
00861 if( x1 == x2 && y1 == y2 && z1 == z2 ) break ;
00862
00863 if( x1 != xlast || y1 != ylast || z1 != zlast ) ADDPT(x1,y1,z1) ;
00864 } while(1) ;
00865
00866 } /* end of loop over lines */
00867
00868 ADDPT(x2,y2,z2) ; /* add last point */
00869
00870 *nout = nut ; *xout = xut ; *yout = yut ; *zout = zut ;
00871 EXRETURN ;
00872 }
|
|
|
Definition at line 2031 of file afni_fimmer.c. References ADDTO_XTARR, XtPointer_array::ar, DESTROY_XTARR, GLOBAL_library, INIT_XTARR, AFNI_library_type::interruptables, MCW_set_widget_cursor(), NORMAL_cursorize, XtPointer_array::num, MCW_interruptables::widgets, and MCW_interruptables::windows. Referenced by RCREND_autocompute_CB(), RCREND_read_exec_CB(), REND_autocompute_CB(), and REND_read_exec_CB().
02032 {
02033 Window wwin , wroot , wpar ;
02034 int ii ;
02035 Window * wchild ;
02036 unsigned int nchild ;
02037
02038 /* input Widget is NULL is the signal to reset everything */
02039
02040 if( w == NULL ){
02041 if( GLOBAL_library.interruptables.windows != NULL ){ /* just toss this list */
02042 DESTROY_XTARR( GLOBAL_library.interruptables.windows ) ;
02043 GLOBAL_library.interruptables.windows = NULL ;
02044 }
02045
02046 if( GLOBAL_library.interruptables.widgets != NULL ){ /* must reset cursors */
02047 for( ii=0 ; ii < GLOBAL_library.interruptables.widgets->num ; ii++ )
02048 MCW_set_widget_cursor( GLOBAL_library.interruptables.widgets->ar[ii] , 0 );
02049
02050 DESTROY_XTARR( GLOBAL_library.interruptables.widgets ) ;
02051 GLOBAL_library.interruptables.widgets = NULL ;
02052 }
02053 return ;
02054 }
02055
02056 /* non-NULL widget --> add it and its sub-windows to the list */
02057
02058 if( ! XtIsRealized(w) ) return ;
02059 wwin = XtWindowOfObject(w) ; if( wwin == (Window) NULL ) return ;
02060
02061 /* get list of all sub-windows into wchild */
02062
02063 nchild = 0 ;
02064 (void) XQueryTree( XtDisplay(w) , wwin , &wroot , &wpar , &wchild , &nchild ) ;
02065
02066 if( GLOBAL_library.interruptables.windows == NULL ) /* initialize lists */
02067 INIT_XTARR( GLOBAL_library.interruptables.windows ) ;
02068
02069 if( GLOBAL_library.interruptables.widgets == NULL )
02070 INIT_XTARR( GLOBAL_library.interruptables.widgets ) ;
02071
02072 ADDTO_XTARR( GLOBAL_library.interruptables.windows , wwin ) ; /* add to lists */
02073 ADDTO_XTARR( GLOBAL_library.interruptables.widgets , w ) ;
02074
02075 for( ii=0 ; ii < nchild ; ii++ )
02076 ADDTO_XTARR( GLOBAL_library.interruptables.windows , wchild[ii] ) ;
02077
02078 XFree( wchild ) ; /* return this to Xlib */
02079
02080 NORMAL_cursorize( w) ;
02081
02082 return ;
02083 }
|
|
|
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 }
|
|
||||||||||||
|
|
|
||||||||||||||||
|
check to see which ones are in the old list * Definition at line 3408 of file afni_func.c. References AFNI_modify_viewing(), AFNI_datamode_widgets::anatmode_bbox, AFNI_widget_set::dmode, DMODE_BRICK_BVAL, ENTRY, AFNI_view_info::force_anat_wod, IM3D_VALID, MCW_val_bbox(), RESET_AFNI_QUIT, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, AFNI_view_info::tempflag, Three_D_View::vinfo, and Three_D_View::vwid.
03409 {
03410 Three_D_View *im3d = (Three_D_View *) cd ;
03411 int old_val , new_val ;
03412 THD_fvec3 fv ;
03413 THD_ivec3 iv ;
03414
03415 ENTRY("AFNI_anatmode_CB") ;
03416
03417 if( ! IM3D_VALID(im3d) ) EXRETURN ;
03418
03419 old_val = 1 << im3d->vinfo->force_anat_wod ;
03420 new_val = MCW_val_bbox( im3d->vwid->dmode->anatmode_bbox ) ;
03421
03422 if(PRINT_TRACING){
03423 char str[256] ; sprintf(str,"old_val=%d new_val=%d",old_val,new_val) ;
03424 STATUS(str) ; }
03425
03426 if( new_val != old_val ){
03427 im3d->vinfo->force_anat_wod = (new_val != DMODE_BRICK_BVAL) ;
03428 SHOW_AFNI_PAUSE ;
03429 im3d->vinfo->tempflag = 1 ; /* 15 Mar 2000 */
03430 AFNI_modify_viewing( im3d , True ) ; /* redisplay */
03431 SHOW_AFNI_READY ;
03432 }
03433
03434 RESET_AFNI_QUIT(im3d) ;
03435 EXRETURN ;
03436 }
|
|
||||||||||||
|
Definition at line 4253 of file afni_func.c. References THD_3dim_dataset::death_mark, DOOMED, THD_session::dsset, ENTRY, FIRST_VIEW_TYPE, GLOBAL_library, ISVALID_3DIM_DATASET, ISVALID_SESSION, ISVALID_SESSIONLIST, LAST_VIEW_TYPE, myXtFree, THD_session::num_dsset, THD_sessionlist::num_sess, AFNI_library_type::session, THD_sessionlist::ssar, STATUS, THD_delete_3dim_dataset(), and VIEW_ORIGINAL_TYPE. Referenced by AFNI_marks_transform_CB(), and AFNI_rescan_session_OLD().
04254 {
04255 int iss , jdd , kvv , num_killed=0 ;
04256 THD_session *ss ;
04257 THD_3dim_dataset *dset ;
04258 Boolean kill_me ;
04259
04260 ENTRY("AFNI_andersonville") ;
04261
04262 if( ! ISVALID_SESSIONLIST(ssl) ) EXRETURN ;
04263
04264 /* loop over each session */
04265
04266 for( iss=0 ; iss < ssl->num_sess ; iss++ ){
04267 ss = ssl->ssar[iss] ;
04268 if( !ISVALID_SESSION(ss) ) continue ; /* no good ==> skip */
04269
04270 if( ss == GLOBAL_library.session ) continue ; /* 21 Dec 2001 */
04271
04272 /* loop over datasets in this session */
04273
04274 for( jdd=0 ; jdd < ss->num_dsset ; jdd++ ){
04275 for( kvv=FIRST_VIEW_TYPE ; kvv <= LAST_VIEW_TYPE ; kvv++ ){
04276
04277 dset = ss->dsset[jdd][kvv] ;
04278
04279 if( ISVALID_3DIM_DATASET(dset) && /* good dset */
04280 dset->death_mark == DOOMED ){ /* alas, poor Yorick */
04281
04282 kill_me = (kvv == VIEW_ORIGINAL_TYPE) ? False : kill_files ;
04283 THD_delete_3dim_dataset( dset , kill_me ) ;
04284 myXtFree( dset ) ;
04285 ss->dsset[jdd][kvv] = NULL ; num_killed ++ ;
04286 }
04287 }
04288 }
04289
04290 } /* end of loop over sessions */
04291
04292 #ifdef AFNI_DEBUG
04293 { char str[256] ;
04294 sprintf(str,"total # datasets killed = %d",num_killed) ;
04295 STATUS(str) ; }
04296 #endif
04297
04298 EXRETURN ;
04299 }
|
|
||||||||||||
|
Append datasets in THD_session ssb to those in ssa.
Definition at line 2491 of file afni_func.c. References THD_session::dsset, ENTRY, ISVALID_SESSION, LAST_VIEW_TYPE, THD_session::num_dsset, qs, THD_session::sessname, THD_equiv_files(), and THD_MAX_SESSION_SIZE. Referenced by AFNI_finalize_read_sess_CB(), AFNI_read_inputs(), and AFNI_rescan_session_OLD().
02492 {
02493 int qs, qd, vv ;
02494
02495 ENTRY("AFNI_append_sessions") ;
02496
02497 if( !ISVALID_SESSION(ssa) || !ISVALID_SESSION(ssb) ) EXRETURN ;
02498 if( THD_equiv_files(ssa->sessname,ssb->sessname) ) EXRETURN ;
02499
02500 qs = ssa->num_dsset ;
02501 for( qd=0; qd < ssb->num_dsset && qd+qs < THD_MAX_SESSION_SIZE ; qd++ )
02502 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ )
02503 ssa->dsset[qd+qs][vv] = ssb->dsset[qd][vv] ;
02504 ssa->num_dsset += qd ;
02505
02506 EXRETURN ;
02507 }
|
|
|
Definition at line 4431 of file afni_func.c. References AV_fval_to_char(), THD_statistics::bstat, DEFAULT_FIM_SCALE, DSET_VALID_BSTAT, ENTRY, AFNI_view_info::fim_autorange, AFNI_view_info::fim_index, Three_D_View::fim_now, ISVALID_3DIM_DATASET, ISVALID_STATISTIC, THD_brick_stats::max, THD_brick_stats::min, RELOAD_STATS, RETURN, s2, THD_3dim_dataset::stats, STATUS, and Three_D_View::vinfo. Referenced by AFNI_reset_func_range().
04432 {
04433 XmString xstr ;
04434 float rrr ;
04435 char buf[32] , qbuf[16] ;
04436
04437 ENTRY("AFNI_autorange_label") ;
04438
04439 if( ! ISVALID_3DIM_DATASET(im3d->fim_now) ){ /* no function */
04440 rrr = DEFAULT_FIM_SCALE ;
04441 } else {
04442 RELOAD_STATS(im3d->fim_now) ;
04443 if( ISVALID_STATISTIC(im3d->fim_now->stats) ){
04444 float s1 , s2 ; int iv ;
04445
04446 iv = im3d->vinfo->fim_index ;
04447
04448 if( DSET_VALID_BSTAT(im3d->fim_now,iv) ){
04449 s1 = fabs(im3d->fim_now->stats->bstat[iv].min) ,
04450 s2 = fabs(im3d->fim_now->stats->bstat[iv].max) ;
04451 rrr = (s1<s2) ? s2 : s1 ; /* largest fim */
04452 } else {
04453 rrr = DEFAULT_FIM_SCALE ; /* don't have stats */
04454 }
04455 } else {
04456 rrr = DEFAULT_FIM_SCALE ; /* don't have stats */
04457 }
04458 }
04459 im3d->vinfo->fim_autorange = rrr ;
04460 AV_fval_to_char( rrr , qbuf ) ;
04461 sprintf( buf , "autoRange:%s" , qbuf ) ;
04462 xstr = XmStringCreateLtoR( buf , XmFONTLIST_DEFAULT_TAG ) ;
04463
04464 #ifdef AFNI_DEBUG
04465 { STATUS(buf) ;
04466 sprintf(buf,"rrr=%g",rrr) ; STATUS(buf) ; }
04467 #endif
04468
04469 RETURN(xstr) ;
04470 }
|
|
||||||||||||
|
Definition at line 504 of file Vecwarp.c.
00505 {
00506 THD_fvec3 new_fv ;
00507
00508 if( warp == NULL ) return old_fv ;
00509
00510 switch( warp->type ){
00511
00512 default: new_fv = old_fv ; break ;
00513
00514 case WARP_TALAIRACH_12_TYPE:{
00515 THD_linear_mapping map ;
00516 int iw ;
00517
00518 /* test if input is in bot..top of each defined map */
00519
00520 for( iw=0 ; iw < 12 ; iw++ ){
00521 map = warp->tal_12.warp[iw] ;
00522
00523 if( old_fv.xyz[0] >= map.bot.xyz[0] &&
00524 old_fv.xyz[1] >= map.bot.xyz[1] &&
00525 old_fv.xyz[2] >= map.bot.xyz[2] &&
00526 old_fv.xyz[0] <= map.top.xyz[0] &&
00527 old_fv.xyz[1] <= map.top.xyz[1] &&
00528 old_fv.xyz[2] <= map.top.xyz[2] ) break ; /* leave loop */
00529 }
00530 new_fv = MATVEC_SUB(map.mbac,old_fv,map.svec) ;
00531 }
00532 break ;
00533
00534 case WARP_AFFINE_TYPE:{
00535 THD_linear_mapping map = warp->rig_bod.warp ;
00536 new_fv = MATVEC_SUB(map.mbac,old_fv,map.svec) ;
00537 }
00538 break ;
00539
00540 }
00541 return new_fv ;
00542 }
|
|
||||||||||||||||
|
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_imseq_status::aux, MCW_grapher_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, AFNI_view_info::i1, i1, i2, SUMA_ixyz::id, THD_ivec3::ijk, SUMA_surface::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, FD_brick::namecode, MCW_grapher_status::namecode, AFNI_surface_widgets::nrow, SUMA_surface::num_ijk, SUMA_surface::num_ixyz, MCW_imseq_status::num_series, MCW_grapher_status::num_series, MCW_imseq_status::num_total, MCW_grapher_status::num_total, THD_datablock::nvals, MCW_grapher_status::nx, MCW_grapher_status::ny, MCW_grapher_status::nz, MCW_imseq_status::parent, FD_brick::parent, MCW_grapher_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_imseq_status::send_CB, MCW_grapher_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_imseq_status::transforms0D, MCW_grapher_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 }
|
|
||||||||||||||||
|
Definition at line 798 of file afni_splash.c. References mri_free(), NC_broutim, NLINE_broutim, NX_broutim, NY_broutim, PLUTO_popup_image(), and SPLASH_decodexx().
00799 {
00800 MRI_IMAGE *imbr ;
00801 imbr = SPLASH_decodexx( NX_broutim,NY_broutim,NLINE_broutim,NC_broutim,
00802 RMAP_broutim,GMAP_broutim,BMAP_broutim,BAR_broutim);
00803 (void) PLUTO_popup_image( NULL , imbr ) ;
00804 mri_free(imbr) ; return ;
00805 }
|
|
||||||||||||
|
Definition at line 4645 of file afni_func.c. References AFNI_process_funcdisplay(), AFNI_set_viewpoint(), AFNI_setup_viewing(), AFNI_function_widgets::anat_buck_av, AFNI_view_info::anat_index, Three_D_View::anat_now, AV_assign_ival(), DSET_NUM_TIMES, DSET_NVALS, ENTRY, AFNI_function_widgets::fim_buck_av, AFNI_view_info::fim_index, Three_D_View::fim_now, AFNI_widget_set::func, AFNI_view_info::func_visible, IM3D_OPEN, AFNI_widget_set::imag, MCW_arrowval::ival, REDISPLAY_ALL, REDISPLAY_OVERLAY, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, AFNI_view_info::tempflag, AFNI_function_widgets::thr_buck_av, AFNI_view_info::thr_index, AFNI_imaging_widgets::time_index_av, AFNI_view_info::time_on, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_gra_send_CB().
04646 {
04647 Three_D_View *im3d = (Three_D_View *) cd ;
04648 int doit = 0 , iv , redisplay ;
04649
04650 ENTRY("AFNI_bucket_CB") ;
04651
04652 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
04653
04654 /** Anat sub-brick [29 Jul 2003: lock to time_index controller as well] **/
04655
04656 if( av == im3d->vwid->func->anat_buck_av ){
04657 iv = av->ival ;
04658 if( iv >= 0 && iv < DSET_NVALS(im3d->anat_now) ){
04659 doit = (iv != im3d->vinfo->anat_index) ;
04660 im3d->vinfo->anat_index = iv ;
04661 redisplay = REDISPLAY_ALL ;
04662 if( doit && im3d->vinfo->time_on )
04663 AV_assign_ival( im3d->vwid->imag->time_index_av , iv ) ;
04664 }
04665 }
04666
04667 /** Func sub-brick **/
04668
04669 else if( av == im3d->vwid->func->fim_buck_av ){
04670 iv = av->ival ;
04671 if( iv >= 0 && iv < DSET_NVALS(im3d->fim_now) ){
04672 doit = (iv != im3d->vinfo->fim_index) ;
04673 im3d->vinfo->fim_index = iv ;
04674 redisplay = REDISPLAY_OVERLAY ;
04675 if( doit && im3d->vinfo->time_on && DSET_NUM_TIMES(im3d->anat_now) == 1 )
04676 AV_assign_ival( im3d->vwid->imag->time_index_av , iv ) ;
04677 }
04678 }
04679
04680 /** Thresh sub-brick **/
04681
04682 else if( av == im3d->vwid->func->thr_buck_av ){
04683 iv = av->ival ;
04684 if( iv >= 0 && iv < DSET_NVALS(im3d->fim_now) ){
04685 doit = (iv != im3d->vinfo->thr_index) ;
04686 im3d->vinfo->thr_index = iv ;
04687 redisplay = REDISPLAY_OVERLAY ;
04688 }
04689 }
04690
04691 /** Change the view, if required **/
04692
04693 if( doit ){
04694 SHOW_AFNI_PAUSE ;
04695 im3d->vinfo->tempflag = 1 ;
04696 AFNI_setup_viewing( im3d , False ) ;
04697 AFNI_set_viewpoint( im3d , -1,-1,-1 , redisplay ) ; /* redraw */
04698 if( redisplay == REDISPLAY_OVERLAY &&
04699 im3d->vinfo->func_visible ) AFNI_process_funcdisplay(im3d) ;
04700 SHOW_AFNI_READY ;
04701 }
04702
04703 EXRETURN ;
04704 }
|
|
||||||||||||
|
Prepare a bucket label for a menu. 21 Jun 2004: modified to allow label length to be different from 14. ---------------------------------------------------------------------------- Definition at line 4711 of file afni_func.c. References AFNI_numenv(), DSET_BRICK_LAB, DSET_BRICK_LABEL, DSET_NVALS, ENTRY, ISVALID_3DIM_DATASET, ISVALID_DSET, MCW_arrowval::ival, malloc, and RETURN.
04712 {
04713 static THD_3dim_dataset *dset_last = NULL ;
04714 static int nsiz_last = 4 ;
04715
04716 THD_3dim_dataset *dset = (THD_3dim_dataset *) cd ;
04717 static char *fmt[3]={NULL,NULL,NULL} , sfmt[16] , blab[48] ;
04718 int nlab ;
04719 static int nlab_old = 0 ;
04720
04721 ENTRY("AFNI_bucket_label_CB") ;
04722
04723 /** 04 May 2005: customize width to this dataset **/
04724
04725 if( dset != dset_last && ISVALID_DSET(dset) ){
04726 int nvals,kk,blw,mblw=4 ; char *lab ;
04727 dset_last = dset ;
04728 nvals = DSET_NVALS(dset) ;
04729 for( kk=0 ; kk < nvals ; kk++ ){
04730 lab = DSET_BRICK_LAB(dset,kk) ;
04731 if( lab != NULL ){ blw=strlen(lab) ; if(blw>mblw)mblw=blw ; }
04732 }
04733 if( mblw > 32 ) mblw = 32 ;
04734 nsiz_last = mblw ;
04735 }
04736
04737 /* see if the environment overrides the above */
04738
04739 #if 0
04740 nlab = (int)AFNI_numenv("AFNI_BUCKET_LABELSIZE") ;
04741 if( nlab <= 0 ) nlab = nsiz_last ;
04742 else if( nlab > 32 ) nlab = 32 ;
04743 #else
04744 nlab = nsiz_last ;
04745 #endif
04746
04747 /* make the format for the label string: left justified, width=nlab */
04748
04749 if( nlab != nlab_old ){
04750 nlab_old = nlab ;
04751 sprintf(sfmt,"%%-%d.%ds",nlab,nlab) ;
04752 if( fmt[0] == NULL ){
04753 fmt[0] = malloc(32); fmt[1] = malloc(32); fmt[2] = malloc(32);
04754 }
04755
04756 /* and now the formats including the sub-brick index and the label */
04757
04758 #ifdef USE_RIGHT_BUCK_LABELS
04759 sprintf(fmt[0],"%s #%%1d",sfmt) ; /* if the #xxx goes to the right */
04760 sprintf(fmt[1],"%s #%%2d",sfmt) ;
04761 sprintf(fmt[2],"%s #%%3d",sfmt) ;
04762 #else
04763 sprintf(fmt[0],"#%%1d %s",sfmt) ; /* if the #xxx goes to the left */
04764 sprintf(fmt[1],"#%%2d %s",sfmt) ;
04765 sprintf(fmt[2],"#%%3d %s",sfmt) ;
04766 #endif
04767 }
04768
04769 /* now actually make the label for this particular sub-brick */
04770
04771 if( ISVALID_3DIM_DATASET(dset) ){
04772
04773 #ifdef USE_RIGHT_BUCK_LABELS
04774 if( DSET_NVALS(dset) < 10 )
04775 sprintf(blab, fmt[0] , DSET_BRICK_LABEL(dset,av->ival) , av->ival ) ;
04776 else if( DSET_NVALS(dset) < 100 )
04777 sprintf(blab, fmt[1] , DSET_BRICK_LABEL(dset,av->ival) , av->ival ) ;
04778 else
04779 sprintf(blab, fmt[2] , DSET_BRICK_LABEL(dset,av->ival) , av->ival ) ;
04780 #else
04781 if( DSET_NVALS(dset) < 10 )
04782 sprintf(blab, fmt[0] , av->ival , DSET_BRICK_LABEL(dset,av->ival) ) ;
04783 else if( DSET_NVALS(dset) < 100 )
04784 sprintf(blab, fmt[1] , av->ival , DSET_BRICK_LABEL(dset,av->ival) ) ;
04785 else
04786 sprintf(blab, fmt[2] , av->ival , DSET_BRICK_LABEL(dset,av->ival) ) ;
04787 #endif
04788 }
04789 else
04790 sprintf(blab," #%d ",av->ival) ; /* shouldn't hapeen, but you never know */
04791
04792 RETURN(blab) ;
04793 }
|
|
||||||||||||
|
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 1938 of file afni_func.c. References AFNI_finalize_dataset_CB(), AFNI_view_info::anat_num, BEEPIT, AFNI_viewing_widgets::choose_anat_pb, AFNI_viewing_widgets::choose_func_pb, AFNI_viewing_widgets::choose_sess_pb, THD_3dim_dataset::dblk, Three_D_View::dc, THD_datablock::diskptr, MCW_DC::display, dset_choice, DSET_COMPRESSED, DSET_GRAPHABLE, DSET_in_global_session(), DSET_NUM_TIMES, DSET_NVALS, DSET_PREFIXSTR, THD_session::dsset, ENTRY, FIRST_VIEW_TYPE, AFNI_view_info::func_num, GLOBAL_library, AFNI_library_type::have_dummy_dataset, IM3D_VALID, ISBUCKET, ISVALID_3DIM_DATASET, LAST_VIEW_TYPE, THD_session::lastname, MAX, MCW_choose_strlist(), MCW_strncpy, MIN, THD_session::num_dsset, THD_sessionlist::num_sess, AFNI_viewing_widgets::popchoose_anat_pb, AFNI_viewing_widgets::popchoose_func_pb, AFNI_viewing_widgets::popchoose_sess_pb, THD_diskptr::prefix, RESET_AFNI_QUIT, AFNI_view_info::sess_num, Three_D_View::ss_now, THD_sessionlist::ssar, AFNI_library_type::sslist, STRLIST_SIZE, THD_MAX_CHOICES, THD_MAX_PREFIX, AFNI_widget_set::view, Three_D_View::vinfo, Three_D_View::vwid, and XtMalloc.
01939 {
01940 static char *strlist[THD_MAX_CHOICES] ; /* strings to choose between */
01941 static int first_call = 1 ; /* initialization flag */
01942
01943 int num_str , ii , init_str , vv , jj ;
01944 char *label ;
01945 Widget wpar ;
01946 Three_D_View *im3d = (Three_D_View *) cd ;
01947 int llen , ltop ;
01948
01949 ENTRY("AFNI_choose_dataset_CB") ;
01950
01951 /*--- initialize ---*/
01952
01953 if( ! IM3D_VALID(im3d) ) EXRETURN ;
01954 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; EXRETURN ; }
01955
01956 if( first_call ){
01957 for( ii=0 ; ii < THD_MAX_CHOICES ; ii++ )
01958 strlist[ii] = (char*)XtMalloc( sizeof(char) * (STRLIST_SIZE+1) ) ;
01959 first_call = 0 ;
01960 }
01961
01962 /*--- make a list of session names ---*/
01963
01964 if( w == im3d->vwid->view->choose_sess_pb ||
01965 w == im3d->vwid->view->popchoose_sess_pb ){
01966
01967 wpar = im3d->vwid->view->choose_sess_pb ;
01968 num_str = GLOBAL_library.sslist->num_sess ;
01969 if( num_str < 1 ) EXRETURN ;
01970
01971 for( ii=0 ; ii < num_str ; ii++ ){
01972 MCW_strncpy( strlist[ii] ,
01973 GLOBAL_library.sslist->ssar[ii]->lastname ,
01974 STRLIST_SIZE ) ;
01975 }
01976
01977 init_str = im3d->vinfo->sess_num ;
01978 label = dset_choice[0] ;
01979
01980 /*--- make a list of anatomy names ---*/
01981
01982 } else if( w == im3d->vwid->view->choose_anat_pb ||
01983 w == im3d->vwid->view->popchoose_anat_pb ){
01984
01985 wpar = im3d->vwid->view->choose_anat_pb ;
01986 num_str = im3d->ss_now->num_dsset ;
01987 if( num_str < 1 ) EXRETURN ;
01988
01989 ltop = 4 ;
01990 for( ii=0 ; ii < num_str ; ii++ ){
01991 for( vv=FIRST_VIEW_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ )
01992 if( ISVALID_3DIM_DATASET(im3d->ss_now->dsset[ii][vv]) ) break ;
01993
01994 if( vv <= LAST_VIEW_TYPE ){
01995 llen = strlen( im3d->ss_now->dsset[ii][vv]->dblk->diskptr->prefix ) ;
01996 ltop = MAX( ltop , llen ) ;
01997 }
01998 }
01999 ltop = MIN(ltop,STRLIST_SIZE-24) ; /* 06 Aug 2002 */
02000
02001 for( ii=0 ; ii < num_str ; ii++ ){
02002 for( vv=FIRST_VIEW_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ )
02003 if( ISVALID_3DIM_DATASET(im3d->ss_now->dsset[ii][vv]) ) break ;
02004
02005 if( vv <= LAST_VIEW_TYPE ){
02006 sprintf( strlist[ii] , "%-*s" ,
02007 ltop,im3d->ss_now->dsset[ii][vv]->dblk->diskptr->prefix ) ;
02008
02009 strcat( strlist[ii] , " [" ) ;
02010 strcat( strlist[ii] , DSET_PREFIXSTR(im3d->ss_now->dsset[ii][vv]) ) ;
02011
02012 if( DSET_NUM_TIMES(im3d->ss_now->dsset[ii][vv]) > 1 ){
02013 int ll = strlen(strlist[ii]) ;
02014 sprintf( strlist[ii]+ll , ":3D+t:%d]" ,
02015 DSET_NUM_TIMES(im3d->ss_now->dsset[ii][vv]) ) ;
02016 } else if( ISBUCKET(im3d->ss_now->dsset[ii][vv]) ){
02017 int ll = strlen(strlist[ii]) ;
02018 sprintf( strlist[ii]+ll , ":%d]" ,
02019 DSET_NVALS(im3d->ss_now->dsset[ii][vv]) ) ;
02020 } else {
02021 strcat( strlist[ii] , "]" ) ;
02022 }
02023
02024 if( DSET_GRAPHABLE(im3d->ss_now->dsset[ii][vv]) )
02025 strcat( strlist[ii] , "*" ) ;
02026
02027 if( DSET_COMPRESSED(im3d->ss_now->dsset[ii][vv]) )
02028 strcat( strlist[ii] , "z" ) ;
02029
02030 /* 20 Dec 2001: mark if this is a global dataset */
02031
02032 if( DSET_in_global_session(im3d->ss_now->dsset[ii][vv]) )
02033 strcat( strlist[ii] , "G" ) ;
02034
02035 } else
02036 MCW_strncpy( strlist[ii] , "??*BAD*??" , THD_MAX_PREFIX ) ;
02037 }
02038
02039 init_str = im3d->vinfo->anat_num ;
02040 label = dset_choice[1] ;
02041
02042 /*--- make a list of function names ---*/
02043
02044 } else if( w == im3d->vwid->view->choose_func_pb ||
02045 w == im3d->vwid->view->popchoose_func_pb ){
02046
02047 wpar = im3d->vwid->view->choose_func_pb ;
02048 num_str = im3d->ss_now->num_dsset ;
02049 if( num_str < 1 ) EXRETURN ;
02050
02051 ltop = 4 ;
02052 for( ii=0 ; ii < num_str ; ii++ ){
02053 for( vv=FIRST_VIEW_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ )
02054 if( ISVALID_3DIM_DATASET(im3d->ss_now->dsset[ii][vv]) ) break ;
02055
02056 if( vv <= LAST_VIEW_TYPE ){
02057 llen = strlen( im3d->ss_now->dsset[ii][vv]->dblk->diskptr->prefix ) ;
02058 ltop = MAX( ltop , llen ) ;
02059 }
02060 }
02061 ltop = MIN(ltop,STRLIST_SIZE-24) ; /* 06 Aug 2002 */
02062
02063 for( ii=0 ; ii < num_str ; ii++ ){
02064 for( vv=FIRST_VIEW_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ )
02065 if( ISVALID_3DIM_DATASET(im3d->ss_now->dsset[ii][vv]) ) break ;
02066
02067 if( vv <= LAST_VIEW_TYPE ){
02068 sprintf( strlist[ii] , "%-*s" ,
02069 ltop , im3d->ss_now->dsset[ii][vv]->dblk->diskptr->prefix ) ;
02070
02071 strcat( strlist[ii] , " [" ) ;
02072 strcat( strlist[ii] , DSET_PREFIXSTR(im3d->ss_now->dsset[ii][vv]) ) ;
02073
02074 if( DSET_NUM_TIMES(im3d->ss_now->dsset[ii][vv]) > 1 ){
02075 int ll = strlen(strlist[ii]) ;
02076 sprintf( strlist[ii]+ll , ":3D+t:%d]" ,
02077 DSET_NUM_TIMES(im3d->ss_now->dsset[ii][vv]) ) ;
02078 } else if( ISBUCKET(im3d->ss_now->dsset[ii][vv]) ){
02079 int ll = strlen(strlist[ii]) ;
02080 sprintf( strlist[ii]+ll , ":%d]" ,
02081 DSET_NVALS(im3d->ss_now->dsset[ii][vv]) ) ;
02082 } else {
02083 strcat( strlist[ii] , "]" ) ;
02084 }
02085
02086 if( DSET_COMPRESSED(im3d->ss_now->dsset[ii][vv]) )
02087 strcat( strlist[ii] , "z" ) ;
02088
02089 /* 20 Dec 2001: mark if this is a global dataset */
02090
02091 if( DSET_in_global_session(im3d->ss_now->dsset[ii][vv]) )
02092 strcat( strlist[ii] , "G" ) ;
02093
02094 } else
02095 MCW_strncpy( strlist[ii] , "**?BAD?**" , THD_MAX_PREFIX ) ;
02096
02097 }
02098
02099 init_str = im3d->vinfo->func_num ;
02100 label = dset_choice[2] ;
02101
02102 } else {
02103 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad news! */
02104 }
02105
02106 /*--- call the chooser ---*/
02107
02108 MCW_choose_strlist( wpar , label , num_str , init_str , strlist ,
02109 AFNI_finalize_dataset_CB , (XtPointer) im3d ) ;
02110
02111 RESET_AFNI_QUIT(im3d) ;
02112 EXRETURN ;
02113 }
|
|
||||||||||||||||
|
Callback for Switch Surface pushbutton [19 Aug 2002]. -------------------------------------------------------------------------- Definition at line 775 of file afni_sumafunc.c. References AFNI_make_surface_widgets(), AFNI_update_surface_widgets(), ENTRY, IM3D_OPEN, AFNI_surface_widgets::rowcol, Three_D_View::ss_now, THD_session::su_num, AFNI_viewing_widgets::swid, AFNI_widget_set::view, Three_D_View::vwid, WAIT_for_window, and AFNI_surface_widgets::wtop.
00776 {
00777 Three_D_View *im3d = (Three_D_View *) cd ;
00778 AFNI_surface_widgets *swid ;
00779 int num , ii , nwid,nall ;
00780
00781 ENTRY("AFNI_choose_surface_CB") ;
00782
00783 if( !IM3D_OPEN(im3d) || im3d->ss_now == NULL ) EXRETURN ; /* bad */
00784
00785 num = im3d->ss_now->su_num ;
00786 swid = im3d->vwid->view->swid ;
00787
00788 /* no surfaces ==> nothing to do */
00789
00790 if( num == 0 ) EXRETURN ;
00791
00792 /* make widgets? */
00793
00794 if( swid == NULL ){
00795 AFNI_make_surface_widgets(im3d,num) ;
00796 swid = im3d->vwid->view->swid ;
00797 }
00798
00799 /* make control panel visible, if it isn't already */
00800
00801 XtMapWidget( swid->wtop ) ;
00802 XRaiseWindow( XtDisplay(swid->wtop), XtWindow(swid->wtop) ) ;
00803
00804 /* put proper labels on widgets, etc. */
00805
00806 AFNI_update_surface_widgets(im3d) ;
00807
00808 /* Mac OS X mangles up the widgets on first display,
00809 so unmanage and remanage them -- this solves that problem */
00810
00811 WAIT_for_window( swid->rowcol ) ;
00812 XtUnmanageChild( swid->rowcol ) ;
00813 WAIT_for_window( swid->rowcol ) ;
00814 XtManageChild ( swid->rowcol ) ;
00815
00816 /* wait for user to press some button */
00817
00818 EXRETURN ;
00819 }
|
|
||||||||||||||||
|
Definition at line 7606 of file afni_widg.c. Referenced by RT_start_dataset(). |
|
||||||||||||||||
|
Definition at line 2345 of file afni_func.c. References ENTRY, AFNI_widget_set::file_dialog, RWC_XtPopdown(), and Three_D_View::vwid. Referenced by AFNI_make_file_dialog().
02346 {
02347 Three_D_View *im3d = (Three_D_View *) cd ;
02348
02349 ENTRY("AFNI_close_file_dialog") ;
02350
02351 if( im3d->vwid->file_dialog != NULL )
02352 RWC_XtPopdown( im3d->vwid->file_dialog ) ;
02353
02354 EXRETURN ;
02355 }
|
|
|
|
at this point, ii = index of a controller to use * Definition at line 7687 of file afni_widg.c. Referenced by AFNI_drive_open_window(), and AFNI_quit_CB(). |
|
|
|
|
July 1996: get the sequences to send their montaging status * Definition at line 1825 of file afni_func.c. References AFNI_controller_index(). Referenced by AFNI_make_surface_widgets(), AFNI_set_window_titles(), AFNI_update_surface_widgets(), DRAW_main(), NOTES_main(), NUD_main(), PLUG_startup_plugin_CB(), RCREND_main(), REND_main(), RT_tell_afni_one(), and TAG_main().
01826 {
01827 static char clabel[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
01828 static char str[8] ;
01829 int ic ;
01830
01831 ic = AFNI_controller_index( im3d ) ;
01832 if( ic < 0 || ic > 26 ) strcpy (str," ") ;
01833 else sprintf(str,"[%c] ",clabel[ic]) ;
01834 return str ;
01835 }
|
|
||||||||||||||||
|
Definition at line 4590 of file afni.c. References AFNI_marks_action_CB(), CLOSE_PANEL, AFNI_widget_set::dmode, ENTRY, AFNI_datamode_widgets::frame, AFNI_function_widgets::frame, AFNI_marks_widgets::frame, AFNI_viewing_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 50 of file adwarp.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().
00051 {
00052 int ibr , nvold , nvnew ;
00053 THD_statistics *stold , *stnew ;
00054
00055 ENTRY("AFNI_copy_statistics") ;
00056
00057 if( !ISVALID_3DIM_DATASET(dsold) || !ISVALID_3DIM_DATASET(dsnew) ) EXRETURN ;
00058
00059 nvold = dsold->dblk->nvals ;
00060 nvnew = dsnew->dblk->nvals ;
00061 stold = dsold->stats ;
00062 stnew = dsnew->stats ;
00063 if( !ISVALID_STATISTIC(stold) ) EXRETURN ;
00064
00065 if( stnew == NULL ){
00066 dsnew->stats = stnew = myXtNew( THD_statistics ) ;
00067 stnew->type = STATISTICS_TYPE ;
00068 stnew->nbstat = nvnew ;
00069 stnew->bstat = (THD_brick_stats *)
00070 XtMalloc( sizeof(THD_brick_stats) * nvnew ) ;
00071 ADDTO_KILL(dsnew->kl,stnew) ;
00072 stnew->parent = (XtPointer) dsnew ;
00073 } else {
00074 stnew->nbstat = nvnew ;
00075 stnew->bstat = (THD_brick_stats *)
00076 XtRealloc( (char *) stnew->bstat ,
00077 sizeof(THD_brick_stats) * nvnew ) ;
00078 }
00079
00080 for( ibr=0 ; ibr < nvnew ; ibr++ ){
00081 if( ibr < nvold )
00082 stnew->bstat[ibr] = stold->bstat[ibr] ;
00083 else
00084 INVALIDATE_BSTAT(stnew->bstat[ibr]) ;
00085 }
00086
00087 EXRETURN ;
00088 }
|
|
|
popup on picture widget (right of Quit button) * Definition at line 7160 of file afni_widg.c. Referenced by AFNI_drive_close_window(), AFNI_quit_CB(), and RT_start_dataset(). |
|
||||||||||||
|
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 852 of file afni_splash.c. References geom. Referenced by AFNI_drive_geom_graph(), AFNI_drive_open_plugin(), AFNI_drive_open_window(), and AFNI_startup_layout_CB().
00853 {
00854 int has_x , has_plus ;
00855
00856 *ww = *hh = *xx = *yy = -1 ;
00857 if( geom == NULL || geom[0] == '\0' ) return ;
00858
00859 has_x = strstr(geom,"x") != NULL ;
00860 has_plus = strstr(geom,"+") != NULL ;
00861
00862 if( has_x && has_plus )
00863 sscanf(geom,"%dx%d+%d+%d",ww,hh,xx,yy) ;
00864 else if( has_x )
00865 sscanf(geom,"%dx%d",ww,hh) ;
00866 else if( has_plus )
00867 sscanf(geom,"+%d+%d",xx,yy) ;
00868
00869 return ;
00870 }
|
|
||||||||||||||||
|
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_datamode_widgets::frame, AFNI_function_widgets::frame, AFNI_marks_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_function_widgets::rowcol, AFNI_marks_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 923 of file afni_receive.c. References ISVALID_DSET, TEMP_FVEC3, THD_3dmm_to_dicomm(), and THD_fvec3::xyz.
00926 {
00927 THD_fvec3 fv ;
00928
00929 if( ! ISVALID_DSET(dset) ) return ;
00930
00931 fv = THD_3dmm_to_dicomm( dset , TEMP_FVEC3(xd,yd,zd) ) ;
00932 *xx = fv.xyz[0] ;
00933 *yy = fv.xyz[1] ;
00934 *zz = fv.xyz[2] ;
00935 return ;
00936 }
|
|
|
Definition at line 573 of file afni_niml.c. References dont_overlay_suma. Referenced by AFNI_see_func_CB().
00574 {
00575 dont_overlay_suma = aa ;
00576 }
|
|
|
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 }
|
|
||||||||||||||||
|
scan once to find longest string name * Definition at line 3647 of file afni_func.c. References AFNI_refashion_dataset(), AFNI_reset_func_range(), AFNI_set_viewpoint(), AFNI_speak(), Three_D_View::anat_now, AFNI_view_info::anat_resam_mode, AFNI_datamode_widgets::anatmode_bbox, AFNI_library_type::controllers, CURRENT_DAXES, DATAXES_TYPE, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, THD_diskptr::directory_name, THD_datablock::diskptr, AFNI_widget_set::dmode, DMODE_BRICK, DSET_WRITEABLE, ENTRY, THD_diskptr::filecode, Three_D_View::fim_now, AFNI_view_info::func_resam_mode, AFNI_datamode_widgets::funcmode_bbox, GLOBAL_library, MCW_choose_cbs::ilist, IM3D_OPEN, ISFUNC, MAX_CONTROLLERS, MCW_CALLER_KILL, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, MCW_choose_cbs::nilist, PLUTO_find_dset(), REDISPLAY_OVERLAY, AFNI_view_info::resam_vox, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, THD_edit_dataxes(), THD_MAX_NAME, THD_dataxes::type, Three_D_View::vinfo, Three_D_View::vwid, MCW_bbox::wbut, and AFNI_view_info::writeownsize. Referenced by AFNI_write_many_dataset_CB().
03648 {
03649 MCW_idcode *idclist = (MCW_idcode *) cd ;
03650 Three_D_View *im3d = NULL , *qq3d ;
03651 THD_3dim_dataset *dset ;
03652 THD_dataxes new_daxes ;
03653 int ib , resam_mode ;
03654 Boolean good ;
03655 Widget wmsg ;
03656 int cc , ccanat[MAX_CONTROLLERS] , ccfunc[MAX_CONTROLLERS] ;
03657
03658 ENTRY("AFNI_do_many_writes") ;
03659
03660 XtVaGetValues( wpar , XmNuserData , &im3d , NULL ) ;
03661 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
03662
03663 SHOW_AFNI_PAUSE ;
03664
03665 /** mark all controllers as untouched **/
03666
03667 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ) ccanat[cc] = ccfunc[cc] = 0 ;
03668
03669 wmsg = MCW_popup_message( wpar ,
03670 "*******************************\n"
03671 "** Please wait for dataset **\n"
03672 "** computations and disk I/O **\n"
03673 "*******************************" , MCW_CALLER_KILL ) ;
03674 AFNI_speak("Writing",0) ;
03675
03676 /** loop through selected datasets and do the dirty work **/
03677
03678 for( ib=0 ; ib < cbs->nilist ; ib++ ){
03679 dset = PLUTO_find_dset( idclist + cbs->ilist[ib] ) ;
03680 if( DSET_WRITEABLE(dset) ){
03681
03682 fprintf(stderr,"-- writing dataset %s%s (%d of %d)\n" ,
03683 dset->dblk->diskptr->directory_name ,
03684 dset->dblk->diskptr->filecode ,
03685 ib+1 , cbs->nilist ) ;
03686
03687 new_daxes.type = DATAXES_TYPE ;
03688
03689 #ifdef USE_WRITEOWNSIZE
03690 if( im3d->vinfo->writeownsize )
03691 THD_edit_dataxes( im3d->vinfo->resam_vox , dset->daxes , &new_daxes ) ;
03692 else
03693 #endif
03694 THD_edit_dataxes( im3d->vinfo->resam_vox ,
03695 CURRENT_DAXES(im3d->anat_now) , &new_daxes ) ;
03696
03697 resam_mode = (ISFUNC(dset)) ? im3d->vinfo->func_resam_mode
03698 : im3d->vinfo->anat_resam_mode ;
03699
03700 good = AFNI_refashion_dataset( im3d , dset , &new_daxes , resam_mode ) ;
03701
03702 /** if the output failed, put a message to the screen **/
03703
03704 if( ! good ){ /* bad news! */
03705 char str[THD_MAX_NAME+128] ;
03706 sprintf( str , "**\n" "** Attempt to write dataset\n"
03707 "** %s%s\n" "** failed for unknown reasons!\n**" ,
03708 dset->dblk->diskptr->directory_name ,
03709 dset->dblk->diskptr->filecode ) ;
03710 (void) MCW_popup_message( wpar , str , MCW_USER_KILL | MCW_TIMER_KILL ) ;
03711
03712 fprintf(stderr," [output of %s%s failed!]\n",
03713 dset->dblk->diskptr->directory_name ,
03714 dset->dblk->diskptr->filecode ) ;
03715
03716 /** otherwise, check if the dataset just done is
03717 the active anatomy or function in any open controller window **/
03718
03719 } else {
03720 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
03721 qq3d = GLOBAL_library.controllers[cc] ;
03722 if( ! IM3D_OPEN(qq3d) ) continue ;
03723 if( dset == qq3d->anat_now ) ccanat[cc] = 1 ; /* flag their */
03724 if( dset == qq3d->fim_now ) ccfunc[cc] = 1 ; /* controllers */
03725 }
03726 }
03727 }
03728 }
03729
03730 /** for any controllers whose active datasets were written out,
03731 we need to set the "See Brick" buttons to be sensitive. **/
03732
03733 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
03734 qq3d = GLOBAL_library.controllers[cc] ;
03735 if( ! IM3D_OPEN(qq3d) ) continue ;
03736
03737 if( ccfunc[cc] ){
03738 STATUS("resetting 'use func brick' button") ;
03739 XtSetSensitive( qq3d->vwid->dmode->funcmode_bbox->wbut[DMODE_BRICK] , True ) ;
03740 AFNI_reset_func_range( qq3d ) ;
03741 AFNI_set_viewpoint( qq3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
03742 }
03743
03744 if( ccanat[cc] ){
03745 STATUS("resetting 'use anat brick' button") ;
03746 XtSetSensitive( qq3d->vwid->dmode->anatmode_bbox->wbut[DMODE_BRICK] , True ) ;
03747 }
03748 }
03749
03750 XtDestroyWidget( wmsg ) ;
03751 SHOW_AFNI_READY ;
03752 EXRETURN ;
03753 }
|
|
|
Definition at line 147 of file afni_driver.c. References ENTRY, free, AFNI_driver_pair::fun, AFNI_driver_pair::nam, and RETURN. Referenced by AFNI_equate_pbars(), AFNI_imag_pop_CB(), AFNI_niml_driver(), AFNI_niml_workproc(), AFNI_process_plugout(), AFNI_range_lock_carryout(), AFNI_startup_script_CB(), AFNI_startup_timeout_CB(), AFNI_thresh_lock_carryout(), and RT_process_info().
00148 {
00149 int clen , rval , ii , dd , dlen ;
00150 char *cmd , *dmd ;
00151
00152 ENTRY("AFNI_driver") ;
00153
00154 if( cmdd == NULL || *cmdd == '\0' ) RETURN(-1) ; /* bad */
00155
00156 dmd = cmd = strdup(cmdd) ; clen = strlen(cmd) ;
00157
00158 /* skip leading blanks */
00159
00160 for( ii=0 ; ii < clen ; ii++ )
00161 if( !isspace(cmd[ii]) ) break ;
00162
00163 if( ii == clen ){ free(dmd); RETURN(-1); } /* all blanks? */
00164
00165 cmd += ii ; clen = strlen(cmd) ;
00166
00167 /* 19 Dec 2002: trim trailing blanks */
00168
00169 for( ii=clen-1 ; ii > 0 && isspace(cmd[ii]) ; ii-- )
00170 cmd[ii] = '\0' ;
00171
00172 clen = strlen(cmd) ;
00173
00174 /* scan dpair list for command */
00175
00176 for( dd=0 ; dpair[dd].nam != NULL ; dd++ ){
00177
00178 dlen = strlen(dpair[dd].nam) ;
00179 if( clen >= dlen &&
00180 strncmp(cmd,dpair[dd].nam,dlen) == 0 ){ /* found it */
00181
00182 for( ii=dlen ; ii < clen ; ii++ ) /* skip blanks */
00183 if( !isspace(cmd[ii]) ) break ; /* after command name */
00184
00185 rval = dpair[dd].fun( cmd+ii ) ; /* execute command */
00186 free(dmd) ; RETURN(rval) ;
00187 }
00188 }
00189
00190 free(dmd) ; RETURN(-1) ; /* not in the list */
00191 }
|
|
||||||||||||
|
Definition at line 382 of file afni_lock.c. References AFNI_controller_index(), AFNI_driver(), AV_uformat_fval(), MCW_pbar::bigflip, MCW_pbar::bigmode, MCW_pbar::bigrota, MCW_pbar::bigtop, AFNI_library_type::dc, ENTRY, AFNI_widget_set::func, GLOBAL_library, IM3D_OPEN, AFNI_function_widgets::inten_pbar, MCW_DCOV::label_ov, MCW_pbar::mode, MCW_pbar::num_panes, MCW_pbar::ov_index, MCW_DC::ovc, MCW_pbar::pval, and Three_D_View::vwid. Referenced by AFNI_pbar_lock_carryout().
00383 {
00384 MCW_pbar *lbar , *rbar ;
00385 char cmd[1024] ;
00386 int cc , qq ;
00387 MCW_DCOV *ovc = GLOBAL_library.dc->ovc ;
00388
00389 ENTRY("AFNI_equate_pbars") ;
00390
00391 if( !IM3D_OPEN(lh3d) || !IM3D_OPEN(rh3d) ) EXRETURN ;
00392
00393 lbar = lh3d->vwid->func->inten_pbar ;
00394 rbar = rh3d->vwid->func->inten_pbar ;
00395
00396 cc = AFNI_controller_index(lh3d) ; if( cc < 0 ) EXRETURN ;
00397
00398 if( !rbar->bigmode ){
00399 sprintf(cmd,"SET_PBAR_ALL %c.%c%d" , 'A'+cc ,
00400 (rbar->mode) ? '+' : '-' , rbar->num_panes ) ;
00401 for( qq=0 ; qq < rbar->num_panes ; qq++ )
00402 sprintf(cmd+strlen(cmd)," %s=%s",
00403 AV_uformat_fval(rbar->pval[qq]) ,
00404 ovc->label_ov[rbar->ov_index[qq]] ) ;
00405 } else {
00406 sprintf(cmd,"SET_PBAR_ALL %c.%c%d %f %s\n" , 'A'+cc ,
00407 (rbar->mode) ? '+' : '-' , 99 ,
00408 rbar->bigtop , PBAR_get_bigmap(rbar) ) ;
00409 if( rbar->bigflip )
00410 sprintf(cmd+strlen(cmd)," FLIP") ;
00411 if( rbar->bigrota )
00412 sprintf(cmd+strlen(cmd)," ROTA=%d",rbar->bigrota) ;
00413 }
00414
00415 AFNI_driver( cmd ) ; EXRETURN ;
00416 }
|
|
|
Definition at line 647 of file afni_splash.c. References AFNI_facedown(), AFNI_find_jpegs(), BEEPIT, AFNI_library_type::dc, drive_MCW_imseq(), ENTRY, face_phan, fim, fname_face, gcd(), generic_func, getenv(), GLOBAL_library, MCW_DC::height, isqDR_periodicmont, isqDR_record_disable, mri_dup2D(), mri_free(), mri_read_stuff(), mri_zeropad_2D(), NI_clock_time(), NI_sleep(), num_face, MRI_IMAGE::nx, NXY, MRI_IMAGE::ny, PLUTO_imseq_addto(), PLUTO_imseq_popim(), PLUTO_imseq_retitle(), PLUTO_imseq_setim(), and MCW_DC::width.
00648 {
00649 MRI_IMAGE *im , *fim ;
00650 int ii , nx,ny , nxdown,nxup , nydown,nyup ;
00651 int ctold,ctnew,mmss , ddss ;
00652 int jj , j0,dj=1 ;
00653
00654 ENTRY("AFNI_faceup") ;
00655
00656 if( num_face < 0 ){ BEEPIT; EXRETURN; }
00657 if( num_face == 0 ){
00658 num_face = AFNI_find_jpegs( "face_" , &fname_face ) ;
00659 if( num_face <= 0 ){ BEEPIT; EXRETURN; }
00660 }
00661 if( face_phan != NULL ){
00662 PLUGIN_imseq *ph = (PLUGIN_imseq *)face_phan ;
00663 XMapRaised( XtDisplay(ph->seq->wtop) , XtWindow(ph->seq->wtop) ) ;
00664 EXRETURN ;
00665 }
00666
00667 ctold = NI_clock_time() ;
00668
00669 ddss = num_face + 16449/num_face ; if( ddss > 222 ) ddss = 222 ;
00670
00671 if( num_face > 4 ){
00672 ii = num_face / 2 ;
00673 do{ dj = 1 + lrand48() % ii ; } while( gcd(num_face,dj) > 1 ) ;
00674 }
00675 j0 = lrand48() % num_face ;
00676
00677 for( ii=0 ; ii < num_face ; ii++ ){
00678 jj = (j0 + ii*dj) % num_face ;
00679 im = mri_read_stuff( fname_face[jj] ) ;
00680 if( im == NULL ) continue ;
00681 nx = im->nx ; ny = im->ny ;
00682
00683 nxdown = (NXY-nx) / 2 ; nxup = NXY - nx - nxdown ;
00684 nydown = (NXY-ny) / 2 ; nyup = NXY - ny - nydown ;
00685 if( nxdown != 0 || nydown != 0 || nxup != 0 || nyup != 0 ){
00686 fim = mri_zeropad_2D( nxdown,nxup , nydown,nyup , im ) ;
00687 if( fim != NULL ){ mri_free(im) ; im = fim ; }
00688 }
00689 fim = mri_dup2D(2,im) ; mri_free(im) ; /* double size for fun */
00690 if( face_phan == NULL ){
00691 int sxx,syy ; char *sen ; PLUGIN_imseq *ph ;
00692
00693 face_phan = PLUTO_imseq_popim( fim,(generic_func *)AFNI_facedown,NULL );
00694 sxx = (GLOBAL_library.dc->width-4*NXY)/2 ; if( sxx < 1 ) sxx = 1 ;
00695 syy = 100 ;
00696 sen = getenv("AFNI_SPLASH_XY") ;
00697 if( sen != NULL ){
00698 int n,x,y ;
00699 n = sscanf(sen,"%d:%d",&x,&y) ;
00700 if( n == 2 && x >= 0 && x < GLOBAL_library.dc->width &&
00701 y >= 0 && y < GLOBAL_library.dc->height ){
00702 sxx = x ; syy = y ;
00703 }
00704 }
00705 ph = (PLUGIN_imseq *)face_phan ;
00706 XtVaSetValues( ph->seq->wtop , XmNx,sxx , XmNy,syy , NULL ) ;
00707 drive_MCW_imseq( ph->seq , isqDR_record_disable , (XtPointer)0 ) ;
00708 drive_MCW_imseq( ph->seq , isqDR_periodicmont , (XtPointer)1 ) ;
00709
00710 } else {
00711 PLUTO_imseq_addto( face_phan , fim ) ;
00712 }
00713 mri_free(fim) ;
00714
00715 ctnew = NI_clock_time() ; /* show 1 image every ddss ms [27 Dec 2004] */
00716 mmss = ddss - (ctnew-ctold) ;
00717 ctold = ctnew ; ddss-- ;
00718 NI_sleep(mmss) ;
00719 }
00720 if( face_phan != NULL ){
00721 PLUTO_imseq_retitle( face_phan , "Faces of AFNI" ) ;
00722 PLUTO_imseq_setim( face_phan , 0 ) ;
00723 } else {
00724 BEEPIT ;
00725 }
00726
00727 EXRETURN ;
00728 }
|
|
||||||||||||||||||||||||||||||||
|
01 Feb 2000: added ucode, for user written functions * Definition at line 268 of file afni_fimmer.c. References abs, ADN_brick_fac, ADN_datum_all, ADN_func_type, ADN_malloc_type, ADN_none, ADN_ntt, ADN_nvals, ADN_prefix, ADN_stat_aux, ADN_type, AFNI_3DDATA_VIEW, AFNI_CALL_fim_function, AFNI_GOOD_FUNC_DTYPE, calloc, DATABLOCK_MEM_MALLOC, THD_3dim_dataset::dblk, DESTROY_IMARR, THD_diskptr::dimsizes, THD_datablock::diskptr, THD_slist_find::dset, DSET_ARRAY, DSET_BRICK, DSET_BRICK_BYTES, DSET_BRICK_TYPE, DSET_GRAPHABLE, DSET_NUM_TIMES, DSET_NVALS, DSET_PREFIX, EDIT_add_brick(), EDIT_BRICK_FACTOR, EDIT_BRICK_LABEL, EDIT_BRICK_TO_FICO, EDIT_clip_float(), EDIT_dset_items(), EDIT_empty_copy(), ENTRY, fd, FIM_ALPHA_MASK, FIM_AVER_MASK, FIM_BASE_MASK, FIM_BEST_MASK, FIM_CORR_MASK, FIM_PAVE_MASK, FIM_PERC_MASK, FIM_PTOP_MASK, FIM_SIGM_MASK, FIM_THR, FIM_TOPL_MASK, Three_D_View::fimdata, FIND_PREFIX, MCW_function_list::flags, free, free_PCOR_references(), free_PCOR_voxel_corr(), FUNC_BUCK_TYPE, FUNC_COR_SCALE_SHORT, MCW_function_list::func_data, FUNC_FIM_TYPE, THD_3dim_dataset::func_type, MCW_function_list::funcs, GEN_FUNC_TYPE, generic_func, GLOBAL_library, HEAD_FUNC_TYPE, FIMdata::ignore, IM3D_OPEN, IMARR_SUBIMAGE, AFNI_fimmer_type::init_ignore, ISHEAD, ISVALID_SESSION, MRI_IMAGE::kind, malloc, MAX, MAX_STAT_AUX, MCW_popdown_meter(), MCW_popup_meter(), MCW_set_meter(), MCW_strncpy, METER_TOP_WIDE, MIN, mri_fix_data_pointer(), MRI_FLOAT_PTR, my_getenv(), new_PCOR_references(), new_PCOR_voxel_corr(), MCW_function_list::num, THD_datablock::nvals, FIMdata::nvox, MRI_IMAGE::nx, MRI_IMAGE::ny, FIMdata::ort_ts, PCOR_get_coef(), PCOR_get_pcor(), PCOR_get_perc(), PCOR_get_stdev(), PCOR_update_float(), AFNI_fimmer_type::polort, FIMdata::polort, FIMdata::ref_ts, AFNI_library_type::registered_fim, RETURN, STATUS, strtod(), THD_count_databricks(), THD_delete_3dim_dataset(), THD_dset_in_session(), THD_extract_many_series(), THD_load_datablock(), THD_MAX_PREFIX, AFNI_widget_set::top_shell, Three_D_View::type, update_PCOR_references(), Three_D_View::vwid, and XtRealloc. Referenced by AFNI_fimmer_execute().
00272 {
00273 THD_3dim_dataset * new_dset=NULL ;
00274 char new_prefix[THD_MAX_PREFIX] ;
00275 char old_prefix[THD_MAX_PREFIX] ;
00276 THD_slist_find fff ;
00277 int ifim , it,iv , nvox , ngood_ref , ntime , it1 , dtyp , nxyz , itbot ;
00278 float * vval, * tsar, * aval, * rbest, * abest, * pbest, * pval, * bbest, * bval;
00279 int * indx ;
00280 short * bar ;
00281 short * ibest ; /* 15 Dec 1997 */
00282 void * ptr ;
00283 float stataux[MAX_STAT_AUX] ;
00284 float fthr , topval ;
00285 int nx_ref , ny_ref , ivec , nnow ;
00286 PCOR_references ** pc_ref ;
00287 PCOR_voxel_corr ** pc_vc ;
00288
00289 int fim_nref , nx_ort , ny_ort , internal_ort ;
00290 float * ortar ;
00291 static float * ref_vec = NULL ;
00292 static int nref_vec = -666 ;
00293
00294 int ibr_best , ibr_perc , ibr_fim , ibr_corr , ibr_base , nbrik ;
00295
00296 int polort = im3d->fimdata->polort , ip ; /* 30 May 1999 */
00297
00298 float top_perc = 0.0 ; /* 30 Aug 1999 */
00299
00300 int ibr_pave , ibr_aver ; /* 08 Sep 1999 */
00301 float * paval , * avval , * pabest , * avbest ; /* 08 Sep 1999 */
00302
00303 int ibr_ptop , ibr_topl , ibr_sigm ; /* 03 Jan 2000 */
00304 float * ptval , * tlval , *sgval ,
00305 * ptbest, * tlbest, *sgbest ;
00306
00307 #ifndef DONT_USE_METER
00308 Widget meter = NULL ;
00309 int meter_perc , meter_pold ;
00310 #endif
00311
00312 int nupdt = 0 , /* number of updates done yet */
00313 min_updt = 5 , /* min number needed for display */
00314 first_updt = 1 ; /* flag to indicate that first update is yet to be displayed */
00315
00316 ENTRY("AFNI_fimmer_compute") ;
00317
00318 /*--- check for legal inputs ---*/
00319
00320 if( ! DSET_GRAPHABLE(dset_time) ||
00321 ref_ts == NULL ||
00322 ref_ts->kind != MRI_float ||
00323 ! IM3D_OPEN(im3d) ||
00324 im3d->type != AFNI_3DDATA_VIEW ||
00325 (code == 0 && ucode == 0) || /* Jan 1998 & Feb 2000 */
00326 ref_ts->nx < DSET_NUM_TIMES(dset_time) ){
00327
00328 if(PRINT_TRACING)
00329 { char str[256] ;
00330 sprintf(str,"illegal inputs: ntime=%d num_ts=%d",
00331 DSET_NUM_TIMES(dset_time), (ref_ts==NULL) ? (0) : (ref_ts->nx) ) ;
00332 STATUS(str) ; }
00333
00334 RETURN(NULL) ;
00335 }
00336
00337 /** 13 Nov 1996: allow for orts **/
00338
00339 if( ort_ts != NULL ){
00340 nx_ort = ort_ts->nx ;
00341 ny_ort = ort_ts->ny ;
00342 ortar = MRI_FLOAT_PTR(ort_ts) ;
00343
00344 internal_ort = (nx_ort < DSET_NUM_TIMES(dset_time)) ;
00345 } else {
00346 internal_ort = 1 ;
00347 }
00348 fim_nref = (internal_ort) ? (polort+2) : (ny_ort+polort+2) ;
00349
00350 if( nref_vec < fim_nref ){
00351 ref_vec = (float *) XtRealloc( (char *)ref_vec, sizeof(float)*fim_nref ) ;
00352 nref_vec = fim_nref ;
00353 }
00354
00355 itbot = im3d->fimdata->init_ignore ;
00356 nx_ref = ref_ts->nx ;
00357 ny_ref = ref_ts->ny ;
00358 ntime = DSET_NUM_TIMES(dset_time) ;
00359 ngood_ref = 0 ;
00360 it1 = -1 ;
00361 for( ivec=0 ; ivec < ny_ref ; ivec++ ){
00362 tsar = MRI_FLOAT_PTR(ref_ts) + (ivec*nx_ref) ;
00363 ifim = 0 ;
00364 for( it=itbot ; it < ntime ; it++ ){
00365 if( tsar[it] < WAY_BIG ){ ifim++ ; if( it1 < 0 ) it1 = it ; }
00366 }
00367
00368 if( ifim < min_updt ){
00369 STATUS("ref_ts has too few good entries!") ;
00370 RETURN(NULL) ;
00371 }
00372
00373 ngood_ref = MAX( ifim , ngood_ref ) ;
00374 }
00375
00376 /** at this point, ngood_ref = max number of good reference points,
00377 and it1 = index of first point used in first reference **/
00378
00379 dtyp = DSET_BRICK_TYPE(dset_time,it1) ;
00380 if( ! AFNI_GOOD_FUNC_DTYPE(dtyp) ){
00381 STATUS("illegal input data type!") ;
00382 RETURN(NULL) ;
00383 }
00384
00385 /*--- Create a new prefix ---*/
00386
00387 MCW_strncpy( old_prefix , DSET_PREFIX(dset_time) , THD_MAX_PREFIX-3 ) ;
00388
00389 if( ! ISVALID_SESSION(sess) ){
00390 sprintf( new_prefix , "%s@%d" , old_prefix , 1 ) ;
00391 } else {
00392 for( ifim=1 ; ifim < 99 ; ifim++ ){
00393 sprintf( new_prefix , "%s@%d" , old_prefix , ifim ) ;
00394 fff = THD_dset_in_session( FIND_PREFIX , new_prefix , sess ) ;
00395 if( fff.dset == NULL ) break ;
00396 }
00397 if( ifim == 99 ){
00398 STATUS("can't create new prefix!") ;
00399 RETURN(NULL) ; /* can't make a new prefix! */
00400 }
00401 }
00402
00403 if(PRINT_TRACING)
00404 { char str[256] ;
00405 sprintf(str,"new prefix = %s",new_prefix) ; STATUS(str) ; }
00406
00407 /*--- FIM: find values above threshold to fim ---*/
00408
00409 THD_load_datablock( dset_time->dblk ) ;
00410
00411 nxyz = dset_time->dblk->diskptr->dimsizes[0]
00412 * dset_time->dblk->diskptr->dimsizes[1]
00413 * dset_time->dblk->diskptr->dimsizes[2] ;
00414
00415 /** find the mean of the first array,
00416 compute the threshold (fthr) from it,
00417 make indx[i] be the 3D index of the i-th voxel above threshold **/
00418
00419 switch( dtyp ){
00420
00421 case MRI_short:{
00422 short * dar = (short *) DSET_ARRAY(dset_time,it1) ;
00423 for( iv=0,fthr=0.0 ; iv < nxyz ; iv++ ) fthr += abs(dar[iv]) ;
00424 fthr = FIM_THR * fthr / nxyz ;
00425
00426 if(PRINT_TRACING)
00427 { char str[256] ; sprintf(str,"fthr = %g",fthr) ; STATUS(str) ; }
00428
00429 for( iv=0,nvox=0 ; iv < nxyz ; iv++ )
00430 if( abs(dar[iv]) > fthr ) nvox++ ;
00431 indx = (int *) malloc( sizeof(int) * nvox ) ;
00432 if( indx == NULL ){
00433 fprintf(stderr,"\n*** indx malloc failure in AFNI_fimmer_compute\n") ;
00434 RETURN(NULL) ;
00435 }
00436 for( iv=0,nvox=0 ; iv < nxyz ; iv++ )
00437 if( abs(dar[iv]) > fthr ) indx[nvox++] = iv ;
00438 }
00439 break ;
00440
00441 case MRI_float:{
00442 float * dar = (float *) DSET_ARRAY(dset_time,it1) ;
00443 for( iv=0,fthr=0.0 ; iv < nxyz ; iv++ ) fthr += fabs(dar[iv]) ;
00444 fthr = FIM_THR * fthr / nxyz ;
00445
00446 if(PRINT_TRACING)
00447 { char str[256] ; sprintf(str,"fthr = %g",fthr) ; STATUS(str) ; }
00448
00449 for( iv=0,nvox=0 ; iv < nxyz ; iv++ )
00450 if( fabs(dar[iv]) > fthr ) nvox++ ;
00451 indx = (int *) malloc( sizeof(int) * nvox ) ;
00452 if( indx == NULL ){
00453 fprintf(stderr,"\n*** indx malloc failure in AFNI_fimmer_compute\n") ;
00454 RETURN(NULL) ;
00455 }
00456 for( iv=0,nvox=0 ; iv < nxyz ; iv++ )
00457 if( fabs(dar[iv]) > fthr ) indx[nvox++] = iv ;
00458 }
00459 break ;
00460
00461 case MRI_byte:{
00462 byte * dar = (byte *) DSET_ARRAY(dset_time,it1) ;
00463 for( iv=0,fthr=0.0 ; iv < nxyz ; iv++ ) fthr += dar[iv] ;
00464 fthr = FIM_THR * fthr / nxyz ;
00465
00466 if(PRINT_TRACING)
00467 { char str[256] ; sprintf(str,"fthr = %g",fthr) ; STATUS(str) ; }
00468
00469 for( iv=0,nvox=0 ; iv < nxyz ; iv++ )
00470 if( dar[iv] > fthr ) nvox++ ;
00471 indx = (int *) malloc( sizeof(int) * nvox ) ;
00472 if( indx == NULL ){
00473 fprintf(stderr,"\n*** indx malloc failure in AFNI_fimmer_compute\n") ;
00474 RETURN(NULL) ;
00475 }
00476 for( iv=0,nvox=0 ; iv < nxyz ; iv++ )
00477 if( dar[iv] > fthr ) indx[nvox++] = iv ;
00478 }
00479 break ;
00480 }
00481
00482 if(PRINT_TRACING)
00483 { char str[256] ; sprintf(str,"number of voxels = %d",nvox) ; STATUS(str) ; }
00484
00485 /** 10 May 2000: check if nothing was found to work on **/
00486
00487 if( nvox == 0 ){
00488 fprintf(stderr,"\n*** no voxels to FIM on!"
00489 "\n*** try setting the Bkg Thresh lower"
00490 "\n [on the FIM -> Edit Ideal menu]\a\n") ;
00491 free(indx) ; RETURN(NULL) ;
00492 }
00493
00494 /** allocate space for voxel values **/
00495
00496 vval = (float *) malloc( sizeof(float) * nvox) ;
00497 if( vval == NULL ){
00498 fprintf(stderr,"\n*** vval malloc failure in AFNI_fimmer_compute\n") ;
00499 free(indx) ; RETURN(NULL) ;
00500 }
00501
00502 /** compute number of output bricks **/
00503
00504 ibr_fim=ibr_corr=ibr_best=ibr_perc=ibr_base = -1 ; nbrik = 0 ;
00505 ibr_pave = ibr_aver = -1 ;
00506 ibr_ptop = ibr_topl = ibr_sigm = -1 ;
00507
00508 if( (code & FIM_ALPHA_MASK)!= 0) { ibr_fim = nbrik; nbrik++; }
00509 if( (code & FIM_BEST_MASK) != 0 && ny_ref > 1){ ibr_best = nbrik; nbrik++; }
00510 if( (code & FIM_PERC_MASK) != 0) { ibr_perc = nbrik; nbrik++; }
00511 if( (code & FIM_PAVE_MASK) != 0) { ibr_pave = nbrik; nbrik++; }
00512 if( (code & FIM_BASE_MASK) != 0) { ibr_base = nbrik; nbrik++; }
00513 if( (code & FIM_AVER_MASK) != 0) { ibr_aver = nbrik; nbrik++; }
00514 if( (code & FIM_CORR_MASK) != 0) { ibr_corr = nbrik; nbrik++; }
00515 if( (code & FIM_PTOP_MASK) != 0) { ibr_ptop = nbrik; nbrik++; }
00516 if( (code & FIM_TOPL_MASK) != 0) { ibr_topl = nbrik; nbrik++; }
00517 if( (code & FIM_SIGM_MASK) != 0) { ibr_sigm = nbrik; nbrik++; }
00518
00519 /** 01 Feb 2000: if no normal FIM stuff (code), skip to the ucode stuff **/
00520
00521 if(PRINT_TRACING)
00522 { char str[256] ; sprintf(str,"number of bricks = %d",nbrik) ; STATUS(str) ; }
00523
00524 if( nbrik == 0 ){
00525
00526 #ifndef DONT_USE_METER
00527 meter = MCW_popup_meter( im3d->vwid->top_shell , METER_TOP_WIDE ) ;
00528 meter_pold = 0 ;
00529 #endif
00530
00531 goto ucode_stuff ; /* way below */
00532 }
00533
00534 /** normal case: do the normal recursive FIMming **/
00535
00536 if(PRINT_TRACING)
00537 { char str[256] ;
00538 sprintf(str,"code of FIM_MASKs = %d",code) ; STATUS(str) ; }
00539
00540 /** allocate extra space for comparing results from multiple ref vectors **/
00541
00542 if( ny_ref > 1 ){
00543 aval = (float *) malloc(sizeof(float) * nvox) ;
00544 rbest = (float *) malloc(sizeof(float) * nvox) ;
00545 abest = (float *) malloc(sizeof(float) * nvox) ;
00546 ibest = (short *) malloc(sizeof(short) * nvox) ; /* 15 Dec 1997 */
00547 pbest = (float *) malloc(sizeof(float) * nvox) ; /* 16 Jan 1998 */
00548 bbest = (float *) malloc(sizeof(float) * nvox) ; /* 16 Jan 1998 */
00549 pval = (float *) malloc(sizeof(float) * nvox) ; /* 16 Jan 1998 */
00550 bval = (float *) malloc(sizeof(float) * nvox) ; /* 16 Jan 1998 */
00551
00552 paval = (float *) malloc(sizeof(float) * nvox) ; /* 08 Sep 1999 */
00553 avval = (float *) malloc(sizeof(float) * nvox) ; /* 08 Sep 1999 */
00554 pabest = (float *) malloc(sizeof(float) * nvox) ; /* 16 Jan 1998 */
00555 avbest = (float *) malloc(sizeof(float) * nvox) ; /* 16 Jan 1998 */
00556
00557 ptval = (float *) malloc(sizeof(float) * nvox) ; /* 03 Jan 2000 */
00558 tlval = (float *) malloc(sizeof(float) * nvox) ; /* 03 Jan 2000 */
00559 sgval = (float *) malloc(sizeof(float) * nvox) ; /* 03 Jan 2000 */
00560 ptbest = (float *) malloc(sizeof(float) * nvox) ; /* 03 Jan 2000 */
00561 tlbest = (float *) malloc(sizeof(float) * nvox) ; /* 03 Jan 2000 */
00562 sgbest = (float *) malloc(sizeof(float) * nvox) ; /* 03 Jan 2000 */
00563
00564 if( sgbest == NULL ){
00565 fprintf(stderr,"\n*** 'best' malloc failure in AFNI_fimmer_compute\n") ;
00566 free(vval) ; free(indx) ;
00567 if( aval != NULL ) free(aval) ;
00568 if( rbest != NULL ) free(rbest) ;
00569 if( abest != NULL ) free(abest) ;
00570 if( ibest != NULL ) free(ibest) ; /* 15 Dec 1997 */
00571 if( pbest != NULL ) free(pbest) ; /* 16 Jan 1998 */
00572 if( bbest != NULL ) free(bbest) ; /* 16 Jan 1998 */
00573 if( pval != NULL ) free(pval) ; /* 16 Jan 1998 */
00574 if( bval != NULL ) free(bval) ; /* 16 Jan 1998 */
00575 if( paval != NULL ) free(paval) ; /* 08 Sep 1999 */
00576 if( avval != NULL ) free(avval) ; /* 08 Sep 1999 */
00577 if( pabest!= NULL ) free(pabest); /* 08 Sep 1999 */
00578 if( avbest!= NULL ) free(avbest); /* 08 Sep 1999 */
00579 if( ptval != NULL ) free(ptval) ; /* 03 Jan 2000 */
00580 if( tlval != NULL ) free(tlval) ; /* 03 Jan 2000 */
00581 if( sgval != NULL ) free(sgval) ; /* 03 Jan 2000 */
00582 if( ptbest!= NULL ) free(ptbest); /* 03 Jan 2000 */
00583 if( tlbest!= NULL ) free(tlbest); /* 03 Jan 2000 */
00584 if( sgbest!= NULL ) free(sgbest); /* 03 Jan 2000 */
00585 RETURN(NULL) ;
00586 }
00587 } else {
00588 aval = rbest = abest = pbest = bbest = pval = bval = NULL ;
00589 paval = avval = pabest = avbest = NULL ; /* 08 Sep 1999 */
00590 ptval = tlval = ptbest = tlbest = NULL ; /* 03 Jan 2000 */
00591 sgval = sgbest = NULL ; /* 03 Jan 2000 */
00592 ibest = NULL ; /* 15 Dec 1997 */
00593 }
00594
00595 if(PRINT_TRACING)
00596 { char str[256] ;
00597 sprintf(str,"nxyz = %d nvox = %d",nxyz,nvox) ; STATUS(str) ; }
00598
00599 /*--- FIM: initialize recursive updates ---*/
00600
00601 pc_ref = (PCOR_references **) malloc( sizeof(PCOR_references *) * ny_ref ) ;
00602 pc_vc = (PCOR_voxel_corr **) malloc( sizeof(PCOR_voxel_corr *) * ny_ref ) ;
00603
00604 if( pc_ref == NULL || pc_vc == NULL ){
00605 free(vval) ; free(indx) ; free(pc_ref) ; free(pc_vc) ;
00606 if( aval != NULL ) free(aval) ;
00607 if( rbest != NULL ) free(rbest) ;
00608 if( abest != NULL ) free(abest) ;
00609 if( ibest != NULL ) free(ibest) ; /* 15 Dec 1997 */
00610 if( pbest != NULL ) free(pbest) ; /* 16 Jan 1998 */
00611 if( bbest != NULL ) free(bbest) ; /* 16 Jan 1998 */
00612 if( pval != NULL ) free(pval) ; /* 16 Jan 1998 */
00613 if( bval != NULL ) free(bval) ; /* 16 Jan 1998 */
00614 if( paval != NULL ) free(paval) ; /* 08 Sep 1999 */
00615 if( avval != NULL ) free(avval) ; /* 08 Sep 1999 */
00616 if( pabest!= NULL ) free(pabest); /* 08 Sep 1999 */
00617 if( avbest!= NULL ) free(avbest); /* 08 Sep 1999 */
00618 if( ptval != NULL ) free(ptval) ; /* 03 Jan 2000 */
00619 if( tlval != NULL ) free(tlval) ; /* 03 Jan 2000 */
00620 if( sgval != NULL ) free(sgval) ; /* 03 Jan 2000 */
00621 if( ptbest!= NULL ) free(ptbest); /* 03 Jan 2000 */
00622 if( tlbest!= NULL ) free(tlbest); /* 03 Jan 2000 */
00623 if( sgbest!= NULL ) free(sgbest); /* 03 Jan 2000 */
00624 fprintf(stderr,"\n*** FIM initialization fails in AFNI_fimmer_compute\n") ;
00625 RETURN(NULL) ;
00626 }
00627
00628 ifim = 0 ;
00629 for( ivec=0 ; ivec < ny_ref ; ivec++ ){
00630 pc_ref[ivec] = new_PCOR_references( fim_nref ) ;
00631 pc_vc[ivec] = new_PCOR_voxel_corr( nvox , fim_nref ) ;
00632 if( pc_ref[ivec] == NULL || pc_vc[ivec] == NULL ) ifim++ ;
00633 }
00634
00635 if( ifim > 0 ){
00636 for( ivec=0 ; ivec < ny_ref ; ivec++ ){
00637 free_PCOR_references(pc_ref[ivec]) ;
00638 free_PCOR_voxel_corr(pc_vc[ivec]) ;
00639 }
00640 free(vval) ; free(indx) ; free(pc_ref) ; free(pc_vc) ;
00641 if( aval != NULL ) free(aval) ;
00642 if( rbest != NULL ) free(rbest) ;
00643 if( abest != NULL ) free(abest) ;
00644 if( ibest != NULL ) free(ibest) ; /* 15 Dec 1997 */
00645 if( pbest != NULL ) free(pbest) ; /* 16 Jan 1998 */
00646 if( bbest != NULL ) free(bbest) ; /* 16 Jan 1998 */
00647 if( pval != NULL ) free(pval) ; /* 16 Jan 1998 */
00648 if( bval != NULL ) free(bval) ; /* 16 Jan 1998 */
00649 if( paval != NULL ) free(paval) ; /* 08 Sep 1999 */
00650 if( avval != NULL ) free(avval) ; /* 08 Sep 1999 */
00651 if( pabest!= NULL ) free(pabest); /* 08 Sep 1999 */
00652 if( avbest!= NULL ) free(avbest); /* 08 Sep 1999 */
00653 if( ptval != NULL ) free(ptval) ; /* 03 Jan 2000 */
00654 if( tlval != NULL ) free(tlval) ; /* 03 Jan 2000 */
00655 if( sgval != NULL ) free(sgval) ; /* 03 Jan 2000 */
00656 if( ptbest!= NULL ) free(ptbest); /* 03 Jan 2000 */
00657 if( tlbest!= NULL ) free(tlbest); /* 03 Jan 2000 */
00658 if( sgbest!= NULL ) free(sgbest); /* 03 Jan 2000 */
00659 fprintf(stderr,"\n*** FIM initialization fails in AFNI_fimmer_compute\n") ;
00660 RETURN(NULL) ;
00661 }
00662
00663 /*--- Make a new dataset to hold the output ---*/
00664
00665 STATUS("making new dataset") ;
00666
00667 new_dset = EDIT_empty_copy( dset_time ) ;
00668
00669 if( nbrik == 1 && ucode == 0 ){ /* 1 brick out --> a 'fim' dataset */
00670 it = EDIT_dset_items( new_dset ,
00671 ADN_prefix , new_prefix ,
00672 ADN_malloc_type , DATABLOCK_MEM_MALLOC ,
00673 ADN_type , ISHEAD(dset_time)
00674 ? HEAD_FUNC_TYPE : GEN_FUNC_TYPE ,
00675 ADN_func_type , FUNC_FIM_TYPE ,
00676 ADN_nvals , 1 ,
00677 ADN_datum_all , MRI_short ,
00678 ADN_ntt , 0 ,
00679 ADN_none ) ;
00680 /* 2 bricks, 2nd corr --> 'fico' */
00681 } else if( nbrik == 2 && ibr_corr == 1 && ucode == 0 ){
00682 it = EDIT_dset_items( new_dset ,
00683 ADN_prefix , new_prefix ,
00684 ADN_malloc_type , DATABLOCK_MEM_MALLOC ,
00685 ADN_type , ISHEAD(dset_time)
00686 ? HEAD_FUNC_TYPE : GEN_FUNC_TYPE ,
00687 ADN_func_type , FUNC_COR_TYPE ,
00688 ADN_nvals , 2 ,
00689 ADN_datum_all , MRI_short ,
00690 ADN_ntt , 0 ,
00691 ADN_none ) ;
00692
00693 } else if( nbrik > 0 ){ /* otherwise --> 'fbuc' (bucket) */
00694 it = EDIT_dset_items( new_dset ,
00695 ADN_prefix , new_prefix ,
00696 ADN_malloc_type , DATABLOCK_MEM_MALLOC ,
00697 ADN_type , ISHEAD(dset_time)
00698 ? HEAD_FUNC_TYPE : GEN_FUNC_TYPE ,
00699 ADN_func_type , FUNC_BUCK_TYPE ,
00700 ADN_nvals , nbrik ,
00701 ADN_datum_all , MRI_short ,
00702 ADN_ntt , 0 ,
00703 ADN_none ) ;
00704 } else {
00705 it = 999 ;
00706 }
00707
00708 if( it > 0 ){
00709 fprintf(stderr,
00710 "\n*** EDIT_dset_items error %d in AFNI_fimmer_compute\n",it) ;
00711 THD_delete_3dim_dataset( new_dset , False ) ;
00712 for( ivec=0 ; ivec < ny_ref ; ivec++ ){
00713 free_PCOR_references(pc_ref[ivec]) ;
00714 free_PCOR_voxel_corr(pc_vc[ivec]) ;
00715 }
00716 free(vval) ; free(indx) ; free(pc_ref) ; free(pc_vc) ;
00717 if( aval != NULL ) free(aval) ;
00718 if( rbest != NULL ) free(rbest) ;
00719 if( abest != NULL ) free(abest) ;
00720 if( ibest != NULL ) free(ibest) ; /* 15 Dec 1997 */
00721 if( pbest != NULL ) free(pbest) ; /* 16 Jan 1998 */
00722 if( bbest != NULL ) free(bbest) ; /* 16 Jan 1998 */
00723 if( pval != NULL ) free(pval) ; /* 16 Jan 1998 */
00724 if( bval != NULL ) free(bval) ; /* 16 Jan 1998 */
00725 if( paval != NULL ) free(paval) ; /* 08 Sep 1999 */
00726 if( avval != NULL ) free(avval) ; /* 08 Sep 1999 */
00727 if( pabest!= NULL ) free(pabest); /* 08 Sep 1999 */
00728 if( avbest!= NULL ) free(avbest); /* 08 Sep 1999 */
00729 if( ptval != NULL ) free(ptval) ; /* 03 Jan 2000 */
00730 if( tlval != NULL ) free(tlval) ; /* 03 Jan 2000 */
00731 if( sgval != NULL ) free(sgval) ; /* 03 Jan 2000 */
00732 if( ptbest!= NULL ) free(ptbest); /* 03 Jan 2000 */
00733 if( tlbest!= NULL ) free(tlbest); /* 03 Jan 2000 */
00734 if( sgbest!= NULL ) free(sgbest); /* 03 Jan 2000 */
00735 RETURN(NULL) ;
00736 }
00737
00738 /* modify labels for each brick */
00739
00740 if( ibr_fim >= 0 )
00741 EDIT_BRICK_LABEL( new_dset , ibr_fim , "Fit Coef" ) ;
00742 if( ibr_corr >= 0 )
00743 EDIT_BRICK_LABEL( new_dset , ibr_corr , "Correlation" ) ;
00744 if( ibr_best >= 0 )
00745 EDIT_BRICK_LABEL( new_dset , ibr_best , "Best Index" ) ;
00746 if( ibr_perc >= 0 )
00747 EDIT_BRICK_LABEL( new_dset , ibr_perc , "% Change" ) ;
00748 if( ibr_base >= 0 )
00749 EDIT_BRICK_LABEL( new_dset , ibr_base , "Baseline" ) ;
00750
00751 if( ibr_pave >= 0 )
00752 EDIT_BRICK_LABEL( new_dset , ibr_pave , "% From Ave" ) ; /* 08 Sep 1999 */
00753 if( ibr_aver >= 0 )
00754 EDIT_BRICK_LABEL( new_dset , ibr_aver , "Average" ) ;
00755
00756 if( ibr_ptop >= 0 )
00757 EDIT_BRICK_LABEL( new_dset , ibr_ptop , "% From Top" ) ; /* 03 Jan 2000 */
00758 if( ibr_topl >= 0 )
00759 EDIT_BRICK_LABEL( new_dset , ibr_topl , "Topline" ) ;
00760 if( ibr_sigm >= 0 )
00761 EDIT_BRICK_LABEL( new_dset , ibr_sigm , "Sigma Resid" ) ;
00762
00763 /*-- 30 Aug 1999: set limits on percent change --*/
00764
00765 if( ibr_perc >= 0 || ibr_pave >= 0 || ibr_ptop >= 0 ){
00766 char * cp = my_getenv("AFNI_FIM_PERCENT_LIMIT") ;
00767 if( cp != NULL ){
00768 float tp = strtod(cp,NULL) ;
00769 if( tp > 0.0 ) top_perc = tp ;
00770 }
00771 }
00772
00773 /* create bricks */
00774
00775 STATUS("making output bricks") ;
00776
00777 for( iv=0 ; iv < new_dset->dblk->nvals ; iv++ ){
00778 ptr = malloc( DSET_BRICK_BYTES(new_dset,iv) ) ;
00779 mri_fix_data_pointer( ptr , DSET_BRICK(new_dset,iv) ) ;
00780 }
00781
00782 if( THD_count_databricks(new_dset->dblk) < new_dset->dblk->nvals ){
00783 fprintf(stderr,
00784 "\n*** failure to malloc new bricks in AFNI_fimmer_compute\n") ;
00785 THD_delete_3dim_dataset( new_dset , False ) ;
00786 for( ivec=0 ; ivec < ny_ref ; ivec++ ){
00787 free_PCOR_references(pc_ref[ivec]) ;
00788 free_PCOR_voxel_corr(pc_vc[ivec]) ;
00789 }
00790 free(vval) ; free(indx) ; free(pc_ref) ; free(pc_vc) ;
00791 if( aval != NULL ) free(aval) ;
00792 if( rbest != NULL ) free(rbest) ;
00793 if( abest != NULL ) free(abest) ;
00794 if( ibest != NULL ) free(ibest) ; /* 15 Dec 1997 */
00795 if( pbest != NULL ) free(pbest) ; /* 16 Jan 1998 */
00796 if( bbest != NULL ) free(bbest) ; /* 16 Jan 1998 */
00797 if( pval != NULL ) free(pval) ; /* 16 Jan 1998 */
00798 if( bval != NULL ) free(bval) ; /* 16 Jan 1998 */
00799 if( paval != NULL ) free(paval) ; /* 08 Sep 1999 */
00800 if( avval != NULL ) free(avval) ; /* 08 Sep 1999 */
00801 if( pabest!= NULL ) free(pabest); /* 08 Sep 1999 */
00802 if( avbest!= NULL ) free(avbest); /* 08 Sep 1999 */
00803 if( ptval != NULL ) free(ptval) ; /* 03 Jan 2000 */
00804 if( tlval != NULL ) free(tlval) ; /* 03 Jan 2000 */
00805 if( sgval != NULL ) free(sgval) ; /* 03 Jan 2000 */
00806 if( ptbest!= NULL ) free(ptbest); /* 03 Jan 2000 */
00807 if( tlbest!= NULL ) free(tlbest); /* 03 Jan 2000 */
00808 if( sgbest!= NULL ) free(sgbest); /* 03 Jan 2000 */
00809 RETURN(NULL) ;
00810 }
00811
00812 /*---------------------------------*/
00813 /*--- FIM: do recursive updates ---*/
00814
00815 #ifndef DONT_USE_METER
00816 meter = MCW_popup_meter( im3d->vwid->top_shell , METER_TOP_WIDE ) ;
00817 meter_pold = 0 ;
00818 #endif
00819
00820 STATUS("starting recursive least squares") ;
00821
00822 for( it=itbot ; it < ntime ; it++ ){ /* loop over time */
00823
00824 nnow = 0 ; /* number of updates done at this time point */
00825
00826 for( ivec=0 ; ivec < ny_ref ; ivec++ ){ /* loop over ref vects */
00827
00828 tsar = MRI_FLOAT_PTR(ref_ts) + (ivec*nx_ref) ; /* ptr to vect */
00829 if( tsar[it] >= WAY_BIG ) continue ; /* skip this */
00830
00831 ref_vec[0] = 1.0 ; /* we always supply ort for constant */
00832 for( ip=1 ; ip <= polort ; ip++ ) /* 30 May 1999: */
00833 ref_vec[ip] = ref_vec[ip-1] * ((float)it) ; /* and polynomials */
00834
00835 if( internal_ort ){ /* no external orts */
00836 ref_vec[ip] = tsar[it] ; /* ref value */
00837 } else {
00838 for( iv=0 ; iv < ny_ort ; iv++ ) /* external */
00839 ref_vec[iv+ip] = ortar[it + iv*nx_ort] ; /* orts */
00840
00841 ref_vec[ny_ort+ip] = tsar[it] ; /* ref value */
00842 }
00843
00844 if(PRINT_TRACING)
00845 { char str[256] ;
00846 sprintf(str,"time index=%d ideal[%d]=%f" , it,ivec,tsar[it] ) ;
00847 STATUS(str) ; }
00848
00849 /* process the ort+ref update */
00850
00851 update_PCOR_references( ref_vec , pc_ref[ivec] ) ;
00852
00853 /* first time thru: load data from dataset */
00854
00855 if( nnow == 0 ){
00856 float fac ;
00857 switch( dtyp ){
00858 case MRI_short:{
00859 short * dar = (short *) DSET_ARRAY(dset_time,it) ;
00860 for( iv=0; iv < nvox; iv++ ) vval[iv] = (float) dar[indx[iv]];
00861 }
00862 break ;
00863
00864 case MRI_float:{
00865 float * dar = (float *) DSET_ARRAY(dset_time,it) ;
00866 for( iv=0; iv < nvox; iv++ ) vval[iv] = (float) dar[indx[iv]];
00867 }
00868 break ;
00869
00870 case MRI_byte:{
00871 byte * dar = (byte *) DSET_ARRAY(dset_time,it) ;
00872 for( iv=0; iv < nvox; iv++ ) vval[iv] = (float) dar[indx[iv]];
00873 }
00874 break ;
00875 }
00876 fac = DSET_BRICK_FACTOR(dset_time,it) ; /* 21 Jul 2004: Ooopsie. */
00877 if( fac > 0.0 )
00878 for( iv=0 ; iv < nvox ; iv++ ) vval[iv] *= fac ;
00879 }
00880
00881 /* process the data update */
00882
00883 PCOR_update_float( vval , pc_ref[ivec] , pc_vc[ivec] ) ;
00884 nnow++ ; /* one more update at this time point */
00885 } /* end of loop over ref vects */
00886
00887 if( nnow > 0 ) nupdt++ ; /* number of time points that had updates */
00888
00889 #ifndef DONT_USE_METER
00890 meter_perc = (int) ( 100.0 * nupdt / ngood_ref ) ;
00891 if( meter_perc != meter_pold ){
00892 MCW_set_meter( meter , meter_perc ) ;
00893 meter_pold = meter_perc ;
00894 }
00895 #endif
00896
00897 } /* end of loop over time */
00898
00899 /*-------------------------------------------*/
00900 /*--- Load final results into the dataset ---*/
00901
00902 /*--- set the statistical parameters ---*/
00903
00904 stataux[0] = nupdt ; /* number of points used */
00905 stataux[1] = (ny_ref==1) ? 1 : 2 ; /* number of references */
00906 stataux[2] = fim_nref - 1 ; /* number of orts */
00907 for( iv=3 ; iv < MAX_STAT_AUX ; iv++ ) stataux[iv] = 0.0 ;
00908
00909 if( ibr_corr >= 0 ){
00910 if( new_dset->func_type == FUNC_COR_TYPE )
00911 EDIT_dset_items( new_dset, ADN_stat_aux, stataux, ADN_none ) ;
00912
00913 EDIT_BRICK_TO_FICO( new_dset, ibr_corr, stataux[0],stataux[1],stataux[2] ) ;
00914 }
00915
00916 #ifndef DONT_USE_METER
00917 # define METERIZE(ib) do { meter_perc = (int) ( 100.0 * (ib) / nbrik ) ; \
00918 if( meter_perc != meter_pold ){ \
00919 MCW_set_meter( meter , meter_perc ) ; \
00920 meter_pold = meter_perc ; \
00921 } } while(0)
00922 #else
00923 # define METERIZE(ib) /*nada*/
00924 #endif
00925
00926 /*** Compute brick arrays for new dataset ***/
00927 /* [load scale factors into stataux, too] */
00928
00929 if( ny_ref == 1 ){
00930
00931 /*** Just 1 ref vector --> load values directly into dataset ***/
00932
00933 if( ibr_fim >= 0 ){
00934
00935 STATUS("getting 1 ref alpha") ;
00936
00937 PCOR_get_coef( pc_ref[0] , pc_vc[0] , vval ) ;
00938
00939 topval = 0.0 ;
00940 for( iv=0 ; iv < nvox ; iv++ )
00941 if( fabs(vval[iv]) > topval ) topval = fabs(vval[iv]) ;
00942
00943 bar = DSET_ARRAY( new_dset , ibr_fim ) ;
00944 memset( bar , 0 , sizeof(short)*nxyz ) ;
00945
00946 if( topval > 0.0 ){
00947 topval = MRI_TYPE_maxval[MRI_short] / topval ;
00948 for( iv=0 ; iv < nvox ; iv++ )
00949 bar[indx[iv]] = (short)(topval * vval[iv] + 0.499) ;
00950
00951 stataux[ibr_fim] = 1.0/topval ;
00952 } else {
00953 stataux[ibr_fim] = 0.0 ;
00954 }
00955
00956 METERIZE(ibr_fim) ;
00957 }
00958
00959 if( ibr_corr >= 0 ){
00960
00961 STATUS("getting 1 ref pcor") ;
00962
00963 PCOR_get_pcor( pc_ref[0] , pc_vc[0] , vval ) ;
00964
00965 bar = DSET_ARRAY( new_dset , ibr_corr ) ;
00966 memset( bar , 0 , sizeof(short)*nxyz ) ;
00967
00968 for( iv=0 ; iv < nvox ; iv++ )
00969 bar[indx[iv]] = (short)(FUNC_COR_SCALE_SHORT * vval[iv] + 0.499) ;
00970
00971 stataux[ibr_corr] = 1.0 / FUNC_COR_SCALE_SHORT ;
00972
00973 METERIZE(ibr_corr) ;
00974 }
00975
00976 if( ibr_perc >= 0 ){
00977
00978 STATUS("getting 1 ref perc") ;
00979
00980 PCOR_get_perc( pc_ref[0] , pc_vc[0] , vval , NULL , 0 ) ;
00981
00982 if( top_perc > 0.0 ) EDIT_clip_float( top_perc , nvox , vval ) ;
00983
00984 topval = 0.0 ;
00985 for( iv=0 ; iv < nvox ; iv++ )
00986 if( fabs(vval[iv]) > topval ) topval = fabs(vval[iv]) ;
00987
00988 bar = DSET_ARRAY( new_dset , ibr_perc ) ;
00989 memset( bar , 0 , sizeof(short)*nxyz ) ;
00990
00991 if( topval > 0.0 ){
00992 topval = MRI_TYPE_maxval[MRI_short] / topval ;
00993 for( iv=0 ; iv < nvox ; iv++ )
00994 bar[indx[iv]] = (short)(topval * vval[iv] + 0.499) ;
00995
00996 stataux[ibr_perc] = 1.0/topval ;
00997 } else {
00998 stataux[ibr_perc] = 0.0 ;
00999 }
01000
01001 METERIZE(ibr_perc) ;
01002 }
01003
01004 if( ibr_pave >= 0 ){ /* 08 Sep 1999 */
01005
01006 STATUS("getting 1 ref pave") ;
01007
01008 PCOR_get_perc( pc_ref[0] , pc_vc[0] , vval , NULL , 1 ) ;
01009
01010 if( top_perc > 0.0 ) EDIT_clip_float( top_perc , nvox , vval ) ;
01011
01012 topval = 0.0 ;
01013 for( iv=0 ; iv < nvox ; iv++ )
01014 if( fabs(vval[iv]) > topval ) topval = fabs(vval[iv]) ;
01015
01016 bar = DSET_ARRAY( new_dset , ibr_pave ) ;
01017 memset( bar , 0 , sizeof(short)*nxyz ) ;
01018
01019 if( topval > 0.0 ){
01020 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01021 for( iv=0 ; iv < nvox ; iv++ )
01022 bar[indx[iv]] = (short)(topval * vval[iv] + 0.499) ;
01023
01024 stataux[ibr_pave] = 1.0/topval ;
01025 } else {
01026 stataux[ibr_pave] = 0.0 ;
01027 }
01028
01029 METERIZE(ibr_pave) ;
01030 }
01031
01032 if( ibr_ptop >= 0 ){ /* 03 Jan 2000 */
01033
01034 STATUS("getting 1 ref ptop") ;
01035
01036 PCOR_get_perc( pc_ref[0] , pc_vc[0] , vval , NULL , 2 ) ;
01037
01038 if( top_perc > 0.0 ) EDIT_clip_float( top_perc , nvox , vval ) ;
01039
01040 topval = 0.0 ;
01041 for( iv=0 ; iv < nvox ; iv++ )
01042 if( fabs(vval[iv]) > topval ) topval = fabs(vval[iv]) ;
01043
01044 bar = DSET_ARRAY( new_dset , ibr_ptop ) ;
01045 memset( bar , 0 , sizeof(short)*nxyz ) ;
01046
01047 if( topval > 0.0 ){
01048 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01049 for( iv=0 ; iv < nvox ; iv++ )
01050 bar[indx[iv]] = (short)(topval * vval[iv] + 0.499) ;
01051
01052 stataux[ibr_ptop] = 1.0/topval ;
01053 } else {
01054 stataux[ibr_ptop] = 0.0 ;
01055 }
01056
01057 METERIZE(ibr_ptop) ;
01058 }
01059
01060 if( ibr_base >= 0 ){
01061
01062 STATUS("getting 1 ref base") ;
01063
01064 PCOR_get_perc( pc_ref[0] , pc_vc[0] , NULL , vval , 0 ) ;
01065
01066 topval = 0.0 ;
01067 for( iv=0 ; iv < nvox ; iv++ )
01068 if( fabs(vval[iv]) > topval ) topval = fabs(vval[iv]) ;
01069
01070 bar = DSET_ARRAY( new_dset , ibr_base ) ;
01071 memset( bar , 0 , sizeof(short)*nxyz ) ;
01072
01073 if( topval > 0.0 ){
01074 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01075 for( iv=0 ; iv < nvox ; iv++ )
01076 bar[indx[iv]] = (short)(topval * vval[iv] + 0.499) ;
01077
01078 stataux[ibr_base] = 1.0/topval ;
01079 } else {
01080 stataux[ibr_base] = 0.0 ;
01081 }
01082
01083 METERIZE(ibr_base) ;
01084 }
01085
01086 if( ibr_aver >= 0 ){ /* 08 Sep 1999 */
01087
01088 STATUS("getting 1 ref aver") ;
01089
01090 PCOR_get_perc( pc_ref[0] , pc_vc[0] , NULL , vval , 1 ) ;
01091
01092 topval = 0.0 ;
01093 for( iv=0 ; iv < nvox ; iv++ )
01094 if( fabs(vval[iv]) > topval ) topval = fabs(vval[iv]) ;
01095
01096 bar = DSET_ARRAY( new_dset , ibr_aver ) ;
01097 memset( bar , 0 , sizeof(short)*nxyz ) ;
01098
01099 if( topval > 0.0 ){
01100 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01101 for( iv=0 ; iv < nvox ; iv++ )
01102 bar[indx[iv]] = (short)(topval * vval[iv] + 0.499) ;
01103
01104 stataux[ibr_aver] = 1.0/topval ;
01105 } else {
01106 stataux[ibr_aver] = 0.0 ;
01107 }
01108
01109 METERIZE(ibr_aver) ;
01110 }
01111
01112 if( ibr_topl >= 0 ){ /* 03 Jan 2000 */
01113
01114 STATUS("getting 1 ref topl") ;
01115
01116 PCOR_get_perc( pc_ref[0] , pc_vc[0] , NULL , vval , 2 ) ;
01117
01118 topval = 0.0 ;
01119 for( iv=0 ; iv < nvox ; iv++ )
01120 if( fabs(vval[iv]) > topval ) topval = fabs(vval[iv]) ;
01121
01122 bar = DSET_ARRAY( new_dset , ibr_topl ) ;
01123 memset( bar , 0 , sizeof(short)*nxyz ) ;
01124
01125 if( topval > 0.0 ){
01126 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01127 for( iv=0 ; iv < nvox ; iv++ )
01128 bar[indx[iv]] = (short)(topval * vval[iv] + 0.499) ;
01129
01130 stataux[ibr_topl] = 1.0/topval ;
01131 } else {
01132 stataux[ibr_topl] = 0.0 ;
01133 }
01134
01135 METERIZE(ibr_topl) ;
01136 }
01137
01138 if( ibr_sigm >= 0 ){ /* 03 Jan 2000 */
01139
01140 STATUS("getting 1 ref sigm") ;
01141
01142 PCOR_get_stdev( pc_vc[0] , vval ) ;
01143
01144 topval = 0.0 ;
01145 for( iv=0 ; iv < nvox ; iv++ )
01146 if( fabs(vval[iv]) > topval ) topval = fabs(vval[iv]) ;
01147
01148 bar = DSET_ARRAY( new_dset , ibr_sigm ) ;
01149 memset( bar , 0 , sizeof(short)*nxyz ) ;
01150
01151 if( topval > 0.0 ){
01152 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01153 for( iv=0 ; iv < nvox ; iv++ )
01154 bar[indx[iv]] = (short)(topval * vval[iv] + 0.499) ;
01155
01156 stataux[ibr_sigm] = 1.0/topval ;
01157 } else {
01158 stataux[ibr_sigm] = 0.0 ;
01159 }
01160
01161 METERIZE(ibr_sigm) ;
01162 }
01163
01164 } else {
01165
01166 /*** Multiple references --> find best correlation at each voxel ***/
01167
01168 /*--- get first ref results into abest and rbest (best so far) ---*/
01169
01170 STATUS("getting first ref results") ;
01171
01172 PCOR_get_coef( pc_ref[0] , pc_vc[0] , abest ) ;
01173 PCOR_get_pcor( pc_ref[0] , pc_vc[0] , rbest ) ;
01174 PCOR_get_perc( pc_ref[0] , pc_vc[0] , pbest , bbest , 0 ) ;
01175 PCOR_get_perc( pc_ref[0] , pc_vc[0] , pabest, avbest, 1 ) ;
01176 PCOR_get_perc( pc_ref[0] , pc_vc[0] , ptbest, tlbest, 2 ) ;
01177 PCOR_get_stdev( pc_vc[0] , sgbest ) ;
01178
01179 for( iv=0 ; iv < nvox ; iv++ ) ibest[iv] = 1 ; /* 15 Dec 1997 */
01180
01181 /*--- for each succeeding ref vector,
01182 get results into aval and vval,
01183 if |vval| > |rbest|, then use that result instead ---*/
01184
01185 for( ivec=1 ; ivec < ny_ref ; ivec++ ){
01186
01187 STATUS(" == getting results for next ref") ;
01188
01189 PCOR_get_coef( pc_ref[ivec] , pc_vc[ivec] , aval ) ;
01190 PCOR_get_pcor( pc_ref[ivec] , pc_vc[ivec] , vval ) ;
01191 PCOR_get_perc( pc_ref[ivec] , pc_vc[ivec] , pval , bval , 0 ) ;
01192 PCOR_get_perc( pc_ref[ivec] , pc_vc[ivec] , paval, avval, 1 ) ;
01193 PCOR_get_perc( pc_ref[ivec] , pc_vc[ivec] , ptval, tlval, 2 ) ;
01194 PCOR_get_stdev( pc_vc[ivec] , sgval ) ;
01195
01196 STATUS(" == and finding the best results") ;
01197
01198 for( iv=0 ; iv < nvox ; iv++ ){
01199 if( fabs(vval[iv]) > fabs(rbest[iv]) ){
01200 rbest[iv] = vval[iv] ;
01201 abest[iv] = aval[iv] ;
01202 ibest[iv] = (ivec+1) ; /* 15 Dec 1997 */
01203 pbest[iv] = pval[iv] ; /* Jan 1998 */
01204 bbest[iv] = bval[iv] ;
01205 pabest[iv]= paval[iv] ; /* 08 Sep 1999 */
01206 avbest[iv]= avval[iv] ;
01207 ptbest[iv]= ptval[iv] ; /* 03 Jan 1999 */
01208 tlbest[iv]= tlval[iv] ;
01209 sgbest[iv]= sgval[iv] ;
01210 }
01211 }
01212 }
01213
01214 /*--- at this point, abest and rbest are the best
01215 results, so scale them into the dataset bricks ---*/
01216
01217 /** fim brick **/
01218
01219 if( ibr_fim >= 0 ){
01220
01221 if(PRINT_TRACING)
01222 { char str[256]; sprintf(str,"getting ibr_fim=%d",ibr_fim); STATUS(str); }
01223
01224 topval = 0.0 ;
01225 for( iv=0 ; iv < nvox ; iv++ )
01226 if( fabs(abest[iv]) > topval ) topval = fabs(abest[iv]) ;
01227
01228 bar = DSET_ARRAY( new_dset , ibr_fim ) ;
01229 memset( bar , 0 , sizeof(short)*nxyz ) ;
01230
01231 if( topval > 0.0 ){
01232 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01233 for( iv=0 ; iv < nvox ; iv++ )
01234 bar[indx[iv]] = (short)(topval * abest[iv] + 0.499) ;
01235
01236 stataux[ibr_fim] = 1.0/topval ;
01237 } else {
01238 stataux[ibr_fim] = 0.0 ;
01239 }
01240
01241 METERIZE(ibr_fim) ;
01242 }
01243
01244 /** threshold brick **/
01245
01246 if( ibr_corr >= 0 ){
01247
01248 if(PRINT_TRACING)
01249 { char str[256]; sprintf(str,"getting ibr_corr=%d",ibr_corr); STATUS(str); }
01250
01251 bar = DSET_ARRAY( new_dset , ibr_corr ) ;
01252 memset( bar , 0 , sizeof(short)*nxyz ) ;
01253
01254 for( iv=0 ; iv < nvox ; iv++ )
01255 bar[indx[iv]] = (short)(FUNC_COR_SCALE_SHORT * rbest[iv] + 0.499) ;
01256
01257 stataux[ibr_corr] = 1.0 / FUNC_COR_SCALE_SHORT ;
01258
01259 METERIZE(ibr_corr) ;
01260 }
01261
01262 /** best index brick (15 Dec 1997) */
01263
01264 if( ibr_best >= 0 ){
01265
01266 if(PRINT_TRACING)
01267 { char str[256]; sprintf(str,"getting ibr_best=%d",ibr_best); STATUS(str); }
01268
01269 bar = DSET_ARRAY( new_dset , ibr_best ) ;
01270 memset( bar , 0 , sizeof(short)*nxyz ) ;
01271 for( iv=0 ; iv < nvox ; iv++ ) bar[indx[iv]] = ibest[iv] ;
01272 stataux[ibr_best] = 0.0 ; /* no scaling */
01273
01274 METERIZE(ibr_best) ;
01275 }
01276
01277 /** perc brick */
01278
01279 if( ibr_perc >= 0 ){
01280
01281 if(PRINT_TRACING)
01282 { char str[256]; sprintf(str,"getting ibr_perc=%d",ibr_perc); STATUS(str); }
01283
01284 if( top_perc > 0.0 ) EDIT_clip_float( top_perc , nvox , pbest ) ;
01285
01286 topval = 0.0 ;
01287 for( iv=0 ; iv < nvox ; iv++ )
01288 if( fabs(pbest[iv]) > topval ) topval = fabs(pbest[iv]) ;
01289
01290 bar = DSET_ARRAY( new_dset , ibr_perc ) ;
01291 memset( bar , 0 , sizeof(short)*nxyz ) ;
01292
01293 if( topval > 0.0 ){
01294 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01295 for( iv=0 ; iv < nvox ; iv++ )
01296 bar[indx[iv]] = (short)(topval * pbest[iv] + 0.499) ;
01297
01298 stataux[ibr_perc] = 1.0/topval ;
01299 } else {
01300 stataux[ibr_perc] = 0.0 ;
01301 }
01302
01303 METERIZE(ibr_perc) ;
01304 }
01305
01306 /** pave brick [08 Sep 1999] */
01307
01308 if( ibr_pave >= 0 ){
01309
01310 if(PRINT_TRACING)
01311 { char str[256]; sprintf(str,"getting ibr_pave=%d",ibr_pave); STATUS(str); }
01312
01313 if( top_perc > 0.0 ) EDIT_clip_float( top_perc , nvox , pabest ) ;
01314
01315 topval = 0.0 ;
01316 for( iv=0 ; iv < nvox ; iv++ )
01317 if( fabs(pabest[iv]) > topval ) topval = fabs(pabest[iv]) ;
01318
01319 bar = DSET_ARRAY( new_dset , ibr_pave ) ;
01320 memset( bar , 0 , sizeof(short)*nxyz ) ;
01321
01322 if( topval > 0.0 ){
01323 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01324 for( iv=0 ; iv < nvox ; iv++ )
01325 bar[indx[iv]] = (short)(topval * pabest[iv] + 0.499) ;
01326
01327 stataux[ibr_pave] = 1.0/topval ;
01328 } else {
01329 stataux[ibr_pave] = 0.0 ;
01330 }
01331
01332 METERIZE(ibr_pave) ;
01333 }
01334
01335 /** ptop brick [03 Jan 2000] */
01336
01337 if( ibr_ptop >= 0 ){
01338
01339 if(PRINT_TRACING)
01340 { char str[256]; sprintf(str,"getting ibr_ptop=%d",ibr_ptop); STATUS(str); }
01341
01342 if( top_perc > 0.0 ) EDIT_clip_float( top_perc , nvox , ptbest ) ;
01343
01344 topval = 0.0 ;
01345 for( iv=0 ; iv < nvox ; iv++ )
01346 if( fabs(ptbest[iv]) > topval ) topval = fabs(ptbest[iv]) ;
01347
01348 bar = DSET_ARRAY( new_dset , ibr_ptop ) ;
01349 memset( bar , 0 , sizeof(short)*nxyz ) ;
01350
01351 if( topval > 0.0 ){
01352 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01353 for( iv=0 ; iv < nvox ; iv++ )
01354 bar[indx[iv]] = (short)(topval * ptbest[iv] + 0.499) ;
01355
01356 stataux[ibr_ptop] = 1.0/topval ;
01357 } else {
01358 stataux[ibr_ptop] = 0.0 ;
01359 }
01360
01361 METERIZE(ibr_ptop) ;
01362 }
01363
01364 /** base brick */
01365
01366 if( ibr_base >= 0 ){
01367
01368 if(PRINT_TRACING)
01369 { char str[256]; sprintf(str,"getting ibr_base=%d",ibr_base); STATUS(str); }
01370
01371 topval = 0.0 ;
01372 for( iv=0 ; iv < nvox ; iv++ )
01373 if( fabs(bbest[iv]) > topval ) topval = fabs(bbest[iv]) ;
01374
01375 bar = DSET_ARRAY( new_dset , ibr_base ) ;
01376 memset( bar , 0 , sizeof(short)*nxyz ) ;
01377
01378 if( topval > 0.0 ){
01379 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01380 for( iv=0 ; iv < nvox ; iv++ )
01381 bar[indx[iv]] = (short)(topval * bbest[iv] + 0.499) ;
01382
01383 stataux[ibr_base] = 1.0/topval ;
01384 } else {
01385 stataux[ibr_base] = 0.0 ;
01386 }
01387
01388 METERIZE(ibr_base) ;
01389 }
01390
01391 /** aver brick [08 Sep 1999] */
01392
01393 if( ibr_aver >= 0 ){
01394
01395 if(PRINT_TRACING)
01396 { char str[256]; sprintf(str,"getting ibr_aver=%d",ibr_aver); STATUS(str); }
01397
01398 topval = 0.0 ;
01399 for( iv=0 ; iv < nvox ; iv++ )
01400 if( fabs(avbest[iv]) > topval ) topval = fabs(avbest[iv]) ;
01401
01402 bar = DSET_ARRAY( new_dset , ibr_aver ) ;
01403 memset( bar , 0 , sizeof(short)*nxyz ) ;
01404
01405 if( topval > 0.0 ){
01406 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01407 for( iv=0 ; iv < nvox ; iv++ )
01408 bar[indx[iv]] = (short)(topval * avbest[iv] + 0.499) ;
01409
01410 stataux[ibr_aver] = 1.0/topval ;
01411 } else {
01412 stataux[ibr_aver] = 0.0 ;
01413 }
01414
01415 METERIZE(ibr_aver) ;
01416 }
01417
01418 /** topl brick [03 Jan 2000] */
01419
01420 if( ibr_topl >= 0 ){
01421
01422 if(PRINT_TRACING)
01423 { char str[256]; sprintf(str,"getting ibr_topl=%d",ibr_topl); STATUS(str); }
01424
01425 topval = 0.0 ;
01426 for( iv=0 ; iv < nvox ; iv++ )
01427 if( fabs(tlbest[iv]) > topval ) topval = fabs(tlbest[iv]) ;
01428
01429 bar = DSET_ARRAY( new_dset , ibr_topl ) ;
01430 memset( bar , 0 , sizeof(short)*nxyz ) ;
01431
01432 if( topval > 0.0 ){
01433 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01434 for( iv=0 ; iv < nvox ; iv++ )
01435 bar[indx[iv]] = (short)(topval * tlbest[iv] + 0.499) ;
01436
01437 stataux[ibr_topl] = 1.0/topval ;
01438 } else {
01439 stataux[ibr_topl] = 0.0 ;
01440 }
01441
01442 METERIZE(ibr_topl) ;
01443 }
01444
01445 /** sigm brick [03 Jan 2000]**/
01446
01447 if( ibr_sigm >= 0 ){
01448
01449 if(PRINT_TRACING)
01450 { char str[256]; sprintf(str,"getting ibr_sigm=%d",ibr_sigm); STATUS(str); }
01451
01452 topval = 0.0 ;
01453 for( iv=0 ; iv < nvox ; iv++ )
01454 if( fabs(sgbest[iv]) > topval ) topval = fabs(sgbest[iv]) ;
01455
01456 bar = DSET_ARRAY( new_dset , ibr_sigm ) ;
01457 memset( bar , 0 , sizeof(short)*nxyz ) ;
01458
01459 if( topval > 0.0 ){
01460 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01461 for( iv=0 ; iv < nvox ; iv++ )
01462 bar[indx[iv]] = (short)(topval * sgbest[iv] + 0.499) ;
01463
01464 stataux[ibr_sigm] = 1.0/topval ;
01465 } else {
01466 stataux[ibr_sigm] = 0.0 ;
01467 }
01468
01469 METERIZE(ibr_sigm) ;
01470 }
01471
01472 } /* end of multiple reference case */
01473
01474 /*** Set the brick factors for the new dataset,
01475 no matter how it was computed above. ***/
01476
01477 STATUS("setting brick_fac") ;
01478
01479 (void) EDIT_dset_items( new_dset , ADN_brick_fac , stataux , ADN_none ) ;
01480
01481 #ifndef DONT_USE_METER
01482 MCW_set_meter( meter , 100 ) ;
01483 #endif
01484
01485 /*--- End of recursive updates; now free temporary workspaces ---*/
01486
01487 for( ivec=0 ; ivec < ny_ref ; ivec++ ){
01488 free_PCOR_references(pc_ref[ivec]) ;
01489 free_PCOR_voxel_corr(pc_vc[ivec]) ;
01490 }
01491 free(pc_ref) ; free(pc_vc) ;
01492 if( aval != NULL ) free(aval) ;
01493 if( rbest != NULL ) free(rbest) ;
01494 if( abest != NULL ) free(abest) ;
01495 if( ibest != NULL ) free(ibest) ; /* 15 Dec 1997 */
01496 if( pbest != NULL ) free(pbest) ; /* 16 Jan 1998 */
01497 if( bbest != NULL ) free(bbest) ; /* 16 Jan 1998 */
01498 if( pval != NULL ) free(pval) ; /* 16 Jan 1998 */
01499 if( bval != NULL ) free(bval) ; /* 16 Jan 1998 */
01500 if( paval != NULL ) free(paval) ; /* 08 Sep 1999 */
01501 if( avval != NULL ) free(avval) ; /* 08 Sep 1999 */
01502 if( pabest!= NULL ) free(pabest); /* 08 Sep 1999 */
01503 if( avbest!= NULL ) free(avbest); /* 08 Sep 1999 */
01504 if( ptval != NULL ) free(ptval) ; /* 03 Jan 2000 */
01505 if( tlval != NULL ) free(tlval) ; /* 03 Jan 2000 */
01506 if( sgval != NULL ) free(sgval) ; /* 03 Jan 2000 */
01507 if( ptbest!= NULL ) free(ptbest); /* 03 Jan 2000 */
01508 if( tlbest!= NULL ) free(tlbest); /* 03 Jan 2000 */
01509 if( sgbest!= NULL ) free(sgbest); /* 03 Jan 2000 */
01510
01511 /*-----------------------------------------------------*/
01512 /*--- 01 Feb 2000: execute user specified functions ---*/
01513
01514 ucode_stuff:
01515
01516 #define MAXUFUN 64 /* should be at least sizeof(int) */
01517 #define MAXTS 32 /* number of timeseries to process at once */
01518
01519 if( ucode != 0 ){
01520 MCW_function_list * rlist = &(GLOBAL_library.registered_fim) ;
01521 int uuse[MAXUFUN] , nbrik[MAXUFUN] , brik1[MAXUFUN] ;
01522 void * udata[MAXUFUN] ;
01523 generic_func * ufunc[MAXUFUN] ;
01524 int nuse , uu , newbrik , oldbrik ;
01525 FIMdata fd ;
01526 MRI_IMAGE * tsim ;
01527 float * tsar , * val , ** vbr ;
01528 short * sar ;
01529 int nts , jts , nbad=0 ;
01530 MRI_IMARR * imar ;
01531
01532 /* mark which ones to execute */
01533
01534 for( newbrik=nuse=uu=0 ; uu < rlist->num && nuse < MAXUFUN ; uu++ ){
01535 if( (ucode & (1<<uu)) != 0 ){
01536 uuse [nuse] = uu ;
01537 ufunc[nuse] = rlist->funcs[uu] ; /* user_func for this func */
01538 nbrik[nuse] = rlist->flags[uu] ; /* new bricks for this func */
01539 udata[nuse] = rlist->func_data[uu] ; /* user_data for this func */
01540 brik1[nuse] = newbrik ; /* index of 1st brick */
01541 newbrik += nbrik[nuse] ; /* total number of new bricks */
01542 nuse++ ;
01543 }
01544 }
01545
01546 if( nuse == 0 ) goto final_exit ; /* shouldn't happen */
01547
01548 /* do the initialization calls to the user_func functions */
01549
01550 fd.ref_ts = ref_ts ;
01551 fd.ort_ts = ort_ts ;
01552 fd.nvox = nvox ;
01553 fd.ignore = im3d->fimdata->init_ignore ;
01554 fd.polort = polort ;
01555
01556 #ifndef DONT_USE_METER
01557 MCW_set_meter( meter , 0 ) ; meter_pold = 0.0 ;
01558 #endif
01559
01560 for( uu=0 ; uu < nuse ; uu++ )
01561 #if 0
01562 ufunc[uu]( ntime , NULL , udata[uu] , nbrik[uu] , (void *)(&fd) ) ;
01563 #else
01564 AFNI_CALL_fim_function( ufunc[uu] ,
01565 ntime, NULL, udata[uu], nbrik[uu], &fd ) ;
01566 #endif
01567
01568 /* loop over voxels,
01569 assemble time series,
01570 call functions to put results in val[],
01571 store float outputs in vbr[][] */
01572
01573 vbr = (float **) malloc(sizeof(float *)*newbrik) ;
01574 for( iv=0 ; iv < newbrik ; iv++ )
01575 vbr[iv] = (float *) malloc(sizeof(float)*nvox) ;
01576
01577 val = (float *) malloc(sizeof(float)*newbrik) ;
01578
01579 for( iv=0 ; iv < nvox ; iv+=MAXTS ){
01580 nts = MIN( MAXTS , nvox-iv ) ;
01581 imar = THD_extract_many_series( nts,indx+iv , dset_time ) ;
01582
01583 for( jts=0 ; jts < nts ; jts++ ){
01584 tsim = IMARR_SUBIMAGE(imar,jts) ; /* data */
01585 tsar = MRI_FLOAT_PTR(tsim) ;
01586
01587 for( uu=0 ; uu < nuse ; uu++ ){
01588 #if 0
01589 ufunc[uu]( ntime , tsar , /* func */
01590 udata[uu] , nbrik[uu] , (void *) val ) ;
01591 #else
01592 AFNI_CALL_fim_function( ufunc[uu] ,
01593 ntime, tsar, udata[uu], nbrik[uu], val ) ;
01594 #endif
01595
01596 for( it=0 ; it < nbrik[uu] ; it++ ) /* storage */
01597 vbr[it+brik1[uu]][iv+jts] = val[it] ;
01598 }
01599 }
01600
01601 DESTROY_IMARR(imar) ; /* garbage disposal */
01602
01603 #ifndef DONT_USE_METER
01604 meter_perc = (int) ( 100.0 * iv / nvox ) ;
01605 if( meter_perc != meter_pold ){
01606 MCW_set_meter( meter , meter_perc ) ;
01607 meter_pold = meter_perc ;
01608 }
01609 #endif
01610 }
01611 free(val) ; /* no longer needed */
01612 #ifndef DONT_USE_METER
01613 MCW_set_meter( meter , 100 ) ;
01614 #endif
01615
01616 /* if necessary, make the new dataset now */
01617
01618 if( new_dset != NULL ){
01619 oldbrik = DSET_NVALS(new_dset) ; /* number of bricks it has now */
01620 } else {
01621 oldbrik = 0 ;
01622
01623 new_dset = EDIT_empty_copy( dset_time ) ;
01624
01625 EDIT_dset_items( new_dset ,
01626 ADN_prefix , new_prefix ,
01627 ADN_malloc_type , DATABLOCK_MEM_MALLOC ,
01628 ADN_type , ISHEAD(dset_time)
01629 ? HEAD_FUNC_TYPE : GEN_FUNC_TYPE ,
01630 ADN_func_type , FUNC_BUCK_TYPE ,
01631 ADN_nvals , newbrik ,
01632 ADN_datum_all , MRI_short ,
01633 ADN_ntt , 0 ,
01634 ADN_none ) ;
01635 }
01636
01637 /* for each output brick:
01638 make short space for it,
01639 scale and stored floats into this space ,
01640 attach it to the output dataset as a new brick */
01641
01642 for( iv=0 ; iv < newbrik ; iv++ ){
01643 tsar = vbr[iv] ; /* float data */
01644 topval = 0.0 ; /* find range of data */
01645
01646 nbad += thd_floatscan( nvox , tsar ) ; /* 08 Aug 2000 */
01647
01648 for( it=0 ; it < nvox ; it++ )
01649 if( fabs(tsar[it]) > topval ) topval = fabs(tsar[it]) ;
01650
01651 sar = (short *) calloc(sizeof(short),nxyz) ; /* new brick */
01652
01653 if( topval > 0.0 ){ /* scale to shorts */
01654 topval = MRI_TYPE_maxval[MRI_short] / topval ;
01655 for( it=0 ; it < nvox ; it++ )
01656 sar[indx[it]] = (short)(topval * tsar[it] + 0.499) ;
01657
01658 topval = 1.0/topval ; /* scale factor */
01659 }
01660
01661 free(tsar) ;
01662
01663 if( oldbrik > 0 ){
01664 EDIT_add_brick( new_dset , MRI_short , topval , sar ) ;
01665 } else {
01666 mri_fix_data_pointer( sar , DSET_BRICK(new_dset,iv) ) ;
01667 EDIT_BRICK_FACTOR( new_dset , iv , topval ) ;
01668 }
01669 }
01670 free(vbr) ;
01671
01672 /* do the ending calls to user_func */
01673
01674 for( uu=0 ; uu < nuse ; uu++ )
01675 #if 0
01676 ufunc[uu]( -(brik1[uu]+oldbrik) , NULL ,
01677 udata[uu] , nbrik[uu] , (void *) new_dset ) ;
01678 #else
01679 AFNI_CALL_fim_function( ufunc[uu] ,
01680 -(brik1[uu]+oldbrik) , NULL ,
01681 udata[uu] , nbrik[uu] , new_dset ) ;
01682 #endif
01683
01684 if( nbad > 0 )
01685 fprintf(stderr,
01686 "++ Warning: %d bad floats computed by user fimfuncs!\n\a",
01687 nbad ) ;
01688
01689 } /* 01 Feb 2000: end of user_func addition to FIMming */
01690
01691 final_exit:
01692 free(vval) ; free(indx) ; /* can finally free these */
01693
01694 /*--- Return new dataset ---*/
01695
01696 #ifndef DONT_USE_METER
01697 MCW_popdown_meter(meter) ;
01698 #endif
01699
01700 RETURN(new_dset) ;
01701 }
|
|
||||||||||||||||
|
sigm brick [03 Jan 2000]* Definition at line 1904 of file afni_fimmer.c. References AFNI_3DDATA_VIEW, AFNI_fimmer_compute(), AFNI_fimmer_redisplay(), AFNI_force_adoption(), AFNI_make_descendants(), AFNI_SEE_FUNC_ON, Three_D_View::anat_now, BEEPIT, Three_D_View::dc, MCW_DC::display, DSET_GRAPHABLE, DSET_HEADNAME, ENTRY, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, AFNI_fimmer_type::fimort, AFNI_fimmer_type::fimref, GLOBAL_library, AFNI_library_type::have_dummy_dataset, IM3D_OPEN, AFNI_fimmer_type::init_ignore, ISVALID_SESSION, MRI_IMAGE::name, THD_session::num_dsset, AFNI_fimmer_type::polort, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, Three_D_View::ss_now, AFNI_library_type::sslist, THD_MAX_SESSION_SIZE, THD_write_3dim_dataset(), tross_Append_History(), tross_Copy_History(), and Three_D_View::type. Referenced by AFNI_gra_send_CB().
01905 {
01906 THD_3dim_dataset * new_dset , * dset_time ;
01907 MRI_IMAGE * ref_ts , * ort_ts ;
01908 THD_session * sess ;
01909 int ifunc ;
01910
01911 ENTRY("AFNI_fimmer_execute") ;
01912
01913 if( ! IM3D_OPEN(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
01914 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; EXRETURN ; }
01915
01916 #if 0
01917 dset_time = im3d->anat_now ;
01918 #else
01919 dset_time = im3d->fimdata->fimdset ;
01920 #endif
01921
01922 if( ! DSET_GRAPHABLE(dset_time) ){ XBell(im3d->dc->display,100) ; EXRETURN ; }
01923
01924 ref_ts = im3d->fimdata->fimref ;
01925 ort_ts = im3d->fimdata->fimort ;
01926 if( ref_ts == NULL ){ XBell(im3d->dc->display,100) ; EXRETURN ; }
01927
01928 sess = im3d->ss_now ;
01929 if( ! ISVALID_SESSION(sess) || sess->num_dsset >= THD_MAX_SESSION_SIZE ){
01930 XBell(im3d->dc->display,100) ; EXRETURN ;
01931 }
01932
01933 SHOW_AFNI_PAUSE ;
01934
01935 /*--- Start lots of CPU time ---*/
01936
01937 new_dset = AFNI_fimmer_compute( im3d, dset_time, ref_ts, ort_ts,
01938 sess, code,ucode ) ;
01939
01940 /*--- End lots of CPU time ---*/
01941
01942 if( new_dset == NULL ){
01943 SHOW_AFNI_READY ;
01944 XBell(im3d->dc->display,100) ; EXRETURN ;
01945 }
01946
01947 AFNI_fimmer_redisplay( 1 , im3d , new_dset ) ;
01948 AFNI_SEE_FUNC_ON(im3d) ;
01949
01950 /* Sep 1999: add some history */
01951
01952 { char his[512] ; int hh ;
01953 tross_Copy_History( dset_time , new_dset ) ;
01954 sprintf(his,"afni FIM: 3D+time=%s ignore=%d polort=%d",
01955 DSET_HEADNAME(dset_time) ,
01956 im3d->fimdata->init_ignore , im3d->fimdata->polort ) ;
01957 if( ref_ts->name != NULL ){
01958 hh = strlen(his) ; sprintf(his+hh," ref=%s",ref_ts->name) ;
01959 }
01960 if( ort_ts != NULL && ort_ts->name != NULL ){
01961 hh = strlen(his) ; sprintf(his+hh," ort=%s",ort_ts->name) ;
01962 }
01963 tross_Append_History( new_dset , his ) ;
01964 }
01965
01966 /* write to disk */
01967
01968 (void) THD_write_3dim_dataset( NULL,NULL , new_dset , True ) ;
01969
01970 /*** At this point, FIM is computed and written to disk ***/
01971
01972 AFNI_force_adoption( sess , False ) ;
01973 AFNI_make_descendants( GLOBAL_library.sslist ) ;
01974
01975 SHOW_AFNI_READY ;
01976 EXRETURN ;
01977 }
|
|
||||||||||||||||
|
Definition at line 61 of file afni_fimmer.c. References AFNI_3DDATA_VIEW, AFNI_fimmer_setort(), ENTRY, GLOBAL_library, IM3D_VALID, IMARR_COUNT, IMARR_SUBIMAGE, MCW_choose_cbs::ival, mcwCR_timeseries, MCW_choose_cbs::reason, AFNI_library_type::timeseries, and Three_D_View::type.
00063 {
00064 Three_D_View * im3d = (Three_D_View *) cd ;
00065 int its ;
00066 MRI_IMAGE * tsim ;
00067
00068 ENTRY("AFNI_fimmer_pickort_CB") ;
00069
00070 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
00071 if( cbs->reason != mcwCR_timeseries ) EXRETURN ; /* error */
00072
00073 its = cbs->ival ;
00074 if( its >= 0 && its < IMARR_COUNT(GLOBAL_library.timeseries) ){
00075
00076 tsim = IMARR_SUBIMAGE(GLOBAL_library.timeseries,its) ;
00077 AFNI_fimmer_setort( im3d , tsim ) ;
00078 }
00079
00080 EXRETURN ;
00081 }
|
|
||||||||||||||||
|
Definition at line 36 of file afni_fimmer.c. References AFNI_3DDATA_VIEW, AFNI_fimmer_setref(), ENTRY, Three_D_View::fimdata, GLOBAL_library, IM3D_VALID, IMARR_COUNT, IMARR_SUBIMAGE, MCW_choose_cbs::ival, mcwCR_timeseries, MCW_choose_cbs::reason, AFNI_fimmer_type::refadd_count, AFNI_library_type::timeseries, and Three_D_View::type.
00038 {
00039 Three_D_View * im3d = (Three_D_View *) cd ;
00040 int its ;
00041 MRI_IMAGE * tsim ;
00042
00043 ENTRY("AFNI_fimmer_pickref_CB") ;
00044
00045 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
00046 if( cbs->reason != mcwCR_timeseries ) EXRETURN ; /* error */
00047
00048 its = cbs->ival ;
00049 if( its >= 0 && its < IMARR_COUNT(GLOBAL_library.timeseries) ){
00050
00051 tsim = IMARR_SUBIMAGE(GLOBAL_library.timeseries,its) ;
00052 AFNI_fimmer_setref( im3d , tsim ) ;
00053 im3d->fimdata->refadd_count = 1 ;
00054 }
00055
00056 EXRETURN ;
00057 }
|
|
||||||||||||||||
|
Definition at line 1981 of file afni_fimmer.c. References AFNI_initialize_view(), AFNI_redisplay_func(), AFNI_reset_func_range(), AFNI_set_thr_pval(), Three_D_View::anat_now, DSET_NVALS, THD_session::dsset, ENTRY, AFNI_view_info::fim_index, AFNI_view_info::func_num, THD_session::num_dsset, Three_D_View::ss_now, STATUS, THD_load_statistics(), AFNI_view_info::thr_index, THD_3dim_dataset::view_type, and Three_D_View::vinfo. Referenced by AFNI_fimmer_execute().
01983 {
01984 int ifunc ;
01985 THD_session * sess = im3d->ss_now ;
01986
01987 ENTRY("AFNI_fimmer_redisplay") ;
01988
01989 if( first_call ){
01990
01991 STATUS("first_call mode") ;
01992
01993 /*** Fit the new dataset into its place in the session ***/
01994
01995 ifunc = sess->num_dsset ;
01996 sess->dsset[ifunc][new_dset->view_type] = new_dset ;
01997 sess->num_dsset ++ ;
01998 im3d->vinfo->func_num = ifunc ;
01999
02000 STATUS("loading statistics") ;
02001 THD_load_statistics( new_dset ) ;
02002
02003 im3d->vinfo->fim_index = 0 ;
02004 im3d->vinfo->thr_index = 1 ;
02005 if( DSET_NVALS(new_dset) == 1 ) im3d->vinfo->thr_index = 0 ;
02006
02007 AFNI_initialize_view( im3d->anat_now , im3d ) ;
02008
02009 } else {
02010
02011 STATUS("redisplay mode") ;
02012
02013 /*** Just redisplay the new dataset ***/
02014
02015 STATUS("loading statistics") ;
02016 THD_load_statistics( new_dset ) ;
02017 AFNI_reset_func_range( im3d ) ;
02018 AFNI_set_thr_pval( im3d ) ;
02019
02020 AFNI_redisplay_func( im3d ) ; /* 05 Mar 2002 */
02021 }
02022
02023 EXRETURN ;
02024 }
|
|
||||||||||||
|
Definition at line 197 of file afni_fimmer.c. References AFNI_3DDATA_VIEW, ALLOW_COMPUTE_FIM, Three_D_View::anat_now, drive_MCW_grapher(), DSET_GRAPHABLE, ENTRY, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, graDR_setignore, IM3D_VALID, AFNI_fimmer_type::init_ignore, and Three_D_View::type. Referenced by AFNI_gra_send_CB().
00198 {
00199 int ii ;
00200
00201 ENTRY("AFNI_fimmer_setignore") ;
00202
00203 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
00204
00205 if( im3d->g123 != NULL )
00206 drive_MCW_grapher( im3d->g123 , graDR_setignore , (XtPointer) new_ignore ) ;
00207
00208 if( im3d->g231 != NULL )
00209 drive_MCW_grapher( im3d->g231 , graDR_setignore , (XtPointer) new_ignore ) ;
00210
00211 if( im3d->g312 != NULL )
00212 drive_MCW_grapher( im3d->g312 , graDR_setignore , (XtPointer) new_ignore ) ;
00213
00214 im3d->fimdata->init_ignore = new_ignore ;
00215
00216 if( DSET_GRAPHABLE(im3d->anat_now) )
00217 im3d->fimdata->fimdset = im3d->anat_now ;
00218
00219 ALLOW_COMPUTE_FIM(im3d) ;
00220 EXRETURN ;
00221 }
|
|
||||||||||||
|
Definition at line 141 of file afni_fimmer.c. References AFNI_3DDATA_VIEW, AFNI_ts_in_library(), ALLOW_COMPUTE_FIM, Three_D_View::anat_now, drive_MCW_grapher(), DSET_GRAPHABLE, ENTRY, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, AFNI_fimmer_type::fimort, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, graDR_addort_ts, IM3D_VALID, mri_free(), MRI_IMAGE::name, STATUS, and Three_D_View::type. Referenced by AFNI_fimmer_pickort_CB(), and AFNI_gra_send_CB().
00142 {
00143 int ii ;
00144
00145 ENTRY("AFNI_fimmer_setort") ;
00146
00147 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
00148
00149 if(PRINT_TRACING)
00150 { char str[256] ;
00151 sprintf(str,"setting fimort to %s",
00152 (tsim==NULL) ? "Nothing" : (tsim->name==NULL) ? "NoName" : tsim->name) ;
00153 STATUS(str) ; }
00154
00155 if( im3d->g123 != NULL )
00156 drive_MCW_grapher( im3d->g123 , graDR_addort_ts , (XtPointer) tsim ) ;
00157
00158 if( im3d->g231 != NULL )
00159 drive_MCW_grapher( im3d->g231 , graDR_addort_ts , (XtPointer) tsim ) ;
00160
00161 if( im3d->g312 != NULL )
00162 drive_MCW_grapher( im3d->g312 , graDR_addort_ts , (XtPointer) tsim ) ;
00163
00164 ii = AFNI_ts_in_library( tsim ) ;
00165
00166 if(PRINT_TRACING)
00167 { char str[256] ; sprintf(str,"found new ort in library at ii=%d",ii) ;
00168 STATUS(str) ; }
00169
00170 ii = AFNI_ts_in_library( im3d->fimdata->fimort ) ;
00171
00172 /* 12 Nov 1996: fix problem with freeing old
00173 ort that might be in the library */
00174
00175 if(PRINT_TRACING)
00176 { char str[256] ; sprintf(str,"found old ort in library at ii=%d",ii) ;
00177 STATUS(str) ; }
00178
00179 if( ii < 0 && im3d->fimdata->fimort != NULL ){
00180 mri_free(im3d->fimdata->fimort) ;
00181 STATUS("freed old ort since wasn't in library") ;
00182 }
00183
00184 im3d->fimdata->fimort = tsim ;
00185
00186 if( DSET_GRAPHABLE(im3d->anat_now) )
00187 im3d->fimdata->fimdset = im3d->anat_now ;
00188
00189 ALLOW_COMPUTE_FIM(im3d) ;
00190 EXRETURN ;
00191 }
|
|
||||||||||||
|
Definition at line 227 of file afni_fimmer.c. References AFNI_3DDATA_VIEW, ALLOW_COMPUTE_FIM, Three_D_View::anat_now, drive_MCW_grapher(), DSET_GRAPHABLE, ENTRY, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, graDR_polort, IM3D_VALID, AFNI_fimmer_type::polort, and Three_D_View::type. Referenced by AFNI_gra_send_CB().
00228 {
00229 int ii ;
00230
00231 ENTRY("AFNI_fimmer_setpolort") ;
00232
00233 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
00234
00235 if( im3d->g123 != NULL )
00236 drive_MCW_grapher( im3d->g123 , graDR_polort , (XtPointer) new_polort ) ;
00237
00238 if( im3d->g231 != NULL )
00239 drive_MCW_grapher( im3d->g231 , graDR_polort , (XtPointer) new_polort ) ;
00240
00241 if( im3d->g312 != NULL )
00242 drive_MCW_grapher( im3d->g312 , graDR_polort , (XtPointer) new_polort ) ;
00243
00244 im3d->fimdata->polort = new_polort ;
00245
00246 if( DSET_GRAPHABLE(im3d->anat_now) )
00247 im3d->fimdata->fimdset = im3d->anat_now ;
00248
00249 ALLOW_COMPUTE_FIM(im3d) ;
00250 EXRETURN ;
00251 }
|
|
||||||||||||
|
Definition at line 87 of file afni_fimmer.c. References AFNI_3DDATA_VIEW, AFNI_ts_in_library(), ALLOW_COMPUTE_FIM, Three_D_View::anat_now, drive_MCW_grapher(), DSET_GRAPHABLE, ENTRY, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, AFNI_fimmer_type::fimref, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, graDR_addref_ts, IM3D_VALID, mri_free(), MRI_IMAGE::name, STATUS, and Three_D_View::type. Referenced by AFNI_closedown_3dview(), AFNI_fimmer_pickref_CB(), AFNI_gra_send_CB(), and MAIN_workprocess().
00088 {
00089 int ii ;
00090
00091 ENTRY("AFNI_fimmer_setref") ;
00092
00093 if( ! IM3D_VALID(im3d) || im3d->type != AFNI_3DDATA_VIEW ) EXRETURN ;
00094
00095 if(PRINT_TRACING)
00096 { char str[256] ;
00097 sprintf(str,"setting fimref to %s",
00098 (tsim==NULL) ? "Nothing" : (tsim->name==NULL) ? "NoName" : tsim->name) ;
00099 STATUS(str) ; }
00100
00101 if( im3d->g123 != NULL )
00102 drive_MCW_grapher( im3d->g123 , graDR_addref_ts , (XtPointer) tsim ) ;
00103
00104 if( im3d->g231 != NULL )
00105 drive_MCW_grapher( im3d->g231 , graDR_addref_ts , (XtPointer) tsim ) ;
00106
00107 if( im3d->g312 != NULL )
00108 drive_MCW_grapher( im3d->g312 , graDR_addref_ts , (XtPointer) tsim ) ;
00109
00110 ii = AFNI_ts_in_library( tsim ) ;
00111
00112 if(PRINT_TRACING)
00113 { char str[256] ; sprintf(str,"found new ref in library at ii=%d",ii) ;
00114 STATUS(str) ; }
00115
00116 ii = AFNI_ts_in_library( im3d->fimdata->fimref ) ;
00117
00118 /* 12 Nov 1996: fix problem with freeing old
00119 ref that might be in the library */
00120
00121 if(PRINT_TRACING)
00122 { char str[256] ; sprintf(str,"found old ref in library at ii=%d",ii) ;
00123 STATUS(str) ; }
00124
00125 if( ii < 0 && im3d->fimdata->fimref != NULL ){
00126 mri_free(im3d->fimdata->fimref) ;
00127 STATUS("freed old ref since wasn't in library") ;
00128 }
00129
00130 im3d->fimdata->fimref = tsim ;
00131
00132 if( DSET_GRAPHABLE(im3d->anat_now) )
00133 im3d->fimdata->fimdset = im3d->anat_now ;
00134
00135 ALLOW_COMPUTE_FIM(im3d) ;
00136 EXRETURN ;
00137 }
|
|
||||||||||||||||
|
Definition at line 2117 of file afni_func.c. References AFNI_initialize_view(), Three_D_View::anat_now, AFNI_view_info::anat_num, AFNI_viewing_widgets::choose_anat_pb, AFNI_viewing_widgets::choose_func_pb, AFNI_viewing_widgets::choose_sess_pb, Three_D_View::dc, MCW_DC::display, THD_session::dsset, ENTRY, Three_D_View::fimdata, AFNI_fimmer_type::fimdset, FIRST_VIEW_TYPE, AFNI_view_info::func_num, GLOBAL_library, IM3D_VALID, ISVALID_3DIM_DATASET, MCW_choose_cbs::ival, LAST_VIEW_TYPE, MCW_invert_widget(), MCW_set_bbox(), THD_session::num_dsset, THD_sessionlist::num_sess, AFNI_view_info::sess_num, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, THD_sessionlist::ssar, AFNI_library_type::sslist, AFNI_widget_set::view, AFNI_viewing_widgets::view_bbox, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, and MCW_bbox::wbut. Referenced by AFNI_choose_dataset_CB(), AFNI_drive_switch_anatomy(), AFNI_drive_switch_function(), AFNI_drive_switch_session(), DRAW_finalize_dset_CB(), process_NIML_Node_ROI(), and process_NIML_SUMA_ixyz().
02119 {
02120 Three_D_View *im3d = (Three_D_View *) cd ;
02121 int old_sess , old_anat , old_func , old_view ;
02122 int new_sess=-1 , new_anat=-1 , new_func=-1 , new_view=-1 ;
02123 int ii , vv , ff ;
02124 THD_session *ss_new ;
02125
02126 ENTRY("AFNI_finalize_dataset_CB") ;
02127
02128 if( ! IM3D_VALID(im3d) ) EXRETURN ;
02129
02130 old_sess = im3d->vinfo->sess_num ; /* record current status */
02131 old_anat = im3d->vinfo->anat_num ;
02132 old_func = im3d->vinfo->func_num ;
02133 old_view = im3d->vinfo->view_type ;
02134
02135 /*--- switch sessions ---*/
02136
02137 if( wcall == im3d->vwid->view->choose_sess_pb ){
02138
02139 new_sess = cbs->ival ;
02140 if( new_sess < 0 || new_sess >= GLOBAL_library.sslist->num_sess ){
02141 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */
02142 }
02143
02144 ss_new = GLOBAL_library.sslist->ssar[new_sess] ;
02145
02146 /* find an anat in new session to match current anat */
02147
02148 if( ISVALID_3DIM_DATASET(ss_new->dsset[old_anat][old_view]) ){ /* are OK */
02149 new_anat = old_anat ;
02150 } else {
02151 for( ii=0 ; ii < ss_new->num_dsset ; ii++ )
02152 if( ISVALID_3DIM_DATASET(ss_new->dsset[ii][old_view]) ){
02153 new_anat = ii ; break ;
02154 }
02155 }
02156 if( new_anat < 0 ) new_anat = 0 ; /* use 1st if no match */
02157
02158 /* find a view to fit this chosen anat */
02159
02160 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][old_view]) ){ /* are OK */
02161 new_view = old_view ;
02162 } else {
02163 for( vv=old_view-1 ; vv >= FIRST_VIEW_TYPE ; vv-- ) /* look below */
02164 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][vv]) ) break ;
02165
02166 if( vv >= FIRST_VIEW_TYPE ){ /* found it below */
02167 new_view = vv ;
02168 } else { /* look above */
02169 for( vv=old_view+1 ; vv <= LAST_VIEW_TYPE ; vv++ )
02170 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][vv]) ) break ;
02171
02172 if( vv <= LAST_VIEW_TYPE ){ /* found it above */
02173 new_view = vv ;
02174 } else {
02175 XBell(im3d->dc->display,100) ; EXRETURN ; /* bad news */
02176 }
02177 }
02178 }
02179
02180 /* find a func in new session that fits the new view */
02181
02182 #define FINDAFUNC
02183 #ifdef FINDAFUNC
02184 if( ISVALID_3DIM_DATASET(ss_new->dsset[old_func][new_view]) ){ /* are OK */
02185
02186 new_func = old_func ;
02187 } else {
02188 for( ff=0 ; ff < ss_new->num_dsset ; ff++ ) /* search */
02189 if( ISVALID_3DIM_DATASET(ss_new->dsset[ff][new_view]) ) break ;
02190
02191 if( ff < ss_new->num_dsset ) new_func = ff ; /* found one */
02192 }
02193 if( new_func < 0 ) new_func = 0 ; /* no match */
02194 #else
02195 new_func = old_func ;
02196 #endif
02197
02198 /*--- switch anatomy ---*/
02199
02200 } else if( wcall == im3d->vwid->view->choose_anat_pb ){
02201
02202 new_sess = old_sess ;
02203 ss_new = GLOBAL_library.sslist->ssar[new_sess] ;
02204
02205 new_anat = cbs->ival ;
02206 if( new_anat < 0 || new_anat >= ss_new->num_dsset ){
02207 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */
02208 }
02209
02210 /* find a view to fit this chosen anat */
02211
02212 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][old_view]) ){ /* are OK */
02213 new_view = old_view ;
02214 } else {
02215 for( vv=old_view-1 ; vv >= FIRST_VIEW_TYPE ; vv-- ) /* look below */
02216 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][vv]) ) break ;
02217
02218 if( vv >= FIRST_VIEW_TYPE ){ /* found it below */
02219 new_view = vv ;
02220 } else { /* look above */
02221 for( vv=old_view+1 ; vv <= LAST_VIEW_TYPE ; vv++ )
02222 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_anat][vv]) ) break ;
02223
02224 if( vv <= LAST_VIEW_TYPE ){ /* found it above */
02225 new_view = vv ;
02226 } else {
02227 XBell(im3d->dc->display,100) ; EXRETURN ; /* bad news */
02228 }
02229 }
02230 }
02231
02232 /* find a func to match this view */
02233
02234 #ifdef FINDAFUNC
02235 if( ISVALID_3DIM_DATASET(ss_new->dsset[old_func][new_view]) ){ /* are OK */
02236
02237 new_func = old_func ;
02238 } else {
02239 for( ff=0 ; ff < ss_new->num_dsset ; ff++ ) /* search */
02240 if( ISVALID_3DIM_DATASET(ss_new->dsset[ff][new_view]) ) break ;
02241
02242 if( ff < ss_new->num_dsset ) new_func = ff ; /* found one */
02243 }
02244 if( new_func < 0 ) new_func = 0 ; /* no match */
02245 #else
02246 new_func = old_func ;
02247 #endif
02248
02249 /*--- switch function ---*/
02250
02251 } else if( wcall == im3d->vwid->view->choose_func_pb ){
02252
02253 new_sess = old_sess ;
02254 ss_new = GLOBAL_library.sslist->ssar[new_sess] ;
02255
02256 new_func = cbs->ival ;
02257 if( new_func < 0 || new_func >= ss_new->num_dsset ){
02258 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */
02259 }
02260
02261 /* find a view to fit this chosen func */
02262
02263 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_func][old_view]) ){ /* are OK */
02264 new_view = old_view ;
02265 } else {
02266 for( vv=old_view-1 ; vv >= FIRST_VIEW_TYPE ; vv-- ) /* look below */
02267 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_func][vv]) ) break ;
02268
02269 if( vv >= FIRST_VIEW_TYPE ){ /* found it below */
02270 new_view = vv ;
02271 } else { /* look above */
02272 for( vv=old_view+1 ; vv <= LAST_VIEW_TYPE ; vv++ )
02273 if( ISVALID_3DIM_DATASET(ss_new->dsset[new_func][vv]) ) break ;
02274
02275 if( vv <= LAST_VIEW_TYPE ){ /* found it above */
02276 new_view = vv ;
02277 } else {
02278 XBell(im3d->dc->display,100) ; EXRETURN ; /* bad news */
02279 }
02280 }
02281 }
02282
02283 /* find an anat to go with the new view (this is NOT optional) */
02284
02285 if( ISVALID_3DIM_DATASET(ss_new->dsset[old_anat][new_view]) ){ /* are OK */
02286
02287 new_anat = old_anat ;
02288 } else {
02289 for( ff=0 ; ff < ss_new->num_dsset ; ff++ ) /* search */
02290 if( ISVALID_3DIM_DATASET(ss_new->dsset[ff][new_view]) ) break ;
02291
02292 if( ff < ss_new->num_dsset ) new_anat = ff ; /* found one */
02293 }
02294 if( new_anat < 0 ){
02295 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */
02296 }
02297
02298 /*--- switch to Hell? ---*/
02299
02300 } else {
02301 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */
02302 }
02303
02304 /*--- make sure all values are set OK-ly ---*/
02305
02306 if( new_view < 0 || new_sess < 0 || new_anat < 0 || new_func < 0 ){
02307 XBell( im3d->dc->display , 100 ) ; EXRETURN ; /* bad! */
02308 }
02309
02310 /*- beep & flash viewing control box if view type changes -*/
02311
02312 if( old_view != new_view ){
02313 XBell( im3d->dc->display , 100 ) ;
02314 MCW_set_bbox( im3d->vwid->view->view_bbox , 1 << new_view ) ;
02315 MCW_invert_widget( im3d->vwid->view->view_bbox->wbut[new_view] ) ;
02316 }
02317
02318 /*----- actually do the switch -----*/
02319
02320 if( im3d->vinfo->sess_num != new_sess ) /* disable FIMage in a new session */
02321 im3d->fimdata->fimdset = NULL ;
02322
02323 im3d->vinfo->view_type = new_view ;
02324 im3d->vinfo->sess_num = new_sess ;
02325 im3d->vinfo->anat_num = new_anat ;
02326 im3d->vinfo->func_num = new_func ;
02327
02328 SHOW_AFNI_PAUSE ;
02329 AFNI_initialize_view( im3d->anat_now , im3d ) ;
02330 SHOW_AFNI_READY ;
02331
02332 if( old_view != new_view ){ /* end flash */
02333 XBell( im3d->dc->display , 100 ) ;
02334 MCW_invert_widget( im3d->vwid->view->view_bbox->wbut[new_view] ) ;
02335 }
02336
02337 EXRETURN ;
02338 }
|
|
||||||||||||||||
|
Definition at line 2744 of file afni_func.c. References Three_D_View::dc, MCW_DC::display, ENTRY, far, AFNI_widget_set::file_dialog, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, MRI_FLOAT_PTR, mri_free(), mri_read_1D(), myXtFree, MRI_IMAGE::nvox, MRI_IMAGE::nx, PLUTO_register_timeseries(), RWC_XtPopdown(), and Three_D_View::vwid. Referenced by AFNI_read_1D_CB().
02745 {
02746 Three_D_View *im3d = (Three_D_View *) cd ;
02747 XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) cb ;
02748
02749 ENTRY("AFNI_finalize_read_1D_CB") ;
02750
02751 switch( cbs->reason ){
02752
02753 /** close the file selection dialog **/
02754
02755 case XmCR_CANCEL:
02756 RWC_XtPopdown( im3d->vwid->file_dialog ) ;
02757 break ;
02758
02759 /** try to read a new timeseries **/
02760
02761 case XmCR_OK:{
02762 char *text = NULL ;
02763 MRI_IMAGE *flim ;
02764 float *far ;
02765 int ii ;
02766
02767 XmStringGetLtoR( cbs->value , XmFONTLIST_DEFAULT_TAG , &text ) ;
02768 flim = mri_read_1D( text ) ;
02769 if( flim == NULL || flim->nx < 2 ){
02770 XBell(im3d->dc->display,100) ;
02771 (void) MCW_popup_message( w ,
02772 "********************************\n"
02773 "** Cannot read data from file **\n"
02774 "********************************"
02775 , MCW_USER_KILL | MCW_TIMER_KILL ) ;
02776 myXtFree(text) ;
02777 break ;
02778 }
02779
02780 far = MRI_FLOAT_PTR(flim) ;
02781 for( ii=0 ; ii < flim->nvox ; ii++ )
02782 if( fabs(far[ii]) >= 33333.0 ) far[ii] = WAY_BIG ;
02783
02784 PLUTO_register_timeseries( text , flim ) ;
02785 mri_free(flim) ;
02786 myXtFree(text) ;
02787 RWC_XtPopdown( im3d->vwid->file_dialog ) ;
02788 }
02789 break ;
02790
02791 case XmCR_HELP:
02792 (void) MCW_popup_message( w ,
02793 "To choose a new timeseries, use the\n"
02794 "Directories and Files selectors,\n"
02795 "and the Filter entry and button,\n"
02796 "to get the 'Selection' box correct;\n"
02797 "that is, 'Selection' should show the\n"
02798 "name of the 1D file which will be input.\n"
02799 "Then press 'Set'.\n"
02800 , MCW_USER_KILL ) ;
02801 break ;
02802 }
02803 EXRETURN ;
02804 }
|
|
||||||||||||||||
|
Definition at line 2515 of file afni_func.c. References AFNI_append_sessions(), AFNI_rescan_timeseries_CB(), Three_D_View::dc, destroy_Htable(), MCW_DC::display, AFNI_widget_set::dmode, THD_session::dsset, ENTRY, AFNI_widget_set::file_dialog, GLOBAL_library, AFNI_library_type::have_dummy_dataset, LAST_VIEW_TYPE, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, myXtFree, new_Htable(), THD_session::num_dsset, THD_sessionlist::num_sess, THD_session::parent, PARENTIZE, AFNI_datamode_widgets::read_sess_pb, RWC_XtPopdown(), AFNI_library_type::session, THD_session::sessname, THD_sessionlist::ssar, AFNI_library_type::sslist, STATUS, subsume_Htable(), THD_equiv_files(), THD_init_session(), THD_is_directory(), THD_is_file(), THD_MAX_NUM_SESSION, THD_reconcile_parents(), UNDUMMYIZE, Three_D_View::vwid, THD_session::warptable, and AFNI_library_type::warptable. Referenced by AFNI_read_sess_CB().
02516 {
02517 Three_D_View *im3d = (Three_D_View *) cd ;
02518 XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) cb ;
02519
02520 ENTRY("AFNI_finalize_read_sess_CB") ;
02521
02522 switch( cbs->reason ){
02523
02524 /** close the file selection dialog **/
02525
02526 case XmCR_CANCEL:
02527 RWC_XtPopdown( im3d->vwid->file_dialog ) ;
02528 break ;
02529
02530 /** try to read a new session **/
02531
02532 case XmCR_OK:{
02533 char *text = NULL ;
02534 XmStringGetLtoR( cbs->value , XmFONTLIST_DEFAULT_TAG , &text ) ;
02535 if( text != NULL ){
02536
02537 THD_session *new_ss = NULL ;
02538
02539 /** if the user selected a file, strip it back to a directory **/
02540
02541 if(PRINT_TRACING)
02542 { char str[256] ; sprintf(str,"input text = %s",text) ; STATUS(str) ; }
02543
02544 if( THD_is_file(text) ){
02545 int ii = strlen(text)-1 ;
02546 for( ; ii > 0 && text[ii] != '/' ; ii-- ) text[ii] = '\0' ;
02547
02548 if(PRINT_TRACING)
02549 { char str[256] ; sprintf(str,"defiled text = %s",text) ; STATUS(str) ; }
02550 }
02551
02552 /** if the name given is a directory, try to read it **/
02553
02554 if( THD_is_directory(text) ){
02555 int ii , eq ;
02556 THD_session *old_ss ;
02557
02558 /** 1st check if this is the same as some other session **/
02559
02560 STATUS("comparing to other sessions") ;
02561 for( ii=0 ; ii < GLOBAL_library.sslist->num_sess ; ii++ ){
02562 old_ss = GLOBAL_library.sslist->ssar[ii] ;
02563 eq = THD_equiv_files( old_ss->sessname , text ) ;
02564 if( eq == 1 ) break ;
02565 }
02566
02567 if( eq == 1 ){
02568 STATUS("illegal duplicate session") ;
02569 XBell(im3d->dc->display,100) ;
02570 (void) MCW_popup_message( w ,
02571 "*******************************\n"
02572 "** Illegal duplicate session **\n"
02573 "*******************************"
02574 , MCW_USER_KILL | MCW_TIMER_KILL ) ;
02575 break ;
02576 } else {
02577 STATUS("reading new session") ;
02578 new_ss = THD_init_session( text ) ; /*** Read session! ***/
02579 }
02580 } else { /** wasn't a directory!? **/
02581
02582 STATUS("wasn't a directory") ;
02583 XBell(im3d->dc->display,100) ;
02584 (void) MCW_popup_message( w ,
02585 "***********************************\n"
02586 "** Cannot find session directory **\n"
02587 "***********************************"
02588 , MCW_USER_KILL | MCW_TIMER_KILL ) ;
02589 break ;
02590 }
02591
02592 /** OK, was a directory and we tried to read it **/
02593
02594 if( new_ss == NULL || new_ss->num_dsset == 0 ){ /** failed to read anything **/
02595
02596 STATUS("failed to read new session") ;
02597 XBell(im3d->dc->display,100) ;
02598 (void) MCW_popup_message( w ,
02599 "******************************\n"
02600 "** Cannot read any datasets **\n"
02601 "******************************"
02602 , MCW_USER_KILL | MCW_TIMER_KILL ) ;
02603
02604 } else if( GLOBAL_library.sslist->num_sess >= THD_MAX_NUM_SESSION ){
02605
02606 STATUS("too many sessions") ;
02607 XBell(im3d->dc->display,100) ;
02608 (void) MCW_popup_message( w ,
02609 "****************************\n"
02610 "** Max number of sessions **\n"
02611 "** exceeded -- Sorry! **\n"
02612 "****************************"
02613 , MCW_USER_KILL | MCW_TIMER_KILL ) ;
02614
02615 } else { /** GOOD! Actually process a new session. **/
02616 /** (The following is from AFNI_read_inputs) **/
02617 int qd , vv ;
02618 char str[356] ; /* for messages */
02619
02620 STATUS("processing new session") ;
02621
02622 new_ss->parent = NULL ;
02623
02624 for( qd=0 ; qd < new_ss->num_dsset ; qd++ ) /* parentize */
02625 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ )
02626 PARENTIZE( new_ss->dsset[qd][vv] , NULL ) ;
02627
02628 /* 20 Dec 2001: if have global datasets, put them in here */
02629
02630 AFNI_append_sessions( new_ss , GLOBAL_library.session ) ;
02631
02632 /* if we were living with a dummy, fix that */
02633
02634 if( GLOBAL_library.have_dummy_dataset ) UNDUMMYIZE ;
02635
02636 /* put the new session into place in the list of sessions */
02637
02638 STATUS("adding new session to list") ;
02639 GLOBAL_library.sslist->ssar[GLOBAL_library.sslist->num_sess] = new_ss ;
02640 (GLOBAL_library.sslist->num_sess)++ ;
02641 THD_reconcile_parents( GLOBAL_library.sslist ) ;
02642
02643 sprintf(str," \n Session #%2d"
02644 "\n %s"
02645 "\n %d datasets\n" ,
02646 GLOBAL_library.sslist->num_sess ,
02647 new_ss->sessname, new_ss->num_dsset ) ;
02648
02649 (void) MCW_popup_message( im3d->vwid->dmode->read_sess_pb,
02650 str, MCW_USER_KILL | MCW_TIMER_KILL ) ;
02651
02652 STATUS("rescanning timeseries files") ;
02653 AFNI_rescan_timeseries_CB(NULL,NULL,NULL) ;
02654
02655 /* 28 Aug 2002: deal with warptables */
02656
02657 if( new_ss->warptable != NULL ){
02658 if( GLOBAL_library.warptable == NULL ) /* create global warptable */
02659 GLOBAL_library.warptable = new_Htable(101) ;
02660 subsume_Htable( new_ss->warptable , GLOBAL_library.warptable ) ;
02661 destroy_Htable( new_ss->warptable ) ;
02662 new_ss->warptable = NULL ;
02663 }
02664
02665 RWC_XtPopdown( im3d->vwid->file_dialog ) ;
02666 }
02667
02668 STATUS("freeing 'text' variable") ;
02669 myXtFree(text) ;
02670 }
02671 }
02672 break ;
02673
02674 case XmCR_HELP:
02675 (void) MCW_popup_message( w ,
02676 "To choose a new session, use the\n"
02677 "Directories and Files selectors,\n"
02678 "and the Filter entry and button,\n"
02679 "to get the 'Selection' box correct;\n"
02680 "that is, 'Selection' should either\n"
02681 "be the name of the session directory,\n"
02682 "or the name of a file in the session\n"
02683 "directory. Then press 'Set'.\n"
02684 "\n"
02685 "N.B.: To see datasets in the new\n"
02686 " session, you must use the\n"
02687 " 'Switch Session' button."
02688 , MCW_USER_KILL ) ;
02689 break ;
02690 }
02691 EXRETURN ;
02692 }
|
|
||||||||||||||||
|
Definition at line 2828 of file afni_func.c. References ADDTO_XTARR, AFNI_add_timeseries(), AFNI_initialize_view(), AFNI_view_info::anat_num, MCW_choose_cbs::cval, AFNI_widget_set::dmode, DSET_delete, THD_session::dsset, ENTRY, FREE_XTARR, AFNI_view_info::func_num, GLOBAL_library, AFNI_library_type::have_dummy_dataset, IC_DSET, IC_FLIM, INIT_XTARR, ISVALID_DSET, LAST_VIEW_TYPE, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, mcwCR_string, XtPointer_array::num, THD_session::num_dsset, AFNI_datamode_widgets::read_Web_pb, MCW_choose_cbs::reason, AFNI_view_info::sess_num, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, THD_sessionlist::ssar, AFNI_library_type::sslist, THD_fetch_dataset(), THD_fetch_many_datasets(), THD_MAX_SESSION_SIZE, UNDUMMYIZE, THD_3dim_dataset::view_type, AFNI_view_info::view_type, Three_D_View::vinfo, Three_D_View::vwid, XTARR_IC, and XTARR_XT. Referenced by AFNI_read_Web_CB().
02829 {
02830 Three_D_View *im3d = (Three_D_View *) cd ;
02831 THD_3dim_dataset *dset ;
02832 XtPointer_array *dsar ;
02833 THD_session *ss = GLOBAL_library.sslist->ssar[im3d->vinfo->sess_num] ;
02834 char str[256] ;
02835 int nds,dd,vv , nn, na=-1,nf=-1 ,nts ;
02836
02837 ENTRY("AFNI_finalize_read_Web_CB") ;
02838
02839 if( cbs->reason != mcwCR_string ||
02840 cbs->cval == NULL ||
02841 cbs->cval[0] == '\0' ||
02842 (strstr(cbs->cval,"http://")==NULL && strstr(cbs->cval,"ftp://")==NULL) ){
02843
02844 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb ,
02845 " \n** Illegal URL **\n " ,
02846 MCW_USER_KILL | MCW_TIMER_KILL ) ;
02847
02848 XBell( XtDisplay(w) , 100 ) ; EXRETURN ;
02849 }
02850
02851 /** read a list of datasets? **/
02852
02853 if( strstr(cbs->cval,"AFNILIST") != NULL ){
02854
02855 SHOW_AFNI_PAUSE ;
02856 dsar = THD_fetch_many_datasets( cbs->cval ) ; /* get array of datasets */
02857 SHOW_AFNI_READY ;
02858 if( dsar == NULL || dsar->num == 0 ){
02859 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb ,
02860 " \n"
02861 "** Can't get datasets **\n"
02862 "** from that URL! **\n " ,
02863 MCW_USER_KILL | MCW_TIMER_KILL ) ;
02864 XBell( XtDisplay(w) , 100 ) ; EXRETURN ;
02865 }
02866
02867 } else { /** read one dataset **/
02868
02869 SHOW_AFNI_PAUSE ;
02870 dset = THD_fetch_dataset( cbs->cval ) ;
02871 SHOW_AFNI_READY ;
02872 if( dset == NULL ){
02873 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb ,
02874 " \n"
02875 "** Can't get a dataset **\n"
02876 "** from that URL! **\n " ,
02877 MCW_USER_KILL | MCW_TIMER_KILL ) ;
02878 XBell( XtDisplay(w) , 100 ) ; EXRETURN ;
02879 }
02880 INIT_XTARR(dsar) ; ADDTO_XTARR(dsar,dset) ; XTARR_IC(dsar,0) = IC_DSET ;
02881 }
02882
02883 /** loop over all datasets in array, place in current session **/
02884
02885 for( nts=nds=dd=0 ; dd < dsar->num ; dd++ ){
02886
02887 if( XTARR_IC(dsar,dd) == IC_FLIM ){ /* process a 1D file */
02888 AFNI_add_timeseries( (MRI_IMAGE *) XTARR_XT(dsar,dd) ) ;
02889 nts++ ; continue ;
02890 }
02891 if( XTARR_IC(dsar,dd) != IC_DSET ) continue ; /* bad */
02892
02893 dset = (THD_3dim_dataset *) XTARR_XT(dsar,dd) ;
02894 if( !ISVALID_DSET(dset) ) continue ; /* bad */
02895 vv = dset->view_type ;
02896 nn = ss->num_dsset ;
02897 if( nn >= THD_MAX_SESSION_SIZE ){
02898 fprintf(stderr,"\a\n*** too many anatomical datasets!\n") ;
02899 DSET_delete(dset) ; /* 01 Nov 2001 */
02900 } else {
02901 ss->dsset[nn][vv] = dset ;
02902 ss->num_dsset++ ; nds++ ;
02903 if( vv == im3d->vinfo->view_type && na == -1 ) na = nn ;
02904 }
02905 } /* end of loop over dd=datasets in dsar */
02906
02907 FREE_XTARR(dsar) ;
02908
02909 /*-- popup a message saying what happened --*/
02910
02911 if( nts > 0 )
02912 sprintf(str," \n Read %d datasets and \n"
02913 " %d timeseries from\n"
02914 " %s\n ",nds,nts,cbs->cval ) ;
02915 else
02916 sprintf(str," \n Read %d datasets from\n"
02917 " %s\n ",nds,cbs->cval ) ;
02918
02919 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb ,
02920 str , MCW_USER_KILL | MCW_TIMER_KILL ) ;
02921
02922 if( nds == 0 ){ XBell(XtDisplay(w),100); EXRETURN; }
02923
02924 /*-- prepare to switch back to AFNI --*/
02925
02926 if( na >= 0 ) im3d->vinfo->anat_num = na ; /* 1st new anat in current view */
02927 if( nf >= 0 ) im3d->vinfo->func_num = nf ; /* 1st new func in current view */
02928
02929 if( GLOBAL_library.have_dummy_dataset ){
02930 UNDUMMYIZE ;
02931 if( na < 0 && ss->num_dsset > 1 ){
02932 im3d->vinfo->anat_num = 1 ;
02933 for( vv=0 ; vv <= LAST_VIEW_TYPE ; vv++ ){
02934 if( ISVALID_DSET(ss->dsset[1][vv]) ){ im3d->vinfo->view_type = vv; break; }
02935 }
02936 } else if( na < 0 ){ /* should be impossible */
02937 (void) MCW_popup_message( im3d->vwid->dmode->read_Web_pb ,
02938 " \n** No datasets available **\n " ,
02939 MCW_USER_KILL | MCW_TIMER_KILL ) ;
02940 }
02941 }
02942
02943 AFNI_initialize_view( NULL , im3d ) ;
02944 EXRETURN ;
02945 }
|
|
||||||||||||||||
|
Definition at line 1723 of file afni_splash.c. References AFNI_startup_script_CB(), MCW_choose_cbs::cval, and ENTRY. Referenced by AFNI_run_script_CB().
01724 {
01725 Three_D_View *im3d = (Three_D_View *) cd ;
01726
01727 ENTRY("AFNI_finalrun_script_CB") ;
01728
01729 AFNI_startup_script_CB( (XtPointer) cbs->cval , NULL ) ;
01730 EXRETURN ;
01731 }
|
|
||||||||||||||||
|
Definition at line 1420 of file afni_splash.c. References AFNI_controller_index(), AV_uformat_fval(), BEEPIT, MCW_pbar::bigmode, MCW_pbar::bigtop, AFNI_library_type::controllers, MCW_choose_cbs::cval, AFNI_library_type::dc, Three_D_View::dc, drive_MCW_imseq(), ENTRY, MCW_grapher::fdw_graph, AFNI_function_widgets::frame, AFNI_widget_set::func, AFNI_view_info::func_resam_mode, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, AFNI_view_info::func_visible, MCW_arrowval::fval, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, GLOBAL_library, IM3D_OPEN, MCW_imseq::image_frac, AFNI_function_widgets::inten_pbar, isq, isqDR_getopacity, MCW_DCOV::label_ov, MCW_grapher::mat, MAX_CONTROLLERS, MCW_widget_geom(), MCW_widget_visible(), MIN_PIN, MCW_pbar::mode, MCW_imseq::mont_gap, MCW_imseq::mont_gapcolor, MCW_imseq::mont_nx, MCW_imseq::mont_ny, MCW_imseq::mont_skip, MCW_DCOV::name_ov, MCW_DCOV::ncol_ov, AFNI_widget_set::nplugbut, MCW_pbar::num_panes, MCW_imseq::onoff_state, MCW_pbar::ov_index, MCW_DC::ovc, MCW_grapher::pin_top, AFNI_widget_set::plugint, AFNI_widget_set::pluglab, MCW_pbar::pval, AFNI_function_widgets::range_av, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, THD_filename_ok(), THR_FACTOR, AFNI_view_info::thr_resam_mode, AFNI_widget_set::top_shell, AFNI_view_info::use_autorange, Three_D_View::vinfo, Three_D_View::vwid, and MCW_imseq::wtop. Referenced by AFNI_save_layout_CB().
01421 {
01422 Three_D_View *im3d = (Three_D_View *) cd ;
01423 int cc,ww , gww,ghh,gxx,gyy ;
01424 FILE *fp , *gp ;
01425 MCW_imseq *isq ;
01426 MCW_grapher *gra ;
01427 float ifrac ;
01428 char mont[128] ;
01429 int matrix , pinnum ;
01430
01431 char *abet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
01432 char *wnam[3] = { "axial" , "sagittal" , "coronal" } ;
01433
01434 int ipl , qq , ll ;
01435 char *plab ;
01436
01437 Three_D_View *qm3d = GLOBAL_library.controllers[0]; /* already open */
01438
01439 #ifdef ALLOW_PLUGINS
01440 int npbut = qm3d->vwid->nplugbut; /* how many plugins */
01441 char ** pluglab = qm3d->vwid->pluglab; /* their labels */
01442 PLUGIN_interface ** plugint = qm3d->vwid->plugint; /* their interfaces */
01443 #endif
01444
01445 MCW_DCOV *ovc = GLOBAL_library.dc->ovc ; /* 22 Jan 2003 */
01446 Three_D_View *zm3d ;
01447
01448 ENTRY("AFNI_finalsave_layout_CB") ;
01449
01450 if( strcmp(cbs->cval,".afnirc") == 0 ){ BEEPIT; EXRETURN; } /* 12 Oct 2000 */
01451
01452 /*-- 23 Jan 2003: open layout file if name is "OK", else don't use it --*/
01453
01454 if( THD_filename_ok(cbs->cval) ){
01455 fp = fopen( cbs->cval , "w" ) ;
01456 if( fp == NULL ){ BEEPIT; EXRETURN; }
01457 } else {
01458 fp = NULL ;
01459 }
01460
01461 if( fp != NULL ) fprintf(fp,"\n***LAYOUT\n") ;
01462
01463 /*-- 22 Jan 2002: maybe write a startup script to do same things --*/
01464
01465 if( fp == NULL )
01466 gp = fopen( ".afni.startup_script" , "w" ) ;
01467 else
01468 gp = NULL ;
01469
01470 if( gp != NULL ){
01471
01472 fprintf(gp,"// AFNI startup script, from Datamode->Misc->Save Layout\n") ;
01473
01474 /* put in any extra overlay colors */
01475
01476 for( qq=DEFAULT_NCOLOVR+1 ; qq < ovc->ncol_ov ; qq++ )
01477 fprintf(gp,"ADD_OVERLAY_COLOR %s %s\n",
01478 ovc->name_ov[qq] , ovc->label_ov[qq] ) ;
01479 } else {
01480 if( fp == NULL ){ BEEPIT; EXRETURN; }
01481 }
01482
01483 /*-- loop over controllers --*/
01484
01485 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
01486
01487 /*-- controller open? */
01488
01489 zm3d = GLOBAL_library.controllers[cc] ;
01490
01491 if( !IM3D_OPEN(zm3d) ) continue ; /* skip */
01492
01493 /* print controller info */
01494
01495 MCW_widget_geom( zm3d->vwid->top_shell ,
01496 NULL,NULL , &gxx,&gyy ) ;
01497
01498 if( fp != NULL ) fprintf(fp," %c geom=+%d+%d\n" , abet[cc] , gxx,gyy ) ;
01499
01500 /*-- 22 Jan 2003: parallel output for startup script --*/
01501
01502 if( gp != NULL ){
01503 MCW_pbar *pbar = zm3d->vwid->func->inten_pbar ;
01504
01505 fprintf(gp,"OPEN_WINDOW %c geom=+%d+%d\n" , abet[cc] , gxx,gyy ) ;
01506
01507 if( XtIsManaged(zm3d->vwid->func->frame) )
01508 fprintf(gp,"OPEN_PANEL %c.Define_Overlay\n" , abet[cc] ) ;
01509
01510 fprintf(gp,"SET_THRESHOLD %c.%04d %d\n" , abet[cc] ,
01511 (int)(zm3d->vinfo->func_threshold/THR_FACTOR) ,
01512 (int)(log10(zm3d->vinfo->func_thresh_top)+.01) ) ;
01513
01514 if( !pbar->bigmode ){
01515 fprintf(gp,"SET_PBAR_ALL %c.%c%d" , abet[cc] ,
01516 (pbar->mode) ? '+' : '-' , pbar->num_panes ) ;
01517 for( qq=0 ; qq < pbar->num_panes ; qq++ )
01518 fprintf(gp," %s=%s",
01519 AV_uformat_fval(pbar->pval[qq]) ,
01520 ovc->label_ov[pbar->ov_index[qq]] ) ;
01521 fprintf(gp,"\n") ;
01522 } else {
01523 fprintf(gp,"SET_PBAR_ALL %c.%c%d %f %s\n" , abet[cc] ,
01524 (pbar->mode) ? '+' : '-' , 99 ,
01525 pbar->bigtop , PBAR_get_bigmap(pbar) ) ;
01526 }
01527
01528 fprintf(gp,"SET_FUNC_VISIBLE %c.%c\n" , abet[cc] ,
01529 (zm3d->vinfo->func_visible) ? '+' : '-' ) ;
01530
01531 fprintf(gp,"SET_FUNC_RESAM %c.%s.%s\n" , abet[cc] ,
01532 RESAM_shortstr[zm3d->vinfo->func_resam_mode] ,
01533 RESAM_shortstr[zm3d->vinfo->thr_resam_mode] ) ;
01534
01535 if( im3d->vinfo->use_autorange )
01536 fprintf(gp,"SET_FUNC_AUTORANGE %c.+\n" , abet[cc] ) ;
01537 else
01538 fprintf(gp,"SET_FUNC_RANGE %c.%f\n" , abet[cc] ,
01539 im3d->vwid->func->range_av->fval ) ;
01540
01541 } /* end of startup script stuff */
01542
01543 /*-- loop over image viewers in this controller --*/
01544
01545 for( ww=0 ; ww < 3 ; ww++ ){
01546
01547 isq = (ww == 0) ? zm3d->s123 /* get the image */
01548 :(ww == 1) ? zm3d->s231 /* viewer struct */
01549 : zm3d->s312 ;
01550
01551 if( isq == NULL ) continue ; /* skip */
01552
01553 /* get and print image viewer info */
01554
01555 MCW_widget_geom( isq->wtop , &gww,&ghh , &gxx,&gyy ) ;
01556
01557 ifrac = (isq->onoff_state) ? isq->image_frac : 1.0 ;
01558
01559 if( isq->mont_nx > 1 || isq->mont_ny > 1 ){
01560 sprintf(mont,"%dx%d:%d:%d:%s" ,
01561 isq->mont_nx , isq->mont_ny , isq->mont_skip+1 , isq->mont_gap ,
01562 zm3d->dc->ovc->label_ov[isq->mont_gapcolor]);
01563 } else {
01564 mont[0] = '\0' ;
01565 }
01566
01567 if( fp != NULL ){
01568 if( mont[0] == '\0' ){
01569 fprintf(fp, " %c.%simage geom=%dx%d+%d+%d ifrac=%s\n" ,
01570 abet[cc] , wnam[ww] , gww,ghh,gxx,gyy , AV_uformat_fval(ifrac) ) ;
01571 } else {
01572 fprintf(fp, " %c.%simage geom=%dx%d+%d+%d ifrac=%s mont=%s\n" ,
01573 abet[cc] , wnam[ww] , gww,ghh,gxx,gyy , AV_uformat_fval(ifrac) , mont ) ;
01574 }
01575 }
01576
01577 /*-- 22 Jan 2003: startup script stuff for image viewers --*/
01578
01579 if( gp != NULL ){
01580 int opval=9 ;
01581 drive_MCW_imseq( isq , isqDR_getopacity , &opval ) ;
01582 if( mont[0] == '\0' ){
01583 fprintf(gp, "OPEN_WINDOW %c.%simage geom=+%d+%d ifrac=%s opacity=%d\n" ,
01584 abet[cc] , wnam[ww] , gxx,gyy , AV_uformat_fval(ifrac) , opval ) ;
01585 } else {
01586 fprintf(gp, "OPEN_WINDOW %c.%simage geom=+%d+%d ifrac=%s mont=%s opacity=%d\n" ,
01587 abet[cc] , wnam[ww] , gxx,gyy , AV_uformat_fval(ifrac) , mont , opval ) ;
01588 }
01589 }
01590 }
01591
01592 /*-- loop over graph viewers --*/
01593
01594 for( ww=0 ; ww < 3 ; ww++ ){
01595
01596 gra = (ww == 0) ? zm3d->g123 /* get the graph */
01597 :(ww == 1) ? zm3d->g231 /* viewer struct */
01598 : zm3d->g312 ;
01599
01600 if( gra == NULL ) continue ; /* ERROR */
01601
01602 MCW_widget_geom( gra->fdw_graph , &gww,&ghh , &gxx,&gyy ) ;
01603
01604 pinnum = (gra->pin_top < MIN_PIN) ? 0 : gra->pin_top ;
01605 matrix = gra->mat ;
01606
01607 if( fp != NULL ){
01608 if( pinnum > 0 ){
01609 fprintf(fp , " %c.%sgraph geom=%dx%d+%d+%d matrix=%d pinnum=%d\n" ,
01610 abet[cc] , wnam[ww] , gww,ghh,gxx,gyy , matrix,pinnum ) ;
01611 } else {
01612 fprintf(fp , " %c.%sgraph geom=%dx%d+%d+%d matrix=%d\n" ,
01613 abet[cc] , wnam[ww] , gww,ghh,gxx,gyy , matrix ) ;
01614 }
01615 }
01616
01617 /*-- 22 Jan 2003: startup script stuff for graph viewers --*/
01618
01619 if( gp != NULL ){
01620 if( pinnum > 0 ){
01621 fprintf(gp , "OPEN_WINDOW %c.%sgraph geom=%dx%d+%d+%d matrix=%d pinnum=%d\n" ,
01622 abet[cc] , wnam[ww] , gww,ghh,gxx,gyy , matrix,pinnum ) ;
01623 } else {
01624 fprintf(gp , "OPEN_WINDOW %c.%sgraph geom=%dx%d+%d+%d matrix=%d\n" ,
01625 abet[cc] , wnam[ww] , gww,ghh,gxx,gyy , matrix ) ;
01626 }
01627 }
01628 }
01629
01630 } /* end of loop over controllers */
01631
01632 #ifdef ALLOW_PLUGINS
01633 /*-- loop over plugins --*/
01634
01635 for( ipl=0 ; ipl < npbut ; ipl++ ){
01636
01637 if( plugint[ipl]->wid == NULL || plugint[ipl]->wid->shell == NULL ) continue ;
01638
01639 cc = AFNI_controller_index( plugint[ipl]->im3d ) ;
01640
01641 if( cc < 0 || cc >= MAX_CONTROLLERS || !IM3D_OPEN(plugint[ipl]->im3d) ) continue ;
01642
01643 if( ! MCW_widget_visible(plugint[ipl]->wid->shell) ) continue ;
01644
01645 /* it passed all the test, so get its location */
01646
01647 MCW_widget_geom( plugint[ipl]->wid->shell , &gww,&ghh , &gxx,&gyy ) ;
01648
01649 /* make a label for the plugin, stripping trailing
01650 blanks and replacing interior blanks with underscores */
01651
01652 plab = strdup( pluglab[ipl] ) ;
01653 for( ll=strlen(plab) ; /* truncate trailing blanks */
01654 ll >= 0 && isspace(plab[ll]) ; ll-- ) plab[ll] = '\0' ;
01655 if( ll < 0 ) continue ; /* all blanks?! ERROR */
01656 ll++ ;
01657 for( qq=0 ; qq < ll ; qq++ ) if( isspace(plab[qq]) ) plab[qq] = '_' ;
01658
01659 if( fp != NULL ) fprintf(fp , " %c.plugin.%s geom=+%d+%d\n" ,
01660 abet[cc] , plab , gxx,gyy ) ;
01661 }
01662 #endif
01663
01664 /*-- finito! --*/
01665
01666 if( fp != NULL ) fclose(fp) ;
01667 if( gp != NULL ) fclose(gp) ;
01668 EXRETURN ;
01669 }
|
|
|
Find first open controller [05 Mar 2002]. --------------------------------------------------------------------- Definition at line 7176 of file afni_widg.c. Referenced by new_RT_input(), PLUG_startup_plugin_CB(), PLUTO_popup_worker(), process_NIML_AFNI_dataset(), process_NIML_Node_ROI(), process_NIML_SUMA_crosshair_xyz(), process_NIML_SUMA_ixyz(), and RT_start_dataset(). |
|
||||||||||||
|
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 426 of file afni_func.c. References ADDTO_KILL, AFNI_concatenate_warp(), AFNI_copy_statistics(), THD_3dim_dataset::anat_parent, THD_3dim_dataset::anat_parent_idcode, THD_3dim_dataset::anat_parent_name, THD_datablock::atr, THD_datablock::brick, THD_datablock::brick_bytes, THD_datablock::brick_fac, THD_datablock::brick_lab, THD_diskptr::byte_order, COPY_LMAP_BOUNDS, DATABLOCK_MEM_UNDEFINED, DATABLOCK_TYPE, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, THD_3dim_dataset::death_mark, THD_diskptr::dimsizes, THD_diskptr::directory_name, THD_datablock::diskptr, DISKPTR_TYPE, DSET_HEADNAME, DSET_NUM_TIMES, DSET_unlock, THD_timeaxis::dz_sl, ENTRY, THD_3dim_dataset::func_type, GLOBAL_argopt, THD_3dim_dataset::idcode, IDENTITY_WARP, INIT_KILL, INIT_STAT_AUX, ISVALID_3DIM_DATASET, ISVALID_WARP, THD_3dim_dataset::kl, THD_datablock::kl, THD_3dim_dataset::label1, THD_3dim_dataset::label2, THD_datablock::malloc_type, THD_3dim_dataset::markers, THD_datablock::master_bytes, THD_datablock::master_ival, THD_datablock::master_nvals, MAX_STAT_AUX, MCW_new_idcode, MCW_strncpy, myXtNew, THD_datablock::natr, THD_datablock::natr_alloc, THD_timeaxis::nsl, THD_datablock::nvals, THD_diskptr::nvals, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, THD_datablock::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_copy_datablock_auxdata(), THD_get_write_order(), THD_init_datablock_brick(), THD_init_datablock_labels(), THD_init_diskptr_names(), THD_MAX_LABEL, THD_MAX_NAME, THD_timeaxis::toff_sl, tross_Copy_History(), THD_3dim_dataset::type, THD_warp::type, THD_datablock::type, THD_diskptr::type, THD_3dim_dataset::view_type, THD_3dim_dataset::vox_warp, THD_3dim_dataset::warp, THD_affine_warp::warp, THD_talairach_12_warp::warp, AF_options::warp_4D, WARP_AFFINE_TYPE, THD_3dim_dataset::warp_parent, THD_3dim_dataset::warp_parent_idcode, THD_3dim_dataset::warp_parent_name, WARP_TALAIRACH_12_TYPE, THD_3dim_dataset::wod_daxes, THD_3dim_dataset::wod_flag, and THD_timeaxis::zorg_sl. Referenced by AFNI_make_descendants_old().
00428 {
00429 THD_3dim_dataset *new_dset ;
00430 int ii ;
00431
00432 ENTRY("AFNI_follower_dataset") ;
00433
00434 /* sanity checks */
00435
00436 if( ! ISVALID_3DIM_DATASET(anat_parent) ||
00437 ! ISVALID_3DIM_DATASET(data_parent) ) RETURN(NULL) ;
00438
00439 /* can't warp a time-dependent dataset (OK, maybe you can) */
00440
00441 if( DSET_NUM_TIMES(data_parent) > 1 && ! GLOBAL_argopt.warp_4D ) RETURN(NULL) ;
00442
00443 if(PRINT_TRACING)
00444 { char str[256] ;
00445 sprintf(str,"anat_parent=%s data_parent=%s",
00446 DSET_HEADNAME(anat_parent) , DSET_HEADNAME(data_parent) ) ;
00447 STATUS(str); }
00448
00449 /* make new dataset, copying appropriate fields from its various parents */
00450
00451 new_dset = myXtNew( THD_3dim_dataset ) ; INIT_KILL( new_dset->kl ) ;
00452
00453 new_dset->type = data_parent->type ; /* same data type */
00454 new_dset->func_type = data_parent->func_type ;
00455 new_dset->view_type = anat_parent->view_type ; /* but different view type */
00456
00457 new_dset->anat_parent = anat_parent ; /* what else makes sense? */
00458
00459 new_dset->tagset = NULL ; /* Oct 1998 */
00460
00461 MCW_strncpy( new_dset->anat_parent_name ,
00462 anat_parent->self_name , THD_MAX_NAME ) ;
00463
00464 new_dset->anat_parent_idcode = anat_parent->idcode ;
00465
00466 /* 11/09/94 addition: the data_parent may itself be a warp;
00467 in this case, we want the true warp parent to be the original data */
00468
00469 new_dset->warp_parent = (data_parent->warp_parent != NULL)
00470 ? (data_parent->warp_parent) : (data_parent) ;
00471
00472 MCW_strncpy( new_dset->warp_parent_name ,
00473 new_dset->warp_parent->self_name , THD_MAX_NAME ) ;
00474
00475 new_dset->warp_parent_idcode = new_dset->warp_parent->idcode ;
00476
00477 new_dset->idcode = MCW_new_idcode() ;
00478
00479 /* make the actual warp from the warp_parent to this dataset */
00480
00481 new_dset->vox_warp = NULL ;
00482 new_dset->warp = myXtNew( THD_warp ) ;
00483 *(new_dset->warp) = IDENTITY_WARP ; /* start with (Dicom) identity */
00484 new_dset->self_warp = NULL ; /* 26 Aug 2002 */
00485
00486 /* follow the links backward from desired view to original view */
00487
00488 AFNI_concatenate_warp( new_dset->warp , anat_parent->warp ) ;
00489 AFNI_concatenate_warp( new_dset->warp , data_parent->warp ) ;
00490
00491 /* reset the bounds in the new warp to be the same as in the anat_parent */
00492
00493 if( ISVALID_WARP(anat_parent->warp) &&
00494 anat_parent->warp->type == new_dset->warp->type ){
00495
00496 switch( anat_parent->warp->type ){
00497
00498 case WARP_AFFINE_TYPE:
00499 COPY_LMAP_BOUNDS( new_dset->warp->rig_bod.warp ,
00500 anat_parent->warp->rig_bod.warp ) ;
00501 break ;
00502
00503 case WARP_TALAIRACH_12_TYPE:
00504 for( ii=0 ; ii < 12 ; ii++ )
00505 COPY_LMAP_BOUNDS( new_dset->warp->tal_12.warp[ii] ,
00506 anat_parent->warp->tal_12.warp[ii] ) ;
00507 break ;
00508 }
00509 }
00510
00511 /* make up some names for this new dataset */
00512
00513 MCW_strncpy( new_dset->self_name ,
00514 new_dset->warp_parent->self_name , THD_MAX_NAME ) ;
00515 ii = strlen( new_dset->self_name ) ;
00516 new_dset->self_name[ii++] = '@' ;
00517 MCW_strncpy( &(new_dset->self_name[ii]) ,
00518 VIEW_typestr[new_dset->view_type] , THD_MAX_NAME-ii ) ;
00519
00520 MCW_strncpy( new_dset->label1 , data_parent->label1 , THD_MAX_LABEL ) ;
00521 MCW_strncpy( new_dset->label2 , data_parent->label2 , THD_MAX_LABEL ) ;
00522
00523 /* set the axes for this new dataset
00524 (same as anatomy parent, since that's the meaning of this routine) */
00525
00526 new_dset->daxes = myXtNew( THD_dataxes ) ; /* copy data axes of */
00527 *(new_dset->daxes) = *(anat_parent->daxes) ; /* anatomy parent */
00528
00529 new_dset->wod_daxes = NULL ;
00530 new_dset->wod_flag = True ;
00531
00532 /* 06 Aug 1996: added ability to use 3D+t datasets here */
00533
00534 if( DSET_NUM_TIMES(data_parent) < 2 ){
00535 new_dset->taxis = NULL ;
00536 } else {
00537 new_dset->taxis = myXtNew( THD_timeaxis ) ; /* new */
00538 *(new_dset->taxis) = *(data_parent->taxis) ; /* copy insides */
00539
00540 new_dset->taxis->nsl = 0 ; /* no slice stuff */
00541 new_dset->taxis->toff_sl = NULL ;
00542 new_dset->taxis->zorg_sl = 0.0 ;
00543 new_dset->taxis->dz_sl = 0.0 ;
00544 }
00545
00546 /* create a datablock and diskptr, in case the data is ever
00547 filled into memory (instead of wod) and written to disk */
00548
00549 new_dset->dblk = myXtNew( THD_datablock ) ; INIT_KILL( new_dset->dblk->kl ) ;
00550
00551 new_dset->dblk->type = DATABLOCK_TYPE ;
00552 new_dset->dblk->nvals = data_parent->dblk->nvals ;
00553 new_dset->dblk->malloc_type = DATABLOCK_MEM_UNDEFINED ;
00554 new_dset->dblk->natr = new_dset->dblk->natr_alloc = 0 ;
00555 new_dset->dblk->atr = NULL ;
00556 new_dset->dblk->parent = (XtPointer) new_dset ;
00557
00558 if( data_parent->dblk->brick_lab == NULL ){
00559 THD_init_datablock_labels( new_dset->dblk ) ; /* 30 Nov 1997 */
00560 } else {
00561 THD_copy_datablock_auxdata( data_parent->dblk , new_dset->dblk ) ;
00562 }
00563
00564 DSET_unlock(new_dset) ; /* Feb 1998 */
00565
00566 new_dset->dblk->diskptr = myXtNew( THD_diskptr ) ;
00567 new_dset->dblk->diskptr->type = DISKPTR_TYPE ;
00568 new_dset->dblk->diskptr->nvals = data_parent->dblk->nvals ;
00569 new_dset->dblk->diskptr->rank = 3 ;
00570 new_dset->dblk->diskptr->storage_mode = STORAGE_UNDEFINED ;
00571 new_dset->dblk->diskptr->byte_order = THD_get_write_order() ; /* 25 April 1998 */
00572 new_dset->dblk->diskptr->dimsizes[0] = new_dset->daxes->nxx ;
00573 new_dset->dblk->diskptr->dimsizes[1] = new_dset->daxes->nyy ;
00574 new_dset->dblk->diskptr->dimsizes[2] = new_dset->daxes->nzz ;
00575
00576 new_dset->dblk->brick_fac = NULL ; /* initialized below */
00577 new_dset->dblk->brick_bytes = NULL ;
00578 new_dset->dblk->brick = NULL ;
00579 THD_init_datablock_brick( new_dset->dblk , -1 , data_parent->dblk ) ;
00580
00581 new_dset->dblk->master_nvals = 0 ; /* 11 Jan 1999 */
00582 new_dset->dblk->master_ival = NULL ;
00583 new_dset->dblk->master_bytes = NULL ;
00584
00585 /* create the names for storage on disk (if ever)
00586 -- note we put it in the same directory as the data_parent */
00587
00588 THD_init_diskptr_names( new_dset->dblk->diskptr ,
00589 data_parent->dblk->diskptr->directory_name , NULL ,
00590 data_parent->dblk->diskptr->prefix ,
00591 new_dset->view_type , True ) ;
00592
00593 ADDTO_KILL( new_dset->dblk->kl , new_dset->dblk->diskptr ) ;
00594
00595 /* oh yeah, set the new_dset kill list,
00596 copy statistics if available, and NULL out any unused stuff */
00597
00598 ADDTO_KILL( new_dset->kl , new_dset->warp ) ;
00599 ADDTO_KILL( new_dset->kl , new_dset->daxes ) ;
00600 ADDTO_KILL( new_dset->kl , new_dset->dblk ) ;
00601
00602 new_dset->stats = NULL ;
00603 AFNI_copy_statistics( data_parent , new_dset ) ;
00604
00605 INIT_STAT_AUX( new_dset , MAX_STAT_AUX , data_parent->stat_aux ) ;
00606
00607 new_dset->markers = NULL ; /* no markers */
00608 new_dset->death_mark = 0 ; /* don't kill me! */
00609 new_dset->tcat_list = 0 ;
00610 new_dset->tcat_num = 0 ;
00611 new_dset->tcat_len = NULL ;
00612
00613 #ifdef ALLOW_DATASET_VLIST
00614 new_dset->pts = NULL ;
00615 #endif
00616
00617 PARENTIZE(new_dset,data_parent->parent) ;
00618
00619 tross_Copy_History( data_parent , new_dset ) ; /* 18 Oct 1999 */
00620
00621 RETURN(new_dset) ;
00622 }
|
|
||||||||||||
|
Definition at line 765 of file afni_func.c. References AFNI_noenv(), THD_3dim_dataset::anat_parent, DSET_HEADNAME, DSET_in_global_session(), THD_session::dsset, ENTRY, GLOBAL_library, ISANAT, ISVALID_3DIM_DATASET, ISVALID_DSET, ISVALID_SESSION, LAST_VIEW_TYPE, THD_session::lastname, THD_3dim_dataset::markers, THD_session::num_dsset, THD_marker_set::numset, AFNI_library_type::session, STATUS, and VIEW_ORIGINAL_TYPE. Referenced by AFNI_fimmer_execute(), AFNI_marks_transform_CB(), AFNI_read_inputs(), AFNI_rescan_session_NEW(), AFNI_rescan_session_OLD(), PLUTO_add_dset(), and RT_tell_afni_one().
00766 {
00767 int aa , ff , vv , apref=0 , aset=-1 ;
00768 THD_3dim_dataset *dset ;
00769 int quiet = !AFNI_noenv("AFNI_NO_ADOPTION_WARNING") ; /* 03 Dec 1999 */
00770 int first = 1 ;
00771
00772 ENTRY("AFNI_force_adoption") ;
00773
00774 if( ! ISVALID_SESSION(ss) || ss->num_dsset == 0 ) EXRETURN ;
00775
00776 if( ss == GLOBAL_library.session ) EXRETURN ; /* 21 Dec 2001 */
00777
00778 /* find a "preferred" parent (one with the most number of markers set) */
00779
00780 for( aa=0 ; aa < ss->num_dsset ; aa++ ){
00781
00782 if(PRINT_TRACING)
00783 { char str[256] ;
00784 sprintf(str,"scanning dataset %d for markers",aa) ; STATUS(str) ; }
00785
00786 dset = ss->dsset[aa][0] ; /* original view */
00787
00788 if( ISVALID_3DIM_DATASET(dset) && /* if a good dataset */
00789 ISANAT(dset) && /* and is anatomical */
00790 dset->markers != NULL ){ /* and has markers */
00791
00792 if( dset->markers->numset > aset ){ /* and has more markers than before */
00793 apref = aa ; /* try this as our "preferred" parent */
00794 aset = dset->markers->numset ;
00795 }
00796 }
00797 }
00798
00799 /* count potential parents [08 Dec 1999: modified from 03 Dec 1999 code] */
00800
00801 vv = 0 ;
00802 if( aset >= 0 ){
00803 for( aa=0 ; aa < ss->num_dsset ; aa++ ){
00804 dset = ss->dsset[aa][0] ;
00805 if( ISVALID_DSET(dset) &&
00806 ISANAT(dset) &&
00807 dset->markers != NULL && dset->markers->numset >= aset ) vv++ ;
00808 }
00809 }
00810
00811 quiet = ( quiet || vv <= 1 ) ; /* be quiet if ordered, or if no alternatives */
00812
00813 if(aset >= 0 && PRINT_TRACING)
00814 { char str[256] ;
00815 sprintf(str,"session %s: apref=%d [%s] aset=%d",
00816 ss->lastname,apref,DSET_HEADNAME(ss->dsset[apref][0]),aset) ;
00817 STATUS(str) ; }
00818
00819 /* scan through all datasets, all views */
00820
00821 for( ff=0 ; ff < ss->num_dsset ; ff++ ){
00822 for( vv=VIEW_ORIGINAL_TYPE ; vv <= LAST_VIEW_TYPE ; vv++ ){
00823
00824 dset = ss->dsset[ff][vv] ; /* function that needs parent */
00825
00826 if( ! ISVALID_3DIM_DATASET(dset) ||
00827 dset->anat_parent != NULL ) continue ; /* nothing to do */
00828
00829 if( !do_anats && ISANAT(dset) ) continue ; /* 28 Jul 2003 */
00830
00831 if( DSET_in_global_session(dset) ) continue ; /* 25 Dec 2001 */
00832
00833 if( ISVALID_3DIM_DATASET(ss->dsset[apref][vv]) ){ /* if preferred is OK, */
00834 dset->anat_parent = ss->dsset[apref][vv] ; /* use it here */
00835 } else {
00836 for( aa=0 ; aa < ss->num_dsset ; aa++ ){ /* search for something, */
00837 if( ISVALID_3DIM_DATASET(ss->dsset[aa][vv])
00838 && ISANAT(ss->dsset[aa][vv]) ){ /* anything, and use it */
00839 dset->anat_parent = ss->dsset[aa][vv] ; break ;
00840 }
00841 }
00842 }
00843
00844 if( !quiet && dset->anat_parent != NULL && dset->anat_parent != dset ){
00845 if( first ){
00846 first = 0 ;
00847 fprintf(stderr,
00848 "\nDatasets with a 'forced adoption' of anat parent:\n") ;
00849 }
00850 fprintf(stderr,
00851 " %s gets parent %s\n",
00852 DSET_HEADNAME(dset) ,
00853 DSET_HEADNAME(dset->anat_parent) ) ;
00854 }
00855 }
00856 }
00857
00858 EXRETURN ;
00859 }
|
|
||||||||||||
|
Definition at line 459 of file Vecwarp.c.
00460 {
00461 THD_fvec3 new_fv ;
00462
00463 if( warp == NULL ) return old_fv ;
00464
00465 switch( warp->type ){
00466
00467 default: new_fv = old_fv ; break ;
00468
00469 case WARP_TALAIRACH_12_TYPE:{
00470 THD_linear_mapping map ;
00471 int iw ;
00472
00473 /* forward transform each possible case,
00474 and test if result is in bot..top of defined map */
00475
00476 for( iw=0 ; iw < 12 ; iw++ ){
00477 map = warp->tal_12.warp[iw] ;
00478 new_fv = MATVEC_SUB(map.mfor,old_fv,map.bvec) ;
00479
00480 if( new_fv.xyz[0] >= map.bot.xyz[0] &&
00481 new_fv.xyz[1] >= map.bot.xyz[1] &&
00482 new_fv.xyz[2] >= map.bot.xyz[2] &&
00483 new_fv.xyz[0] <= map.top.xyz[0] &&
00484 new_fv.xyz[1] <= map.top.xyz[1] &&
00485 new_fv.xyz[2] <= map.top.xyz[2] ) break ; /* leave loop */
00486 }
00487 }
00488 break ;
00489
00490 case WARP_AFFINE_TYPE:{
00491 THD_linear_mapping map = warp->rig_bod.warp ;
00492 new_fv = MATVEC_SUB(map.mfor,old_fv,map.bvec) ;
00493 }
00494 break ;
00495
00496 }
00497 return new_fv ;
00498 }
|
|
||||||||||||
|
Make a functional overlay -- very simple routine at present; n = slice index , br_fim = data structure to extract slice from. Note that imseq requires that the overlay be an image of shorts. This routine requires that the function and threshold images be bytes, shorts, or floats (complex-valued functional images are not supported). (The underlay image may be any legal type; this image is not used here.) ------------------------------------------------------------------------- Definition at line 937 of file afni_func.c. References AFNI_CALL_0D_function, AFNI_CALL_2D_function, AFNI_GOOD_FUNC_DTYPE, AFNI_newfunc_overlay(), AFNI_reset_func_range(), AFNI_set_valabel(), AFNI_yesenv(), MCW_pbar::bigbot, MCW_pbar::bigcolor, MCW_pbar::bigmode, MCW_pbar::bigtop, FD_brick::dset, DSET_BRICK_FACTOR, DSET_load, DSET_NVALS, MRI_IMAGE::dx, MRI_IMAGE::dy, ENTRY, FD_warp_to_mri(), AFNI_view_info::fim_autorange, AFNI_view_info::fim_index, Three_D_View::fim_now, AFNI_view_info::fim_range, AFNI_widget_set::func, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, AFNI_view_info::func_val, ind, AFNI_function_widgets::inten_pbar, KILL_1MRI, MRI_IMAGE::kind, LOAD_DSET_VIEWS, MRI_BYTE_PTR, mri_copy(), mri_edgize(), MRI_FLOAT_PTR, mri_free(), mri_maxabs(), mri_new(), mri_rgb_transform_nD(), MRI_SHORT_PTR, mri_threshold(), mri_to_float(), MRI_TYPE_NAME, NPANE_MAX, MCW_pbar::num_panes, MRI_IMAGE::nvox, MRI_IMAGE::nx, MRI_IMAGE::ny, MCW_pbar::ov_index, FD_brick::parent, AFNI_function_widgets::pbar_transform0D_func, AFNI_function_widgets::pbar_transform2D_func, MCW_pbar::pval, RETURN, AFNI_view_info::stats_func_ok, AFNI_view_info::stats_thresh_ok, STATUS, AFNI_view_info::thr_index, AFNI_view_info::thr_val, AFNI_view_info::use_posfunc, Three_D_View::vinfo, Three_D_View::vwid, and ZREJ. Referenced by AFNI_overlay().
00938 {
00939 Three_D_View *im3d ;
00940 MRI_IMAGE *im_thr , *im_fim , *im_ov ;
00941 short *ar_ov ;
00942 short fim_ovc[NPANE_MAX+1] ;
00943 int npix , ii , lp , num_lp , ival ;
00944 float scale_factor , scale_thr ;
00945 MCW_pbar *pbar ;
00946 int simult_thr , need_thr ;
00947 int reject_zero = !AFNI_yesenv("AFNI_OVERLAY_ZERO") ; /* 20 Apr 2005 */
00948
00949 ENTRY("AFNI_func_overlay") ;
00950
00951 /* sanity check */
00952
00953 if( br_fim == NULL || n < 0 ) RETURN(NULL) ; /* nothing to do */
00954
00955 im3d = (Three_D_View *) br_fim->parent ;
00956
00957 ival = im3d->vinfo->thr_index ; /* threshold sub-brick index */
00958
00959 /* get the component images */
00960
00961 LOAD_DSET_VIEWS(im3d) ; /* 02 Nov 1996 */
00962
00963 need_thr = im3d->vinfo->func_threshold > 0.0 ;
00964
00965 /* 29 Mar 2005: make sure statistics of overlay dataset are ready */
00966
00967 DSET_load( im3d->fim_now ) ;
00968 if( !im3d->vinfo->stats_func_ok || (!im3d->vinfo->stats_thresh_ok && need_thr) )
00969 AFNI_reset_func_range( im3d ) ;
00970
00971 /* get the threshold image? */
00972
00973 if( need_thr ){
00974 STATUS("fetch im_thr") ;
00975 im_thr = FD_warp_to_mri( n , ival , br_fim ) ;
00976 } else{
00977 STATUS("don't need im_thr") ;
00978 im_thr = NULL ;
00979 }
00980
00981 #if 1
00982 scale_thr = 1.0f ; /* FD_warp_to_mri() already scales this */
00983 #else
00984 scale_thr = DSET_BRICK_FACTOR(br_fim->dset,ival) ;
00985 if( scale_thr == 0.0f ) scale_thr = 1.0f ;
00986 #endif
00987
00988 /* get function image */
00989
00990 { int ind ;
00991
00992 ind = im3d->vinfo->fim_index ;
00993 if( ind >= DSET_NVALS(br_fim->dset) )
00994 ind = DSET_NVALS(br_fim->dset) - 1 ;
00995
00996 if( im_thr != NULL && ind == ival ){ /* 06 Feb 2003: allow for */
00997 STATUS("copy im_thr to im_fim") ;
00998 im_fim = mri_copy( im_thr ) ; /* func image = thr image */
00999 } else {
01000 STATUS("fetch im_fim") ;
01001 im_fim = FD_warp_to_mri( n, ind, br_fim ) ; /* get func image */
01002 }
01003 scale_factor = im3d->vinfo->fim_range ;
01004 if( scale_factor == 0.0 ) scale_factor = im3d->vinfo->fim_autorange ;
01005 if( scale_factor == 0.0 ) scale_factor = 1.0 ;
01006
01007 AFNI_set_valabel( br_fim , n , im_fim , im3d->vinfo->func_val ) ;
01008 }
01009
01010 /* 04 Mar 2003: convert thresh to float if its datum is unacceptable */
01011 /* 21 Dec 2004: also allow RGB images as threshold via this mechanism */
01012
01013 if( im_thr != NULL && !(im_thr->kind == MRI_float ||
01014 im_thr->kind == MRI_short ||
01015 im_thr->kind == MRI_byte ) ){
01016
01017 MRI_IMAGE *qim = mri_to_float(im_thr) ;
01018 STATUS("scaled im_thr to floats") ;
01019 mri_free(im_thr) ; im_thr = qim ; scale_thr = 1.0f ;
01020 }
01021
01022 AFNI_set_valabel( br_fim , n , im_thr , im3d->vinfo->thr_val ) ;
01023
01024 /* if component images not good, quit now */
01025
01026 if( im_fim == NULL ){
01027 STATUS("couldn't get Func image!") ;
01028 KILL_1MRI(im_thr) ; RETURN(NULL) ;
01029 }
01030
01031 /* 15 Apr 2002: allow overlay image to be pure RBG (no colorscale) */
01032 /* 20 Dec 2004: allow thresholding of RGB overlays */
01033
01034 if( im_fim->kind == MRI_rgb ){ /* 15 Apr 2002: RGB overlays */
01035
01036 if( im_thr != NULL && im_thr != im_fim ){ /* 20 Dec 2004: threshold */
01037 float thresh = im3d->vinfo->func_threshold
01038 * im3d->vinfo->func_thresh_top / scale_thr ;
01039 mri_threshold( -thresh,thresh , im_thr , im_fim ) ; /* in place */
01040 }
01041
01042 /* 27 Apr 2005: transform RGB func image in place? */
01043
01044 mri_rgb_transform_nD( im_fim, 0, im3d->vwid->func->pbar_transform0D_func );
01045 mri_rgb_transform_nD( im_fim, 2, im3d->vwid->func->pbar_transform2D_func );
01046
01047 if( im_thr != im_fim ) KILL_1MRI(im_thr) ; /* toss the trash */
01048 RETURN(im_fim) ;
01049 }
01050
01051 if( ! AFNI_GOOD_FUNC_DTYPE(im_fim->kind) ){ /* should never happen! */
01052 MRI_IMAGE *qim = mri_to_float(im_fim) ; /* (but fix it if it does) */
01053 STATUS("had to convert im_fim to floats?????") ;
01054 mri_free(im_fim) ; im_fim = qim ;
01055 }
01056
01057 /* 15 Jun 2000: transformation of functional image? */
01058
01059 if( im3d->vwid->func->pbar_transform0D_func != NULL ){
01060 MRI_IMAGE *tim = mri_to_float(im_fim) ;
01061 STATUS("transform0D of im_fim") ;
01062 #if 0
01063 im3d->vwid->func->pbar_transform0D_func( tim->nvox , MRI_FLOAT_PTR(tim) ) ;
01064 #else
01065 AFNI_CALL_0D_function( im3d->vwid->func->pbar_transform0D_func ,
01066 tim->nvox , MRI_FLOAT_PTR(tim) ) ;
01067 #endif
01068 if( im_fim != im_thr ) mri_free(im_fim) ;
01069 im_fim = tim ;
01070 }
01071
01072 if( im3d->vwid->func->pbar_transform2D_func != NULL ){
01073 MRI_IMAGE *tim = mri_to_float(im_fim) ;
01074 STATUS("transform2D of im_fim") ;
01075 #if 0
01076 im3d->vwid->func->pbar_transform2D_func( tim->nx, tim->ny,
01077 tim->dx, tim->dy,
01078 MRI_FLOAT_PTR(tim) ) ;
01079 #else
01080 AFNI_CALL_2D_function( im3d->vwid->func->pbar_transform2D_func ,
01081 tim->nx, tim->ny, tim->dx, tim->dy, MRI_FLOAT_PTR(tim) ) ;
01082 #endif
01083 if( im_fim != im_thr ) mri_free(im_fim) ;
01084 im_fim = tim ;
01085 }
01086
01087 pbar = im3d->vwid->func->inten_pbar ;
01088
01089 /** 30 Jan 2003:
01090 if the pbar is in "big" mode,
01091 then create an RGB overlay in a separate function **/
01092
01093 if( pbar->bigmode ){
01094 float thresh ;
01095 thresh = im3d->vinfo->func_threshold
01096 * im3d->vinfo->func_thresh_top / scale_thr ;
01097
01098 if( PRINT_TRACING && im_thr != NULL )
01099 { char str[256] ; float tmax ;
01100 sprintf(str,"im_thr: nx=%d ny=%d kind=%s",
01101 im_thr->nx,im_thr->ny,MRI_TYPE_NAME(im_thr)) ; STATUS(str) ;
01102 tmax = (float)mri_maxabs(im_thr) ;
01103 sprintf(str,"maxabs(im_thr)=%g scale_thr=%g thresh=%g",tmax,scale_thr,thresh);
01104 STATUS(str) ;
01105 sprintf(str,"func_threshold=%g func_thresh_top=%g",
01106 im3d->vinfo->func_threshold,im3d->vinfo->func_thresh_top); STATUS(str);
01107 }
01108
01109 im_ov = AFNI_newfunc_overlay( im_thr , thresh ,
01110 im_fim ,
01111 scale_factor*pbar->bigbot ,
01112 scale_factor*pbar->bigtop ,
01113 pbar->bigcolor ) ;
01114 goto CLEANUP ;
01115 }
01116
01117 /** create output image the old way (indexes into overlay colors) **/
01118
01119 npix = im_fim->nx * im_fim->ny ;
01120 im_ov = mri_new( im_fim->nx , im_fim->ny , MRI_short ) ;
01121 ar_ov = MRI_SHORT_PTR( im_ov ) ;
01122
01123 /* set overlay colors */
01124
01125 num_lp = pbar->num_panes ;
01126
01127 for( lp=0 ; lp < num_lp ; lp++ ) fim_ovc[lp] = pbar->ov_index[lp] ;
01128
01129 fim_ovc[num_lp] = (im3d->vinfo->use_posfunc) ? (0) : (fim_ovc[num_lp-1]) ;
01130
01131 /** process im_fim into overlay, depending on data type **/
01132
01133 simult_thr = (im_thr != NULL) && /* do threshold */
01134 (im3d->vinfo->func_threshold > 0.0) && /* simultaneously? */
01135 (im_fim->kind == im_thr->kind) ; /* (July 15, 1996) */
01136
01137 switch( im_fim->kind ){
01138
01139 default: /* should not happen! */
01140 if( im_thr != im_fim ) mri_free(im_thr) ;
01141 mri_free(im_fim) ; mri_free(im_ov) ;
01142 STATUS("bad im_fim->kind!") ;
01143 RETURN(NULL) ;
01144
01145 case MRI_short:{
01146 short *ar_fim = MRI_SHORT_PTR(im_fim) ;
01147 float fim_thr[NPANE_MAX] ; /* 13 Nov 1996: changed from short */
01148
01149 for( lp=0 ; lp < num_lp ; lp++ )
01150 fim_thr[lp] = scale_factor * pbar->pval[lp+1] ;
01151
01152 if( simult_thr ){
01153 float thresh = im3d->vinfo->func_threshold
01154 * im3d->vinfo->func_thresh_top / scale_thr ;
01155 short *ar_thr = MRI_SHORT_PTR(im_thr) ;
01156 for( ii=0 ; ii < npix ; ii++ ){
01157 if( (ar_thr[ii] > -thresh && ar_thr[ii] < thresh) || ZREJ(ar_fim[ii]) ){
01158 ar_ov[ii] = 0 ;
01159 } else {
01160 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/
01161 ar_ov[ii] = fim_ovc[lp] ;
01162 }
01163 }
01164 } else {
01165 for( ii=0 ; ii < npix ; ii++ ){
01166 if( ZREJ(ar_fim[ii]) ){
01167 ar_ov[ii] = 0 ;
01168 } else {
01169 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/
01170 ar_ov[ii] = fim_ovc[lp] ;
01171 }
01172 }
01173 }
01174 }
01175 break ;
01176
01177 case MRI_byte:{
01178 byte *ar_fim = MRI_BYTE_PTR(im_fim) ;
01179 float fim_thr[NPANE_MAX] ; /* 13 Nov 1996: changed from short */
01180
01181 for( lp=0 ; lp < num_lp ; lp++ )
01182 fim_thr[lp] = (pbar->pval[lp+1] > 0.0) ? scale_factor*pbar->pval[lp+1]
01183 : 0.0 ;
01184
01185 if( simult_thr ){
01186 float thresh = im3d->vinfo->func_threshold
01187 * im3d->vinfo->func_thresh_top / scale_thr ;
01188 byte *ar_thr = MRI_BYTE_PTR(im_thr) ;
01189
01190 for( ii=0 ; ii < npix ; ii++ ){
01191 if( ar_thr[ii] < thresh || ZREJ(ar_fim[ii]) ){
01192 ar_ov[ii] = 0 ;
01193 } else {
01194 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/
01195 ar_ov[ii] = fim_ovc[lp] ;
01196 }
01197 }
01198 } else {
01199 for( ii=0 ; ii < npix ; ii++ ){
01200 if( ZREJ(ar_fim[ii]) ){
01201 ar_ov[ii] = 0 ;
01202 } else {
01203 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/
01204 ar_ov[ii] = fim_ovc[lp] ;
01205 }
01206 }
01207 }
01208 }
01209 break ;
01210
01211 case MRI_float:{
01212 float *ar_fim = MRI_FLOAT_PTR(im_fim) ;
01213 float fim_thr[NPANE_MAX] ;
01214
01215 for( lp=0 ; lp < num_lp ; lp++ )
01216 fim_thr[lp] = scale_factor * pbar->pval[lp+1] ;
01217
01218 if( simult_thr ){
01219 float thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ;
01220 float *ar_thr = MRI_FLOAT_PTR(im_thr) ;
01221
01222 for( ii=0 ; ii < npix ; ii++ ){
01223 if( (ar_thr[ii] > -thresh && ar_thr[ii] < thresh) || ZREJ(ar_fim[ii]) ){
01224 ar_ov[ii] = 0 ;
01225 } else {
01226 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/
01227 ar_ov[ii] = fim_ovc[lp] ;
01228 }
01229 }
01230 } else {
01231 for( ii=0 ; ii < npix ; ii++ ){
01232 if( ZREJ(ar_fim[ii]) ){
01233 ar_ov[ii] = 0 ;
01234 } else {
01235 for( lp=0 ; lp < num_lp && ar_fim[ii] < fim_thr[lp] ; lp++ ) ; /*nada*/
01236 ar_ov[ii] = fim_ovc[lp] ;
01237 }
01238 }
01239 }
01240 }
01241 break ;
01242 }
01243
01244 /** if have yet to do threshold, clip the overlay **/
01245
01246 if( im_thr != NULL && im3d->vinfo->func_threshold > 0.0 && !simult_thr ){
01247
01248 switch( im_thr->kind ){
01249
01250 case MRI_short:{
01251 float thresh = im3d->vinfo->func_threshold
01252 * im3d->vinfo->func_thresh_top / scale_thr ;
01253 short *ar_thr = MRI_SHORT_PTR(im_thr) ;
01254
01255 for( ii=0 ; ii < npix ; ii++ )
01256 if( ar_thr[ii] > -thresh && ar_thr[ii] < thresh ) ar_ov[ii] = 0 ;
01257 }
01258 break ;
01259
01260 case MRI_byte:{
01261 float thresh = im3d->vinfo->func_threshold
01262 * im3d->vinfo->func_thresh_top / scale_thr ;
01263 byte *ar_thr = MRI_BYTE_PTR(im_thr) ;
01264
01265 for( ii=0 ; ii < npix ; ii++ )
01266 if( ar_thr[ii] < thresh ) ar_ov[ii] = 0 ;
01267 }
01268 break ;
01269
01270 case MRI_float:{
01271 float thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ;
01272 float *ar_thr = MRI_FLOAT_PTR(im_thr) ;
01273
01274 for( ii=0 ; ii < npix ; ii++ )
01275 if( ar_thr[ii] > -thresh && ar_thr[ii] < thresh ) ar_ov[ii] = 0 ;
01276 }
01277 break ;
01278 }
01279 }
01280
01281 /* delete the overlay if it contains nothing */
01282
01283 for( ii=0 ; ii < npix ; ii++ ) if( ar_ov[ii] != 0 ) break ;
01284 if( ii == npix ) KILL_1MRI(im_ov) ; /* no nonzero values --> no overlay */
01285
01286 /** time to trot, Bwana **/
01287
01288 CLEANUP:
01289 if( im_thr != NULL && im_thr != im_fim ) mri_free( im_thr ) ;
01290 mri_free( im_fim ) ;
01291
01292 /* 21 Mar 2005: Hollow out overlay? */
01293
01294 if( AFNI_yesenv("AFNI_EDGIZE_OVERLAY") ) mri_edgize(im_ov) ;
01295
01296 RETURN(im_ov) ;
01297 }
|
|
||||||||||||||||
|
Definition at line 3442 of file afni_func.c. References AFNI_modify_viewing(), AFNI_widget_set::dmode, DMODE_BRICK_BVAL, ENTRY, AFNI_view_info::force_func_wod, AFNI_datamode_widgets::funcmode_bbox, IM3D_VALID, MCW_val_bbox(), RESET_AFNI_QUIT, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, AFNI_view_info::tempflag, Three_D_View::vinfo, and Three_D_View::vwid.
03443 {
03444 Three_D_View *im3d = (Three_D_View *) cd ;
03445 int old_val , new_val ;
03446 THD_fvec3 fv ;
03447 THD_ivec3 iv ;
03448
03449 ENTRY("AFNI_funcmode_CB") ;
03450
03451 if( ! IM3D_VALID(im3d) ) EXRETURN ;
03452
03453 old_val = 1 << im3d->vinfo->force_func_wod ;
03454 new_val = MCW_val_bbox( im3d->vwid->dmode->funcmode_bbox ) ;
03455
03456 if(PRINT_TRACING){
03457 char str[256] ; sprintf(str,"old_val=%d new_val=%d",old_val,new_val) ;
03458 STATUS(str) ; }
03459
03460 if( new_val != old_val ){
03461 im3d->vinfo->force_func_wod = (new_val != DMODE_BRICK_BVAL) ;
03462 SHOW_AFNI_PAUSE ;
03463 im3d->vinfo->tempflag = 1 ; /* 15 Mar 2000 */
03464 AFNI_modify_viewing( im3d , True ) ; /* redisplay */
03465 SHOW_AFNI_READY ;
03466 }
03467
03468 RESET_AFNI_QUIT(im3d) ;
03469 EXRETURN ;
03470 }
|
|
|
Return today's date trivia string. Definition at line 719 of file afni_friends.c. References mday::day, mday::label, mday::mon, NOV, NTMAX, OCT, SEP, and tt. Referenced by SPLASH_imseq_getim().
00720 {
00721 time_t tt ;
00722 struct tm *lt ;
00723 int ii , ntar ;
00724 char *tar[NTMAX] ;
00725
00726 tt = time(NULL) ; /* seconds since 01 Jan 1970 */
00727 lt = localtime( &tt ) ; /* break into pieces */
00728
00729 /**** find this month and day in the trivia list, if present ****/
00730
00731 for( ii=ntar=0 ; ntar < NTMAX && holiday[ii].day != 0 ; ii++ )
00732 if( holiday[ii].mon == lt->tm_mon+1 && holiday[ii].day == lt->tm_mday )
00733 tar[ntar++] = holiday[ii].label ;
00734
00735 /**** Special days not on fixed dates ****/
00736
00737 /* Day of month = 13 and weekday = Friday */
00738
00739 if( ntar < NTMAX && lt->tm_mday == 13 && lt->tm_wday == 5 )
00740 tar[ntar++] = "Friday the 13th" ;
00741
00742 /* 1st Monday in September */
00743
00744 if( ntar < NTMAX && lt->tm_mon+1 == SEP && lt->tm_wday == 1 && lt->tm_mday <= 7 )
00745 tar[ntar++] = "Labor Day (USA)" ;
00746
00747 /* 4th Thursday in November */
00748
00749 if( ntar < NTMAX && lt->tm_mon+1 == NOV && lt->tm_wday == 4 &&
00750 lt->tm_mday <= 28 && lt->tm_mday >= 22 )
00751 tar[ntar++] = "Thanksgiving (USA)" ;
00752
00753 /* 1st Monday in October */
00754
00755 if( ntar < NTMAX && lt->tm_mon+1 == OCT && lt->tm_wday == 1 && lt->tm_mday <= 7 )
00756 tar[ntar++] = "Opening of Supreme Court (USA)" ;
00757
00758 /* 1st Tuesday after 1st Monday in November */
00759
00760 if( ntar < NTMAX && lt->tm_mon+1 == NOV && lt->tm_wday == 2 &&
00761 lt->tm_mday >= 2 && lt->tm_mday <= 8 )
00762 tar[ntar++] = "Election Day (USA)" ;
00763
00764 /**** select which one to return ***/
00765
00766 if( ntar == 1 ){
00767 return tar[0] ;
00768 } else if( ntar > 1 ){
00769 static int iold=-1 ;
00770 ii = (lrand48()>>8) % ntar ;
00771 if( ii == iold ) ii = (ii+1)%ntar ;
00772 iold = ii ; return tar[ii] ;
00773 }
00774
00775 /* default trivia */
00776
00777 return "[Elen sila lumenn' omentielvo]" ;
00778 }
|
|
|
Return a "thanks" string (static storage - don't free it). Definition at line 87 of file afni_friends.c. References afni_helptypes, AFNI_friend::helpmask, INSPIRATION, KLOSEK, name, NUM_FRIENDS, NUM_HELPTYPES, and YOU_KNOW_WHAT. Referenced by main(), and SPLASH_imseq_getim().
00088 {
00089 static char buf[256] ; int nf , nh , hmask , qq=0 ;
00090 nf = lrand48() % NUM_FRIENDS ;
00091 do{
00092 nh = lrand48() % NUM_HELPTYPES ; hmask = 1 << nh ; qq++ ;
00093 } while( qq < 73 && (hmask & afni_friends[nf].helpmask) == 0 ) ;
00094
00095 if( nh == YOU_KNOW_WHAT && nf != KLOSEK ) nh = INSPIRATION; /* only Gosia */
00096
00097 sprintf( buf ,
00098 "Thanks go to %s for %s" ,
00099 afni_friends[nf].name , afni_helptypes[nh] ) ;
00100 return buf ;
00101 }
|
|
||||||||||||||||
|
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, MCW_grapher::status, 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 78 of file aiv.c. Referenced by main().
00078 { return ; } /* hide X11 warnings */
|
|
||||||||||||||||
|
Definition at line 7912 of file afni_func.c. |
|
||||||||||||||||||||
|
add files we found to list * Definition at line 8196 of file afni_func.c. |
|
||||||||||||||||
|
|
|
||||||||||||
|
Definition at line 248 of file afni_func.c. References AV_fval_to_char(), MCW_pbar::bigfac, MCW_pbar::bigmode, ENTRY, MCW_register_hint(), MCW_pbar::num_panes, MCW_pbar::panes, MCW_pbar::pval, sb, and top. Referenced by AFNI_drive_set_pbar_all(), AFNI_inten_pbar_CB(), AFNI_range_bbox_CB(), RCREND_choose_av_CB(), RCREND_color_pbar_CB(), RCREND_finalize_func_CB(), RCREND_range_av_CB(), RCREND_range_bbox_CB(), REND_choose_av_CB(), REND_color_pbar_CB(), REND_finalize_func_CB(), REND_range_av_CB(), and REND_range_bbox_CB().
00249 {
00250 int ip , np ;
00251 Widget w ;
00252 char sbot[16],stop[16] , hint[64] , *sb,*st ;
00253 float bot , top ;
00254
00255 ENTRY("AFNI_hintize_pbar") ;
00256
00257 if( pbar == NULL || fac == 0.0 ) EXRETURN ; /* bad */
00258
00259 if( pbar->bigmode ){
00260 MCW_register_hint( pbar->panes[0] ,
00261 "Button-1=flip; Button-3=menu" ) ;
00262 pbar->bigfac = fac ; /* 11 Feb 2003 */
00263 } else {
00264 np = pbar->num_panes ;
00265 for( ip=0 ; ip < np ; ip++ ){
00266 w = pbar->panes[ip] ; /* the widget for the ip-th pane */
00267 top = pbar->pval[ip] * fac ; /* scaled top value */
00268 bot = pbar->pval[ip+1] * fac ; /* scaled bot value */
00269 AV_fval_to_char( bot , sbot ) ; /* convert to a nice string */
00270 AV_fval_to_char( top , stop ) ;
00271 sb = (sbot[0] == ' ') ? sbot+1 : sbot ; /* skip leading blanks */
00272 st = (stop[0] == ' ') ? stop+1 : stop ;
00273 sprintf(hint,"%s .. %s",sb,st) ; /* create hint */
00274 MCW_register_hint( w , hint ) ; /* send to hint system */
00275 }
00276 }
00277
00278 EXRETURN ;
00279 }
|
|
||||||||||||||||
|
Definition at line 273 of file afni_lock.c. References AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, AFNI_library_type::ijk_lock, AFNI_datamode_widgets::ijk_lock_bbox, IM3D_VALID, MAX_CONTROLLERS, MCW_set_bbox(), MCW_val_bbox(), RESET_AFNI_QUIT, and Three_D_View::vwid.
00274 {
00275 Three_D_View *im3d = (Three_D_View *) cd ;
00276 Three_D_View *qq3d ;
00277 int bval , ii , bold ;
00278
00279 ENTRY("AFNI_ijk_lock_change_CB") ;
00280
00281 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00282
00283 /* get current global setting and compare to changed lock box */
00284
00285 bold = GLOBAL_library.ijk_lock ;
00286 bval = MCW_val_bbox( im3d->vwid->dmode->ijk_lock_bbox ) ;
00287 if( bval == bold ) EXRETURN ; /* same --> nothing to do */
00288
00289 /* new value --> save in global setting */
00290
00291 GLOBAL_library.ijk_lock = bval ;
00292
00293 /* set all other controller lock boxes to the same value */
00294
00295 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00296 qq3d = GLOBAL_library.controllers[ii] ;
00297 if( qq3d == im3d || ! IM3D_VALID(qq3d) ) continue ;
00298
00299 MCW_set_bbox( qq3d->vwid->dmode->ijk_lock_bbox , bval ) ;
00300 }
00301 RESET_AFNI_QUIT(im3d) ;
00302 EXRETURN ;
00303 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 878 of file afni_receive.c. References ISVALID_DSET, TEMP_IVEC3, THD_3dind_to_3dmm(), and THD_fvec3::xyz.
00881 {
00882 THD_fvec3 fv ;
00883
00884 if( ! ISVALID_DSET(dset) ) return ;
00885
00886 fv = THD_3dind_to_3dmm( dset , TEMP_IVEC3(ii,jj,kk) ) ;
00887 *xx = fv.xyz[0] ;
00888 *yy = fv.xyz[1] ;
00889 *zz = fv.xyz[2] ;
00890 return ;
00891 }
|
|
||||||||||||||||
|
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 4303 of file afni_func.c. References drive_MCW_imseq(), ENTRY, IM3D_VALID, isqDR_clearstat, Three_D_View::s123, Three_D_View::s231, and Three_D_View::s312. Referenced by PLUTO_dset_redisplay_mode().
04304 {
04305
04306 ENTRY("AFNI_imseq_clearstat") ;
04307
04308 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04309
04310 if( im3d->s123 != NULL )
04311 drive_MCW_imseq( im3d->s123 , isqDR_clearstat , NULL ) ;
04312
04313 if( im3d->s231 != NULL )
04314 drive_MCW_imseq( im3d->s231 , isqDR_clearstat , NULL ) ;
04315
04316 if( im3d->s312 != NULL )
04317 drive_MCW_imseq( im3d->s312 , isqDR_clearstat , NULL ) ;
04318
04319 EXRETURN ;
04320 }
|
|
|
Initialize NIML listening. ------------------------------------------------------------------------- Definition at line 212 of file afni_niml.c. References AFNI_niml_atexit(), AFNI_niml_driver(), AFNI_niml_redisplay_CB(), AFNI_niml_viewpoint_CB(), AFNI_niml_workproc(), AFNI_numenv(), AFNI_receive_init(), AFNI_yesenv(), atexit(), AFNI_library_type::controllers, ENTRY, g_show_as_popup, GLOBAL_argopt, GLOBAL_library, MAX_CONTROLLERS, NI_register_doer(), NIML_TCP_FIRST_PORT, ns_flags, ns_name, NUM_NIML, PLUTO_register_workproc(), AF_options::port_niml, RECEIVE_FUNCDISPLAY_MASK, RECEIVE_VIEWPOINT_MASK, redisplay_key, sendit, serrit, started, and viewpoint_key. Referenced by AFNI_misc_CB(), and AFNI_startup_timeout_CB().
00213 {
00214 int cc , ii ;
00215
00216 ENTRY("AFNI_init_niml") ;
00217
00218 if( started ) EXRETURN ;
00219
00220 PLUTO_register_workproc( AFNI_niml_workproc , NULL ) ;
00221 #if 0
00222 atexit( AFNI_niml_atexit ) ;
00223 #endif
00224
00225 /* initialize status and names of all listening NI_streams */
00226
00227 for( cc=0 ; cc < NUM_NIML ; cc++ ){
00228 ns_listen[cc] = NULL ;
00229 ns_flags[cc] = 0 ;
00230 }
00231
00232 /* 10 Dec 2002: allow user to specify NIML port number */
00233
00234 cc = GLOBAL_argopt.port_niml ;
00235 if( cc < 1024 || cc > 65535 ) cc = SUMA_TCP_PORT ;
00236 sprintf( ns_name[0] , "tcp:host:%d" , cc ) ;
00237
00238 /* 09 Mar 2005: add extra ports */
00239
00240 cc = AFNI_numenv( "AFNI_NIML_FIRST_PORT" ) ;
00241 if( cc < 1024 || cc > 65535 ) cc = NIML_TCP_FIRST_PORT ;
00242 for( ii=1 ; ii < NUM_NIML ; ii++ )
00243 sprintf( ns_name[ii] , "tcp:host:%d" , (cc+ii-1) ) ;
00244
00245 /* initialize all receive keys (cf. afni_receive.c) */
00246
00247 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00248 redisplay_key[cc] = -1 ;
00249 viewpoint_key[cc] = -1 ;
00250 }
00251
00252 /* set up to receive notifications (callbacks)
00253 when the functional overlay is redisplayed (controller A only) */
00254
00255 redisplay_key[0] = AFNI_receive_init( GLOBAL_library.controllers[0] ,
00256 RECEIVE_FUNCDISPLAY_MASK ,
00257 AFNI_niml_redisplay_CB ,
00258 GLOBAL_library.controllers[0] ,
00259 "AFNI_niml_redisplay_CB" ) ;
00260
00261 /* set up to receive notifications (callbacks)
00262 when the viewpoint is altered by the user (controller A only) */
00263
00264 viewpoint_key[0] = AFNI_receive_init( GLOBAL_library.controllers[0] ,
00265 RECEIVE_VIEWPOINT_MASK ,
00266 AFNI_niml_viewpoint_CB ,
00267 GLOBAL_library.controllers[0] ,
00268 "AFNI_niml_viewpoint_CB" ) ;
00269
00270 /* determine if we actually want to send data */
00271
00272 sendit = !AFNI_yesenv("AFNI_NIML_DONTSEND") ;
00273 serrit = !sendit || AFNI_yesenv("AFNI_NIML_STDERR") ; /* debugging */
00274
00275 /* 12 Feb 2003: setup ni_do "DRIVE_AFNI" verb */
00276
00277 NI_register_doer( "DRIVE_AFNI" , AFNI_niml_driver ) ;
00278
00279 /* 04 Jan 2005 [rickr]: check for AFNI_SHOW_SURF_POPUPS */
00280
00281 if( AFNI_yesenv("AFNI_SHOW_SURF_POPUPS") ) g_show_as_popup = 1 ;
00282 else if( AFNI_yesenv("AFNI_KILL_SURF_POPUPS") ) g_show_as_popup = -1 ;
00283
00284 /* and we're off to see the wizard */
00285
00286 started = 1 ; EXRETURN ;
00287 }
|
|
||||||||||||||||||||
|
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_datablock::kl, THD_3dim_dataset::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_datablock::nvals, THD_diskptr::nvals, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, ORI_A2P_TYPE, ORI_I2S_TYPE, ORI_R2L_TYPE, THD_marker_set::ovcolor, THD_3dim_dataset::parent, THD_dataxes::parent, THD_datablock::parent, PARENTIZE, THD_diskptr::prefix, THD_diskptr::rank, RETURN, THD_warp::rig_bod, THD_3dim_dataset::self_name, THD_3dim_dataset::self_warp, THD_3dim_dataset::stat_aux, THD_3dim_dataset::stats, STATUS, THD_diskptr::storage_mode, STORAGE_UNDEFINED, THD_3dim_dataset::tagset, THD_warp::tal_12, THD_3dim_dataset::taxis, THD_3dim_dataset::tcat_len, THD_3dim_dataset::tcat_list, THD_3dim_dataset::tcat_num, THD_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_marker_set::type, THD_dataxes::type, THD_datablock::type, THD_diskptr::type, THD_3dim_dataset::type, THD_warp::type, THD_marker_set::valid, VIEW_ACPCALIGNED_TYPE, THD_3dim_dataset::view_type, THD_3dim_dataset::vox_warp, Three_D_View::vwid, THD_affine_warp::warp, THD_3dim_dataset::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_marker_set::xyz, THD_fvec3::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 7418 of file afni_widg.c. Referenced by AFNI_drive_open_window(), and MAIN_workprocess(). |
|
||||||||||||
|
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 }
|
|
||||||||||||
|
load the values for the current pane count * Definition at line 389 of file afni_func.c. References AFNI_inten_pbar_CB(), alter_MCW_pbar(), MCW_pbar::bigmode, FIX_SCALE_SIZE, HIDE_SCALE, MCW_arrowval::ival, MCW_pbar::mode, NORMAL_cursorize, NPANE_MAX, MCW_pbar::num_panes, MCW_pbar::panew, MCW_pbar::parent, PBAR_set_bigmode(), pmax, pmin, POPUP_cursorize, and MCW_pbar::pval_save.
00390 {
00391 MCW_pbar *pbar = (MCW_pbar *) cd ;
00392 Three_D_View *im3d = (Three_D_View *) pbar->parent ;
00393
00394 HIDE_SCALE(im3d) ;
00395 if( av->ival > NPANE_MAX ){
00396 int npane=pbar->num_panes , jm=pbar->mode ;
00397 float pmax=pbar->pval_save[npane][0][jm] ,
00398 pmin=pbar->pval_save[npane][npane][jm] ;
00399 PBAR_set_bigmode( pbar , 1 , pmin,pmax ) ;
00400 AFNI_inten_pbar_CB( pbar , im3d , 0 ) ;
00401 POPUP_cursorize( pbar->panew ) ; /* 08 Apr 2005 */
00402 } else {
00403 pbar->bigmode = 0 ;
00404 alter_MCW_pbar( pbar , av->ival , NULL ) ;
00405 NORMAL_cursorize( pbar->panew ) ; /* 08 Apr 2005 */
00406 }
00407 FIX_SCALE_SIZE(im3d) ;
00408 }
|
|
||||||||||||
|
Definition at line 410 of file afni_func.c. References MCW_arrowval::ival, and NPANE_MAX.
00411 {
00412 static char buf[4] ;
00413 if( av->ival > NPANE_MAX ) strcpy (buf,"**") ;
00414 else sprintf(buf,"%d",av->ival) ;
00415 return buf ;
00416 }
|
|
||||||||||||||||
|
Definition at line 4536 of file afni_func.c. References AFNI_inten_pbar_CB(), AFNI_redisplay_func(), alter_MCW_pbar(), AV_assign_ival(), MCW_pbar::bigmode, MCW_pbar::bigset, ENTRY, FIX_SCALE_SIZE, AFNI_widget_set::func, HIDE_SCALE, IM3D_VALID, AFNI_function_widgets::inten_av, AFNI_function_widgets::inten_bbox, AFNI_function_widgets::inten_pbar, MCW_val_bbox(), MCW_pbar::mode, MCW_pbar::npan_save, NPANE_MAX, MCW_pbar::num_panes, PBAR_MODEBUT, PBAR_MODEPOS, PBAR_set_bigmode(), pmax, pmin, MCW_pbar::pval_save, AFNI_view_info::use_posfunc, Three_D_View::vinfo, Three_D_View::vwid, and MCW_bbox::wbut. Referenced by AFNI_drive_set_pbar_sign().
04537 {
04538 Three_D_View *im3d = (Three_D_View *) cd ;
04539 Boolean new_pos ;
04540 int jm ;
04541 MCW_pbar *pbar ;
04542
04543 ENTRY("AFNI_inten_bbox_CB") ;
04544
04545 if( ! IM3D_VALID(im3d) ||
04546 w != im3d->vwid->func->inten_bbox->wbut[PBAR_MODEBUT] ) EXRETURN ;
04547
04548 new_pos = (MCW_val_bbox(im3d->vwid->func->inten_bbox) & PBAR_MODEPOS) != 0 ;
04549
04550 if( new_pos != im3d->vinfo->use_posfunc ){ /* new button value */
04551
04552 im3d->vinfo->use_posfunc = new_pos ; /* record for later use */
04553
04554 pbar = im3d->vwid->func->inten_pbar ;
04555 jm = pbar->mode = (new_pos) ? 1 : 0 ; /* pbar mode */
04556
04557 /* re-panel the pbar befitting its new mode */
04558
04559 HIDE_SCALE(im3d) ;
04560 if( pbar->bigmode ){ /* 30 Jan 2003 */
04561 int npane=pbar->num_panes ;
04562 float pmax=pbar->pval_save[npane][0][jm] ,
04563 pmin=pbar->pval_save[npane][npane][jm] ;
04564 pbar->bigset = 0 ;
04565 PBAR_set_bigmode( pbar , 1 , pmin,pmax ) ;
04566 AFNI_inten_pbar_CB( pbar , im3d , 0 ) ;
04567 } else {
04568 alter_MCW_pbar( pbar , pbar->npan_save[jm] , NULL ) ;
04569 }
04570 FIX_SCALE_SIZE(im3d) ;
04571
04572 /* set the count on the pbar control arrowval to match */
04573
04574 if( pbar->bigmode )
04575 AV_assign_ival( im3d->vwid->func->inten_av, NPANE_MAX+1 ) ;
04576 else
04577 AV_assign_ival( im3d->vwid->func->inten_av, pbar->npan_save[jm] ) ;
04578
04579 AFNI_redisplay_func( im3d ) ;
04580 }
04581
04582 EXRETURN ;
04583 }
|
|
||||||||||||||||
|
Definition at line 286 of file afni_func.c. References AFNI_hintize_pbar(), AFNI_pbar_lock_carryout(), AFNI_redisplay_func(), ENTRY, AFNI_view_info::fim_autorange, AFNI_view_info::fim_range, AFNI_view_info::func_visible, IM3D_VALID, and Three_D_View::vinfo. Referenced by AFNI_drive_set_pbar_all(), AFNI_drive_set_pbar_number(), AFNI_inten_av_CB(), AFNI_inten_bbox_CB(), AFNI_set_pbar_top_CB(), and RCREND_color_bbox_CB().
00287 {
00288 Three_D_View *im3d = (Three_D_View *) cd ;
00289 float fac ;
00290
00291 ENTRY("AFNI_inten_pbar_CB") ;
00292
00293 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00294
00295 if( im3d->vinfo->func_visible )
00296 AFNI_redisplay_func( im3d ) ;
00297
00298 AFNI_hintize_pbar( pbar ,
00299 (im3d->vinfo->fim_range != 0.0) ? im3d->vinfo->fim_range
00300 : im3d->vinfo->fim_autorange ) ;
00301
00302 FIX_SCALE_SIZE(im3d) ;
00303
00304 AFNI_pbar_lock_carryout(im3d) ; /* 07 Feb 2004 */
00305 EXRETURN ;
00306 }
|
|
||||||||||||||||
|
Definition at line 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 5665 of file to3d.c.
05666 {
05667 char * xdef ;
05668 Display * display ;
05669 int ival ;
05670 float fval ;
05671 char * cpt ;
05672
05673 ENTRY("AFNI_load_defaults") ;
05674
05675 if( w == NULL ) EXRETURN ;
05676 display = XtDisplay( w ) ;
05677
05678 /** initialize display and overlay colors **/
05679
05680 NAME2INT("ncolors",INIT_ngray,3,MAX_COLORS) ;
05681
05682 NAME2FLOAT("gamma",INIT_gamma,0.1,9.9) ;
05683
05684 NAME2FLOAT("init_fov",INIT_fov,1.0,1000.0) ;
05685 INIT_fov = 0.1 * ( (int)(10*INIT_fov) ) ;
05686
05687 EXRETURN ;
05688 }
|
|
|
Definition at line 7715 of file afni_widg.c. |
|
|
Definition at line 190 of file afni_lock.c. References AFNI_controller_index(), AFNI_set_viewpoint(), AFNI_transform_vector(), Three_D_View::anat_now, AFNI_library_type::controller_lock, AFNI_library_type::controllers, CURRENT_DAXES, ENTRY, GLOBAL_library, AFNI_view_info::i1, AFNI_library_type::ignore_lock, THD_ivec3::ijk, AFNI_library_type::ijk_lock, IM3D_OPEN, AFNI_view_info::j2, AFNI_view_info::k3, LOAD_ANAT_VIEW, LOAD_FVEC3, MAX_CONTROLLERS, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, REDISPLAY_ALL, SAVE_VPT, THD_3dmm_to_3dind(), THD_dicomm_to_3dmm(), Three_D_View::vinfo, AFNI_view_info::xi, AFNI_view_info::yj, and AFNI_view_info::zk. Referenced by AFNI_lock_enforce_CB(), and AFNI_set_viewpoint().
00191 {
00192 Three_D_View *qq3d ;
00193 int ii,jj,kk , cc , glock ;
00194 THD_fvec3 old_fv , fv ;
00195 THD_ivec3 iv ;
00196 THD_dataxes *qaxes , *daxes ;
00197 static int busy = 0 ; /* !=0 if this routine is "busy" */
00198
00199 ENTRY("AFNI_lock_carryout") ;
00200
00201 /* first, determine if there is anything to do */
00202
00203 glock = GLOBAL_library.controller_lock ;
00204
00205 if( busy ) EXRETURN ; /* routine already busy */
00206 if( glock == 0 ) EXRETURN ; /* nothing to do */
00207 if( !IM3D_OPEN(im3d) ) EXRETURN ; /* bad input */
00208 if( GLOBAL_library.ignore_lock ) EXRETURN ; /* ordered not to do anything */
00209
00210 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00211
00212 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00213 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00214
00215 /* something to do? */
00216
00217 busy = 1 ; /* don't let this routine be called recursively */
00218
00219 /* load Dicom location of current point of view in this controller */
00220
00221 LOAD_FVEC3( old_fv , im3d->vinfo->xi, im3d->vinfo->yj, im3d->vinfo->zk ) ;
00222
00223 LOAD_ANAT_VIEW(im3d) ; /* prepare coordinates */
00224 daxes = CURRENT_DAXES(im3d->anat_now) ;
00225
00226 /* loop through other controllers:
00227 for those that ARE open, ARE NOT the current one,
00228 and ARE locked, transform the above vector to the
00229 controller's dataset, and then jump to that point */
00230
00231 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00232
00233 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00234
00235 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00236
00237 LOAD_ANAT_VIEW(qq3d) ; /* prepare coordinates */
00238 qaxes = CURRENT_DAXES(qq3d->anat_now) ;
00239
00240 if( !GLOBAL_library.ijk_lock ){ /* xyz coord lock */
00241
00242 fv = AFNI_transform_vector( im3d->anat_now, old_fv, qq3d->anat_now ) ;
00243 fv = THD_dicomm_to_3dmm( qq3d->anat_now , fv ) ;
00244 iv = THD_3dmm_to_3dind ( qq3d->anat_now , fv ) ;
00245 ii = iv.ijk[0] ; jj = iv.ijk[1] ; kk = iv.ijk[2] ;
00246
00247 } else { /* 11 Sep 2000: ijk index lock */
00248
00249 ii = im3d->vinfo->i1 * qaxes->nxx / daxes->nxx ;
00250 jj = im3d->vinfo->j2 * qaxes->nyy / daxes->nyy ;
00251 kk = im3d->vinfo->k3 * qaxes->nzz / daxes->nzz ;
00252 }
00253
00254 /* if have good new ijk coords, jump to them */
00255
00256 if( ii >= 0 && ii < qaxes->nxx &&
00257 jj >= 0 && jj < qaxes->nyy && kk >= 0 && kk < qaxes->nzz ){
00258
00259 SAVE_VPT(qq3d) ;
00260 AFNI_set_viewpoint( qq3d , ii,jj,kk , REDISPLAY_ALL ) ; /* jump */
00261 }
00262 }
00263 }
00264
00265 busy = 0 ; /* OK, let this routine be activated again */
00266 EXRETURN ;
00267 }
|
|
||||||||||||||||
|
Definition at line 116 of file afni_lock.c. References AFNI_library_type::controller_lock, AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, IM3D_VALID, AFNI_datamode_widgets::lock_bbox, MAX_CONTROLLERS, MCW_set_bbox(), MCW_val_bbox(), RESET_AFNI_QUIT, and Three_D_View::vwid.
00117 {
00118 Three_D_View *im3d = (Three_D_View *) cd ;
00119 Three_D_View *qq3d ;
00120 int bval , ii , bold ;
00121
00122 ENTRY("AFNI_lock_change_CB") ;
00123
00124 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00125
00126 /* get current global setting and compare to changed lock box */
00127
00128 bold = GLOBAL_library.controller_lock ;
00129 bval = MCW_val_bbox( im3d->vwid->dmode->lock_bbox ) ;
00130 if( bval == bold ) EXRETURN ; /* same --> nothing to do */
00131
00132 /* new value --> save in global setting */
00133
00134 GLOBAL_library.controller_lock = bval ;
00135
00136 /* set all other controller lock boxes to the same value */
00137
00138 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00139 qq3d = GLOBAL_library.controllers[ii] ;
00140 if( qq3d == im3d || ! IM3D_VALID(qq3d) ) continue ;
00141
00142 MCW_set_bbox( qq3d->vwid->dmode->lock_bbox , bval ) ;
00143 }
00144 RESET_AFNI_QUIT(im3d) ;
00145 EXRETURN ;
00146 }
|
|
||||||||||||||||
|
Definition at line 150 of file afni_lock.c. References AFNI_library_type::controller_lock, AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, IM3D_VALID, AFNI_datamode_widgets::lock_bbox, MAX_CONTROLLERS, MCW_set_bbox(), and Three_D_View::vwid.
00151 {
00152 Three_D_View *qq3d ;
00153 int ii ;
00154
00155 ENTRY("AFNI_lock_clear_CB") ;
00156
00157 GLOBAL_library.controller_lock = 0 ;
00158 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00159 qq3d = GLOBAL_library.controllers[ii] ;
00160 if( IM3D_VALID(qq3d) )
00161 MCW_set_bbox( qq3d->vwid->dmode->lock_bbox , 0 ) ;
00162 }
00163 EXRETURN ;
00164 }
|
|
||||||||||||||||
|
Definition at line 103 of file afni_lock.c. References AFNI_lock_carryout(), AFNI_time_lock_carryout(), ENTRY, and RESET_AFNI_QUIT.
00104 {
00105 Three_D_View *im3d = (Three_D_View *) cd ;
00106
00107 ENTRY("AFNI_lock_enforce_CB") ;
00108 AFNI_lock_carryout( im3d ) ;
00109 AFNI_time_lock_carryout( im3d ) ; /* 03 Nov 1998 */
00110 RESET_AFNI_QUIT(im3d) ;
00111 EXRETURN ;
00112 }
|
|
||||||||||||||||
|
Definition at line 168 of file afni_lock.c. References AFNI_library_type::controller_lock, AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, IM3D_VALID, AFNI_datamode_widgets::lock_bbox, MAX_CONTROLLERS, MCW_set_bbox(), and Three_D_View::vwid.
00169 {
00170 Three_D_View *qq3d ;
00171 int ii ;
00172
00173 ENTRY("AFNI_lock_setall_CB") ;
00174
00175 GLOBAL_library.controller_lock = 0 ;
00176 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ )
00177 GLOBAL_library.controller_lock |= (1<<ii) ;
00178
00179 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00180 qq3d = GLOBAL_library.controllers[ii] ;
00181 if( IM3D_VALID(qq3d) )
00182 MCW_set_bbox( qq3d->vwid->dmode->lock_bbox ,
00183 GLOBAL_library.controller_lock ) ;
00184 }
00185 EXRETURN ;
00186 }
|
|
|
Definition at line 7587 of file afni_widg.c. Referenced by AFNI_drive_open_window(), and AFNI_startup_layout_CB(). |
|
|
Definition at line 659 of file afni_func.c. References AFNI_make_descendants_old(), VIEW_ACPCALIGNED_TYPE, and VIEW_ORIGINAL_TYPE. Referenced by AFNI_fimmer_execute(), AFNI_marks_transform_CB(), AFNI_read_inputs(), AFNI_rescan_session_NEW(), AFNI_rescan_session_OLD(), PLUTO_add_dset(), and RT_tell_afni_one().
00660 {
00661 AFNI_make_descendants_old( ssl , VIEW_ORIGINAL_TYPE ) ;
00662 #if 0
00663 AFNI_make_descendants_old( ssl , VIEW_ACPCALIGNED_TYPE ) ; /* doesn't work */
00664 #endif
00665 return ;
00666 }
|
|
|
Definition at line 2362 of file afni_func.c. References AFNI_close_file_dialog_CB(), Three_D_View::dc, MCW_DC::display, ENTRY, AFNI_widget_set::file_cb, AFNI_widget_set::file_cd, AFNI_widget_set::file_dialog, AFNI_widget_set::file_sbox, MCW_hotcolor(), MCW_set_widget_bg(), STATUS, AFNI_widget_set::top_shell, and Three_D_View::vwid. Referenced by AFNI_pbar_CB(), AFNI_read_1D_CB(), and AFNI_read_sess_CB().
02363 {
02364
02365 ENTRY("AFNI_make_file_dialog") ;
02366
02367 /*** make a new dialog? ***/
02368
02369 if( im3d->vwid->file_dialog == NULL ){
02370 XmString oklabel , cancellabel ;
02371
02372 STATUS("creating new dialog") ;
02373
02374 im3d->vwid->file_dialog =
02375 XtVaCreatePopupShell(
02376 "menu" , xmDialogShellWidgetClass , im3d->vwid->top_shell ,
02377 XmNtitle , "GPL AFNI" ,
02378 XmNdeleteResponse , XmDO_NOTHING ,
02379 XmNinitialResourcesPersistent , False ,
02380 NULL ) ;
02381
02382 XmAddWMProtocolCallback( /* make "Close" window menu work */
02383 im3d->vwid->file_dialog ,
02384 XmInternAtom( im3d->dc->display , "WM_DELETE_WINDOW" , False ) ,
02385 AFNI_close_file_dialog_CB , (XtPointer) im3d ) ;
02386
02387 /** change button labels to conform to other AFNI dialogs **/
02388
02389 oklabel = XmStringCreateLtoR( "Set" , XmFONTLIST_DEFAULT_TAG ) ;
02390 cancellabel = XmStringCreateLtoR( "Quit" , XmFONTLIST_DEFAULT_TAG ) ;
02391
02392 im3d->vwid->file_sbox =
02393 XtVaCreateManagedWidget(
02394 "menu" , xmFileSelectionBoxWidgetClass , im3d->vwid->file_dialog ,
02395 XmNfileTypeMask , XmFILE_ANY_TYPE ,
02396 XmNcancelLabelString , cancellabel ,
02397 XmNokLabelString , oklabel ,
02398 XmNtraversalOn , False ,
02399 XmNinitialResourcesPersistent , False ,
02400 NULL ) ;
02401
02402 XmStringFree(oklabel) ; XmStringFree(cancellabel) ;
02403
02404 im3d->vwid->file_cb = NULL ;
02405 im3d->vwid->file_cd = NULL ;
02406
02407 #if 1
02408 { Widget www ;
02409 www = XmFileSelectionBoxGetChild( im3d->vwid->file_sbox ,
02410 XmDIALOG_TEXT ) ;
02411 if( www != NULL ) MCW_set_widget_bg( www , MCW_hotcolor(www) , 0 ) ;
02412 }
02413 #endif
02414
02415 } else if( im3d->vwid->file_cb != NULL ){
02416
02417 STATUS("re-initializing old dialog") ;
02418
02419 /*** re-initialize an old dialog to have no callbacks ***/
02420
02421 XtRemoveCallback( im3d->vwid->file_sbox , XmNokCallback ,
02422 im3d->vwid->file_cb , im3d->vwid->file_cd ) ;
02423
02424 XtRemoveCallback( im3d->vwid->file_sbox , XmNcancelCallback ,
02425 im3d->vwid->file_cb , im3d->vwid->file_cd ) ;
02426
02427 XtRemoveCallback( im3d->vwid->file_sbox , XmNhelpCallback ,
02428 im3d->vwid->file_cb , im3d->vwid->file_cd ) ;
02429
02430 XtVaSetValues( im3d->vwid->file_sbox , XmNpattern,NULL , NULL ) ;
02431
02432 im3d->vwid->file_cb = NULL ;
02433 im3d->vwid->file_cd = NULL ;
02434 }
02435
02436 EXRETURN ;
02437 }
|
|
||||||||||||||||
|
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 409 of file afni_version.c. Referenced by AFNI_startup_timeout_CB().
00409 { return NULL; }
|
|
|
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_linear_mapping::type, THD_affine_warp::type, THD_talairach_12_warp::type, THD_marker_set::type, THD_affine_warp::warp, WARP_AFFINE_TYPE, THD_3dim_dataset::warp_parent, WARP_TALAIRACH_12_TYPE, THD_fvec3::xyz, and THD_marker_set::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 312 of file afni_widg.c. References ADDTO_KILL, afni16_pixmap, AFNI_3DDATA_VIEW, AFNI_make_wid1(), AFNI_make_wid2(), AFNI_make_wid3(), AFNI_plugin_button(), AFNI_tophelp, AFNI_yesenv(), AFNI_widget_set::butx, AFNI_widget_set::buty, Three_D_View::dc, DC_find_closest_overlay_color(), MCW_DC::display, AFNI_widget_set::dmode, ENTRY, FatalError, AFNI_widget_set::file_dialog, AFNI_imaging_widgets::frame, AFNI_viewing_widgets::frame, AFNI_marks_widgets::frame, AFNI_function_widgets::frame, AFNI_datamode_widgets::frame, AFNI_program_widgets::frame, AFNI_widget_set::func, getenv(), IM3D_VALID, AFNI_widget_set::imag, MRI_IMAGE::kind, Three_D_View::kl, last_color, logo_pixmap, AFNI_widget_set::marks, MCW_kill_XImage(), MCW_register_help(), mri_clear_data_pointer, mri_fix_data_pointer(), mri_free(), mri_new_vol_empty(), mri_read_just_one(), myXtNew, MCW_DC::ncol_im, MCW_DCOV::ncol_ov, AFNI_widget_set::nplugbut, num_entry, MRI_IMAGE::nx, MRI_IMAGE::ny, MCW_DC::origGC, MCW_DCOV::ov_darkest, MCW_DC::ovc, AFNI_widget_set::parent, MCW_DC::pix_im, MCW_DCOV::pix_ov, MCW_DC::planes, AFNI_widget_set::prog, REFRESH, rgb_to_XImage(), MCW_DC::screen, STATUS, AFNI_widget_set::top_form, AFNI_widget_set::top_shell, Three_D_View::type, vers_pixmap, AFNI_widget_set::view, MCW_DC::visual_class, and Three_D_View::vwid.
00313 {
00314
00315 ENTRY("AFNI_make_widgets") ;
00316
00317 /*---- initialize -----*/
00318
00319 if( ! IM3D_VALID(im3d) )
00320 FatalError("illegal call to AFNI_make_widgets") ;
00321
00322 num_entry++ ;
00323
00324 last_color = im3d->dc->ovc->ncol_ov - 1 ;
00325
00326 vwid = im3d->vwid ;
00327 vwid->parent = im3d ;
00328
00329 vwid->butx = vwid->buty = 9 ; /* 17 May 2005 */
00330
00331 #define AFNI_FORM_SPACING 9
00332
00333 STATUS("creating top_form") ;
00334
00335 vwid->top_form =
00336 XtVaCreateWidget(
00337 "dialog" , xmFormWidgetClass , vwid->top_shell ,
00338 XmNborderWidth , 0 ,
00339 XmNmarginHeight , AFNI_FORM_SPACING ,
00340 XmNmarginWidth , AFNI_FORM_SPACING ,
00341 XmNtraversalOn , False ,
00342 XmNinitialResourcesPersistent , False ,
00343 NULL ) ;
00344
00345 MCW_register_help( vwid->top_form , AFNI_tophelp ) ;
00346
00347 vwid->file_dialog = NULL ; /* Mar 1997 */
00348
00349 /* create pixmaps, if desired */
00350
00351 #if defined(WANT_LOGO_BITMAP) || defined(WANT_AFNI_BITMAP)
00352 { Pixel bg_pix , fg_pix ; /* colors: from control window */
00353 Pixel bot_pix , top_pix ; /* colors: from image windows */
00354
00355 #ifdef USE_IMPIX /** which colors to use for program icons **/
00356 # define ICON_bg bot_pix /* use image display pixels */
00357 # define ICON_fg top_pix
00358 #else
00359 # define ICON_bg bg_pix /* use widget pixels (e.g., FALLback in afni.h) */
00360 # define ICON_fg fg_pix
00361 #endif
00362
00363 XtVaGetValues( vwid->top_form ,
00364 XmNforeground , &bg_pix , /* note reversal of roles here! */
00365 XmNbackground , &fg_pix ,
00366 NULL ) ;
00367
00368 bot_pix = im3d->dc->pix_im[0] ;
00369 top_pix = im3d->dc->pix_im[im3d->dc->ncol_im-1] ;
00370
00371 #ifdef WANT_LOGO_BITMAP
00372 STATUS("WANT_LOGO_BITMAP") ;
00373 if( logo_pixmap == XmUNSPECIFIED_PIXMAP ){
00374
00375 #ifndef NO_FRIVOLITIES
00376 #include "lll.h"
00377 if( im3d->dc->visual_class == TrueColor ){ /* 23 Sep 2001 */
00378 MRI_IMAGE *bim ; XImage *xim ;
00379 bim = mri_new_vol_empty( lll_width,lll_height,1 , MRI_rgb ) ;
00380 mri_fix_data_pointer( lll_rgb , bim ) ;
00381 logo_pixmap = XCreatePixmap( im3d->dc->display ,
00382 RootWindowOfScreen(im3d->dc->screen) ,
00383 lll_width , lll_height ,
00384 im3d->dc->planes ) ;
00385 xim = rgb_to_XImage( im3d->dc , bim ) ;
00386 if( xim != NULL )
00387 XPutImage( im3d->dc->display ,
00388 logo_pixmap ,
00389 im3d->dc->origGC ,
00390 xim , 0,0 , 0,0 , lll_width , lll_height ) ;
00391 MCW_kill_XImage( xim );
00392
00393 mri_fix_data_pointer( vvv_rgb , bim ) ; /* 08 Aug 2005 */
00394 vers_pixmap = XCreatePixmap( im3d->dc->display ,
00395 RootWindowOfScreen(im3d->dc->screen) ,
00396 lll_width , lll_height ,
00397 im3d->dc->planes ) ;
00398 xim = rgb_to_XImage( im3d->dc , bim ) ;
00399 if( xim != NULL )
00400 XPutImage( im3d->dc->display ,
00401 vers_pixmap ,
00402 im3d->dc->origGC ,
00403 xim , 0,0 , 0,0 , lll_width , lll_height ) ;
00404 MCW_kill_XImage( xim );
00405 mri_clear_data_pointer(bim); mri_free(bim);
00406 }
00407 #endif
00408
00409 if( logo_pixmap == XmUNSPECIFIED_PIXMAP ) /* original code */
00410 logo_pixmap = XCreatePixmapFromBitmapData( /* B&W pixmap logo */
00411 XtDisplay(vwid->top_shell) ,
00412 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00413 logo_bits , logo_width , logo_height ,
00414 fg_pix , bg_pix ,
00415 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00416 }
00417 #endif
00418
00419 #ifdef WANT_AFNI_BITMAP
00420 STATUS("WANT_AFNI_BITMAP") ;
00421 if( afni48_pixmap == XmUNSPECIFIED_PIXMAP )
00422 afni48_pixmap = XCreatePixmapFromBitmapData(
00423 XtDisplay(vwid->top_shell) ,
00424 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00425 afni48_bits , afni48_width , afni48_height ,
00426 ICON_fg , ICON_bg ,
00427 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00428
00429 if( afni48cor_pixmap == XmUNSPECIFIED_PIXMAP )
00430 afni48cor_pixmap = XCreatePixmapFromBitmapData(
00431 XtDisplay(vwid->top_shell) ,
00432 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00433 afni48cor_bits , afni48cor_width , afni48cor_height ,
00434 ICON_fg , ICON_bg ,
00435 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00436
00437 if( afni48sag_pixmap == XmUNSPECIFIED_PIXMAP )
00438 afni48sag_pixmap = XCreatePixmapFromBitmapData(
00439 XtDisplay(vwid->top_shell) ,
00440 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00441 afni48sag_bits , afni48sag_width , afni48sag_height ,
00442 ICON_fg , ICON_bg ,
00443 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00444
00445 if( afni48axi_pixmap == XmUNSPECIFIED_PIXMAP )
00446 afni48axi_pixmap = XCreatePixmapFromBitmapData(
00447 XtDisplay(vwid->top_shell) ,
00448 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00449 afni48axi_bits , afni48axi_width , afni48axi_height ,
00450 ICON_fg , ICON_bg ,
00451 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00452
00453 if( afni48gra_pixmap == XmUNSPECIFIED_PIXMAP )
00454 afni48gra_pixmap = XCreatePixmapFromBitmapData(
00455 XtDisplay(vwid->top_shell) ,
00456 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00457 afni48gra_bits , afni48gra_width , afni48gra_height ,
00458 ICON_fg , ICON_bg ,
00459 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00460
00461 if( afni48graaxi_pixmap == XmUNSPECIFIED_PIXMAP )
00462 afni48graaxi_pixmap = XCreatePixmapFromBitmapData(
00463 XtDisplay(vwid->top_shell) ,
00464 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00465 afni48graaxi_bits , afni48graaxi_width , afni48graaxi_height ,
00466 ICON_fg , ICON_bg ,
00467 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00468
00469 if( afni48grasag_pixmap == XmUNSPECIFIED_PIXMAP )
00470 afni48grasag_pixmap = XCreatePixmapFromBitmapData(
00471 XtDisplay(vwid->top_shell) ,
00472 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00473 afni48grasag_bits , afni48grasag_width , afni48grasag_height ,
00474 ICON_fg , ICON_bg ,
00475 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00476
00477 if( afni48gracor_pixmap == XmUNSPECIFIED_PIXMAP )
00478 afni48gracor_pixmap = XCreatePixmapFromBitmapData(
00479 XtDisplay(vwid->top_shell) ,
00480 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00481 afni48gracor_bits , afni48gracor_width , afni48gracor_height ,
00482 ICON_fg , ICON_bg ,
00483 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00484
00485 /* 28 Jan 2004: just for fun, background pixmaps for top forms */
00486
00487 if( im3d->dc->visual_class == TrueColor &&
00488 AFNI_yesenv("AFNI_LOGO16") &&
00489 afni16_pixmap[num_entry-1] == XmUNSPECIFIED_PIXMAP ){
00490
00491 MRI_IMAGE *bim ; XImage *xim ; char ename[32], *ept ;
00492 sprintf(ename,"AFNI_LOGO16_IMAGE_%c" , 'A'+num_entry-1 ) ;
00493 ept = getenv(ename) ;
00494 if( ept == NULL ) ept = getenv( "AFNI_LOGO16_IMAGE" ) ;
00495 if( ept != NULL ){
00496 bim = mri_read_just_one( ept ) ;
00497 if( bim != NULL ){
00498 if( bim->kind == MRI_rgb ){
00499 xim = rgb_to_XImage( im3d->dc , bim ) ;
00500 if( xim != NULL ){
00501 afni16_pixmap[num_entry-1] = XCreatePixmap( im3d->dc->display ,
00502 RootWindowOfScreen(im3d->dc->screen) ,
00503 bim->nx , bim->ny , im3d->dc->planes ) ;
00504 XPutImage( im3d->dc->display , afni16_pixmap[num_entry-1] ,
00505 im3d->dc->origGC , xim , 0,0 , 0,0 , bim->nx , bim->ny ) ;
00506 MCW_kill_XImage( xim ) ;
00507 }
00508 }
00509 mri_free(bim) ;
00510 }
00511 }
00512 }
00513
00514 #if 0
00515 if( afni16_pixmap[num_entry-1] == XmUNSPECIFIED_PIXMAP && AFNI_yesenv("AFNI_LOGO16") ){
00516 Pixel fg16=ICON_bg, bg16=ICON_fg ; int ic ; char ename[32] ;
00517 char *fgn[7] = { "red", "blue-cyan", "green", "violet", "orange", "gray70", "yellow" };
00518
00519 sprintf(ename,"AFNI_LOGO16_FOREGROUND_%c" , 'A'+num_entry-1 ) ;
00520 ic = DC_find_closest_overlay_color(im3d->dc, getenv(ename) ) ;
00521 if( ic < 0 ) ic = DC_find_closest_overlay_color(im3d->dc, getenv("AFNI_LOGO16_FOREGROUND")) ;
00522 if( ic < 0 ) ic = DC_find_closest_overlay_color(im3d->dc, fgn[(num_entry-1)%7] ) ;
00523 if( ic >= 0 ) fg16 = im3d->dc->ovc->pix_ov[ic] ;
00524
00525 sprintf(ename,"AFNI_LOGO16_BACKGROUND_%c" , 'A'+num_entry-1 ) ;
00526 ic = DC_find_closest_overlay_color(im3d->dc, getenv(ename) ) ;
00527 if( ic < 0 ) ic = DC_find_closest_overlay_color(im3d->dc, getenv("AFNI_LOGO16_BACKGROUND")) ;
00528 #if 0
00529 if( ic < 0 ) ic = im3d->dc->ovc->ov_darkest ;
00530 #endif
00531 if( ic >= 0 ) bg16 = im3d->dc->ovc->pix_ov[ic] ;
00532
00533 afni16_pixmap[num_entry-1] = XCreatePixmapFromBitmapData(
00534 XtDisplay(vwid->top_shell) ,
00535 RootWindowOfScreen(XtScreen(vwid->top_shell)) ,
00536 afni16_bits , afni16_width , afni16_height ,
00537 fg16 , bg16 ,
00538 DefaultDepthOfScreen(XtScreen(vwid->top_shell)) ) ;
00539 }
00540 #endif
00541
00542 #endif /* WANT_AFNI_BITMAP */
00543 }
00544 #endif /* if WANT any of the BITMAPs */
00545
00546 if( afni16_pixmap[num_entry-1] != XmUNSPECIFIED_PIXMAP )
00547 XtVaSetValues( vwid->top_form , XmNbackgroundPixmap,afni16_pixmap[num_entry-1] , NULL ) ;
00548
00549 /* create each control panel, and a container frame for each */
00550
00551 STATUS("creating control panels") ;
00552
00553 imag =vwid->imag = myXtNew(AFNI_imaging_widgets) ;ADDTO_KILL(im3d->kl,imag);
00554 view =vwid->view = myXtNew(AFNI_viewing_widgets) ;ADDTO_KILL(im3d->kl,view);
00555 marks=vwid->marks= myXtNew(AFNI_marks_widgets) ;ADDTO_KILL(im3d->kl,marks);
00556 func =vwid->func = myXtNew(AFNI_function_widgets);ADDTO_KILL(im3d->kl,func);
00557 prog =vwid->prog = myXtNew(AFNI_program_widgets) ;ADDTO_KILL(im3d->kl,prog);
00558 dmode=vwid->dmode= myXtNew(AFNI_datamode_widgets);ADDTO_KILL(im3d->kl,dmode);
00559
00560 imag->frame =
00561 XtVaCreateWidget(
00562 "dialog" , xmFrameWidgetClass , vwid->top_form ,
00563 XmNleftAttachment , XmATTACH_FORM ,
00564 XmNtopAttachment , XmATTACH_FORM ,
00565 XmNleftOffset , AFNI_FORM_SPACING ,
00566 XmNtopOffset , AFNI_FORM_SPACING ,
00567 XmNshadowType , XmSHADOW_ETCHED_IN ,
00568 XmNshadowThickness , 5 ,
00569 XmNtraversalOn , False ,
00570 XmNinitialResourcesPersistent , False ,
00571 NULL ) ;
00572
00573 view->frame =
00574 XtVaCreateWidget(
00575 "dialog" , xmFrameWidgetClass , vwid->top_form ,
00576 XmNleftAttachment , XmATTACH_WIDGET ,
00577 XmNleftWidget , imag->frame ,
00578 XmNtopAttachment , XmATTACH_FORM ,
00579 XmNleftOffset , AFNI_FORM_SPACING ,
00580 XmNtopOffset , AFNI_FORM_SPACING ,
00581 XmNshadowType , XmSHADOW_ETCHED_IN ,
00582 XmNshadowThickness , 5 ,
00583 XmNtraversalOn , False ,
00584 XmNinitialResourcesPersistent , False ,
00585 NULL ) ;
00586
00587 marks->frame =
00588 XtVaCreateWidget(
00589 "dialog" , xmFrameWidgetClass , vwid->top_form ,
00590 XmNleftAttachment , XmATTACH_WIDGET ,
00591 XmNleftWidget , view->frame ,
00592 XmNtopAttachment , XmATTACH_FORM ,
00593 XmNleftOffset , AFNI_FORM_SPACING ,
00594 XmNtopOffset , AFNI_FORM_SPACING ,
00595 XmNshadowType , XmSHADOW_ETCHED_IN ,
00596 XmNshadowThickness , 5 ,
00597 XmNtraversalOn , False ,
00598 XmNinitialResourcesPersistent , False ,
00599 NULL ) ;
00600
00601 func->frame =
00602 XtVaCreateWidget(
00603 "dialog" , xmFrameWidgetClass , vwid->top_form ,
00604 XmNleftAttachment , XmATTACH_WIDGET ,
00605 XmNleftWidget , view->frame ,
00606 XmNtopAttachment , XmATTACH_FORM ,
00607 XmNleftOffset , AFNI_FORM_SPACING ,
00608 XmNtopOffset , AFNI_FORM_SPACING ,
00609 XmNshadowType , XmSHADOW_ETCHED_IN ,
00610 XmNshadowThickness , 5 ,
00611 XmNtraversalOn , False ,
00612 XmNinitialResourcesPersistent , False ,
00613 NULL ) ;
00614
00615 dmode->frame =
00616 XtVaCreateWidget(
00617 "dialog" , xmFrameWidgetClass , vwid->top_form ,
00618 XmNleftAttachment , XmATTACH_WIDGET ,
00619 XmNleftWidget , view->frame ,
00620 XmNtopAttachment , XmATTACH_FORM ,
00621 XmNleftOffset , AFNI_FORM_SPACING ,
00622 XmNtopOffset , AFNI_FORM_SPACING ,
00623 XmNshadowType , XmSHADOW_ETCHED_IN ,
00624 XmNshadowThickness , 5 ,
00625 XmNtraversalOn , False ,
00626 XmNinitialResourcesPersistent , False ,
00627 NULL ) ;
00628
00629 prog->frame =
00630 XtVaCreateWidget(
00631 "dialog" , xmFrameWidgetClass , vwid->top_form ,
00632 XmNtopAttachment , XmATTACH_WIDGET ,
00633 XmNtopWidget , imag->frame ,
00634 XmNleftAttachment , XmATTACH_FORM ,
00635 XmNleftOffset , AFNI_FORM_SPACING ,
00636 XmNtopOffset , AFNI_FORM_SPACING ,
00637 XmNshadowType , XmSHADOW_ETCHED_IN ,
00638 XmNshadowThickness , 5 ,
00639 XmNtraversalOn , False ,
00640 XmNinitialResourcesPersistent , False ,
00641 NULL ) ;
00642
00643 /************* call other routines to create rest of widgets *************/
00644
00645 REFRESH ;
00646 AFNI_make_wid1( im3d ) ; REFRESH ;
00647 AFNI_make_wid2( im3d ) ; REFRESH ;
00648 AFNI_make_wid3( im3d ) ; REFRESH ;
00649
00650 #ifdef ALLOW_PLUGINS
00651 im3d->vwid->nplugbut = 0 ;
00652 AFNI_plugin_button( im3d ) ; /* 07 Oct 1996 */
00653 #endif
00654
00655 /*---------------------------------------------------*/
00656 /************** finish up widgets *******************/
00657 /*---------------------------------------------------*/
00658
00659 XtManageChild( imag->frame ) ;
00660 if( im3d->type == AFNI_3DDATA_VIEW ){
00661 XtManageChild( view->frame ) ;
00662 }
00663 XtManageChild( prog->frame ) ;
00664
00665 XtManageChild( vwid->top_form ) ;
00666
00667 EXRETURN ;
00668 }
00669
00670 /*------------------------------------------------------------------*/
00671
00672 void AFNI_raiseup_CB( Widget w , XtPointer cd , XtPointer cb )
00673 {
00674 XMapRaised( XtDisplay(w) , XtWindow(XtParent(w)) ) ;
00675 }
00676
00677 /*--------------------------------------------------------------------*/
00678
00679 void AFNI_make_wid1( Three_D_View * im3d )
00680 {
00681 int ii ;
00682
00683 ENTRY("AFNI_make_wid1") ;
00684
00685 /*----------------------------------------------------------*/
00686 /***************** imaging controls *************************/
00687 /*----------------------------------------------------------*/
00688
00689 /*--- vertical rowcol to hold all imaging stuff ---*/
00690
00691 STATUS("making imag->rowcol") ;
00692
00693 imag->rowcol =
00694 XtVaCreateWidget(
00695 "dialog" , xmRowColumnWidgetClass , imag->frame ,
00696 XmNpacking , XmPACK_TIGHT ,
00697 XmNorientation , XmVERTICAL ,
00698 XmNtraversalOn , False ,
00699 XmNinitialResourcesPersistent , False ,
00700 NULL ) ;
00701
00702 /*--- popup menu to handle special imaging concerns ---*/
00703
00704 imag->topper = /* invisible widget to be parent of popup */
00705 XtVaCreateManagedWidget(
00706 "dialog" , xmSeparatorWidgetClass , imag->rowcol ,
00707 XmNseparatorType , XmNO_LINE ,
00708 NULL ) ;
00709
00710 #ifdef BAD_BUTTON3_POPUPS /* 21 Jul 2003 */
00711 imag->popmenu =
00712 XmCreatePopupMenu( vwid->top_form, "menu" , NULL , 0 ) ;
00713 #else
00714 imag->popmenu =
00715 XmCreatePopupMenu( imag->topper , "menu" , NULL , 0 ) ;
00716 #endif
00717
00718 SAVEUNDERIZE(XtParent(imag->popmenu)) ; /* 27 Feb 2001 */
00719
00720 VISIBILIZE_WHEN_MAPPED(imag->popmenu) ;
00721
00722 /***
00723 XtAddCallback( imag->popmenu ,
00724 XmNunmapCallback , AFNI_imag_pop_CB , im3d ) ;
00725 ***/
00726
00727 XtVaSetValues( imag->popmenu ,
00728 XmNradioBehavior , True ,
00729 XmNradioAlwaysOne , False ,
00730 XmNspacing , 1 ,
00731 XmNmarginHeight , 0 ,
00732 XmNmarginWidth , 0 ,
00733 NULL ) ;
00734
00735 /*--- jumpback button in menu ---*/
00736
00737 imag->pop_jumpback_pb =
00738 XtVaCreateManagedWidget(
00739 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00740 LABEL_ARG("Jumpback") ,
00741 XmNmarginHeight , 0 ,
00742 XmNtraversalOn , False ,
00743 XmNinitialResourcesPersistent , False ,
00744 NULL ) ;
00745
00746 XtAddCallback( imag->pop_jumpback_pb , XmNactivateCallback ,
00747 AFNI_imag_pop_CB , im3d ) ;
00748
00749 /*--- jumpto button in menu ---*/
00750
00751 if( im3d->type == AFNI_3DDATA_VIEW ){
00752 imag->pop_jumpto_pb =
00753 XtVaCreateManagedWidget(
00754 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00755 LABEL_ARG("Jump to (xyz)") ,
00756 XmNmarginHeight , 0 ,
00757 XmNtraversalOn , False ,
00758 XmNinitialResourcesPersistent , False ,
00759 NULL ) ;
00760
00761 XtAddCallback( imag->pop_jumpto_pb , XmNactivateCallback ,
00762 AFNI_imag_pop_CB , im3d ) ;
00763 } else {
00764 imag->pop_jumpto_pb = NULL ;
00765 }
00766
00767 if( im3d->type == AFNI_3DDATA_VIEW ){
00768 imag->pop_jumpto_ijk_pb =
00769 XtVaCreateManagedWidget(
00770 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00771 LABEL_ARG("Jump to (ijk)") ,
00772 XmNmarginHeight , 0 ,
00773 XmNtraversalOn , False ,
00774 XmNinitialResourcesPersistent , False ,
00775 NULL ) ;
00776
00777 XtAddCallback( imag->pop_jumpto_ijk_pb , XmNactivateCallback ,
00778 AFNI_imag_pop_CB , im3d ) ;
00779 } else {
00780 imag->pop_jumpto_ijk_pb = NULL ;
00781 }
00782
00783 /*--- mnito button in menu [01 May 2002] ---*/
00784
00785 if( im3d->type == AFNI_3DDATA_VIEW ){
00786 imag->pop_mnito_pb =
00787 XtVaCreateManagedWidget(
00788 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00789 LABEL_ARG("Jump to (MNI)") ,
00790 XmNmarginHeight , 0 ,
00791 XmNtraversalOn , False ,
00792 XmNinitialResourcesPersistent , False ,
00793 NULL ) ;
00794
00795 XtAddCallback( imag->pop_mnito_pb , XmNactivateCallback ,
00796 AFNI_imag_pop_CB , im3d ) ;
00797 } else {
00798 imag->pop_mnito_pb = NULL ;
00799 }
00800
00801 /*--- sumato button in menu ---*/
00802
00803 if( im3d->type == AFNI_3DDATA_VIEW ){
00804 imag->pop_sumato_pb =
00805 XtVaCreateManagedWidget(
00806 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00807 LABEL_ARG("SUMA to (node)") ,
00808 XmNmarginHeight , 0 ,
00809 XmNtraversalOn , False ,
00810 XmNinitialResourcesPersistent , False ,
00811 NULL ) ;
00812
00813 XtAddCallback( imag->pop_sumato_pb , XmNactivateCallback ,
00814 AFNI_imag_pop_CB , im3d ) ;
00815 } else {
00816 imag->pop_sumato_pb = NULL ;
00817 }
00818
00819 /*--- Talairach To button in menu ---*/
00820
00821 if( im3d->type == AFNI_3DDATA_VIEW ){
00822 imag->pop_talto_pb =
00823 XtVaCreateManagedWidget(
00824 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00825 LABEL_ARG("-Talairach to") ,
00826 XmNmarginHeight , 0 ,
00827 XmNtraversalOn , False ,
00828 XmNinitialResourcesPersistent , False ,
00829 NULL ) ;
00830
00831 XtAddCallback( imag->pop_talto_pb , XmNactivateCallback ,
00832 AFNI_imag_pop_CB , im3d ) ;
00833
00834 if( TT_load_atlas() > 0 ){
00835 imag->pop_whereami_pb = /* 10 Jul 2001 */
00836 XtVaCreateManagedWidget(
00837 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00838 LABEL_ARG("-Where Am I?") ,
00839 XmNmarginHeight , 0 ,
00840 XmNtraversalOn , False ,
00841 XmNinitialResourcesPersistent , False ,
00842 NULL ) ;
00843
00844 XtAddCallback( imag->pop_whereami_pb , XmNactivateCallback ,
00845 AFNI_imag_pop_CB , im3d ) ;
00846
00847 imag->pop_ttren_pb =
00848 XtVaCreateManagedWidget(
00849 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00850 LABEL_ARG("-Atlas Colors") ,
00851 XmNmarginHeight , 0 ,
00852 XmNtraversalOn , False ,
00853 XmNinitialResourcesPersistent , False ,
00854 NULL ) ;
00855
00856 XtAddCallback( imag->pop_ttren_pb , XmNactivateCallback ,
00857 AFNI_imag_pop_CB , im3d ) ;
00858
00859 } else {
00860 static int first=1 ;
00861 imag->pop_ttren_pb = imag->pop_whereami_pb = NULL ;
00862 if( first ){
00863 first = 0 ;
00864 fprintf(stderr,
00865 "\n++ WARNING: Can't find TTatlas+tlrc or TTatlas.nii.gz dataset for 'whereami'!\n"
00866 "++--------- See http://afni.nimh.nih.gov/pub/dist/data/\n" ) ;
00867 }
00868 }
00869 imag->pop_whereami_twin = NULL ;
00870 } else {
00871 imag->pop_talto_pb = NULL ;
00872 imag->pop_ttren_pb = imag->pop_whereami_pb = NULL ; /* 10 Jul 2001 */
00873 imag->pop_whereami_twin = NULL ;
00874 }
00875
00876 /*--- imageonly button in menu ---*/
00877
00878 imag->pop_imageonly_pb =
00879 XtVaCreateManagedWidget(
00880 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00881 LABEL_ARG("Image display") ,
00882 XmNmarginHeight , 0 ,
00883 XmNtraversalOn , False ,
00884 XmNinitialResourcesPersistent , False ,
00885 NULL ) ;
00886
00887 XtAddCallback( imag->pop_imageonly_pb , XmNactivateCallback ,
00888 AFNI_imag_pop_CB , im3d ) ;
00889
00890 /*--- environment button in menu [05 Nov 2003] ---*/
00891
00892 #ifdef ALLOW_PLUGINS
00893 imag->pop_environment_pb =
00894 XtVaCreateManagedWidget(
00895 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00896 LABEL_ARG("Edit Environment") ,
00897 XmNmarginHeight , 0 ,
00898 XmNtraversalOn , False ,
00899 XmNinitialResourcesPersistent , False ,
00900 NULL ) ;
00901 XtAddCallback( imag->pop_environment_pb , XmNactivateCallback ,
00902 AFNI_imag_pop_CB , im3d ) ;
00903
00904 imag->pop_drawdataset_pb =
00905 XtVaCreateManagedWidget(
00906 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
00907 LABEL_ARG("Draw ROI plugin") ,
00908 XmNmarginHeight , 0 ,
00909 XmNtraversalOn , False ,
00910 XmNinitialResourcesPersistent , False ,
00911 NULL ) ;
00912 XtAddCallback( imag->pop_drawdataset_pb , XmNactivateCallback ,
00913 AFNI_imag_pop_CB , im3d ) ;
00914 #else
00915 imag->pop_environment_pb = NULL ;
00916 imag->pop_drawdataset_pb = NULL ;
00917 #endif
00918
00919 /*--- frame to hold all crosshair stuff ---*/
00920
00921 imag->crosshair_frame =
00922 XtVaCreateManagedWidget(
00923 "dialog" , xmFrameWidgetClass , imag->rowcol ,
00924 XmNshadowType , XmSHADOW_ETCHED_IN ,
00925 XmNshadowThickness , 2 ,
00926 XmNtraversalOn , False ,
00927 XmNinitialResourcesPersistent , False ,
00928 NULL ) ;
00929
00930 /*--- rowcol to manage crosshair stuff ---*/
00931
00932 imag->crosshair_rowcol =
00933 XtVaCreateWidget(
00934 "dialog" , xmRowColumnWidgetClass , imag->crosshair_frame ,
00935 XmNpacking , XmPACK_TIGHT ,
00936 XmNorientation , XmVERTICAL ,
00937 XmNtraversalOn , False ,
00938 XmNinitialResourcesPersistent , False ,
00939 NULL ) ;
00940
00941 /*--- label to display the crosshair location ---*/
00942
00943 im3d->vinfo->old_crosshair_label = xstr = AFNI_crosshair_label( im3d ) ;
00944
00945 im3d->vinfo->view_setter = -1 ; /* 20 Feb 2003 */
00946
00947 imag->crosshair_label =
00948 XtVaCreateManagedWidget(
00949 "dialog" , xmLabelWidgetClass , imag->crosshair_rowcol ,
00950 XmNrecomputeSize , False ,
00951 XmNlabelString , xstr ,
00952 XmNtraversalOn , False ,
00953 XmNinitialResourcesPersistent , False ,
00954 NULL ) ;
00955
00956 MCW_register_help( imag->crosshair_label , AFNI_crosshair_label_help ) ;
00957 MCW_register_hint( imag->crosshair_label , "Coordinates of crosshair point" ) ;
00958
00959 /*--- 12 Mar 2004: coordinate order popup menu ---*/
00960
00961 if( im3d->type == AFNI_3DDATA_VIEW ){
00962 imag->crosshair_menu =
00963 XmCreatePopupMenu( imag->crosshair_label , "menu" , NULL , 0 ) ;
00964
00965 SAVEUNDERIZE(XtParent(imag->crosshair_menu)) ;
00966 VISIBILIZE_WHEN_MAPPED(imag->crosshair_menu) ;
00967
00968 XtInsertEventHandler( imag->crosshair_label , /* handle events in label */
00969 ButtonPressMask , /* button presses */
00970 FALSE , /* nonmaskable events? */
00971 AFNI_crosshair_EV , /* handler */
00972 (XtPointer) im3d , /* client data */
00973 XtListTail /* last in queue */
00974 ) ;
00975
00976 (void) XtVaCreateManagedWidget(
00977 "menu" , xmLabelWidgetClass , imag->crosshair_menu ,
00978 LABEL_ARG("-Set Coord Order-") ,
00979 XmNrecomputeSize , False ,
00980 XmNinitialResourcesPersistent , False ,
00981 NULL ) ;
00982
00983 (void) XtVaCreateManagedWidget(
00984 "menu" , xmSeparatorWidgetClass , imag->crosshair_menu ,
00985 XmNseparatorType , XmSINGLE_LINE , NULL ) ;
00986
00987 imag->crosshair_dicom_pb =
00988 XtVaCreateManagedWidget(
00989 "menu" , xmPushButtonWidgetClass , imag->crosshair_menu ,
00990 LABEL_ARG(" RAI=DICOM order") ,
00991 XmNmarginHeight , 0 ,
00992 XmNtraversalOn , False ,
00993 XmNinitialResourcesPersistent , False ,
00994 NULL ) ;
00995 XtAddCallback( imag->crosshair_dicom_pb , XmNactivateCallback ,
00996 AFNI_crosshair_pop_CB , im3d ) ;
00997
00998 imag->crosshair_spm_pb =
00999 XtVaCreateManagedWidget(
01000 "menu" , xmPushButtonWidgetClass , imag->crosshair_menu ,
01001 LABEL_ARG(" LPI=SPM order") ,
01002 XmNmarginHeight , 0 ,
01003 XmNtraversalOn , False ,
01004 XmNinitialResourcesPersistent , False ,
01005 NULL ) ;
01006 XtAddCallback( imag->crosshair_spm_pb , XmNactivateCallback ,
01007 AFNI_crosshair_pop_CB , im3d ) ;
01008
01009 } /*- end of crosshair_label popup menu -*/
01010
01011 /*--- 01 Jan 1997: horizontal rowcol for crosshair stuff ---*/
01012
01013 STATUS("making imag->xhair_rowcol") ;
01014
01015 imag->xhair_rowcol =
01016 XtVaCreateWidget(
01017 "dialog" , xmRowColumnWidgetClass , imag->crosshair_rowcol ,
01018 XmNpacking , XmPACK_TIGHT ,
01019 XmNorientation , XmHORIZONTAL ,
01020 XmNmarginHeight, 0 ,
01021 XmNmarginWidth , 0 ,
01022 XmNtraversalOn , False ,
01023 XmNinitialResourcesPersistent , False ,
01024 NULL ) ;
01025
01026 /*--- arrowval to control crosshair visibility ---*/
01027
01028 if( im3d->vinfo->crosshair_visible )
01029 ii = (im3d->vinfo->xhairs_show_montage) ? AFNI_XHAIRS_MULTI
01030 : AFNI_XHAIRS_SINGLE ;
01031 else
01032 ii = AFNI_XHAIRS_OFF ;
01033
01034 im3d->vinfo->xhairs_orimask = ORIMASK_ALL ; /* 31 Dec 1998 */
01035
01036 STATUS("making imag->crosshair_av") ;
01037
01038 imag->crosshair_av = new_MCW_arrowval(
01039 imag->xhair_rowcol , /* parent Widget */
01040 "Xhairs" , /* label */
01041 AVOPT_STYLE , /* option menu style */
01042 AFNI_XHAIRS_OFF , /* first option */
01043 AFNI_XHAIRS_LASTOPTION , /* last option */
01044 ii , /* initial selection */
01045 MCW_AV_readtext , /* ignored but needed */
01046 0 , /* ditto */
01047 AFNI_crosshair_visible_CB , /* callback when changed */
01048 (XtPointer) im3d , /* data for above */
01049 MCW_av_substring_CB , /* text creation routine */
01050 AFNI_crosshair_av_label /* data for above */
01051 ) ;
01052
01053 if( AVOPT_STYLE == MCW_AV_optmenu )
01054 AVOPT_columnize( imag->crosshair_av , 3 ) ;
01055
01056 imag->crosshair_av->parent = (XtPointer) im3d ;
01057 imag->crosshair_av->allow_wrap = True ;
01058
01059 MCW_reghelp_children( imag->crosshair_av->wrowcol , AFNI_crosshair_av_help ) ;
01060 MCW_reghint_children( imag->crosshair_av->wrowcol , "Crosshairs style" ) ;
01061
01062 ADDTO_KILL(im3d->kl,imag->crosshair_av) ;
01063
01064 /*--- 01 Jan 1997: buttonbox to control "all" or "one" xhairs in montage ---*/
01065
01066 STATUS("making imag->xhall_bbox") ;
01067
01068 imag->xhall_bbox = new_MCW_bbox( imag->xhair_rowcol ,
01069 1 , AFNI_xhall_bbox_label ,
01070 MCW_BB_check ,
01071 MCW_BB_noframe ,
01072 AFNI_xhall_bbox_CB , (XtPointer) im3d ) ;
01073
01074 MCW_set_bbox( imag->xhall_bbox , im3d->vinfo->xhairs_all ? 1 : 0 ) ;
01075
01076 ADDTO_KILL(im3d->kl , imag->xhall_bbox) ;
01077
01078 MCW_reghelp_children( imag->xhall_bbox->wrowcol ,
01079 "IN: Montage will show crosshairs in all slices\n"
01080 "OUT: Montage will show crosshairs in one slice"
01081 ) ;
01082 MCW_reghint_children( imag->xhall_bbox->wrowcol ,
01083 "All-or-One Montage crosshairs" ) ;
01084
01085 STATUS("managing imag->xhair_rowcol") ;
01086
01087 XtManageChild( imag->xhair_rowcol ) ;
01088
01089 /*--- arrowval to control crosshair color ---*/
01090
01091 ii = AVOPT_STYLE ;
01092
01093 STATUS("making imag->crosshair_color_av") ;
01094
01095 if( ii == MCW_AV_downup ){
01096 imag->crosshair_color_av =
01097 new_MCW_arrowval( imag->crosshair_rowcol , /* parent */
01098 "Color " , /* label */
01099 MCW_AV_downup , /* arrow directions */
01100 1 , /* min value */
01101 last_color , /* max value */
01102 im3d->vinfo->crosshair_ovcolor ,/* init value */
01103 MCW_AV_readtext , /* readonly text */
01104 0 , /* 0 decimal shift */
01105 AFNI_crosshair_color_CB , /* click routine */
01106 (XtPointer) im3d , /* data for above */
01107 MCW_DC_ovcolor_text , /* text routine */
01108 (XtPointer) im3d->dc /* data for text */
01109 ) ;
01110
01111 (void) MCW_DC_ovcolor_text( imag->crosshair_color_av ,
01112 im3d->dc ) ; /* set color now! */
01113
01114 imag->crosshair_color_av->fastdelay = 333 ; /* slow down repeat action */
01115 imag->crosshair_color_av->allow_wrap = 1 ;
01116
01117 } else {
01118 imag->crosshair_color_av =
01119 new_MCW_colormenu( imag->crosshair_rowcol , "Color " , im3d->dc ,
01120 1 , last_color , im3d->vinfo->crosshair_ovcolor ,
01121 AFNI_crosshair_color_CB , (XtPointer) im3d ) ;
01122 }
01123
01124 imag->crosshair_color_av->parent = (XtPointer) im3d ;
01125 imag->crosshair_color_av->fastdelay = 333 ; /* slow down repeat action */
01126 imag->crosshair_color_av->allow_wrap = 1 ;
01127
01128 MCW_reghelp_children( imag->crosshair_color_av->wrowcol ,
01129 AFNI_crosshair_color_help ) ;
01130 MCW_reghint_children( imag->crosshair_color_av->wrowcol , "Crosshairs color" ) ;
01131
01132 ADDTO_KILL(im3d->kl,imag->crosshair_color_av) ;
01133
01134 /**** 1 Aug 1996:
01135 put crosshair gap into a horizontal rowcol so
01136 can attach a toggle for periodic montages here, too ****/
01137
01138 STATUS("making imag->gap_wrap_rowcol") ;
01139
01140 imag->gap_wrap_rowcol =
01141 XtVaCreateWidget(
01142 "dialog" , xmRowColumnWidgetClass , imag->crosshair_rowcol ,
01143 XmNpacking , XmPACK_TIGHT ,
01144 XmNorientation , XmHORIZONTAL ,
01145 XmNmarginHeight, 0 ,
01146 XmNmarginWidth , 0 ,
01147 XmNtraversalOn , False ,
01148 XmNinitialResourcesPersistent , False ,
01149 NULL ) ;
01150
01151 /*--- arrowval to control crosshair gap ---*/
01152
01153 STATUS("making imag->crosshair_gap_av") ;
01154
01155 imag->crosshair_gap_av =
01156 new_MCW_arrowval( imag->gap_wrap_rowcol , /* parent */
01157 "Gap " , /* label */
01158 AVOPT_STYLE , /* arrow directions */
01159 -1 , /* min value */
01160 MAXOVSIZE , /* max value */
01161 im3d->vinfo->crosshair_gap , /* init value */
01162 MCW_AV_editext , /* input/output text */
01163 0 , /* 0 decimal shift */
01164 AFNI_crosshair_gap_CB , /* click routine */
01165 (XtPointer) im3d , /* data */
01166 NULL , NULL
01167 ) ;
01168
01169 if( AVOPT_STYLE == MCW_AV_optmenu && MAXOVSIZE >= COLSIZE )
01170 AVOPT_columnize( imag->crosshair_gap_av , 1+(MAXOVSIZE+1)/COLSIZE ) ;
01171
01172 imag->crosshair_gap_av->parent = (XtPointer) im3d ;
01173 imag->crosshair_gap_av->fastdelay = 333 ; /* slow down repeat action */
01174
01175 MCW_reghelp_children( imag->crosshair_gap_av->wrowcol ,
01176 AFNI_crosshair_gap_help ) ;
01177 MCW_reghint_children( imag->crosshair_gap_av->wrowcol ,
01178 "Gap in crosshairs" ) ;
01179
01180 ADDTO_KILL(im3d->kl,imag->crosshair_gap_av) ;
01181
01182 /*--- 1 Aug 1996:
01183 toggle button box to control periodic montages ---*/
01184
01185 STATUS("making imag->wrap_bbox") ;
01186
01187 imag->wrap_bbox = new_MCW_bbox( imag->gap_wrap_rowcol ,
01188 1 , AFNI_wrap_bbox_label ,
01189 MCW_BB_check ,
01190 MCW_BB_noframe ,
01191 AFNI_wrap_bbox_CB , (XtPointer) im3d ) ;
01192
01193 MCW_set_bbox( imag->wrap_bbox , im3d->vinfo->xhairs_periodic ? 1 : 0 ) ;
01194
01195 ADDTO_KILL(im3d->kl , imag->wrap_bbox) ;
01196
01197 MCW_reghelp_children( imag->wrap_bbox->wrowcol ,
01198 "IN: Montage layout wraps around when slices\n"
01199 " go past an edge of the dataset.\n"
01200 "OUT: Montage layout shows blanks for slices\n"
01201 " past an edge of the dataset."
01202 ) ;
01203 MCW_reghint_children( imag->wrap_bbox->wrowcol ,
01204 "Wrap montage past edge of volume?" ) ;
01205
01206 STATUS("managing imag->gap_wrap_rowcol") ;
01207
01208 XtManageChild( imag->gap_wrap_rowcol ) ;
01209
01210 /*--- arrowval to control time index we are viewing ---*/
01211
01212 STATUS("making imag->time_index_av") ;
01213
01214 imag->time_index_av =
01215 new_MCW_arrowval( imag->crosshair_rowcol , /* parent */
01216 "Index " , /* label */
01217 MCW_AV_downup , /* arrow directions */
01218 0 , /* min value */
01219 im3d->vinfo->top_index , /* max value */
01220 im3d->vinfo->time_index , /* init value */
01221 MCW_AV_editext , /* input/output text */
01222 0 , /* 0 decimal shift */
01223 AFNI_time_index_CB , /* click routine */
01224 (XtPointer) im3d , /* data */
01225 NULL , NULL
01226 ) ;
01227 imag->time_index_av->parent = (XtPointer) im3d ;
01228 imag->time_index_av->allow_wrap = 1 ;
01229
01230 MCW_reghelp_children( imag->time_index_av->wrowcol ,
01231 "Controls the time index\n"
01232 "of the images being viewed.\n"
01233 "[For time-dependent datasets.]" ) ;
01234 MCW_reghint_children( imag->time_index_av->wrowcol ,
01235 "Set index in time" ) ;
01236
01237 ADDTO_KILL(im3d->kl,imag->time_index_av) ;
01238
01239 /*--- frame to hold all viewing control stuff ---*/
01240
01241 STATUS("imag->view_frame") ;
01242
01243 imag->view_frame =
01244 XtVaCreateManagedWidget(
01245 "dialog" , xmFrameWidgetClass , imag->rowcol ,
01246 XmNshadowType , XmSHADOW_ETCHED_IN ,
01247 XmNshadowThickness , 2 ,
01248 XmNinitialResourcesPersistent , False ,
01249 NULL ) ;
01250
01251 /*--- rowcol to manage viewing control stuff ---*/
01252
01253 imag->view_rowcol =
01254 XtVaCreateWidget(
01255 "dialog" , xmRowColumnWidgetClass , imag->view_frame ,
01256 XmNpacking , XmPACK_TIGHT ,
01257 XmNorientation , XmVERTICAL ,
01258 XmNtraversalOn , False ,
01259 XmNinitialResourcesPersistent , False ,
01260 NULL ) ;
01261
01262 /*--- pushbuttons to turn different views on ---*/
01263
01264 #define xyz_3DIM "Axial "
01265 #define yzx_3DIM "Sagittal"
01266 #define zxy_3DIM "Coronal "
01267
01268 /*--------------------------------------------------------------*/
01269 imag->xyz_rowcol =
01270 XtVaCreateWidget(
01271 "dialog" , xmRowColumnWidgetClass , imag->view_rowcol ,
01272 XmNpacking , XmPACK_TIGHT ,
01273 XmNorientation , XmHORIZONTAL ,
01274 XmNmarginHeight, 0 ,
01275 XmNmarginWidth , 0 ,
01276 XmNtraversalOn , False ,
01277 XmNinitialResourcesPersistent , False ,
01278 NULL ) ;
01279
01280 imag->name_xyz_lab =
01281 XtVaCreateManagedWidget(
01282 "dialog" , xmLabelWidgetClass , imag->xyz_rowcol ,
01283 LABEL_ARG( xyz_3DIM ) ,
01284 XmNmarginHeight, 0 ,
01285 XmNmarginWidth , 0 ,
01286 XmNrecomputeSize , False ,
01287 XmNtraversalOn , False ,
01288 XmNinitialResourcesPersistent , False ,
01289 NULL ) ;
01290
01291 imag->image_xyz_pb =
01292 XtVaCreateManagedWidget(
01293 "dialog" , xmPushButtonWidgetClass , imag->xyz_rowcol ,
01294 LABEL_ARG("Image") ,
01295 XmNmarginHeight, 0 ,
01296 XmNmarginWidth , 0 ,
01297 XmNrecomputeSize , False ,
01298 XmNtraversalOn , False ,
01299 XmNinitialResourcesPersistent , False ,
01300 NULL ) ;
01301
01302 imag->graph_xyz_pb =
01303 XtVaCreateManagedWidget(
01304 "dialog" , xmPushButtonWidgetClass , imag->xyz_rowcol ,
01305 LABEL_ARG("Graph") ,
01306 XmNmarginHeight, 0 ,
01307 XmNmarginWidth , 0 ,
01308 XmNrecomputeSize , False ,
01309 XmNtraversalOn , False ,
01310 XmNinitialResourcesPersistent , False ,
01311 NULL ) ;
01312
01313 XtManageChild( imag->xyz_rowcol ) ;
01314 /*----------------------------------------------------------------*/
01315
01316 /*--------------------------------------------------------------*/
01317 imag->yzx_rowcol =
01318 XtVaCreateWidget(
01319 "dialog" , xmRowColumnWidgetClass , imag->view_rowcol ,
01320 XmNpacking , XmPACK_TIGHT ,
01321 XmNorientation , XmHORIZONTAL ,
01322 XmNmarginHeight, 0 ,
01323 XmNmarginWidth , 0 ,
01324 XmNtraversalOn , False ,
01325 XmNinitialResourcesPersistent , False ,
01326 NULL ) ;
01327
01328 imag->name_yzx_lab =
01329 XtVaCreateManagedWidget(
01330 "dialog" , xmLabelWidgetClass , imag->yzx_rowcol ,
01331 LABEL_ARG( yzx_3DIM ) ,
01332 XmNmarginHeight, 0 ,
01333 XmNmarginWidth , 0 ,
01334 XmNrecomputeSize , False ,
01335 XmNtraversalOn , False ,
01336 XmNinitialResourcesPersistent , False ,
01337 NULL ) ;
01338
01339 imag->image_yzx_pb =
01340 XtVaCreateManagedWidget(
01341 "dialog" , xmPushButtonWidgetClass , imag->yzx_rowcol ,
01342 LABEL_ARG("Image") ,
01343 XmNmarginHeight, 0 ,
01344 XmNmarginWidth , 0 ,
01345 XmNrecomputeSize , False ,
01346 XmNtraversalOn , False ,
01347 XmNinitialResourcesPersistent , False ,
01348 NULL ) ;
01349
01350 imag->graph_yzx_pb =
01351 XtVaCreateManagedWidget(
01352 "dialog" , xmPushButtonWidgetClass , imag->yzx_rowcol ,
01353 LABEL_ARG("Graph") ,
01354 XmNmarginHeight, 0 ,
01355 XmNmarginWidth , 0 ,
01356 XmNrecomputeSize , False ,
01357 XmNtraversalOn , False ,
01358 XmNinitialResourcesPersistent , False ,
01359 NULL ) ;
01360
01361 XtManageChild( imag->yzx_rowcol ) ;
01362 /*----------------------------------------------------------------*/
01363
01364 /*--------------------------------------------------------------*/
01365 imag->zxy_rowcol =
01366 XtVaCreateWidget(
01367 "dialog" , xmRowColumnWidgetClass , imag->view_rowcol ,
01368 XmNpacking , XmPACK_TIGHT ,
01369 XmNorientation , XmHORIZONTAL ,
01370 XmNmarginHeight, 0 ,
01371 XmNmarginWidth , 0 ,
01372 XmNtraversalOn , False ,
01373 XmNinitialResourcesPersistent , False ,
01374 NULL ) ;
01375
01376 imag->name_zxy_lab =
01377 XtVaCreateManagedWidget(
01378 "dialog" , xmLabelWidgetClass , imag->zxy_rowcol ,
01379 LABEL_ARG( zxy_3DIM ) ,
01380 XmNmarginHeight, 0 ,
01381 XmNmarginWidth , 0 ,
01382 XmNrecomputeSize , False ,
01383 XmNtraversalOn , False ,
01384 XmNinitialResourcesPersistent , False ,
01385 NULL ) ;
01386
01387 imag->image_zxy_pb =
01388 XtVaCreateManagedWidget(
01389 "dialog" , xmPushButtonWidgetClass , imag->zxy_rowcol ,
01390 LABEL_ARG("Image") ,
01391 XmNmarginHeight, 0 ,
01392 XmNmarginWidth , 0 ,
01393 XmNrecomputeSize , False ,
01394 XmNtraversalOn , False ,
01395 XmNinitialResourcesPersistent , False ,
01396 NULL ) ;
01397
01398 imag->graph_zxy_pb =
01399 XtVaCreateManagedWidget(
01400 "dialog" , xmPushButtonWidgetClass , imag->zxy_rowcol ,
01401 LABEL_ARG("Graph") ,
01402 XmNmarginHeight, 0 ,
01403 XmNmarginWidth , 0 ,
01404 XmNrecomputeSize , False ,
01405 XmNtraversalOn , False ,
01406 XmNinitialResourcesPersistent , False ,
01407 NULL ) ;
01408
01409 XtManageChild( imag->zxy_rowcol ) ;
01410 /*----------------------------------------------------------------*/
01411
01412 XtAddCallback( imag->image_xyz_pb , XmNactivateCallback ,
01413 AFNI_view_xyz_CB , im3d ) ;
01414
01415 XtAddCallback( imag->image_yzx_pb , XmNactivateCallback ,
01416 AFNI_view_xyz_CB , im3d ) ;
01417
01418 XtAddCallback( imag->image_zxy_pb , XmNactivateCallback ,
01419 AFNI_view_xyz_CB , im3d ) ;
01420
01421 XtAddCallback( imag->graph_xyz_pb , XmNactivateCallback ,
01422 AFNI_view_xyz_CB , im3d ) ;
01423
01424 XtAddCallback( imag->graph_yzx_pb , XmNactivateCallback ,
01425 AFNI_view_xyz_CB , im3d ) ;
01426
01427 XtAddCallback( imag->graph_zxy_pb , XmNactivateCallback ,
01428 AFNI_view_xyz_CB , im3d ) ;
01429
01430 MCW_reghelp_children( imag->xyz_rowcol , AFNI_view_help ) ;
01431 MCW_reghelp_children( imag->yzx_rowcol , AFNI_view_help ) ;
01432 MCW_reghelp_children( imag->zxy_rowcol , AFNI_view_help ) ;
01433
01434 MCW_reghint_children( imag->xyz_rowcol , "Open/raise viewing window" ) ;
01435 MCW_reghint_children( imag->yzx_rowcol , "Open/raise viewing window" ) ;
01436 MCW_reghint_children( imag->zxy_rowcol , "Open/raise viewing window" ) ;
01437
01438 XtInsertEventHandler( imag->image_xyz_pb ,
01439 ButtonPressMask , FALSE ,
01440 AFNI_viewbut_EV , (XtPointer)im3d , XtListTail ) ;
01441 XtInsertEventHandler( imag->graph_xyz_pb ,
01442 ButtonPressMask , FALSE ,
01443 AFNI_viewbut_EV , (XtPointer)im3d , XtListTail ) ;
01444 XtInsertEventHandler( imag->image_yzx_pb ,
01445 ButtonPressMask , FALSE ,
01446 AFNI_viewbut_EV , (XtPointer)im3d , XtListTail ) ;
01447 XtInsertEventHandler( imag->graph_yzx_pb ,
01448 ButtonPressMask , FALSE ,
01449 AFNI_viewbut_EV , (XtPointer)im3d , XtListTail ) ;
01450 XtInsertEventHandler( imag->image_zxy_pb ,
01451 ButtonPressMask , FALSE ,
01452 AFNI_viewbut_EV , (XtPointer)im3d , XtListTail ) ;
01453 XtInsertEventHandler( imag->graph_zxy_pb ,
01454 ButtonPressMask , FALSE ,
01455 AFNI_viewbut_EV , (XtPointer)im3d , XtListTail ) ;
01456
01457 /* imaging column finished, so manage its pieces */
01458
01459 XtManageChild( imag->crosshair_rowcol ) ;
01460 XtManageChild( imag->view_rowcol ) ;
01461 XtManageChild( imag->rowcol ) ;
01462
01463 /*-------------------------------------------------------*/
01464 /************ Controls for which view we see *************/
01465 /*-------------------------------------------------------*/
01466
01467 marks->ov_visible = marks->tag_visible = False ;
01468
01469 /*--- vertical rowcol to hold all viewing controls stuff ---*/
01470
01471 STATUS("making view->rowcol") ;
01472
01473 view->rowcol =
01474 XtVaCreateWidget(
01475 "dialog" , xmRowColumnWidgetClass , view->frame ,
01476 XmNpacking , XmPACK_TIGHT ,
01477 XmNorientation , XmVERTICAL ,
01478 XmNtraversalOn , False ,
01479 XmNinitialResourcesPersistent , False ,
01480 NULL ) ;
01481
01482 view_count = 0 ; /* count of widgets in this column */
01483
01484 /*--- radio box to control which view we see ---*/
01485
01486 view->view_bbox =
01487 new_MCW_bbox( view->rowcol ,
01488 LAST_VIEW_TYPE+1 ,
01489 VIEW_typestr ,
01490 MCW_BB_radio_one ,
01491 MCW_BB_frame ,
01492 AFNI_switchview_CB , (XtPointer) im3d ) ;
01493
01494 for( id=0 ; id <= LAST_VIEW_TYPE ; id++ ){
01495 if( im3d->anat_dset[id] == NULL )
01496 XtSetSensitive( view->view_bbox->wbut[id] , False ) ;
01497 }
01498
01499 MCW_set_bbox( view->view_bbox , 1 << im3d->vinfo->view_type ) ;
01500
01501 ADDTO_KILL(im3d->kl,view->view_bbox) ;
01502
01503 MCW_reghelp_children( view->view_bbox->wrowcol ,
01504 "Use these to select the\n"
01505 "type of view for your data" ) ;
01506
01507 { char * hh[] = { "View data in original coordinates" ,
01508 "View data in AC-PC aligned coordinates" ,
01509 "View data in Talairach coordinates" } ;
01510 MCW_bbox_hints( view->view_bbox , 3 , hh ) ;
01511 }
01512
01513 view_count += LAST_VIEW_TYPE+1 ;
01514
01515 /*--- frame for marks buttons ---*/
01516
01517 view->marks_frame =
01518 XtVaCreateManagedWidget(
01519 "dialog" , xmFrameWidgetClass , view->rowcol ,
01520 XmNshadowType , XmSHADOW_ETCHED_IN ,
01521 XmNshadowThickness , 2 ,
01522 XmNtraversalOn , False ,
01523 XmNinitialResourcesPersistent , False ,
01524 NULL ) ;
01525
01526 view->marks_rowcol =
01527 XtVaCreateWidget(
01528 "dialog" , xmRowColumnWidgetClass , view->marks_frame ,
01529 XmNpacking , XmPACK_TIGHT ,
01530 XmNorientation , XmVERTICAL ,
01531 XmNtraversalOn , False ,
01532 XmNinitialResourcesPersistent , False ,
01533 NULL ) ;
01534
01535 /*--- pushbutton to allow user to define marks ---*/
01536
01537 view->define_marks_pb =
01538 XtVaCreateManagedWidget(
01539 "dialog" , xmPushButtonWidgetClass , view->marks_rowcol ,
01540 LABEL_ARG("Define Markers") ,
01541 XmNmarginHeight , 1 ,
01542 XmNtraversalOn , False ,
01543 XmNinitialResourcesPersistent , False ,
01544 NULL ) ;
01545
01546 view->marks_pb_inverted = False ;
01547
01548 XtAddCallback( view->define_marks_pb , XmNactivateCallback ,
01549 AFNI_define_CB , im3d ) ;
01550
01551 MCW_register_help( view->define_marks_pb ,
01552 "Use this to allow you to define\n"
01553 "the markers for this view type" ) ;
01554 MCW_register_hint( view->define_marks_pb ,
01555 "Open/close Talairach markers control panel" ) ;
01556
01557 view_count ++ ;
01558
01559 /*--- bbox to allow the user to turn marks off and on ---*/
01560
01561 view->see_marks_bbox =
01562 new_MCW_bbox( view->marks_rowcol ,
01563 1 , AFNI_see_marks_bbox_label ,
01564 MCW_BB_check ,
01565 MCW_BB_noframe ,
01566 AFNI_see_marks_CB , (XtPointer) im3d ) ;
01567
01568 view->see_marks_bbox->parent = (XtPointer) im3d ;
01569
01570 MCW_set_bbox( view->see_marks_bbox , (marks->ov_visible) ? 0 : 1 ) ;
01571
01572 MCW_reghelp_children( view->see_marks_bbox->wrowcol ,
01573 AFNI_see_marks_bbox_help ) ;
01574 MCW_reghint_children( view->see_marks_bbox->wrowcol ,
01575 "Visibility of Talairach markers and Tags" ) ;
01576
01577 ADDTO_KILL(im3d->kl,view->see_marks_bbox) ;
01578
01579 view_count ++ ;
01580
01581 /*--- frame for func buttons ---*/
01582
01583 im3d->vinfo->func_visible = False ;
01584
01585 view->func_frame =
01586 XtVaCreateManagedWidget(
01587 "dialog" , xmFrameWidgetClass , view->rowcol ,
01588 XmNshadowType , XmSHADOW_ETCHED_IN ,
01589 XmNshadowThickness , 2 ,
01590 XmNtraversalOn , False ,
01591 XmNinitialResourcesPersistent , False ,
01592 NULL ) ;
01593
01594 view->func_rowcol =
01595 XtVaCreateWidget(
01596 "dialog" , xmRowColumnWidgetClass , view->func_frame ,
01597 XmNpacking , XmPACK_TIGHT ,
01598 XmNorientation , XmVERTICAL ,
01599 XmNtraversalOn , False ,
01600 XmNinitialResourcesPersistent , False ,
01601 NULL ) ;
01602
01603 /*--- pushbutton to allow user to define functions ---*/
01604
01605 view->define_func_pb =
01606 XtVaCreateManagedWidget(
01607 "dialog" , xmPushButtonWidgetClass , view->func_rowcol ,
01608 LABEL_ARG("Define OverLay") ,
01609 XmNmarginHeight , 1 ,
01610 XmNtraversalOn , False ,
01611 XmNinitialResourcesPersistent , False ,
01612 NULL ) ;
01613
01614 view->func_pb_inverted = False ;
01615
01616 XtAddCallback( view->define_func_pb , XmNactivateCallback ,
01617 AFNI_define_CB , im3d ) ;
01618
01619 MCW_register_help( view->define_func_pb ,
01620 "Use this to control the thresholds,\n"
01621 "colors, etc. for overlays" ) ;
01622 MCW_register_hint( view->define_func_pb ,
01623 "Open/close overlay control panel" ) ;
01624
01625 view_count ++ ;
01626
01627 /*--- bbox to allow the user to turn function overlay off and on ---*/
01628
01629 view->see_func_bbox =
01630 new_MCW_bbox( view->func_rowcol ,
01631 1 , AFNI_see_func_bbox_label ,
01632 MCW_BB_check ,
01633 MCW_BB_noframe ,
01634 AFNI_see_func_CB , (XtPointer) im3d ) ;
01635
01636 view->see_func_bbox->parent = (XtPointer) im3d ;
01637
01638 MCW_set_bbox( view->see_func_bbox , (im3d->vinfo->func_visible) ? 1 : 0 ) ;
01639
01640 MCW_reghelp_children( view->see_func_bbox->wrowcol ,
01641 AFNI_see_func_bbox_help ) ;
01642 MCW_reghint_children( view->see_func_bbox->wrowcol ,
01643 "Visibility of color overlay" ) ;
01644
01645 ADDTO_KILL(im3d->kl,view->see_func_bbox) ;
01646
01647 view_count ++ ;
01648
01649 /*--- pushbutton to allow user to define datamode ---*/
01650
01651 view->define_dmode_pb =
01652 XtVaCreateManagedWidget(
01653 "dialog" , xmPushButtonWidgetClass , view->rowcol ,
01654 LABEL_ARG("Define Datamode") ,
01655 XmNmarginHeight , 1 ,
01656 XmNtraversalOn , False ,
01657 XmNinitialResourcesPersistent , False ,
01658 NULL ) ;
01659
01660 view->dmode_pb_inverted = False ;
01661
01662 XtAddCallback( view->define_dmode_pb , XmNactivateCallback ,
01663 AFNI_define_CB , im3d ) ;
01664
01665 MCW_register_help( view->define_dmode_pb ,
01666 "Use this to control the mode in which\n"
01667 "the anatomy data is viewed, and also\n"
01668 "to save 3D datasets to disk" ) ;
01669 MCW_register_hint( view->define_dmode_pb ,
01670 "Open/close data manipulation control panel" ) ;
01671
01672 view_count ++ ;
01673
01674 /*--- frame for dataset choosers ---*/
01675
01676 view->dataset_frame =
01677 XtVaCreateManagedWidget(
01678 "dialog" , xmFrameWidgetClass , view->rowcol ,
01679 XmNshadowType , XmSHADOW_ETCHED_IN ,
01680 XmNshadowThickness , 2 ,
01681 XmNtraversalOn , False ,
01682 XmNinitialResourcesPersistent , False ,
01683 NULL ) ;
01684
01685 view->dataset_rowcol =
01686 XtVaCreateWidget(
01687 "dialog" , xmRowColumnWidgetClass , view->dataset_frame ,
01688 XmNpacking , XmPACK_TIGHT ,
01689 XmNorientation , XmVERTICAL ,
01690 XmNtraversalOn , False ,
01691 XmNinitialResourcesPersistent , False ,
01692 NULL ) ;
01693
01694 /*--- pushbuttons for dataset choice ---*/
01695
01696 view->choose_sess_pb =
01697 XtVaCreateManagedWidget(
01698 "dialog" , xmPushButtonWidgetClass , view->dataset_rowcol ,
01699 LABEL_ARG("Switch Session") ,
01700 XmNmarginHeight , 1 ,
01701 XmNtraversalOn , False ,
01702 XmNinitialResourcesPersistent , False ,
01703 NULL ) ;
01704
01705 XtAddCallback( view->choose_sess_pb , XmNactivateCallback ,
01706 AFNI_choose_dataset_CB , im3d ) ;
01707
01708 MCW_register_help( view->choose_sess_pb ,
01709 "Use this to choose from which\n"
01710 "session 3D datasets may be viewed." ) ;
01711 MCW_register_hint( view->choose_sess_pb ,
01712 "Switch between session directories" ) ;
01713
01714 view_count ++ ;
01715
01716 view->choose_anat_pb =
01717 XtVaCreateManagedWidget(
01718 "dialog" , xmPushButtonWidgetClass , view->dataset_rowcol ,
01719 LABEL_ARG("Switch UnderLay") ,
01720 XmNmarginHeight , 1 ,
01721 XmNtraversalOn , False ,
01722 XmNinitialResourcesPersistent , False ,
01723 NULL ) ;
01724
01725 XtAddCallback( view->choose_anat_pb , XmNactivateCallback ,
01726 AFNI_choose_dataset_CB , im3d ) ;
01727
01728 MCW_register_help( view->choose_anat_pb ,
01729 "Use this to choose which 3D\n"
01730 "dataset to view as the underlay\n"
01731 "(from the current session).\n\n"
01732 "N.B.: Datasets which can be\n"
01733 " graphed are marked with a\n"
01734 " '*' after their names.\n"
01735 " Datasets that are compressed\n"
01736 " have 'z' after their names."
01737 ) ;
01738 MCW_register_hint( view->choose_anat_pb ,
01739 "Switch datasets for underlay/graphs" ) ;
01740
01741 view_count ++ ;
01742
01743 view->choose_func_pb =
01744 XtVaCreateManagedWidget(
01745 "dialog" , xmPushButtonWidgetClass , view->dataset_rowcol ,
01746 LABEL_ARG("Switch OverLay") ,
01747 XmNmarginHeight , 1 ,
01748 XmNtraversalOn , False ,
01749 XmNinitialResourcesPersistent , False ,
01750 NULL ) ;
01751
01752 XtAddCallback( view->choose_func_pb , XmNactivateCallback ,
01753 AFNI_choose_dataset_CB , im3d ) ;
01754
01755 MCW_register_help( view->choose_func_pb ,
01756 "Use this to choose which\n"
01757 "overlay 3D dataset to view\n"
01758 "(from the current session).\n"
01759 "N.B.: Datasets that are compressed\n"
01760 " have 'z' after their names."
01761 ) ;
01762 MCW_register_hint( view->choose_func_pb ,
01763 "Switch datasets for color overlay" ) ;
01764
01765 view_count ++ ;
01766
01767 /* 19 Aug 2002: Surface chooser! */
01768
01769 view->choose_surf_pb =
01770 XtVaCreateManagedWidget(
01771 "dialog" , xmPushButtonWidgetClass , view->dataset_rowcol ,
01772 LABEL_ARG("Control Surface") ,
01773 XmNmarginHeight , 1 ,
01774 XmNtraversalOn , False ,
01775 XmNinitialResourcesPersistent , False ,
01776 NULL ) ;
01777
01778 XtAddCallback( view->choose_surf_pb , XmNactivateCallback ,
01779 AFNI_choose_surface_CB , im3d ) ;
01780
01781 MCW_register_help( view->choose_surf_pb ,
01782 "Use this to control the display of\n"
01783 "overlaid surfaces in image viewers:\n"
01784 "\n"
01785 "Surface nodes will have little boxes\n"
01786 " drawn, when they appear inside a slice.\n"
01787 "Surface triangles will have line segments\n"
01788 " drawn, where they intersect a slice\n"
01789 " center-plane."
01790 ) ;
01791 MCW_register_hint( view->choose_surf_pb ,
01792 "Control surface overlay" ) ;
01793
01794 view->swid = NULL ; /* no widgets for surface yet */
01795
01796 view_count ++ ;
01797
01798 #ifdef POPUP_CHOOSERS
01799 (void) XtVaCreateManagedWidget(
01800 "dialog" , xmSeparatorWidgetClass , imag->popmenu ,
01801 XmNseparatorType , XmDOUBLE_LINE ,
01802 NULL ) ;
01803
01804 view->popchoose_sess_pb =
01805 XtVaCreateManagedWidget(
01806 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
01807 LABEL_ARG("Switch Session") ,
01808 XmNmarginHeight , 0 ,
01809 XmNtraversalOn , False ,
01810 XmNinitialResourcesPersistent , False ,
01811 NULL ) ;
01812
01813 XtAddCallback( view->popchoose_sess_pb , XmNactivateCallback ,
01814 AFNI_choose_dataset_CB , im3d ) ;
01815
01816 view->popchoose_anat_pb =
01817 XtVaCreateManagedWidget(
01818 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
01819 LABEL_ARG("Switch UnderLay") ,
01820 XmNmarginHeight , 0 ,
01821 XmNtraversalOn , False ,
01822 XmNinitialResourcesPersistent , False ,
01823 NULL ) ;
01824
01825 XtAddCallback( view->popchoose_anat_pb , XmNactivateCallback ,
01826 AFNI_choose_dataset_CB , im3d ) ;
01827
01828 view->popchoose_func_pb =
01829 XtVaCreateManagedWidget(
01830 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
01831 LABEL_ARG("Switch OverLay") ,
01832 XmNmarginHeight , 0 ,
01833 XmNtraversalOn , False ,
01834 XmNinitialResourcesPersistent , False ,
01835 NULL ) ;
01836
01837 XtAddCallback( view->popchoose_func_pb , XmNactivateCallback ,
01838 AFNI_choose_dataset_CB , im3d ) ;
01839
01840 if( im3d->type == AFNI_IMAGES_VIEW ){
01841 XtUnmanageChild( view->popchoose_func_pb ) ;
01842 XtUnmanageChild( view->popchoose_anat_pb ) ;
01843 XtUnmanageChild( view->popchoose_sess_pb ) ;
01844 }
01845
01846 #else /* don't POPUP_CHOOSERS */
01847
01848 view->popchoose_func_pb =
01849 view->popchoose_anat_pb =
01850 view->popchoose_sess_pb = NULL ;
01851
01852 #endif /* POPUP_CHOOSERS*/
01853
01854 /*--- all view controls made, now manage them ---*/
01855
01856 XtManageChild( view->marks_rowcol ) ;
01857 XtManageChild( view->func_rowcol ) ;
01858 XtManageChild( view->dataset_rowcol ) ;
01859 XtManageChild( view->rowcol ) ;
01860
01861 /** compute height of widgets in the view-> column **/
01862
01863 xstr = XmStringCreateLtoR("(y[M",XmFONTLIST_DEFAULT_TAG );
01864 XtVaGetValues( view->choose_func_pb , XmNfontList , &xflist , NULL ) ;
01865 view_height = (10 + XmStringHeight(xflist,xstr)) * view_count ;
01866 XmStringFree( xstr ) ;
01867
01868 EXRETURN ;
01869 }
01870
01871 /*--------------------------------------------------------------------*/
01872
01873 void AFNI_make_wid2( Three_D_View * im3d )
01874 {
01875 int ii ;
01876 Widget hrc ; /* 30 Mar 2001 */
01877
01878 ENTRY("AFNI_make_wid2") ;
01879
01880 /*-------------------------------------------------------*/
01881 /************ Marker controls (lots of them) ************/
01882 /*-------------------------------------------------------*/
01883
01884 /*----- horizontal rowcol to hold the two columns of controls -----*/
01885
01886 STATUS("making marks->rowcol") ;
01887
01888 marks->rowcol =
01889 XtVaCreateWidget(
01890 "dialog" , xmRowColumnWidgetClass , marks->frame ,
01891 XmNpacking , XmPACK_TIGHT ,
01892 XmNorientation , XmHORIZONTAL ,
01893 XmNtraversalOn , False ,
01894 XmNinitialResourcesPersistent , False ,
01895 NULL ) ;
01896
01897 /*---------------------------------------------------------------*/
01898 /*----- COLUMN 1: the toggle switches for selecting markers -----*/
01899 /*---------------------------------------------------------------*/
01900
01901 marks->tog_frame =
01902 XtVaCreateManagedWidget(
01903 "dialog" , xmFrameWidgetClass , marks->rowcol ,
01904 XmNshadowType , XmSHADOW_ETCHED_IN ,
01905 XmNshadowThickness , 2 ,
01906 XmNinitialResourcesPersistent , False ,
01907 NULL ) ;
01908
01909 /*--- rowcol to manage toggle buttons stuff ---*/
01910
01911 marks->tog_rowcol =
01912 XtVaCreateWidget(
01913 "dialog" , xmRowColumnWidgetClass , marks->tog_frame ,
01914 XmNpacking , XmPACK_TIGHT ,
01915 XmNorientation , XmVERTICAL ,
01916 XmNtraversalOn , False ,
01917 XmNinitialResourcesPersistent , False ,
01918 NULL ) ;
01919
01920 /*----- create radio buttons in pairs,
01921 one in the rowcol and one in the popmenu;
01922 N.B.: they are created unmanaged and will be managed
01923 later, depending on defined marks for the view -----*/
01924
01925 XtVaSetValues( marks->tog_rowcol ,
01926 XmNradioBehavior , True ,
01927 XmNradioAlwaysOne , False ,
01928 XmNspacing , 1 ,
01929 XmNmarginHeight , 0 ,
01930 XmNmarginWidth , 0 ,
01931 NULL ) ;
01932
01933 marks->num_sometimes_popup = 0 ;
01934 marks->num_always_popup = 0 ;
01935
01936 marks->always_popup[(marks->num_always_popup)++] =
01937 XtVaCreateWidget(
01938 "dialog" , xmSeparatorWidgetClass , imag->popmenu ,
01939 XmNseparatorType , XmDOUBLE_LINE ,
01940 NULL ) ;
01941
01942 { int ib ;
01943 Dimension isiz ;
01944 Pixel fg_pix ;
01945
01946 XtVaGetValues( marks->tog_rowcol , XmNforeground , &fg_pix , NULL ) ;
01947
01948 for( ib=0 ; ib < MARKS_MAXNUM ; ib++ ){
01949
01950 marks->tog[ib] =
01951 XtVaCreateWidget(
01952 "dialog" , xmToggleButtonWidgetClass , marks->tog_rowcol ,
01953 XmNvisibleWhenOff , True ,
01954 XmNmarginHeight , 0 ,
01955 XmNmarginWidth , 0 ,
01956 XmNselectColor , fg_pix ,
01957 XmNtraversalOn , False ,
01958 XmNinitialResourcesPersistent , False ,
01959 NULL ) ;
01960
01961 /* we set XmNindicatorSize resource for the popup to same as the
01962 menu above, since menu default size is tiny and looks bad! */
01963
01964 if( ib==0 )
01965 XtVaGetValues( marks->tog[0],XmNindicatorSize,&isiz,NULL ) ;
01966
01967 marks->sometimes_popup[(marks->num_sometimes_popup)++] =
01968 marks->poptog[ib] =
01969 XtVaCreateWidget(
01970 "dialog" , xmToggleButtonWidgetClass , imag->popmenu ,
01971 XmNindicatorSize , isiz ,
01972 XmNvisibleWhenOff , True ,
01973 XmNmarginHeight , 0 ,
01974 XmNmarginWidth , 0 ,
01975 XmNselectColor , fg_pix ,
01976 XmNtraversalOn , False ,
01977 XmNinitialResourcesPersistent , False ,
01978 NULL ) ;
01979
01980 MCW_register_help( marks->tog[ib],&(marks->tog_help[ib][0]) ) ;
01981
01982 XtAddCallback( marks->tog[ib] ,
01983 XmNdisarmCallback ,
01984 AFNI_marktog_CB , im3d ) ;
01985
01986 XtAddCallback( marks->poptog[ib] ,
01987 XmNvalueChangedCallback ,
01988 AFNI_marktog_CB , im3d ) ;
01989
01990 marks->inverted[ib] = False ;
01991 } /* end of loop creating toggle buttons */
01992 } /* end of radio toggle creation */
01993
01994 /*----------------------------------------------------*/
01995 /*----- COLUMN 2: controls to manage the markers -----*/
01996 /*----------------------------------------------------*/
01997
01998 marks->control_frame =
01999 XtVaCreateManagedWidget(
02000 "dialog" , xmFrameWidgetClass , marks->rowcol ,
02001 XmNshadowType , XmSHADOW_ETCHED_IN ,
02002 XmNshadowThickness , 2 ,
02003 XmNinitialResourcesPersistent , False ,
02004 NULL ) ;
02005
02006 /*--- rowcol to manage marker control stuff ---*/
02007
02008 marks->control_rowcol =
02009 XtVaCreateWidget(
02010 "dialog" , xmRowColumnWidgetClass , marks->control_frame ,
02011 XmNpacking , XmPACK_TIGHT ,
02012 XmNorientation , XmVERTICAL ,
02013 XmNtraversalOn , False ,
02014 XmNinitialResourcesPersistent , False ,
02015 NULL ) ;
02016
02017 /*--- bbox to control editability of marks ---*/
02018
02019 marks->edits_bbox =
02020 new_MCW_bbox( marks->control_rowcol ,
02021 1 , AFNI_marks_edits_bbox_label ,
02022 MCW_BB_check ,
02023 MCW_BB_noframe ,
02024 AFNI_marks_edits_CB , (XtPointer) im3d ) ;
02025
02026 marks->edits_bbox->parent = (XtPointer) im3d ;
02027
02028 MCW_reghelp_children( marks->edits_bbox->wrowcol ,
02029 AFNI_marks_edits_bbox_help ) ;
02030 MCW_reghint_children( marks->edits_bbox->wrowcol ,
02031 "Press IN to allow changes to markers" ) ;
02032
02033 ADDTO_KILL(im3d->kl,marks->edits_bbox) ;
02034
02035 /*----- frame to hold markers display stuff -----*/
02036
02037 marks->disp_frame =
02038 XtVaCreateManagedWidget(
02039 "frame" , xmFrameWidgetClass , marks->control_rowcol ,
02040 XmNshadowType , XmSHADOW_ETCHED_IN ,
02041 XmNshadowThickness , 2 ,
02042 XmNinitialResourcesPersistent , False ,
02043 NULL ) ;
02044
02045 /*----- rowcol to hold markers display stuff -----*/
02046
02047 marks->disp_rowcol =
02048 XtVaCreateWidget(
02049 "dialog" , xmRowColumnWidgetClass , marks->disp_frame ,
02050 XmNpacking , XmPACK_TIGHT ,
02051 XmNorientation , XmVERTICAL ,
02052 XmNtraversalOn , False ,
02053 XmNinitialResourcesPersistent , False ,
02054 NULL ) ;
02055
02056 /*--- arrowval to control primary color ---*/
02057
02058 marks->ov_pcolor = MIN(last_color,INIT_marks1_color) ;
02059 marks->ov_scolor = MIN(last_color,INIT_marks2_color) ;
02060
02061 ii = AVOPT_STYLE ;
02062
02063 if( ii == MCW_AV_downup ){
02064 marks->disp_pcolor_av =
02065 new_MCW_arrowval(
02066 marks->disp_rowcol , /* parent */
02067 "Pcolor" , /* label */
02068 MCW_AV_downup , /* arrow directions */
02069 0 , /* min value */
02070 last_color , /* max value */
02071 marks->ov_pcolor , /* init value */
02072 MCW_AV_readtext , /* readonly text display */
02073 0 , /* 0 decimal shift */
02074 AFNI_marks_disp_av_CB , /* click routine */
02075 (XtPointer) im3d , /* data */
02076 MCW_DC_ovcolor_text , /* text routine */
02077 (XtPointer) im3d->dc /* data */
02078 ) ;
02079 marks->disp_pcolor_av->fastdelay = 333 ; /* slow down repeat action */
02080 marks->disp_pcolor_av->allow_wrap = 1 ;
02081 (void) MCW_DC_ovcolor_text( marks->disp_pcolor_av ,
02082 im3d->dc ) ; /* set color! */
02083 } else {
02084 marks->disp_pcolor_av =
02085 new_MCW_colormenu( marks->disp_rowcol , "Pcolor" , im3d->dc ,
02086 0 , last_color , marks->ov_pcolor ,
02087 AFNI_marks_disp_av_CB , (XtPointer) im3d ) ;
02088 }
02089
02090 marks->disp_pcolor_av->parent = (XtPointer) im3d ;
02091
02092 MCW_reghelp_children( marks->disp_pcolor_av->wrowcol ,
02093 AFNI_disp_pcolor_help ) ;
02094 MCW_reghint_children( marks->disp_pcolor_av->wrowcol ,
02095 "Color of primary marker" ) ;
02096
02097 ADDTO_KILL(im3d->kl,marks->disp_pcolor_av) ;
02098
02099 /*--- arrowval to control secondary color ---*/
02100
02101 if( ii == MCW_AV_downup ){
02102 marks->disp_scolor_av =
02103 new_MCW_arrowval(
02104 marks->disp_rowcol , /* parent */
02105 "Scolor" , /* label */
02106 MCW_AV_downup , /* arrow directions */
02107 0 , /* min value */
02108 last_color , /* max value */
02109 marks->ov_scolor , /* init value */
02110 MCW_AV_readtext , /* readonly text display */
02111 0 , /* 0 decimal shift */
02112 AFNI_marks_disp_av_CB , /* click routine */
02113 (XtPointer) im3d , /* data */
02114 MCW_DC_ovcolor_text , /* text routine */
02115 (XtPointer) im3d->dc /* data */
02116 ) ;
02117 marks->disp_scolor_av->fastdelay = 333 ; /* slow down repeat action */
02118 marks->disp_scolor_av->allow_wrap = 1 ;
02119 (void) MCW_DC_ovcolor_text( marks->disp_scolor_av ,
02120 im3d->dc ) ; /* set color! */
02121 } else {
02122 marks->disp_scolor_av =
02123 new_MCW_colormenu( marks->disp_rowcol , "Scolor" , im3d->dc ,
02124 0 , last_color , marks->ov_scolor ,
02125 AFNI_marks_disp_av_CB , (XtPointer) im3d ) ;
02126 }
02127
02128 marks->disp_scolor_av->parent = (XtPointer) im3d ;
02129
02130 MCW_reghelp_children( marks->disp_scolor_av->wrowcol ,
02131 AFNI_disp_scolor_help ) ;
02132 MCW_reghint_children( marks->disp_scolor_av->wrowcol ,
02133 "Color of secondary markers" ) ;
02134
02135 ADDTO_KILL(im3d->kl,marks->disp_scolor_av) ;
02136
02137 /*--- arrowval to control point size ---*/
02138
02139 marks->ov_size = INIT_marks_size ; /* initialize overlay mask */
02140 marks->ov_gap = INIT_marks_gap ;
02141 AFNI_make_ptmask( marks->ov_size , marks->ov_gap , &(marks->ov_mask) ) ;
02142
02143 marks->disp_size_av =
02144 new_MCW_arrowval(
02145 marks->disp_rowcol , /* parent */
02146 "Size " , /* label */
02147 AVOPT_STYLE , /* arrow directions */
02148 1 , /* min value */
02149 MAXOVSIZE , /* max value */
02150 marks->ov_size , /* init value */
02151 MCW_AV_editext , /* input/output text display */
02152 0 , /* 0 decimal shift */
02153 AFNI_marks_disp_av_CB , /* routine to call after click */
02154 (XtPointer) im3d , /* data to pass */
02155 NULL , /* routine to call for text display */
02156 NULL /* data for text display routine */
02157 ) ;
02158
02159 if( AVOPT_STYLE == MCW_AV_optmenu && MAXOVSIZE >= COLSIZE )
02160 AVOPT_columnize( marks->disp_size_av , 1+(MAXOVSIZE+1)/COLSIZE ) ;
02161
02162 marks->disp_size_av->parent = (XtPointer) im3d ;
02163 marks->disp_size_av->fastdelay = 333 ; /* slow down repeat action */
02164
02165 MCW_reghelp_children( marks->disp_size_av->wrowcol ,
02166 AFNI_disp_size_help ) ;
02167 MCW_reghint_children( marks->disp_size_av->wrowcol ,
02168 "Size of markers" ) ;
02169
02170 ADDTO_KILL(im3d->kl,marks->disp_size_av) ;
02171
02172 /*--- arrowval to control point gap ---*/
02173
02174 marks->disp_gap_av =
02175 new_MCW_arrowval(
02176 marks->disp_rowcol , /* parent */
02177 "Gap " , /* label */
02178 AVOPT_STYLE , /* arrow directions */
02179 1 , /* min value */
02180 MAXOVSIZE , /* max value */
02181 marks->ov_gap , /* init value */
02182 MCW_AV_editext , /* input/output text display */
02183 0 , /* 0 decimal shift */
02184 AFNI_marks_disp_av_CB , /* routine to call after click */
02185 (XtPointer) im3d , /* data to pass */
02186 NULL , /* routine to call for text display */
02187 NULL /* data for text display routine */
02188 ) ;
02189
02190 if( AVOPT_STYLE == MCW_AV_optmenu && MAXOVSIZE >= COLSIZE )
02191 AVOPT_columnize( marks->disp_gap_av , 1+(MAXOVSIZE+1)/COLSIZE ) ;
02192
02193 marks->disp_size_av->parent = (XtPointer) im3d ;
02194 marks->disp_size_av->fastdelay = 333 ; /* slow down repeat action */
02195
02196 MCW_reghelp_children( marks->disp_gap_av->wrowcol ,
02197 AFNI_disp_gap_help ) ;
02198 MCW_reghint_children( marks->disp_gap_av->wrowcol ,
02199 "Size of gap in markers" ) ;
02200
02201 ADDTO_KILL(im3d->kl,marks->disp_size_av) ;
02202
02203 /*----- rowcol to hold action pushbuttons -----*/
02204
02205 marks->action_rowcol =
02206 XtVaCreateWidget(
02207 "dialog" , xmRowColumnWidgetClass , marks->control_rowcol ,
02208 XmNorientation , XmHORIZONTAL ,
02209 XmNtraversalOn , False ,
02210 XmNinitialResourcesPersistent , False ,
02211 NULL ) ;
02212
02213 /*----- set point pushbutton -----*/
02214
02215 marks->action_set_pb =
02216 XtVaCreateManagedWidget(
02217 "dialog" , xmPushButtonWidgetClass , marks->action_rowcol ,
02218 LABEL_ARG("Set") ,
02219 XmNtraversalOn , False ,
02220 XmNinitialResourcesPersistent , False ,
02221 NULL ) ;
02222
02223 XtAddCallback( marks->action_set_pb , XmNactivateCallback ,
02224 AFNI_marks_action_CB , im3d ) ;
02225
02226 MCW_register_help( marks->action_set_pb , AFNI_marks_set_help ) ;
02227 MCW_register_hint( marks->action_set_pb , "Set marker at crosshairs" ) ;
02228
02229 /*----- clear point pushbutton -----*/
02230
02231 marks->action_clear_pb =
02232 XtVaCreateManagedWidget(
02233 "dialog" , xmPushButtonWidgetClass , marks->action_rowcol ,
02234 LABEL_ARG("Clear") ,
02235 XmNtraversalOn , False ,
02236 XmNinitialResourcesPersistent , False ,
02237 NULL ) ;
02238
02239 XtAddCallback( marks->action_clear_pb , XmNactivateCallback ,
02240 AFNI_marks_action_CB , im3d ) ;
02241
02242 MCW_register_help( marks->action_clear_pb , AFNI_marks_clear_help ) ;
02243 MCW_register_hint( marks->action_clear_pb , "Un-set primary marker" ) ;
02244
02245 /*----- copies of these pushbuttons on the popup menu -----*/
02246
02247 marks->always_popup[(marks->num_always_popup)++] =
02248 XtVaCreateManagedWidget(
02249 "dialog" , xmSeparatorWidgetClass , imag->popmenu ,
02250 XmNseparatorType , XmDOUBLE_LINE ,
02251 NULL ) ;
02252
02253 marks->always_popup[(marks->num_always_popup)++] =
02254 marks->pop_set_pb =
02255 XtVaCreateWidget(
02256 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
02257 LABEL_ARG("Set") ,
02258 XmNmarginHeight , 0 ,
02259 XmNtraversalOn , False ,
02260 XmNinitialResourcesPersistent , False ,
02261 NULL ) ;
02262
02263 XtAddCallback( marks->pop_set_pb , XmNactivateCallback ,
02264 AFNI_marks_action_CB , im3d ) ;
02265
02266 marks->always_popup[(marks->num_always_popup)++] =
02267 marks->pop_clear_pb =
02268 XtVaCreateWidget(
02269 "dialog" , xmPushButtonWidgetClass , imag->popmenu ,
02270 LABEL_ARG("Clear") ,
02271 XmNmarginHeight , 0 ,
02272 XmNtraversalOn , False ,
02273 XmNinitialResourcesPersistent , False ,
02274 NULL ) ;
02275
02276 XtAddCallback( marks->pop_clear_pb , XmNactivateCallback ,
02277 AFNI_marks_action_CB , im3d ) ;
02278
02279 /*----- a "quality" button (not on the popup menu) -----*/
02280
02281 marks->action_quality_pb =
02282 XtVaCreateManagedWidget(
02283 "dialog" , xmPushButtonWidgetClass , marks->action_rowcol ,
02284 LABEL_ARG("Quality?") ,
02285 XmNtraversalOn , False ,
02286 XmNinitialResourcesPersistent , False ,
02287 NULL ) ;
02288
02289 XtAddCallback( marks->action_quality_pb , XmNactivateCallback ,
02290 AFNI_marks_action_CB , im3d ) ;
02291
02292 MCW_register_help( marks->action_quality_pb , AFNI_marks_quality_help ) ;
02293 MCW_register_hint( marks->action_quality_pb , "Check markers for consistency" ) ;
02294
02295 /*----- below the line, put the transformation controls -----*/
02296
02297 (void) XtVaCreateManagedWidget(
02298 "dialog" , xmSeparatorWidgetClass , marks->control_rowcol ,
02299 XmNseparatorType , XmDOUBLE_LINE ,
02300 NULL ) ;
02301
02302 /*----- the transformation control -----*/
02303
02304 marks->transform_pb =
02305 XtVaCreateManagedWidget(
02306 "dialog" , xmPushButtonWidgetClass , marks->control_rowcol ,
02307 LABEL_ARG("Transform Data") ,
02308 XmNtraversalOn , False ,
02309 XmNinitialResourcesPersistent , False ,
02310 NULL ) ;
02311
02312 XtAddCallback( marks->transform_pb , XmNactivateCallback ,
02313 AFNI_marks_transform_CB , im3d ) ;
02314
02315 MCW_register_help( marks->transform_pb , AFNI_marks_transform_help ) ;
02316 MCW_register_hint( marks->transform_pb , "Compute transformation from markers" ) ;
02317
02318 /*----- 3/06/96: the "big Talairach box" button -----*/
02319
02320 marks->tlrc_big_bbox =
02321 new_MCW_bbox( marks->control_rowcol ,
02322 1 , AFNI_tlrc_big_bbox_label ,
02323 MCW_BB_check , MCW_BB_noframe ,
02324 NULL , NULL ) ; /* no callback */
02325
02326 marks->tlrc_big_bbox->parent = (XtPointer) im3d ;
02327
02328 MCW_reghelp_children( marks->tlrc_big_bbox->wrowcol ,
02329 AFNI_tlrc_big_bbox_help ) ;
02330 MCW_reghint_children( marks->tlrc_big_bbox->wrowcol ,
02331 "Use 'big' Talairach bounding box" ) ;
02332
02333 ADDTO_KILL(im3d->kl,marks->tlrc_big_bbox) ;
02334
02335 if( GLOBAL_argopt.tlrc_big )
02336 MCW_set_bbox( marks->tlrc_big_bbox , 1 ) ;
02337
02338 /*----- manage the managers -----*/
02339
02340 XtManageChild( marks->tog_rowcol ) ;
02341 XtManageChild( marks->disp_rowcol ) ;
02342 XtManageChild( marks->action_rowcol ) ;
02343 XtManageChild( marks->control_rowcol ) ;
02344 XtManageChild( marks->rowcol ) ;
02345
02346 /*-----------------------------------------------------*/
02347 /**************** Function controls ********************/
02348 /*-----------------------------------------------------*/
02349
02350 /** old hard-wired definition */
02351 #define SELECTOR_HEIGHT 240
02352
02353 sel_height = view_height - 19 ;
02354
02355 STATUS("making func->rowcol") ;
02356
02357 func->rowcol =
02358 XtVaCreateWidget(
02359 "dialog" , xmRowColumnWidgetClass , func->frame ,
02360 XmNorientation , XmHORIZONTAL ,
02361 XmNpacking , XmPACK_TIGHT ,
02362 XmNtraversalOn , False ,
02363 XmNinitialResourcesPersistent , False ,
02364 NULL ) ;
02365
02366 /*-- threshold stuff --*/
02367
02368 func->thr_rowcol =
02369 XtVaCreateWidget(
02370 "dialog" , xmRowColumnWidgetClass , func->rowcol ,
02371 XmNorientation , XmVERTICAL ,
02372 XmNpacking , XmPACK_TIGHT ,
02373 XmNmarginHeight, 0 ,
02374 XmNmarginWidth , 0 ,
02375 XmNtraversalOn , False ,
02376 XmNinitialResourcesPersistent , False ,
02377 NULL ) ;
02378
02379 func->thr_label =
02380 XtVaCreateManagedWidget(
02381 "dialog" , xmLabelWidgetClass , func->thr_rowcol ,
02382 LABEL_ARG("Thr") ,
02383 XmNrecomputeSize , False ,
02384 XmNinitialResourcesPersistent , False ,
02385 NULL ) ;
02386
02387 #ifdef FIX_SCALE_VALUE_PROBLEM
02388 MCW_register_help( func->thr_label ,
02389 "This version of AFNI has been\n"
02390 "compiled to show the slider value\n"
02391 "here, since there is a bug in the\n"
02392 "Motif library for this computer system."
02393 ) ;
02394 #else
02395 #endif
02396 MCW_register_help( func->thr_label ,
02397 "Shows the type of threshold\n"
02398 "statistic that is available\n"
02399 "at this moment. Names mean:\n\n"
02400 FUNC_THR_LABEL " = " FUNC_THR_DESCRIPTOR "\n"
02401 FUNC_COR_LABEL " = " FUNC_COR_DESCRIPTOR "\n"
02402 FUNC_TT_LABEL " = " FUNC_TT_DESCRIPTOR "\n"
02403 FUNC_FT_LABEL " = " FUNC_FT_DESCRIPTOR "\n"
02404 FUNC_ZT_LABEL " = " FUNC_ZT_DESCRIPTOR "\n"
02405 FUNC_CT_LABEL " = " FUNC_CT_DESCRIPTOR "\n"
02406 FUNC_BT_LABEL " = " FUNC_BT_DESCRIPTOR "\n"
02407 FUNC_BN_LABEL " = " FUNC_BN_DESCRIPTOR "\n"
02408 FUNC_GT_LABEL " = " FUNC_GT_DESCRIPTOR "\n"
02409 FUNC_PT_LABEL " = " FUNC_PT_DESCRIPTOR "\n"
02410 ) ;
02411 MCW_register_hint( func->thr_label , "Type of threshold statistic" ) ;
02412
02413 FIX_SCALE_VALUE(im3d) ;
02414
02415 #define SCALE_EXTRA 66
02416
02417 {Widget qqq ; int iqqq ;
02418 char thr_str[] = "-----------" ;
02419 char zork[2] ;
02420
02421 int smax , stop , decim , sstep ; /* 30 Nov 1997: */
02422 decim = THR_TOP_EXPON ; /* compute parameters */
02423 smax = (int)( pow(10.0,decim) + 0.001 ) ; /* for scale display. */
02424 stop = smax - 1 ;
02425 sstep = smax / 1000 ;
02426 { char *eee = getenv("AFNI_THRESH_BIGSTEP") ; /* 09 May 2003 */
02427 if( eee != NULL ){ iqqq=strtol(eee,NULL,10); if(iqqq > 0) sstep=iqqq; }
02428 }
02429 if( sstep < 1 ) sstep = 1 ; else if( sstep > (smax/10) ) sstep = (smax/10) ;
02430
02431 #ifdef BOXUP_SCALE
02432 qqq = XtVaCreateManagedWidget(
02433 "dialog" , xmFrameWidgetClass , func->thr_rowcol ,
02434 XmNshadowType , XmSHADOW_ETCHED_IN ,
02435 XmNtraversalOn , False ,
02436 XmNinitialResourcesPersistent , False ,
02437 NULL ) ;
02438 #else
02439 qqq = func->thr_rowcol ;
02440 #endif
02441
02442 func->thr_scale =
02443 XtVaCreateManagedWidget(
02444 "scale" , xmScaleWidgetClass , qqq ,
02445 XmNminimum , 0 , /* 30 Nov 1997: changed */
02446 XmNmaximum , stop , /* range to be computed */
02447 XmNscaleMultiple , sstep ,
02448 XmNdecimalPoints , decim ,
02449 #ifdef FIX_SCALE_VALUE_PROBLEM
02450 XmNshowValue , False ,
02451 #else
02452 XmNshowValue , True ,
02453 #endif
02454 XmNvalue , (int)(smax*im3d->vinfo->func_threshold) ,
02455 XmNorientation , XmVERTICAL ,
02456 XmNheight , sel_height ,
02457 XmNborderWidth , 0 ,
02458 XmNtraversalOn , False ,
02459 XmNinitialResourcesPersistent , False ,
02460 NULL ) ;
02461
02462 #ifdef FIX_SCALE_SIZE_PROBLEM
02463 XtVaSetValues( func->thr_scale ,
02464 XmNuserData , (XtPointer) sel_height ,
02465 NULL ) ;
02466 #endif
02467
02468 #ifdef USING_LESSTIF
02469 XtVaSetValues( func->thr_scale , XmNscaleWidth,24 , NULL ) ;
02470 #endif
02471
02472 #ifdef FIX_SCALE_VALUE_PROBLEM
02473 for( iqqq=0 ; iqqq < strlen(thr_str) ; iqqq++ ){
02474 zork[0] = thr_str[iqqq] ; zork[1] = '\0' ;
02475 XtVaCreateManagedWidget( zork,xmLabelWidgetClass,func->thr_scale,NULL ) ;
02476 }
02477 #endif
02478 }
02479
02480 XtAddCallback( func->thr_scale , XmNvalueChangedCallback ,
02481 AFNI_thr_scale_CB , im3d ) ;
02482
02483 XtAddCallback( func->thr_scale , XmNdragCallback ,
02484 AFNI_thr_scale_drag_CB , im3d ) ;
02485
02486 MCW_reghelp_children( func->thr_scale ,
02487 "Drag the slider bar to\n"
02488 "adjust the threshold\n"
02489 "for overlay display.\n\n"
02490 "* Threshold doesn't apply\n"
02491 " if dataset is RGB-format.\n"
02492 "* Threshold applies to 'Thr'\n"
02493 " sub-brick.\n"
02494 ) ;
02495 #if 0
02496 MCW_register_hint( func->thr_scale , "Threshold for color overlay" ) ;
02497 #endif
02498
02499 /** Mar 1996: label for computed p-value, under scale **/
02500
02501 func->thr_pval_label =
02502 XtVaCreateManagedWidget(
02503 "dialog" , xmLabelWidgetClass , func->thr_rowcol ,
02504 LABEL_ARG( THR_PVAL_LABEL_NONE ) ,
02505 XmNrecomputeSize , False ,
02506 XmNinitialResourcesPersistent , False ,
02507 NULL ) ;
02508
02509 MCW_register_help( func->thr_pval_label ,
02510 "Shows the estimated significance\n"
02511 "(p value) of the threshold above,\n"
02512 "if possible.\n"
02513 "* If not possible, will display as\n"
02514 " '[N/A]' instead.\n"
02515 "* p's that display as 1.2-7 should\n"
02516 " be interpreted as 1.2 x 10^(-7).\n"
02517 "* This is the significance PER VOXEL." ) ;
02518 MCW_register_hint( func->thr_pval_label , "Nominal p-value per voxel" ) ;
02519
02520 /** Jul 1997: optmenu to choose top value for scale **/
02521
02522 func->thr_top_av = new_MCW_arrowval( func->thr_rowcol ,
02523 "**" ,
02524 AVOPT_STYLE ,
02525 0,THR_TOP_EXPON,0 ,
02526 MCW_AV_notext , 0 ,
02527 AFNI_thresh_top_CB , (XtPointer) im3d ,
02528 AFNI_thresh_tlabel_CB , NULL ) ;
02529
02530 im3d->vinfo->func_thresh_top = 1.0 ;
02531
02532 MCW_reghelp_children( func->thr_top_av->wrowcol ,
02533 "Use this to set\n"
02534 "the power-of-10\n"
02535 "range of the\n"
02536 "threshold slider\n"
02537 "above."
02538 ) ;
02539
02540 MCW_reghint_children( func->thr_top_av->wrowcol ,
02541 "Power-of-10 range of slider" ) ;
02542
02543 /*-- intensity threshold stuff --*/
02544
02545 func->inten_rowcol =
02546 XtVaCreateWidget(
02547 "dialog" , xmRowColumnWidgetClass , func->rowcol ,
02548 XmNorientation , XmVERTICAL ,
02549 XmNmarginHeight, 0 ,
02550 XmNmarginWidth , 0 ,
02551 XmNpacking , XmPACK_TIGHT ,
02552 XmNtraversalOn , False ,
02553 XmNinitialResourcesPersistent , False ,
02554 NULL ) ;
02555
02556 func->inten_label =
02557 XtVaCreateManagedWidget(
02558 "dialog" , xmLabelWidgetClass , func->inten_rowcol ,
02559 LABEL_ARG("Inten") ,
02560 XmNinitialResourcesPersistent , False ,
02561 NULL ) ;
02562
02563 /**-- 17 Dec 1997: pbar menu hidden on the inten_label --**/
02564
02565 #ifdef BAD_BUTTON3_POPUPS /* 21 Jul 2003 */
02566 func->pbar_menu = XmCreatePopupMenu( func->inten_rowcol, "menu", NULL, 0 ) ;
02567 #else
02568 func->pbar_menu = XmCreatePopupMenu( func->inten_label , "menu", NULL, 0 ) ;
02569 #endif
02570
02571 SAVEUNDERIZE(XtParent(func->pbar_menu)) ; /* 27 Feb 2001 */
02572
02573 VISIBILIZE_WHEN_MAPPED(func->pbar_menu) ;
02574
02575 XtInsertEventHandler( func->inten_label , /* handle events in label */
02576
02577 0
02578 | ButtonPressMask /* button presses */
02579 ,
02580 FALSE , /* nonmaskable events? */
02581 AFNI_pbar_EV , /* handler */
02582 (XtPointer) im3d , /* client data */
02583 XtListTail /* last in queue */
02584 ) ;
02585
02586 #if 0
02587 allow_MCW_optmenu_popup(0) ; /* 12 Dec 2001 */
02588 #endif
02589
02590 (void) XtVaCreateManagedWidget(
02591 "dialog" , xmLabelWidgetClass , func->pbar_menu ,
02592 LABEL_ARG("--- Cancel ---") ,
02593 XmNrecomputeSize , False ,
02594 XmNinitialResourcesPersistent , False ,
02595 NULL ) ;
02596
02597 (void) XtVaCreateManagedWidget(
02598 "dialog" , xmSeparatorWidgetClass , func->pbar_menu ,
02599 XmNseparatorType , XmSINGLE_LINE , NULL ) ;
02600
02601 /*--- environment button in menu [10 Feb 2004] ---*/
02602
02603 #ifdef ALLOW_PLUGINS
02604 func->pbar_environment_pb =
02605 XtVaCreateManagedWidget(
02606 "dialog" , xmPushButtonWidgetClass , func->pbar_menu ,
02607 LABEL_ARG("Edit Environment") ,
02608 XmNmarginHeight , 0 ,
02609 XmNtraversalOn , False ,
02610 XmNinitialResourcesPersistent , False ,
02611 NULL ) ;
02612 XtAddCallback( func->pbar_environment_pb , XmNactivateCallback ,
02613 AFNI_pbar_CB , im3d ) ;
02614 #else
02615 func->pbar_environment_pb = NULL ;
02616 #endif
02617
02618 func->pbar_equalize_pb =
02619 XtVaCreateManagedWidget(
02620 "dialog" , xmPushButtonWidgetClass , func->pbar_menu ,
02621 LABEL_ARG("Equalize Spacing") ,
02622 XmNmarginHeight , 0 ,
02623 XmNtraversalOn , False ,
02624 XmNinitialResourcesPersistent , False ,
02625 NULL ) ;
02626
02627 XtAddCallback( func->pbar_equalize_pb , XmNactivateCallback ,
02628 AFNI_pbar_CB , im3d ) ;
02629
02630 MCW_register_hint( func->pbar_equalize_pb , "Space separators equally" ) ;
02631
02632 func->pbar_settop_pb =
02633 XtVaCreateManagedWidget(
02634 "dialog" , xmPushButtonWidgetClass , func->pbar_menu ,
02635 LABEL_ARG("Set Top Value") ,
02636 XmNmarginHeight , 0 ,
02637 XmNtraversalOn , False ,
02638 XmNinitialResourcesPersistent , False ,
02639 NULL ) ;
02640
02641 XtAddCallback( func->pbar_settop_pb , XmNactivateCallback ,
02642 AFNI_pbar_CB , im3d ) ;
02643
02644 MCW_register_hint( func->pbar_settop_pb , "Is scaled by 'range' controls" ) ;
02645
02646 (void) XtVaCreateManagedWidget(
02647 "dialog" , xmSeparatorWidgetClass , func->pbar_menu ,
02648 XmNseparatorType , XmSINGLE_LINE , NULL ) ;
02649
02650 func->pbar_readin_pb =
02651 XtVaCreateManagedWidget(
02652 "dialog" , xmPushButtonWidgetClass , func->pbar_menu ,
02653 LABEL_ARG("Read in palette") ,
02654 XmNmarginHeight , 0 ,
02655 XmNtraversalOn , False ,
02656 XmNinitialResourcesPersistent , False ,
02657 NULL ) ;
02658
02659 MCW_register_hint( func->pbar_readin_pb , "Read in a palette file" ) ;
02660
02661 XtAddCallback( func->pbar_readin_pb , XmNactivateCallback ,
02662 AFNI_pbar_CB , im3d ) ;
02663
02664 func->pbar_writeout_pb =
02665 XtVaCreateManagedWidget(
02666 "dialog" , xmPushButtonWidgetClass , func->pbar_menu ,
02667 LABEL_ARG("Write out palette") ,
02668 XmNmarginHeight , 0 ,
02669 XmNtraversalOn , False ,
02670 XmNinitialResourcesPersistent , False ,
02671 NULL ) ;
02672
02673 MCW_register_hint( func->pbar_writeout_pb ,
02674 "Write out a palette file" ) ;
02675
02676 XtAddCallback( func->pbar_writeout_pb , XmNactivateCallback ,
02677 AFNI_pbar_CB , im3d ) ;
02678
02679 /* 15 Jun 2000: image save button */
02680
02681 func->pbar_saveim_pb =
02682 XtVaCreateManagedWidget(
02683 "dialog" , xmPushButtonWidgetClass , func->pbar_menu ,
02684 LABEL_ARG("Save to PPM") ,
02685 XmNmarginHeight , 0 ,
02686 XmNtraversalOn , False ,
02687 XmNinitialResourcesPersistent , False ,
02688 NULL ) ;
02689
02690 MCW_register_hint( func->pbar_saveim_pb ,
02691 "Write out as image file" );
02692
02693 XtAddCallback( func->pbar_saveim_pb , XmNactivateCallback ,
02694 AFNI_pbar_CB , im3d ) ;
02695
02696 func->pbar_showtable_pb =
02697 XtVaCreateManagedWidget(
02698 "dialog" , xmPushButtonWidgetClass , func->pbar_menu ,
02699 LABEL_ARG("Show Palette Table") ,
02700 XmNmarginHeight , 0 ,
02701 XmNtraversalOn , False ,
02702 XmNinitialResourcesPersistent , False ,
02703 NULL ) ;
02704
02705 XtAddCallback( func->pbar_showtable_pb , XmNactivateCallback ,
02706 AFNI_pbar_CB , im3d ) ;
02707
02708 MCW_register_hint( func->pbar_showtable_pb , "Will popup a listing window" ) ;
02709
02710 (void) XtVaCreateManagedWidget(
02711 "dialog" , xmSeparatorWidgetClass , func->pbar_menu ,
02712 XmNseparatorType , XmSINGLE_LINE , NULL ) ;
02713
02714 func->pbar_palette_av = new_MCW_arrowval(
02715 func->pbar_menu , /* parent Widget */
02716 "Set Pal " , /* label */
02717 MCW_AV_optmenu , /* option menu style */
02718 0 , /* first option */
02719 1 , /* last option */
02720 0 , /* initial selection */
02721 MCW_AV_readtext , /* ignored but needed */
02722 0 , /* ditto */
02723 AFNI_palette_av_CB , /* callback when changed */
02724 (XtPointer) im3d , /* data for above */
02725 MCW_av_substring_CB , /* text creation routine */
02726 AFNI_dummy_av_label /* data for above */
02727 ) ;
02728
02729 MCW_reghint_children( func->pbar_palette_av->wrowcol , "Choose a palette" ) ;
02730
02731 if( GPT != NULL && PALTAB_NUM(GPT) > 0 ){
02732 refit_MCW_optmenu( func->pbar_palette_av ,
02733 0 , /* new minval */
02734 PALTAB_NUM(GPT)-1 , /* new maxval */
02735 0 , /* new inival */
02736 0 , /* new decim? */
02737 AFNI_palette_label_CB , /* text routine */
02738 NULL /* text data */
02739 ) ;
02740 } else {
02741 XtUnmanageChild( func->pbar_palette_av->wrowcol ) ;
02742 }
02743
02744 /*-- 15 Jun 2000: 0D func list --*/
02745
02746 (void) XtVaCreateManagedWidget(
02747 "dialog" , xmSeparatorWidgetClass , func->pbar_menu ,
02748 XmNseparatorType , XmSINGLE_LINE , NULL ) ;
02749
02750 func->pbar_transform0D_av = new_MCW_arrowval(
02751 func->pbar_menu , /* parent Widget */
02752 "Tran 0D " , /* label */
02753 MCW_AV_optmenu , /* option menu style */
02754 0 , /* first option */
02755 1 , /* last option */
02756 0 , /* initial selection */
02757 MCW_AV_readtext , /* ignored but needed */
02758 0 , /* ditto */
02759 AFNI_palette_tran_CB, /* callback when changed */
02760 (XtPointer) im3d , /* data for above */
02761 MCW_av_substring_CB , /* text creation routine */
02762 AFNI_dummy_av_label /* data for above */
02763 ) ;
02764
02765 MCW_reghint_children( func->pbar_transform0D_av->wrowcol ,
02766 "Transform overlay image values" ) ;
02767 XtUnmanageChild( func->pbar_transform0D_av->wrowcol ) ;
02768 func->pbar_transform0D_index = 0 ;
02769 func->pbar_transform0D_func = NULL ;
02770
02771 /*-- 16 Jun 2000: 2D func list --*/
02772
02773 (void) XtVaCreateManagedWidget(
02774 "dialog" , xmSeparatorWidgetClass , func->pbar_menu ,
02775 XmNseparatorType , XmSINGLE_LINE , NULL ) ;
02776
02777 func->pbar_transform2D_av = new_MCW_arrowval(
02778 func->pbar_menu , /* parent Widget */
02779 "Tran 2D " , /* label */
02780 MCW_AV_optmenu , /* option menu style */
02781 0 , /* first option */
02782 1 , /* last option */
02783 0 , /* initial selection */
02784 MCW_AV_readtext , /* ignored but needed */
02785 0 , /* ditto */
02786 AFNI_palette_tran_CB, /* callback when changed */
02787 (XtPointer) im3d , /* data for above */
02788 MCW_av_substring_CB , /* text creation routine */
02789 AFNI_dummy_av_label /* data for above */
02790 ) ;
02791
02792 MCW_reghint_children( func->pbar_transform2D_av->wrowcol ,
02793 "Transform overlay image values" ) ;
02794 XtUnmanageChild( func->pbar_transform2D_av->wrowcol ) ;
02795 func->pbar_transform2D_index = 0 ;
02796 func->pbar_transform2D_func = NULL ;
02797
02798 #if 0
02799 allow_MCW_optmenu_popup(1) ; /* 12 Dec 2001 */
02800 #endif
02801
02802 /**-- Color pbar to control intensity-to-color mapping --**/
02803
02804 { float pmin , pmax ; /* posfunc added 3/21/95 */
02805
02806 pmax = 1.0 ;
02807 pmin = (im3d->vinfo->use_posfunc) ? (0.0) : (-1.0) ;
02808 npane = (im3d->vinfo->use_posfunc) ? INIT_panes_pos
02809 : INIT_panes_sgn ;
02810
02811 #if 0
02812 sel_height -= (8+view_height/view_count) * 1 ; /* 1 = widgets below pbar */
02813 #else
02814 sel_height -= (8+view_height/view_count) * 0.5 ;
02815 #endif
02816
02817 func->inten_pbar = new_MCW_pbar(
02818 func->inten_rowcol , /* parent */
02819 im3d->dc , /* display */
02820 npane , /* number panes */
02821 sel_height / npane , /* init pane height */
02822 pmin , pmax , /* value range */
02823 AFNI_inten_pbar_CB , /* callback */
02824 (XtPointer) im3d ); /* callback data */
02825
02826 /* 04 Feb 2002: colorscale-ize? */
02827
02828 if( im3d->dc->visual_class == TrueColor ){
02829 char *eee = getenv("AFNI_COLORSCALE_DEFAULT") ;
02830 if( eee == NULL ) eee = getenv("AFNI_COLOR_SCALE_DEFAULT") ;
02831 if( eee == NULL || strcmp(eee,"NO") != 0 ){
02832 PBAR_set_bigmode( func->inten_pbar , 1 , pmin,pmax ) ;
02833 PBAR_set_bigmap( func->inten_pbar , eee ) ;
02834 }
02835 }
02836 }
02837
02838 func->inten_pbar->parent = (XtPointer) im3d ;
02839 func->inten_pbar->mode = (im3d->vinfo->use_posfunc) ? (1) : (0) ;
02840 func->inten_pbar->npan_save[0] = INIT_panes_sgn ;
02841 func->inten_pbar->npan_save[1] = INIT_panes_pos ;
02842 func->inten_pbar->hide_changes = INIT_panes_hide ;
02843
02844 AFNI_setup_inten_pbar( im3d ) ; /* other setup stuff (afni_func.c) */
02845
02846 MCW_reghelp_children( func->inten_pbar->panew ,
02847 "Drag the separator bars to alter the thresholds.\n"
02848 "Click in a pane to alter the color for that range.\n\n"
02849 "The overlay dataset value that maps to 1.0 is\n"
02850 "determined by the 'autoRange' controls to the right.\n"
02851 "\n"
02852 "In 'continuous' colorscale mode, Button-1 click flips\n"
02853 "colors top-to-bottom; Button-3 click shows a menu of\n"
02854 "available colorscales.\n"
02855 ) ;
02856
02857 MCW_reghelp_children( func->inten_pbar->top ,
02858 "Drag the separator bars to alter the thresholds.\n"
02859 "Click in a pane to alter the color for that range.\n\n"
02860 "The overlay dataset value that maps to 1.0 is\n"
02861 "determined by the 'autoRange' controls to the right.\n"
02862 "\n"
02863 "In 'continuous' colorscale mode, Button-1 click flips\n"
02864 "colors top-to-bottom; Button-3 click shows a menu of\n"
02865 "available colorscales.\n"
02866 ) ;
02867
02868 MCW_register_help( func->inten_label ,
02869 "Drag the separator bars to alter the thresholds.\n"
02870 "Click in a pane to alter the color for that range.\n\n"
02871 "The overlay dataset value that maps to 1.0 is\n"
02872 "determined by the 'autoRange' controls to the right.\n\n"
02873 "N.B.: A popup menu to control the palette\n"
02874 " setup is 'hidden' under this label."
02875 ) ;
02876
02877 MCW_register_hint( func->inten_label ,
02878 "Control overlay colors" ) ;
02879
02880 (void) XtVaCreateManagedWidget(
02881 "dialog" , xmSeparatorWidgetClass , func->inten_rowcol ,
02882 XmNseparatorType , XmSINGLE_LINE ,
02883 NULL ) ;
02884
02885 func->inten_av = new_MCW_arrowval(
02886 func->inten_rowcol ,
02887 "#" ,
02888 AVOPT_STYLE ,
02889 NPANE_MIN , NPANE_MAX+1 ,
02890 (func->inten_pbar->bigmode) ? NPANE_MAX+1 : npane ,
02891 MCW_AV_notext , 0 ,
02892 AFNI_inten_av_CB , func->inten_pbar ,
02893 AFNI_inten_av_texter,NULL ) ;
02894
02895 if( AVOPT_STYLE == MCW_AV_optmenu )
02896 AVOPT_columnize( func->inten_av , 2 ) ;
02897
02898 func->inten_av->fastdelay = 4000 ; /* slow down repeat action */
02899 func->inten_av->parent = im3d ; /* Daddy! */
02900 func->inten_av->allow_wrap = 1 ;
02901
02902 MCW_reghelp_children( func->inten_av->wrowcol ,
02903 "Controls the number of panes\n"
02904 "in the intensity color/threshold\n"
02905 "selector above (the 'pbar')"
02906 ) ;
02907 MCW_reghint_children( func->inten_av->wrowcol ,
02908 "Number of color panes" ) ;
02909
02910 /*--- toggle button to control posfunc option for pbar ---*/
02911
02912 func->inten_bbox =
02913 new_MCW_bbox( func->inten_rowcol ,
02914 1 , AFNI_inten_bbox_label ,
02915 MCW_BB_check ,
02916 MCW_BB_noframe ,
02917 AFNI_inten_bbox_CB , (XtPointer) im3d ) ;
02918
02919 func->inten_bbox->parent = (XtPointer) im3d ;
02920
02921 MCW_set_bbox( func->inten_bbox ,
02922 (im3d->vinfo->use_posfunc) ? (1) : (0) ) ;
02923
02924 MCW_reghelp_children( func->inten_bbox->wrowcol ,
02925 "Pressed In: Displays only positive overlay\n"
02926 " values in the 'pbar' above and\n"
02927 " in the color overlays.\n"
02928 " Out: Displays positive and negative\n"
02929 " overlay values.\n\n"
02930 "N.B.: Zero overlay values are never overlaid." ) ;
02931 MCW_reghint_children( func->inten_bbox->wrowcol ,
02932 "Use positive-only or signed overlay values" ) ;
02933
02934 ADDTO_KILL(im3d->kl,func->inten_bbox) ;
02935
02936 /*-- options controls --*/
02937
02938 func->options_rowcol =
02939 XtVaCreateWidget(
02940 "dialog" , xmRowColumnWidgetClass , func->rowcol ,
02941 XmNorientation , XmVERTICAL ,
02942 XmNpacking , XmPACK_TIGHT ,
02943 XmNmarginHeight, 0 ,
02944 XmNmarginWidth , 0 ,
02945 XmNtraversalOn , False ,
02946 XmNinitialResourcesPersistent , False ,
02947 NULL ) ;
02948
02949 func->options_label =
02950 XtVaCreateManagedWidget(
02951 "dialog" , xmLabelWidgetClass , func->options_rowcol ,
02952 LABEL_ARG("Options") ,
02953 XmNinitialResourcesPersistent , False ,
02954 NULL ) ;
02955
02956 /*-- underlay type --*/
02957
02958 func->underlay_bbox =
02959 new_MCW_bbox( func->options_rowcol ,
02960 LAST_UNDERLAY_TYPE+1 , UNDERLAY_typestr ,
02961 MCW_BB_radio_one ,
02962 MCW_BB_frame ,
02963 AFNI_underlay_CB , (XtPointer) im3d ) ;
02964
02965 func->underlay_bbox->parent = (XtPointer) im3d ;
02966
02967 MCW_set_bbox( func->underlay_bbox , 1 << im3d->vinfo->underlay_type ) ;
02968
02969 MCW_reghelp_children( func->underlay_bbox->wrowcol ,
02970 "Use these buttons to choose\n"
02971 "whether the underlay or\n"
02972 "overlay images appear\n"
02973 "as the background display" ) ;
02974
02975 { char * hh[] = { "Use underlay dataset for background" ,
02976 "Use overlay dataset for background" ,
02977 "Use thresholded overlay dataset for background" } ;
02978 MCW_bbox_hints( func->underlay_bbox , 3 , hh ) ;
02979 }
02980
02981 ADDTO_KILL(im3d->kl,func->underlay_bbox) ;
02982
02983 /*--- 30 Nov 1997: bucket managers ---*/
02984
02985 func->buck_frame =
02986 XtVaCreateWidget(
02987 "dialog" , xmFrameWidgetClass , func->options_rowcol ,
02988 XmNshadowType , XmSHADOW_ETCHED_IN ,
02989 XmNshadowThickness , 2 ,
02990 XmNtraversalOn , False ,
02991 XmNinitialResourcesPersistent , False ,
02992 NULL ) ;
02993
02994 func->buck_rowcol =
02995 XtVaCreateWidget(
02996 "dialog" , xmRowColumnWidgetClass , func->buck_frame ,
02997 XmNorientation , XmVERTICAL ,
02998 XmNpacking , XmPACK_TIGHT ,
02999 XmNtraversalOn , False ,
03000 XmNinitialResourcesPersistent , False ,
03001 NULL ) ;
03002
03003 /*--- 30 Nov 1997: anatomy bucket arrowval ---*/
03004 /* (Actual labels are set when used) */
03005
03006 func->anat_buck_av = new_MCW_arrowval(
03007 func->buck_rowcol , /* parent Widget */
03008 "ULay" , /* label */
03009 MCW_AV_optmenu , /* option menu style */
03010 0 , /* first option */
03011 1 , /* last option */
03012 0 , /* initial selection */
03013 MCW_AV_readtext , /* ignored but needed */
03014 0 , /* ditto */
03015 AFNI_bucket_CB , /* callback when changed */
03016 (XtPointer) im3d , /* data for above */
03017 MCW_av_substring_CB , /* text creation routine */
03018 AFNI_dummy_av_label /* data for above */
03019 ) ;
03020
03021 func->anat_buck_av->parent = (XtPointer) im3d ;
03022 func->anat_buck_av->allow_wrap = True ;
03023
03024 MCW_reghelp_children( func->anat_buck_av->wrowcol ,
03025 "Use this to choose which\n"
03026 "sub-brick of the overlay\n"
03027 "dataset to display (='ULay').\n"
03028 "(The sub-brick labels are\n"
03029 " assigned when the dataset\n"
03030 " is created. The [index]\n"
03031 " values show the numerical\n"
03032 " location of the sub-brick\n"
03033 " in the dataset.)" ) ;
03034 MCW_reghint_children( func->anat_buck_av->wrowcol ,
03035 "Choose UnderLay sub-brick" ) ;
03036
03037 ADDTO_KILL(im3d->kl,func->anat_buck_av) ;
03038
03039 XtUnmanageChild( func->anat_buck_av->wrowcol ) ;
03040
03041 /*--- 30 Nov 1997: function bucket arrowval ---*/
03042
03043 func->fim_buck_av = new_MCW_arrowval(
03044 func->buck_rowcol , /* parent Widget */
03045 "OLay" , /* label */
03046 MCW_AV_optmenu , /* option menu style */
03047 0 , /* first option */
03048 1 , /* last option */
03049 0 , /* initial selection */
03050 MCW_AV_readtext , /* ignored but needed */
03051 0 , /* ditto */
03052 AFNI_bucket_CB , /* callback when changed */
03053 (XtPointer) im3d , /* data for above */
03054 MCW_av_substring_CB , /* text creation routine */
03055 AFNI_dummy_av_label /* data for above */
03056 ) ;
03057
03058 func->fim_buck_av->parent = (XtPointer) im3d ;
03059 func->fim_buck_av->allow_wrap = True ;
03060
03061 MCW_reghelp_children( func->fim_buck_av->wrowcol ,
03062 "Use this to choose which\n"
03063 "sub-brick of the overlay\n"
03064 "dataset to display (='OLay').\n"
03065 "(The sub-brick labels are\n"
03066 " assigned when the dataset\n"
03067 " is created. The [index]\n"
03068 " values show the numerical\n"
03069 " location of the sub-brick\n"
03070 " in the dataset.)" ) ;
03071 MCW_reghint_children( func->fim_buck_av->wrowcol ,
03072 "Choose overlay sub-brick" ) ;
03073
03074 ADDTO_KILL(im3d->kl,func->fim_buck_av) ;
03075
03076 XtUnmanageChild( func->fim_buck_av->wrowcol ) ;
03077
03078 /*--- 30 Nov 1997: threshold bucket arrowval ---*/
03079
03080 func->thr_buck_av = new_MCW_arrowval(
03081 func->buck_rowcol , /* parent Widget */
03082 "Thr " , /* label */
03083 MCW_AV_optmenu , /* option menu style */
03084 0 , /* first option */
03085 1 , /* last option */
03086 0 , /* initial selection */
03087 MCW_AV_readtext , /* ignored but needed */
03088 0 , /* ditto */
03089 AFNI_bucket_CB , /* callback when changed */
03090 (XtPointer) im3d , /* data for above */
03091 MCW_av_substring_CB , /* text creation routine */
03092 AFNI_dummy_av_label /* data for above */
03093 ) ;
03094
03095 func->thr_buck_av->parent = (XtPointer) im3d ;
03096 func->thr_buck_av->allow_wrap = True ;
03097
03098 MCW_reghelp_children( func->thr_buck_av->wrowcol ,
03099 "Use this to choose which\n"
03100 "sub-brick of the overlay\n"
03101 "dataset with which to threshold\n"
03102 "the OLay sub-brick (='Thr').\n"
03103 "(The sub-brick labels are\n"
03104 " assigned when the dataset\n"
03105 " is created. The [index]\n"
03106 " values show the numerical\n"
03107 " location of the sub-brick\n"
03108 " in the dataset.)" ) ;
03109 MCW_reghint_children( func->thr_buck_av->wrowcol ,
03110 "Choose Thr sub-brick" ) ;
03111
03112 ADDTO_KILL(im3d->kl,func->thr_buck_av) ;
03113
03114 XtUnmanageChild( func->thr_buck_av->wrowcol ) ;
03115
03116 /*--- range controls ---*/
03117
03118 func->range_frame =
03119 XtVaCreateManagedWidget(
03120 "dialog" , xmFrameWidgetClass , func->options_rowcol ,
03121 XmNshadowType , XmSHADOW_ETCHED_IN ,
03122 XmNshadowThickness , 2 ,
03123 XmNtraversalOn , False ,
03124 XmNinitialResourcesPersistent , False ,
03125 NULL ) ;
03126
03127 func->range_rowcol =
03128 XtVaCreateWidget(
03129 "dialog" , xmRowColumnWidgetClass , func->range_frame ,
03130 XmNorientation , XmVERTICAL ,
03131 XmNpacking , XmPACK_TIGHT ,
03132 XmNtraversalOn , False ,
03133 XmNinitialResourcesPersistent , False ,
03134 NULL ) ;
03135
03136 /*--- label to show the ranges ---*/
03137
03138 im3d->vinfo->old_range_label = xstr = AFNI_range_label( NULL ) ;
03139
03140 func->range_label =
03141 XtVaCreateManagedWidget(
03142 "dialog" , xmLabelWidgetClass , func->range_rowcol ,
03143 XmNrecomputeSize , False ,
03144 XmNlabelString , xstr ,
03145 XmNtraversalOn , False ,
03146 XmNinitialResourcesPersistent , False ,
03147 NULL ) ;
03148
03149 MCW_register_help( func->range_label ,
03150 "These are the range of values in the\n"
03151 "UnderLay and OverLay 3D datasets.\n"
03152 "The overlay values may be useful\n"
03153 "for choosing the Range for the pbar.\n"
03154 "[If a dataset is warped from a\n"
03155 " 'parent', these statistics are\n"
03156 " taken from the parent dataset.]" ) ;
03157
03158 MCW_register_hint( func->range_label , "Ranges of dataset values" ) ;
03159
03160 /*--- toggle button to control automatic range scaling for pbar ---*/
03161
03162 im3d->vinfo->autorange_label =
03163 XmStringCreateLtoR( AFNI_range_bbox_label[0] , XmFONTLIST_DEFAULT_TAG ) ;
03164
03165 func->range_bbox =
03166 new_MCW_bbox( func->range_rowcol ,
03167 1 , AFNI_range_bbox_label ,
03168 MCW_BB_check ,
03169 MCW_BB_noframe ,
03170 AFNI_range_bbox_CB , (XtPointer) im3d ) ;
03171
03172 func->range_bbox->parent = (XtPointer) im3d ;
03173
03174 MCW_set_bbox( func->range_bbox ,
03175 (im3d->vinfo->use_autorange) ? (1) : (0) ) ;
03176
03177 MCW_reghelp_children( func->range_bbox->wrowcol ,
03178 "This button determines whether the program\n"
03179 "or the user sets the OLay value that maps\n"
03180 "to the color pbar level 1.0:\n\n"
03181 "Pressed In: use 'autoRange' value for pbar 1.0\n"
03182 " Out: user controls Range value (below)"
03183 ) ;
03184 MCW_reghint_children( func->range_bbox->wrowcol ,
03185 "Automatic or user-controlled color range scaling" ) ;
03186
03187 ADDTO_KILL(im3d->kl,func->range_bbox) ;
03188
03189 /*--- 30 Mar 2001: put the next 2 things in a horizontal rowcol ---*/
03190
03191 hrc = XtVaCreateWidget(
03192 "dialog" , xmRowColumnWidgetClass , func->range_rowcol ,
03193 XmNorientation , XmHORIZONTAL ,
03194 XmNpacking , XmPACK_TIGHT ,
03195 XmNtraversalOn , False ,
03196 XmNinitialResourcesPersistent , False ,
03197 NULL ) ;
03198
03199 /*--- arrowval to provide user control for pbar scaling ---*/
03200
03201 func->range_av =
03202 new_MCW_arrowval(
03203 hrc , /* parent */
03204 NULL , /* label */
03205 MCW_AV_downup , /* arrow directions */
03206 0 , /* min value */
03207 9999999 , /* max value */
03208 (int) (im3d->vinfo->fim_range) , /* init value */
03209 MCW_AV_editext , /* input/output text display */
03210 0 , /* decimal shift */
03211 AFNI_range_av_CB , /* routine to call when button */
03212 (XtPointer) im3d , /* is pressed, and its data */
03213 NULL,NULL /* no special display */
03214 ) ;
03215
03216 func->range_av->parent = (XtPointer) im3d ;
03217
03218 MCW_reghelp_children( func->range_av->wrowcol ,
03219 "When the autoRange button above is Out, this\n"
03220 "selector is used to set the OLay level which\n"
03221 "maps to 1.0 on the color pbar."
03222 ) ;
03223 MCW_reghint_children( func->range_av->wrowcol ,
03224 "OLay value that maps to 1.0 for color overlay" ) ;
03225
03226 ADDTO_KILL(im3d->kl,func->range_av) ;
03227
03228 AV_SENSITIZE( func->range_av , ! im3d->vinfo->use_autorange ) ;
03229
03230 /*--- 30 Mar 2001: rotate pbar ---*/
03231
03232 func->range_rotate_av = new_MCW_arrowval(
03233 hrc , "Rota" ,
03234 MCW_AV_downup , 0,0,0 ,
03235 MCW_AV_notext , 0 ,
03236 AFNI_range_rotate_av_CB , (XtPointer) func->inten_pbar ,
03237 NULL,NULL ) ;
03238
03239 func->range_rotate_av->parent = (XtPointer) im3d ;
03240
03241 MCW_reghelp_children( func->range_rotate_av->wrowcol ,
03242 "Rotate the colors on\n"
03243 "the 'pbar' up or down.\n"
03244 "[Press with Shift to]\n"
03245 "[rotate in steps of 4]" ) ;
03246 MCW_reghint_children( func->range_rotate_av->wrowcol ,
03247 "Rotate pbar colors" ) ;
03248
03249 ADDTO_KILL(im3d->kl,func->range_rotate_av) ;
03250
03251 XtManageChild( hrc ) ;
03252
03253 #ifdef USE_FUNC_FIM
03254 /*--- fim execution controls ---*/
03255
03256 func->fim_frame =
03257 XtVaCreateManagedWidget(
03258 "dialog" , xmFrameWidgetClass , func->options_rowcol ,
03259 XmNshadowType , XmSHADOW_ETCHED_IN ,
03260 XmNshadowThickness , 2 ,
03261 XmNtraversalOn , False ,
03262 XmNinitialResourcesPersistent , False ,
03263 NULL ) ;
03264
03265 func->fim_rowcol =
03266 XtVaCreateWidget(
03267 "dialog" , xmRowColumnWidgetClass , func->fim_frame ,
03268 XmNorientation , XmHORIZONTAL ,
03269 XmNpacking , XmPACK_TIGHT ,
03270 XmNtraversalOn , False ,
03271 XmNinitialResourcesPersistent , False ,
03272 NULL ) ;
03273
03274 func->fim_mbar =
03275 XmCreateMenuBar( func->fim_rowcol, "dialog" , NULL,0 ) ;
03276 XtVaSetValues( func->fim_mbar ,
03277 XmNmarginWidth , 0 ,
03278 XmNmarginHeight , 0 ,
03279 XmNspacing , 3 ,
03280 XmNborderWidth , 0 ,
03281 XmNtraversalOn , False ,
03282 NULL ) ;
03283 XtManageChild( func->fim_mbar ) ;
03284
03285 func->fim_menu = AFNI_new_fim_menu( func->fim_mbar , AFNI_fimmer_menu_CB , 0 ) ;
03286 func->fim_menu->parent = (XtPointer) im3d ;
03287
03288 xstr = XmStringCreateLtoR("1234567890123456789",XmFONTLIST_DEFAULT_TAG );
03289 func->fim_dset_label =
03290 XtVaCreateManagedWidget(
03291 "dialog" , xmLabelWidgetClass , func->fim_rowcol ,
03292 XmNrecomputeSize , False ,
03293 XmNlabelString , xstr ,
03294 XmNtraversalOn , False ,
03295 XmNinitialResourcesPersistent , False ,
03296 NULL ) ;
03297 XmStringFree(xstr) ;
03298 MCW_register_help( func->fim_dset_label ,
03299 "Shows the name of the\n"
03300 "dataset for which FIM\n"
03301 "is currently set up."
03302 ) ;
03303 MCW_register_hint( func->fim_dset_label , "Dataset to be FIM-ed") ;
03304 #endif
03305
03306 /* 25 Jul 2001: a toggle box to show the TT Atlas */
03307
03308 { char *see_ttatlas_label[1] = { "See TT Atlas Regions" } ;
03309 func->see_ttatlas_bbox =
03310 new_MCW_bbox( func->options_rowcol ,
03311 1 , see_ttatlas_label ,
03312 MCW_BB_check ,
03313 MCW_BB_frame ,
03314 AFNI_see_ttatlas_CB , (XtPointer) im3d ) ;
03315
03316 func->see_ttatlas_bbox->parent = (XtPointer) im3d ;
03317
03318 MCW_set_bbox( func->see_ttatlas_bbox ,
03319 (im3d->vinfo->see_ttatlas) ? (1) : (0) ) ;
03320
03321 MCW_reghelp_children( func->see_ttatlas_bbox->wrowcol ,
03322 "This button determines whether to show\n"
03323 "the Talairach-Tournoux Atlas regions,\n"
03324 "which are controlled by the 'Atlas Colors'\n"
03325 "item on the image viewing window popup menu."
03326 ) ;
03327 MCW_reghint_children( func->see_ttatlas_bbox->wrowcol ,
03328 "Use 'Atlas Colors' from image popup menu" ) ;
03329
03330 ADDTO_KILL(im3d->kl,func->see_ttatlas_bbox) ;
03331 }
03332
03333 xstr = XmStringCreateLtoR( "ULay = xxxxxxxxxxxxxxxx\n"
03334 "OLay = xxxxxxxxxxxxxxxx\n"
03335 "Thr = xxxxxxxxxxxxxxxx" ,
03336 XmFONTLIST_DEFAULT_TAG ) ;
03337
03338 func->bkgd_lab =
03339 XtVaCreateWidget(
03340 "dialog" , xmLabelWidgetClass , func->options_rowcol ,
03341 XmNrecomputeSize , False ,
03342 XmNlabelString , xstr ,
03343 XmNmarginHeight, 0 ,
03344 XmNtraversalOn , False ,
03345 XmNinitialResourcesPersistent , False ,
03346 NULL ) ;
03347 XmStringFree( xstr ) ;
03348
03349 im3d->vinfo->anat_val[0] =
03350 im3d->vinfo->func_val[0] =
03351 im3d->vinfo->thr_val[0] = '\0' ;
03352
03353 MCW_register_help( func->bkgd_lab ,
03354 "Shows the values at the\n"
03355 "current crosshair voxel.\n"
03356 "\n"
03357 "N.B.: Is only active when\n"
03358 " all 3 image windows are\n"
03359 " open!"
03360 ) ;
03361 MCW_register_hint( func->bkgd_lab , "Values at crosshairs voxel" ) ;
03362
03363 /*-- manage the managers --*/
03364
03365 XtManageChild( func->thr_rowcol ) ;
03366 XtManageChild( func->inten_rowcol ) ;
03367 XtManageChild( func->range_rowcol ) ;
03368 XtManageChild( func->options_rowcol ) ;
03369 #ifdef USE_FUNC_FIM
03370 XtManageChild( func->fim_rowcol ) ;
03371 #endif
03372 XtManageChild( func->rowcol ) ;
03373
03374 EXRETURN ;
03375 }
03376
03377 /*--------------------------------------------------------------------*/
03378
03379 void AFNI_make_wid3( Three_D_View * im3d )
03380 {
|
|
|
force return of unscaled slices for output * Definition at line 4205 of file afni_func.c. References THD_3dim_dataset::anat_parent, THD_3dim_dataset::death_mark, DOOMED, DSET_MARK_FOR_DEATH, THD_session::dsset, ENTRY, FIRST_VIEW_TYPE, ISVALID_3DIM_DATASET, ISVALID_SESSION, ISVALID_SESSIONLIST, LAST_VIEW_TYPE, THD_session::num_dsset, THD_sessionlist::num_sess, THD_sessionlist::ssar, STATUS, and THD_3dim_dataset::warp_parent. Referenced by AFNI_marks_transform_CB(), and AFNI_rescan_session_OLD().
04206 {
04207 int iss , jdd , kvv , num_marked=0 ;
04208 THD_session *ss ;
04209 THD_3dim_dataset *dset ;
04210
04211 ENTRY("AFNI_mark_for_death") ;
04212
04213 if( ! ISVALID_SESSIONLIST(ssl) ) EXRETURN ;
04214
04215 /* loop over each session */
04216
04217 for( iss=0 ; iss < ssl->num_sess ; iss++ ){
04218 ss = ssl->ssar[iss] ;
04219 if( !ISVALID_SESSION(ss) ) continue ; /* no good ==> skip */
04220
04221 /* loop over datasets in this session */
04222
04223 for( jdd=0 ; jdd < ss->num_dsset ; jdd++ ){
04224 for( kvv=FIRST_VIEW_TYPE ; kvv <= LAST_VIEW_TYPE ; kvv++ ){
04225
04226 dset = ss->dsset[jdd][kvv] ;
04227
04228 if( ISVALID_3DIM_DATASET(dset) && /* good dset */
04229 dset->anat_parent != NULL && /* has parent */
04230 dset->anat_parent->death_mark == DOOMED && /* parent dies */
04231 dset->warp_parent != NULL ){ /* is a warp child */
04232
04233 DSET_MARK_FOR_DEATH(dset) ;
04234 num_marked ++ ;
04235 }
04236 }
04237 }
04238 } /* end of loop over sessions */
04239
04240 #ifdef AFNI_DEBUG
04241 { char str[256] ;
04242 sprintf(str,"total # descendants marked = %d",num_marked) ;
04243 STATUS(str) ; }
04244 #endif
04245
04246 EXRETURN ;
04247 }
|
|
||||||||||||||||
|
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_fvec3::xyz, and THD_marker_set::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_fvec3::xyz, and THD_marker_set::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 7905 of file afni_widg.c. |
|
||||||||||||||||
|
04 May 2005: customize width to this dataset * Definition at line 4799 of file afni_func.c. References AFNI_init_niml(), AFNI_init_plugouts(), AFNI_purge_dsets(), AFNI_set_viewpoint(), Three_D_View::anat_now, Bool, AFNI_widget_set::butx, AFNI_widget_set::buty, AFNI_library_type::controllers, DATABLOCK_MEM_MALLOC, DATABLOCK_MEM_MMAP, DATABLOCK_MEM_SHARED, THD_3dim_dataset::dblk, DBLK_LOCKED, Three_D_View::dc, AFNI_library_type::dc, MCW_DC::display, AFNI_widget_set::dmode, DSET_ARRAY, ENTRY, ENV_init(), F1D_init(), F2D_init(), Three_D_View::fim_now, free, GLOBAL_library, AFNI_library_type::hints_on, IM3D_OPEN, IM3D_VALID, AFNI_widget_set::imag, malloc, THD_datablock::malloc_type, MAX_CONTROLLERS, MCW_hint_toggle(), mcw_malloc_dump(), MCW_MALLOC_enabled, MCW_popup_message(), MCW_set_bbox(), MCW_set_widget_label(), MCW_TIMER_KILL, MCW_USER_KILL, MCW_val_bbox(), MCW_widget_geom(), AFNI_datamode_widgets::misc_1dchain_pb, AFNI_datamode_widgets::misc_2dchain_pb, AFNI_datamode_widgets::misc_anat_info_pb, AFNI_datamode_widgets::misc_dumpmalloc_pb, AFNI_datamode_widgets::misc_environ_pb, AFNI_datamode_widgets::misc_func_info_pb, AFNI_datamode_widgets::misc_hints_bbox, AFNI_datamode_widgets::misc_hints_pb, AFNI_datamode_widgets::misc_license_pb, AFNI_datamode_widgets::misc_niml_pb, AFNI_datamode_widgets::misc_plugout_pb, AFNI_datamode_widgets::misc_purge_pb, AFNI_datamode_widgets::misc_readme_env_pb, AFNI_datamode_widgets::misc_showmalloc_pb, AFNI_datamode_widgets::misc_tracing_pb, AFNI_datamode_widgets::misc_vcheck_pb, AFNI_datamode_widgets::misc_voxind_bbox, AFNI_datamode_widgets::misc_voxind_pb, AFNI_datamode_widgets::misc_writeownsize_bbox, AFNI_datamode_widgets::misc_writeownsize_pb, new_MCW_textwin(), pclose, PLUG_setup_widgets(), PLUTO_cursorize, popen, REDISPLAY_OVERLAY, RWC_visibilize_widget(), THD_datablock::shm_idint, AFNI_view_info::show_voxind, STATUS, TEXT_READONLY, THD_dataset_info(), THD_zzprintf(), AFNI_imaging_widgets::topper, Three_D_View::vinfo, Three_D_View::vwid, and AFNI_view_info::writeownsize. Referenced by AFNI_imag_pop_CB(), and AFNI_pbar_CB().
04800 {
04801 Three_D_View *im3d = (Three_D_View *) cd ;
04802 XmAnyCallbackStruct *cbs = (XmAnyCallbackStruct *) cbd ;
04803
04804 ENTRY("AFNI_misc_CB") ;
04805
04806 if( !IM3D_OPEN(im3d) || w == NULL ) EXRETURN ;
04807
04808 /*.........................................................*/
04809
04810 if( w == im3d->vwid->dmode->misc_voxind_pb ){
04811 im3d->vinfo->show_voxind = MCW_val_bbox(im3d->vwid->dmode->misc_voxind_bbox);
04812 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
04813 }
04814
04815 /*.........................................................*/
04816
04817 #ifndef DONT_USE_HINTS
04818 else if( w == im3d->vwid->dmode->misc_hints_pb ){
04819 int val = MCW_val_bbox(im3d->vwid->dmode->misc_hints_bbox) ;
04820 if( val != GLOBAL_library.hints_on ){
04821 int ii ; Three_D_View *qq3d ;
04822 MCW_hint_toggle() ; GLOBAL_library.hints_on = val ;
04823 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){ /* this loop: */
04824 qq3d = GLOBAL_library.controllers[ii] ; /* 07 Aug 1999 */
04825 if( IM3D_VALID(qq3d) )
04826 MCW_set_bbox( qq3d->vwid->dmode->misc_hints_bbox , val ) ;
04827 }
04828 }
04829 }
04830 #endif
04831
04832 /*.........................................................*/
04833
04834 else if( w == im3d->vwid->dmode->misc_anat_info_pb ){
04835 char *inf ;
04836 STATUS("getting anat info") ;
04837 inf = THD_dataset_info( im3d->anat_now , 0 ) ;
04838 if( inf != NULL ){
04839 if( DSET_ARRAY(im3d->anat_now,0) == NULL ){
04840 inf = THD_zzprintf( inf , "\n*** Not loaded into memory.\n") ;
04841 } else if( im3d->anat_now->dblk->malloc_type == DATABLOCK_MEM_MALLOC ){
04842 if( DBLK_LOCKED(im3d->anat_now->dblk) )
04843 inf = THD_zzprintf( inf , "\n*** Locked into memory using malloc.\n") ;
04844 else
04845 inf = THD_zzprintf( inf , "\n*** Loaded into memory using malloc.\n") ;
04846 } else if( im3d->anat_now->dblk->malloc_type == DATABLOCK_MEM_MMAP ){
04847 inf = THD_zzprintf( inf , "\n*** Loaded into memory using mmap.\n") ;
04848 } else if( im3d->anat_now->dblk->malloc_type == DATABLOCK_MEM_SHARED ){
04849 inf = THD_zzprintf( inf , "\n*** Loaded into shared memory segment %d.\n",
04850 im3d->anat_now->dblk->shm_idint) ;
04851 }
04852 (void) new_MCW_textwin( im3d->vwid->imag->topper , inf , TEXT_READONLY ) ;
04853 free(inf) ;
04854 } else
04855 XBell( im3d->dc->display , 100 ) ;
04856 }
04857
04858 /*.........................................................*/
04859
04860 else if( w == im3d->vwid->dmode->misc_func_info_pb ){
04861 char *inf ;
04862 STATUS("getting func info") ;
04863 inf = THD_dataset_info( im3d->fim_now , 0 ) ;
04864 STATUS("got func info") ;
04865 if( inf != NULL ){
04866 if( DSET_ARRAY(im3d->fim_now,0) == NULL ){
04867 inf = THD_zzprintf( inf , "\n*** Not loaded into memory.\n") ;
04868 } else if( im3d->fim_now->dblk->malloc_type == DATABLOCK_MEM_MALLOC ){
04869 if( DBLK_LOCKED(im3d->fim_now->dblk) )
04870 inf = THD_zzprintf( inf , "\n*** Locked into memory using malloc.\n") ;
04871 else
04872 inf = THD_zzprintf( inf , "\n*** Loaded into memory using malloc.\n") ;
04873 } else if( im3d->fim_now->dblk->malloc_type == DATABLOCK_MEM_MMAP ){
04874 inf = THD_zzprintf( inf , "\n*** Loaded into memory using mmap.\n") ;
04875 } else if( im3d->fim_now->dblk->malloc_type == DATABLOCK_MEM_SHARED ){
04876 inf = THD_zzprintf( inf , "\n*** Loaded into shared memory segment %d.\n",
04877 im3d->fim_now->dblk->shm_idint) ;
04878 }
04879 (void) new_MCW_textwin( im3d->vwid->imag->topper , inf , TEXT_READONLY ) ;
04880 free(inf) ;
04881 } else
04882 XBell( im3d->dc->display , 100 ) ;
04883 }
04884
04885 /*.........................................................*/
04886
04887 else if( w == im3d->vwid->dmode->misc_license_pb ){ /* 03 Dec 2000 */
04888 #include "license.h"
04889 char *inf = NULL ; int ii ;
04890
04891 for( ii=0 ; license[ii] != NULL ; ii++ )
04892 inf = THD_zzprintf( inf , "%s" , license[ii] ) ;
04893 (void) new_MCW_textwin( im3d->vwid->imag->topper , inf , TEXT_READONLY ) ;
04894 free(inf) ;
04895 }
04896
04897 /*.........................................................*/
04898
04899 else if( w == im3d->vwid->dmode->misc_readme_env_pb ){ /* 05 Aug 2004 */
04900 #include "readme_env.h"
04901 char *inf = NULL ; int ii ;
04902
04903 for( ii=0 ; readme_env[ii] != NULL ; ii++ )
04904 inf = THD_zzprintf( inf , "%s" , readme_env[ii] ) ;
04905 (void) new_MCW_textwin( im3d->vwid->imag->topper , inf , TEXT_READONLY ) ;
04906 free(inf) ;
04907 }
04908
04909 /*.........................................................*/
04910
04911 else if( w == im3d->vwid->dmode->misc_vcheck_pb ){ /* 11 Jan 2000 */
04912 FILE *fp = popen( "afni_vcheck" , "r" ) ;
04913 if( fp == NULL ){
04914 (void) MCW_popup_message( im3d->vwid->imag->topper ,
04915 " \n"
04916 "* Cannot execute *\n"
04917 "* afni_vcheck! *\n" ,
04918 MCW_USER_KILL | MCW_TIMER_KILL ) ;
04919 XBell( im3d->dc->display , 100 ) ;
04920 } else {
04921 #define ISIZE 1024
04922 char *info=(char *)malloc(sizeof(char)*ISIZE) ; int ninfo ;
04923 strcpy(info," \n Output of Program afni_vcheck \n"
04924 " ---------------------------------\n \n" ) ;
04925 ninfo = strlen(info) ;
04926 while( fgets(info+ninfo,ISIZE-ninfo,fp) != NULL ){
04927 ninfo = strlen(info) ;
04928 if( ninfo >= ISIZE-2 ) break ;
04929 }
04930 pclose(fp) ;
04931 (void) MCW_popup_message( im3d->vwid->imag->topper , info ,
04932 MCW_USER_KILL | MCW_TIMER_KILL ) ;
04933 free(info) ;
04934 }
04935 }
04936
04937 /*.........................................................*/
04938
04939 else if( w == im3d->vwid->dmode->misc_purge_pb ){
04940 AFNI_purge_dsets( 1 ) ;
04941 }
04942
04943 /*.........................................................*/
04944
04945 #ifdef USE_TRACING
04946 else if( w == im3d->vwid->dmode->misc_tracing_pb ){
04947 DBG_trace = (DBG_trace + 1) % 3 ; /* Aug 23 1998: cycle between 0,1,2 */
04948 MCW_set_widget_label( im3d->vwid->dmode->misc_tracing_pb, DBG_label ) ; /* 01 Aug 1999 */
04949
04950 XSynchronize( im3d->dc->display, (Bool)(DBG_trace==2) ) ; /* 01 Dec 1999 */
04951 if( DBG_trace == 2 ) STATUS("XSynchronize enabled") ;
04952 else STATUS("XSynchronize disabled") ;
04953 }
04954 #endif
04955
04956 /*.........................................................*/
04957
04958 #ifdef USING_MCW_MALLOC /* 07 Mar 1999 */
04959 else if( MCW_MALLOC_enabled && w == im3d->vwid->dmode->misc_showmalloc_pb ){
04960 MCHECK ;
04961 }
04962
04963 else if( MCW_MALLOC_enabled && w == im3d->vwid->dmode->misc_dumpmalloc_pb ){
04964 mcw_malloc_dump() ;
04965 }
04966 #endif
04967
04968 /*.........................................................*/
04969
04970 #ifdef USE_WRITEOWNSIZE
04971 else if( w == im3d->vwid->dmode->misc_writeownsize_pb ){
04972 im3d->vinfo->writeownsize = MCW_val_bbox( im3d->vwid->dmode->misc_writeownsize_bbox ) ;
04973 }
04974 #endif
04975
04976 /*.........................................................*/
04977
04978 #ifdef ALLOW_PLUGINS
04979 else if( w == im3d->vwid->dmode->misc_environ_pb ){ /* 20 Jun 2000 */
04980 static PLUGIN_interface *plint=NULL ;
04981 Widget wpop ;
04982
04983 /* first time in: create interface like a plugin */
04984
04985 if( plint == NULL ){
04986 plint = ENV_init() ;
04987 if( plint == NULL ){ XBell(im3d->dc->display,100); EXRETURN; }
04988 PLUG_setup_widgets( plint , GLOBAL_library.dc ) ;
04989 }
04990
04991 /* code below is from PLUG_startup_plugin_CB() in afni_plugin.c */
04992
04993 plint->im3d = im3d ;
04994 XtVaSetValues( plint->wid->shell ,
04995 XmNtitle , "AFNI Environmentalism", /* top of window */
04996 XmNiconName , "Green AFNI" , /* label on icon */
04997 NULL ) ;
04998 PLUTO_cursorize( plint->wid->shell ) ;
04999
05000 /*-- if possible, find where this popup should go --*/
05001
05002 wpop = plint->wid->shell ;
05003
05004 if( cbs != NULL && cbs->event != NULL
05005 && cbs->event->type == ButtonRelease ){
05006
05007 XButtonEvent *xev = (XButtonEvent *) cbs->event ;
05008 int xx = (int)xev->x_root , yy = (int)xev->y_root ;
05009 int ww,hh , sw,sh ;
05010
05011 MCW_widget_geom( wpop , &ww,&hh , NULL,NULL ) ;
05012 sw = WidthOfScreen (XtScreen(wpop)) ;
05013 sh = HeightOfScreen(XtScreen(wpop)) ;
05014
05015 if( xx+ww+3 >= sw && ww <= sw ) xx = sw-ww ;
05016 if( yy+hh+3 >= sh && hh <= sh ) yy = sh-hh ;
05017
05018 XtVaSetValues( wpop , XmNx , xx , XmNy , yy , NULL ) ;
05019 } else if( im3d->vwid->butx >= 0 && im3d->vwid->buty >= 0 ){
05020 XtVaSetValues( wpop ,
05021 XmNx , im3d->vwid->butx ,
05022 XmNy , im3d->vwid->buty , NULL ) ; /* 17 May 2005 */
05023 }
05024
05025 /*-- popup widgets --*/
05026
05027 XtMapWidget( wpop ) ; /* after this, is up to user */
05028 RWC_visibilize_widget( wpop ) ;
05029 }
05030
05031 /*.........................................................*/
05032
05033 else if( w == im3d->vwid->dmode->misc_1dchain_pb ){ /* 07 Aug 2001 */
05034 static PLUGIN_interface *plint=NULL ;
05035 Widget wpop ;
05036
05037 /* first time in: create interface like a plugin */
05038
05039 if( plint == NULL ){
05040 plint = F1D_init() ;
05041 if( plint == NULL ){ XBell(im3d->dc->display,100); EXRETURN; }
05042 PLUG_setup_widgets( plint , GLOBAL_library.dc ) ;
05043 }
05044
05045 if( cbs == NULL ) EXRETURN ; /* only for a setup call */
05046
05047 /* code below is from PLUG_startup_plugin_CB() in afni_plugin.c */
05048
05049 plint->im3d = im3d ;
05050 XtVaSetValues( plint->wid->shell ,
05051 XmNtitle , "AFNI 1DChain Function", /* top of window */
05052 XmNiconName , "1DChain" , /* label on icon */
05053 NULL ) ;
05054 PLUTO_cursorize( plint->wid->shell ) ;
05055
05056 /*-- if possible, find where this popup should go --*/
05057
05058 wpop = plint->wid->shell ;
05059
05060 if( cbs->event != NULL && cbs->event->type == ButtonRelease ){
05061
05062 XButtonEvent *xev = (XButtonEvent *) cbs->event ;
05063 int xx = (int)xev->x_root , yy = (int)xev->y_root ;
05064 int ww,hh , sw,sh ;
05065
05066 MCW_widget_geom( wpop , &ww,&hh , NULL,NULL ) ;
05067 sw = WidthOfScreen (XtScreen(wpop)) ;
05068 sh = HeightOfScreen(XtScreen(wpop)) ;
05069
05070 if( xx+ww+3 >= sw && ww <= sw ) xx = sw-ww ;
05071 if( yy+hh+3 >= sh && hh <= sh ) yy = sh-hh ;
05072
05073 XtVaSetValues( wpop , XmNx , xx , XmNy , yy , NULL ) ;
05074 }
05075
05076 /*-- popup widgets --*/
05077
05078 XtMapWidget( wpop ) ; /* after this, is up to user */
05079 RWC_visibilize_widget( wpop ) ;
05080 }
05081
05082 /*.........................................................*/
05083
05084 else if( w == im3d->vwid->dmode->misc_2dchain_pb ){ /* 20 Jun 2000 */
05085 static PLUGIN_interface *plint=NULL ;
05086 Widget wpop ;
05087
05088 /* first time in: create interface like a plugin */
05089
05090 if( plint == NULL ){
05091 plint = F2D_init() ;
05092 if( plint == NULL ){ XBell(im3d->dc->display,100); EXRETURN; }
05093 PLUG_setup_widgets( plint , GLOBAL_library.dc ) ;
05094 }
05095
05096 if( cbs == NULL ) EXRETURN ; /* only for a setup call */
05097
05098 /* code below is from PLUG_startup_plugin_CB() in afni_plugin.c */
05099
05100 plint->im3d = im3d ;
05101 XtVaSetValues( plint->wid->shell ,
05102 XmNtitle , "AFNI 2DChain Function", /* top of window */
05103 XmNiconName , "2DChain" , /* label on icon */
05104 NULL ) ;
05105 PLUTO_cursorize( plint->wid->shell ) ;
05106
05107 /*-- if possible, find where this popup should go --*/
05108
05109 wpop = plint->wid->shell ;
05110
05111 if( cbs->event != NULL && cbs->event->type == ButtonRelease ){
05112
05113 XButtonEvent *xev = (XButtonEvent *) cbs->event ;
05114 int xx = (int)xev->x_root , yy = (int)xev->y_root ;
05115 int ww,hh , sw,sh ;
05116
05117 MCW_widget_geom( wpop , &ww,&hh , NULL,NULL ) ;
05118 sw = WidthOfScreen (XtScreen(wpop)) ;
05119 sh = HeightOfScreen(XtScreen(wpop)) ;
05120
05121 if( xx+ww+3 >= sw && ww <= sw ) xx = sw-ww ;
05122 if( yy+hh+3 >= sh && hh <= sh ) yy = sh-hh ;
05123
05124 XtVaSetValues( wpop , XmNx , xx , XmNy , yy , NULL ) ;
05125 }
05126
05127 /*-- popup widgets --*/
05128
05129 XtMapWidget( wpop ) ; /* after this, is up to user */
05130 RWC_visibilize_widget( wpop ) ;
05131 }
05132
05133 /*.........................................................*/
05134
05135 else if( w == im3d->vwid->dmode->misc_plugout_pb ){ /* 07 Nov 2001 */
05136 AFNI_init_plugouts() ;
05137 XtSetSensitive(w,False) ;
05138 }
05139 #endif /* ALLOW_PLUGINS */
05140
05141 else if( w == im3d->vwid->dmode->misc_niml_pb ){ /* 02 Mar 2002 */
05142 AFNI_init_niml() ;
05143 XtSetSensitive(w,False) ;
05144 }
05145
05146 /*.........................................................*/
05147
05148 /****----- Get Outta Here -----****/
05149
05150 EXRETURN ;
05151 }
05152
05153 #ifdef USE_HIDDEN
05154
05155 /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
05156 May 1995: Hidden popup menu stuff
05157 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
05158
05159 #ifndef ALLOW_PLUGINS
05160 # undef WANT_RWCOX_IMAGE
05161 #endif
05162
05163 #ifdef WANT_RWCOX_IMAGE
05164 void RWCOX_popper(void) ;
05165 #endif
05166
05167 #ifdef USE_SKIT
05168 void SKIT_popper( Three_D_View * ) ;
05169 #endif
05170
05171 static int num_poem = 0 ; /* 15 Oct 2003 */
05172 static char **fname_poem=NULL ;
05173 static void AFNI_find_poem_files(void) ;
05174
05175 /*---------------------------------------------------------------
05176 Callback for all actions in the hidden popup
05177 -----------------------------------------------------------------*/
05178
05179 void AFNI_hidden_CB( Widget w , XtPointer cd , XtPointer cbs )
05180 {
05181 Three_D_View *im3d = (Three_D_View *)cd ;
05182
05183 ENTRY("AFNI_hidden_CB") ;
05184
05185 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
05186
05187 #ifdef ALLOW_DATASET_VLIST
05188 /****----- Read points -----****/
05189
05190 if( w == im3d->vwid->prog->hidden_readpts_ijk_pb ||
05191 w == im3d->vwid->prog->hidden_readpts_xyz_pb ){
05192
05193 im3d->vwid->prog->hidden_code =
05194 (w == im3d->vwid->prog->hidden_readpts_ijk_pb) ? PTS_READ_IJK
05195 : PTS_READ_XYZ ;
05196
05197 POPDOWN_ovcolor_chooser ;
05198
05199 MCW_choose_string( im3d->vwid->picture ,
05200
05201 (im3d->vwid->prog->hidden_code == PTS_READ_IJK)
05202 ? "Enter IJK input filename:"
05203 : "Enter XYZ input filename:" ,
05204
05205 NULL , AFNI_hidden_pts_CB , cd ) ;
05206 }
05207
05208 /****----- Write points -----****/
05209
05210 else if( w == im3d->vwid->prog->hidden_writepts_ijk_pb ||
05211 w == im3d->vwid->prog->hidden_writepts_xyz_pb ){
05212
05213 if( im3d->anat_now->pts == NULL || im3d->anat_now->pts->num <= 0 ){
05214 (void) MCW_popup_message( im3d->vwid->picture ,
05215 "No points to write out!" ,
05216 MCW_USER_KILL | MCW_TIMER_KILL ) ;
05217 XBell( im3d->dc->display , 100 ) ;
05218 EXRETURN ;
05219 }
05220
05221 POPDOWN_ovcolor_chooser ;
05222
05223 im3d->vwid->prog->hidden_code =
05224 (w == im3d->vwid->prog->hidden_writepts_ijk_pb) ? PTS_WRITE_IJK
05225 : PTS_WRITE_XYZ ;
05226
05227 MCW_choose_string( im3d->vwid->picture ,
05228
05229 (im3d->vwid->prog->hidden_code == PTS_WRITE_IJK)
05230 ? "Enter IJK output filename:"
05231 : "Enter XYZ output filename:" ,
05232
05233 NULL , AFNI_hidden_pts_CB , cd ) ;
05234 }
05235
05236 /****----- Show points -----****/
05237
05238 else if( w == im3d->vwid->prog->hidden_colorpts_pb ){
05239
05240 POPDOWN_string_chooser ;
05241
05242 im3d->vwid->prog->hidden_code = PTS_SET_COLOR ;
05243
05244 MCW_choose_ovcolor( im3d->vwid->picture ,
05245 im3d->dc ,
05246 im3d->vinfo->pts_color ,
05247 AFNI_hidden_pts_CB , cd ) ;
05248 }
05249 #endif /* ALLOW_DATASET_VLIST */
05250
05251 /****----- Mission Statement -----****/
05252
05253 if( w == im3d->vwid->prog->hidden_mission_pb ){
05254 (void) MCW_popup_message( im3d->vwid->picture ,
05255 " \n"
05256 " AFNI Mission Statement\n"
05257 " ----------------------\n"
05258 " To empower neuroscientists\n"
05259 " to perform their own state-\n"
05260 " of-the-art data analyses and\n"
05261 " visualizations, so they will \n"
05262 " stop bugging me with their\n"
05263 " pitiful 'quick questions'.\n " ,
05264 MCW_USER_KILL | MCW_TIMER_KILL ) ;
05265 }
05266
05267 else if( w == im3d->vwid->prog->hidden_gamberi_pb ){
05268 AFNI_speak( "The Rime of the Gamberi Cattivi" , 0 ) ;
05269 (void) MCW_popup_message( im3d->vwid->imag->topper ,
05270 " \n"
05271 " The Rime of the Ancient Gamberi Cattivi\n"
05272 " (with apologies to Coleridge and Dante)\n"
05273 " -----------------------------------------\n\n"
05274 " Illuminato dal sole toscano,\n"
05275 " volsi lo sguardo all'orizzonte;\n"
05276 " nel mare bagnavo la mano,\n"
05277 " e al cielo volgevo la fronte.\n"
05278 " \n"
05279 " D'improvviso dal mare schiumante,\n"
05280 " due gamberi killer cattivi si avvicinarono.\n"
05281 " Uno stiletto mi poser d'innante,\n"
05282 " mentre i lunghi baffi neri si accarezzavano.\n"
05283 " \n"
05284 " Il piu giovane ordino:\n"
05285 " \"La macchina fotografica dalla giacca sgancia!\"\n"
05286 " mentre la lama premeva forte la guancia.\n"
05287 " Prima di dichiarare \"Del Governo e proprieta,\n"
05288 " sul mio corpo il nemico passar dovra!\",\n"
05289 " il gambero malvagio nella bocca la camera si fionda\n"
05290 " e del Tirreno scuro e profondo ritorna a prender l'onda.\n"
05291 " \n"
05292 " Roberto Cox \"il Magnifico\" di Milwaukee e il dottor Emiliano\n"
05293 " corrono al grido di Ziad, ma e tutto invano.\n"
05294 " \n"
05295 " Ai nostri eroi non resta che accettare l'accaduto,\n"
05296 " e a tutta Italia AFNI e SUMA insegnare.\n"
05297 " Scusateci se lo stile e un po' caduto,\n"
05298 " ma e la scusa per l'anno prossimo a Pisa ritornare.\n" ,
05299 MCW_USER_KILL ) ;
05300 }
05301
05302 else if( w == im3d->vwid->prog->hidden_ranpoem_pb ){
05303 static int *dold=NULL, ndold=0 ; int qq,dd ;
05304 char *poem ;
05305
05306 if( num_poem < 0 ) EXRETURN ;
05307 if( num_poem == 0 ){
05308 AFNI_find_poem_files() ;
05309 if( num_poem <= 0 ){ num_poem = -1 ; EXRETURN ; }
05310 }
05311 if( ndold == 0 && num_poem > 1 ){
05312 ndold = num_poem/2 ;
05313 dold = (int *) malloc(sizeof(int)*ndold) ;
05314 for( qq=0 ; qq < ndold ; qq++ ) dold[qq] = -1 ;
05315 }
05316 Retry_dd:
05317 dd = (lrand48() >> 8) % num_poem ; /* pick random file */
05318 if( num_poem > 1 ){ /* check if used recently */
05319 for( qq=0 ; qq < ndold && dold[qq] != dd ; qq++ ) ; /* nada */
05320 if( qq < ndold ) goto Retry_dd ; /* was recent */
05321 for( qq=1 ; qq < ndold ; qq++ ) /* wasn't, so save in list */
05322 dold[qq-1] = dold[qq] ;
05323 dold[ndold-1] = dd ;
05324 }
05325 poem = AFNI_suck_file( fname_poem[dd] ) ;
05326 if( poem == NULL ) EXRETURN ;
05327 (void) MCW_popup_message( im3d->vwid->imag->topper, poem, MCW_USER_KILL );
05328 free( poem ) ;
05329 }
05330
05331 /*------ Faces! [17 Dec 2004] -----*/
05332
05333 else if( w == im3d->vwid->prog->hidden_faces_pb && w != NULL ){
05334
05335 AFNI_faceup() ;
05336 }
05337
05338 /*------ Browser [22 Apr 2005] -----*/
05339
05340 else if( w == im3d->vwid->prog->hidden_browser_pb && w != NULL ){
05341
05342 system("open http://afni.nimh.nih.gov/afni") ;
05343 }
05344
05345 /*------- random speaking --------*/
05346
05347 else if( w == im3d->vwid->prog->hidden_speech_pb && w != NULL ){
05348 static char *words[] = { "What do you want?" ,
05349 "Nice to see you" ,
05350 "Words fail me now" ,
05351 "I do not know what to say" ,
05352 "How are you feeling?" ,
05353 "Do you like, afnee?" ,
05354 "Do you use ess, pee, emm?" ,
05355 "Do you use eff, ess, ell?" ,
05356 "Exercise your hippocampus daily"
05357 } ;
05358 if( AFNI_noenv("AFNI_SPEECH") )
05359 XBell( im3d->dc->display , 100 ) ;
05360 else {
05361 static int nold=-1 ;
05362 int nn = sizeof(words)/sizeof(char *) , jj ;
05363 do{ jj = lrand48()%nn ; } while( jj == nold ) ;
05364 AFNI_speak( words[jj] , 1 ) ; nold = jj ;
05365 }
05366 }
05367
05368 /****----- Get Outta Here -----****/
05369
05370 EXRETURN ;
05371 }
05372
05373 /*--------------------------------------------------------------------------*/
05374
05375 static void AFNI_find_poem_files(void) /* 15 Oct 2003 */
05376 {
05377 char *epath , *elocal , *eee ;
05378 char edir[THD_MAX_NAME] , **ename ;
05379 int epos , ll , ii , id , npoem , nx,ny , nep ;
05380 char **fpoem ;
05381
05382 ENTRY("AFNI_find_poem_files") ;
05383
05384 if( num_poem != 0 ) EXRETURN ; /* should never happen */
05385
05386 /*----- get path to search -----*/
05387
05388 epath = getenv("AFNI_PLUGINPATH") ;
05389 if( epath == NULL ) epath = getenv("AFNI_PLUGIN_PATH") ;
05390 if( epath == NULL ) epath = getenv("PATH") ;
05391 if( epath == NULL ){ num_poem=-1; EXRETURN ; }
05392
05393 /*----- copy path list into local memory -----*/
05394
05395 ll = strlen(epath) ;
05396 elocal = AFMALL( char, sizeof(char) * (ll+2) ) ;
05397
05398 /*----- put a blank at the end -----*/
05399
05400 strcpy( elocal , epath ) ; elocal[ll] = ' ' ; elocal[ll+1] = '\0' ;
05401
05402 /*----- replace colons with blanks -----*/
05403
05404 for( ii=0 ; ii < ll ; ii++ )
05405 if( elocal[ii] == ':' ) elocal[ii] = ' ' ;
05406
05407
05408 /*----- extract blank delimited strings;
05409 use as directory names to look for files -----*/
05410
05411 ename = (char **) malloc(sizeof(char *)*2) ;
05412 ename[0] = (char *) malloc(THD_MAX_NAME) ;
05413 ename[1] = (char *) malloc(THD_MAX_NAME) ;
05414
05415 epos = 0 ;
05416
05417 do{
05418 ii = sscanf( elocal+epos , "%s%n" , edir , &id ); /* next substring */
05419 if( ii < 1 ) break ; /* none -> done */
05420
05421 /** check if edir occurs earlier in elocal **/
05422
05423 eee = strstr( elocal , edir ) ;
05424 if( eee != NULL && (eee-elocal) < epos ){ epos += id ; continue ; }
05425
05426 epos += id ; /* char after last scanned */
05427
05428 ii = strlen(edir) ; /* make sure name has */
05429 if( edir[ii-1] != '/' ){ /* a trailing '/' on it */
05430 edir[ii] = '/' ; edir[ii+1] = '\0' ;
05431 }
05432 strcpy(ename[0],edir) ;
05433 strcat(ename[0],"poem_*.txt") ; /* add filename pattern */
05434 nep = 1 ;
05435
05436 MCW_file_expand( nep,ename, &npoem , &fpoem ); /* find files that match */
05437 if( npoem <= 0 ) continue ; /* no files found */
05438
05439 /** add files we found to list **/
05440
05441 if( fname_poem == NULL )
05442 fname_poem = (char **)malloc(sizeof(char *)*npoem) ;
05443 else
05444 fname_poem = (char **)realloc(fname_poem,sizeof(char *)*(num_poem+npoem));
05445
05446 for( ii=0 ; ii < npoem ; ii++ )
05447 fname_poem[num_poem++] = strdup(fpoem[ii]) ;
05448
05449 MCW_free_expand( npoem , fpoem ) ;
05450
05451 } while( epos < ll ) ; /* scan until 'epos' is after end of epath */
05452
05453 free(elocal) ; free(ename[0]) ; free(ename[1]) ; free(ename) ;
05454
05455 if( num_poem == 0 ) num_poem = -1 ;
05456 EXRETURN ;
05457 }
05458
05459 /*-----------------------------------------------------------------
05460 Event handler to find #3 button press for hidden popup
05461 -------------------------------------------------------------------*/
05462
05463 void AFNI_hidden_EV( Widget w , XtPointer cd ,
05464 XEvent *ev , Boolean *continue_to_dispatch )
05465 {
05466 Three_D_View *im3d = (Three_D_View *) cd ;
05467
05468 ENTRY("AFNI_hidden_EV") ;
05469
05470 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
05471
05472 /*** handle events ***/
05473
05474 switch( ev->type ){
05475
05476 /*----- take button press -----*/
05477
05478 case ButtonPress:{
05479 XButtonEvent *event = (XButtonEvent *) ev ;
05480
05481 if( event->button == Button3 ||
05482 (event->button == Button1 &&
05483 (event->state & (ShiftMask|ControlMask))) ){
05484
05485 im3d->vwid->butx = event->x_root ; /* 17 May 2005 */
05486 im3d->vwid->buty = event->y_root ;
05487 event->button = Button3 ; /* fakeout */
05488 XmMenuPosition( im3d->vwid->prog->hidden_menu , event ) ; /* where */
05489 XtManageChild ( im3d->vwid->prog->hidden_menu ) ; /* popup */
05490 }
05491 #ifdef WANT_RWCOX_IMAGE
05492 else if( !NO_frivolities && event->button == Button1 ) RWCOX_popper() ;
05493 #endif
05494
05495 #ifdef USE_SKIT
05496 else if( !NO_frivolities && event->button == Button2 ) SKIT_popper(im3d) ;
05497 #endif
05498 }
05499 break ;
05500
05501 /*----- take key press [09 Sep 2002] -----*/
05502
05503 case KeyPress:{
05504 XKeyEvent *event = (XKeyEvent *) ev ;
05505 char buf[32] ;
05506 KeySym ks ;
05507 int nbuf ;
05508
05509 buf[0] = '\0' ;
05510 nbuf = XLookupString( event , buf , 32 , &ks , NULL ) ;
05511
05512 switch( buf[0] ){
05513 case 'Q':
05514 exit(0) ; /* Death Now! */
05515
05516 case 'q':
05517 AFNI_quit_CB( w , im3d, NULL ) ; /* Close just this controller */
05518 break ;
05519
05520 case 'f':
05521 case 'F':
05522 AFNI_faceup() ; /* Faces! [27 Dec 2004] */
05523 break ;
05524
05525 case 'p':
05526 case 'P':
05527 AFNI_hidden_CB( im3d->vwid->prog->hidden_ranpoem_pb ,
05528 (XtPointer)im3d , NULL ) ;
05529 break ;
05530
05531 case 'g':
05532 case 'G':
05533 AFNI_hidden_CB( im3d->vwid->prog->hidden_gamberi_pb ,
05534 (XtPointer)im3d , NULL ) ;
05535 break ;
05536 }
05537 }
05538 break ;
05539 }
05540
05541 EXRETURN ;
05542 }
05543
05544 /*-------------------------------------------------------------------*/
05545
05546 #ifdef ALLOW_DATASET_VLIST
05547 void AFNI_hidden_pts_CB( Widget w , XtPointer cd , MCW_choose_cbs *cbs )
05548 {
05549 Three_D_View *im3d = (Three_D_View *) cd ;
05550 THD_3dim_dataset *dset_now ;
05551 THD_fvec3 xyz_vec ;
05552 THD_ivec3 ijk_vec ;
05553 Boolean ijk_option , pause_it ;
05554 FILE *fil ;
05555 THD_vector_list *sv ;
05556 int ii ;
05557
05558 ENTRY("AFNI_hidden_pts_CB") ;
05559
05560 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
05561 dset_now = im3d->anat_now ;
05562 if( ! ISVALID_3DIM_DATASET(dset_now) ) EXRETURN ;
05563
05564 ijk_option = False ;
05565 switch( im3d->vwid->prog->hidden_code ){ /* action set by user */
05566
05567 /*---- Set Color ----*/
05568
05569 case PTS_SET_COLOR:
05570 im3d->vinfo->pts_color = cbs->ival ;
05571 im3d->vinfo->pts_visible = (cbs->ival > 0) ? True : False ;
05572 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ; /* redraw */
05573 break ;
05574
05575 /*---- READ pts int ----*/
05576
05577 case PTS_READ_IJK:
05578 ijk_option = True ; /* fall thru on purpose */
05579
05580 case PTS_READ_XYZ:
05581
05582 /** open input file **/
05583
05584 fil = fopen( cbs->cval , "r" ) ;
05585 if( fil == NULL ){
05586 char buf[256] ;
05587 sprintf(buf,"Cannot open file\n %s\nfor reading!",cbs->cval) ;
05588 (void) MCW_popup_message( im3d->vwid->picture , buf ,
05589 MCW_USER_KILL | MCW_TIMER_KILL ) ;
05590 XBell( im3d->dc->display , 100 ) ;
05591 EXRETURN ;
05592 }
05593
05594 POPDOWN_string_chooser ;
05595
05596 pause_it = ( THD_filesize(cbs->cval) > 99999 ) ;
05597 if( pause_it ) SHOW_AFNI_PAUSE ;
05598
05599 /** read points **/
05600
05601 INIT_VLIST(sv,dset_now) ;
05602 do {
05603 if( ijk_option )
05604 ii = fscanf( fil , " %d %d %d\n",
05605 &(ijk_vec.ijk[0]),&(ijk_vec.ijk[1]),&(ijk_vec.ijk[2])) ;
05606 else
05607 ii = fscanf( fil , " %f %f %f\n",
05608 &(xyz_vec.xyz[0]),&(xyz_vec.xyz[1]),&(xyz_vec.xyz[2])) ;
05609
05610 if( ii == 3 ){ /* all 3 good! */
05611 if( ijk_option ){ ADD_IVEC_TO_VLIST(sv,ijk_vec) ; }
05612 else { ADD_FVEC_TO_VLIST(sv,xyz_vec) ; }
05613 } else if( ii == EOF ){ /* end of data! */
05614 fclose(fil) ;
05615 break ; /* exit do loop */
05616 } else {
05617 char buf[256] ; /* bad data! */
05618 fclose(fil) ;
05619 sprintf(buf,"Bad read in file\n %s\nat point # %d",
05620 cbs->cval , sv->num + 1 ) ;
05621 (void) MCW_popup_message( im3d->vwid->picture , buf ,
05622 MCW_USER_KILL | MCW_TIMER_KILL ) ;
05623 XBell( im3d->dc->display , 100 ) ;
05624 DESTROY_VLIST(sv) ;
05625 EXRETURN ;
05626 }
05627 } while (1) ;
05628
05629 /** destroy any point sets in all current datasets **/
05630
05631 for( ii=0 ; ii <= LAST_VIEW_TYPE ; ii++ ){
05632 if( ISVALID_3DIM_DATASET(im3d->anat_dset[ii]) ){
05633 DESTROY_VLIST( im3d->anat_dset[ii]->pts ) ;
05634 im3d->anat_dset[ii]->pts_original = False ;
05635 }
05636 }
05637
05638 /** put new point set into current dataset **/
05639
05640 dset_now->pts = sv ;
05641 dset_now->pts_original = True ;
05642
05643 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ;
05644 if( pause_it ) SHOW_AFNI_READY ;
05645 break ; /* end of read pts */
05646
05647 /*---- WRITE pts out ----*/
05648
05649 case PTS_WRITE_IJK:
05650 ijk_option = True ; /* fall thru on purpose */
05651
05652 case PTS_WRITE_XYZ:
05653
05654 sv = im3d->anat_now->pts ;
05655 if( sv == NULL || sv->num == 0 ){
05656 XBell( im3d->dc->display , 100 ) ;
05657 EXRETURN ;
05658 }
05659
05660 if( cbs->cval[0] == '|' ){ /* send to standard output */
05661 fil = stdout ;
05662 } else {
05663 if( THD_is_file(cbs->cval) ){
05664 char buf[256] ;
05665 sprintf(buf,"Desired output file\n %s\nalready exists!",cbs->cval);
05666 (void) MCW_popup_message( im3d->vwid->picture , buf ,
05667 MCW_USER_KILL | MCW_TIMER_KILL ) ;
05668 XBell( im3d->dc->display , 100 ) ;
05669 EXRETURN ;
05670 }
05671
05672 fil = fopen( cbs->cval , "w" ) ;
05673 if( fil == NULL ){
05674 char buf[256] ;
05675 sprintf(buf,"Cannot open file\n %s\nfor writing!",cbs->cval) ;
05676 (void) MCW_popup_message( im3d->vwid->picture , buf ,
05677 MCW_USER_KILL | MCW_TIMER_KILL ) ;
05678 XBell( im3d->dc->display , 100 ) ;
05679 EXRETURN ;
05680 }
05681 }
05682
05683 POPDOWN_string_chooser ;
05684
05685 pause_it = ( sv->num > 6666 ) ;
05686 if( pause_it ) SHOW_AFNI_PAUSE ;
05687
05688 if( ijk_option ){
05689 for( ii=0 ; ii < sv->num ; ii++ )
05690 fprintf(fil,"%d %d %d\n", sv->ijk[ii].ijk[0],
05691 sv->ijk[ii].ijk[1],
05692 sv->ijk[ii].ijk[2] ) ;
05693 } else {
05694 for( ii=0 ; ii < sv->num ; ii++ )
05695 fprintf(fil,"%g %g %g\n", sv->xyz[ii].xyz[0],
05696 sv->xyz[ii].xyz[1],
05697 sv->xyz[ii].xyz[2] ) ;
05698 }
05699
05700 if( fil != stdout ) fclose(fil) ;
05701 if( pause_it ) SHOW_AFNI_READY ;
05702 break ; /* end of write pts */
05703
05704 } /* end of switch */
05705
05706 EXRETURN ;
05707 }
05708 #endif
05709
05710 /*====================================================================================*/
05711 #if defined(WANT_RWCOX_IMAGE) && defined(ALLOW_PLUGINS)
05712
05713 void RWCOX_popper(void)
05714 {
05715 AFNI_splashup() ;
05716 return ;
05717 }
05718 #endif /* WANT_RWCOX_IMAGE */
05719 /*====================================================================================*/
05720 #ifdef USE_SKIT
05721 #define NSKIT 50
05722 static char *skit[NSKIT][3] = {
05723 "artless" , "base-court" , "apple-john" ,
05724 "bawdy" , "bat-fowling" , "baggage" ,
05725 "beslubbering" , "beef-witted" , "barnacle" ,
05726 "bootless" , "beetle-headed" , "bladder" ,
05727 "churlish" , "boil-brained" , "boar-pig" ,
05728 "cockered" , "clapper-clawed" , "bugbear" ,
05729 "clouted" , "clay-brained" , "bum-bailey" ,
05730 "craven" , "common-kissing" , "canker-blossom" ,
05731 "currish" , "crook-pated" , "clack-dish" ,
05732 "dankish" , "dismal-dreaming" , "clotpole" ,
05733 "dissembling" , "dizzy-eyed" , "coxcomb" ,
05734 "droning" , "doghearted" , "codpiece" ,
05735 "errant" , "dread-bolted" , "death-token" ,
05736 "fawning" , "earth-vexing" , "dewberry" ,
05737 "fobbing" , "elf-skinned" , "flap-dragon" ,
05738 "froward" , "fat-kidneyed" , "flax-wench" ,
05739 "frothy" , "fen-sucked" , "flirt-gill" ,
05740 "gleeking" , "flap-mouthed" , "foot-licker" ,
05741 "goatish" , "fly-bitten" , "fustilarian" ,
05742 "gorbellied" , "folly-fallen" , "giglet" ,
05743 "impertinent" , "fool-born" , "gudgeon" ,
05744 "infectious" , "full-gorged" , "haggard" ,
05745 "jarring" , "guts-griping" , "harpy" ,
05746 "loggerheaded" , "half-faced" , "hedge-pig" ,
05747 "lumpish" , "hasty-witted" , "horn-beast" ,
05748 "mammering" , "hedge-born" , "hugger-mugger" ,
05749 "mangled" , "hell-hated" , "joithead" ,
05750 "mewling" , "idle-headed" , "lewdster" ,
05751 "paunchy" , "ill-breeding" , "lout" ,
05752 "pribbling" , "ill-nurtured" , "maggot-pie" ,
05753 "puking" , "knotty-pated" , "malt-worm" ,
05754 "puny" , "milk-livered" , "mammet" ,
05755 "qualling" , "motley-minded" , "measle" ,
05756 "rank" , "onion-eyed" , "minnow" ,
05757 "reeky" , "plume-plucked" , "miscreant" ,
05758 "roguish" , "pottle-deep" , "moldwarp" ,
05759 "ruttish" , "pox-marked" , "mumble-news" ,
05760 "saucy" , "reeling-ripe" , "nut-hook" ,
05761 "spleeny" , "rough-hewn" , "pigeon-egg" ,
05762 "spongy" , "rude-growing" , "pignut" ,
05763 "surly" , "rump-fed" , "puttock" ,
05764 "tottering" , "shard-borne" , "pumpion" ,
05765 "unmuzzled" , "sheep-biting" , "ratsbane" ,
05766 "vain" , "spur-galled" , "scut" ,
05767 "venomed" , "swag-bellied" , "skainsmate" ,
05768 "villainous" , "tardy-gaited" , "strumpet" ,
05769 "warped" , "tickle-brained" , "varlet" ,
05770 "wayward" , "toad-spotted" , "vassal" ,
05771 "weedy" , "unchin-snouted" , "whey-face" ,
05772 "yeasty" , "weather-bitten" , "wagtail"
05773 } ;
05774
05775 static char skstr[512] ;
05776
05777 void SKIT_popper(Three_D_View *im3d)
05778 {
05779 int ii,jj,kk ;
05780
05781 ii = lrand48() % NSKIT ; jj = lrand48() % NSKIT ; kk = lrand48() % NSKIT ;
05782 sprintf(skstr,"Randomly generated Shakespearean Insult:\n\n"
05783 " Thou %s %s %s! \n" ,
05784 skit[ii][0] , skit[jj][1] , skit[kk][2] ) ;
05785
05786 if( lrand48()%7 == 0 ){
05787 ii = strlen(skstr) ;
05788 sprintf( skstr+ii , "\n [Data provided by Sandy Kindermann]" ) ;
05789 }
05790
05791 (void) MCW_popup_message( im3d->vwid->picture , skstr ,
05792 MCW_USER_KILL | MCW_TIMER_KILL ) ;
05793 }
05794 #endif /* USE_SKIT */
05795 /*====================================================================================*/
05796
05797 #endif /* USE_HIDDEN */
|
|
||||||||||||||||
|
Definition at line 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 3477 of file afni_func.c. References AFNI_3DDATA_VIEW, AFNI_set_viewpoint(), AFNI_setup_viewing(), Three_D_View::anat_now, DISABLE_LOCK, ENABLE_LOCK, ENTRY, AFNI_view_info::i1, THD_ivec3::ijk, IM3D_OPEN, AFNI_view_info::j2, AFNI_view_info::k3, LOAD_ANAT_VIEW, REDISPLAY_ALL, SAVE_VPT, TEMP_FVEC3, TEMP_IVEC3, THD_3dmm_to_3dind(), THD_dicomm_to_3dmm(), Three_D_View::type, Three_D_View::vinfo, AFNI_view_info::xi, AFNI_view_info::yj, and AFNI_view_info::zk. Referenced by AFNI_anatmode_CB(), AFNI_funcmode_CB(), AFNI_resam_av_CB(), AFNI_resam_vox_av_CB(), AFNI_time_index_CB(), and RT_tell_afni_one().
03478 {
03479 THD_fvec3 fv ;
03480 THD_ivec3 iv ;
03481
03482 ENTRY("AFNI_modify_viewing") ;
03483
03484 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
03485
03486 /* set up datasets for new imaging */
03487
03488 AFNI_setup_viewing( im3d , rescaled ) ;
03489
03490 /* transform current POV to new indices */
03491
03492 if( im3d->type == AFNI_3DDATA_VIEW ){ /* 19 Oct 1999 */
03493
03494 LOAD_ANAT_VIEW(im3d) ; /* 02 Nov 1996 */
03495
03496 fv = THD_dicomm_to_3dmm(
03497 im3d->anat_now ,
03498 TEMP_FVEC3(im3d->vinfo->xi, im3d->vinfo->yj, im3d->vinfo->zk) ) ;
03499
03500 iv = THD_3dmm_to_3dind( im3d->anat_now , fv ) ;
03501
03502 } else {
03503
03504 iv = TEMP_IVEC3( im3d->vinfo->i1 , im3d->vinfo->j2 , im3d->vinfo->k3 ) ;
03505 }
03506
03507 /* and redisplay the images */
03508
03509 DISABLE_LOCK ;
03510 AFNI_set_viewpoint( im3d, iv.ijk[0],iv.ijk[1],iv.ijk[2] , REDISPLAY_ALL ) ;
03511 ENABLE_LOCK ;
03512
03513 SAVE_VPT(im3d) ;
03514 EXRETURN ;
03515 }
|
|
|
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 ; }
|
|
||||||||||||||||||||||||||||
|
Make a functional overlay the new way (30 Jan 2003):
Definition at line 1308 of file afni_func.c. References AFNI_yesenv(), rgbyte::b, ENTRY, rgbyte::g, MRI_IMAGE::kind, MRI_BYTE_PTR, MRI_FLOAT_PTR, mri_free(), mri_new_conforming, MRI_RGB_PTR, MRI_SHORT_PTR, NPANE_BIG, MRI_IMAGE::nvox, rgbyte::r, RETURN, thr, and ZREJ. Referenced by AFNI_func_overlay().
01311 {
01312 MRI_IMAGE *im_ov ;
01313 byte *ovar ;
01314 int ii , npix , zbot , jj ;
01315 float fac , val ;
01316 int reject_zero = !AFNI_yesenv("AFNI_OVERLAY_ZERO") ; /* 20 Apr 2005 */
01317
01318 ENTRY("AFNI_newfunc_overlay") ;
01319
01320 if( im_fim == NULL || fimbot >= fimtop || fimcolor == NULL ) RETURN(NULL) ;
01321
01322 /* create output image */
01323
01324 im_ov = mri_new_conforming( im_fim , MRI_rgb ) ;
01325 ovar = MRI_RGB_PTR(im_ov) ;
01326 npix = im_ov->nvox ;
01327 zbot = (fimbot == 0.0) ; /* no color for negative values? */
01328 fac = NPANE_BIG / (fimtop-fimbot) ;
01329
01330 /* load output image with colors */
01331
01332 switch( im_fim->kind ){
01333
01334 default: /* should not happen! */
01335 mri_free(im_ov) ;
01336 RETURN(NULL) ;
01337
01338 case MRI_short:{
01339 short *ar_fim = MRI_SHORT_PTR(im_fim) ;
01340
01341 for( ii=0 ; ii < npix ; ii++ ){
01342 if( ZREJ(ar_fim[ii]) ) continue ;
01343 if( zbot && ar_fim[ii] < 0 ) continue ;
01344 val = fac*(fimtop-ar_fim[ii]) ;
01345 if( val < 0.0 ) val = 0.0;
01346 jj = (int)(val+0.49); if( jj >= NPANE_BIG ) jj = NPANE_BIG-1;
01347 ovar[3*ii ] = fimcolor[jj].r ;
01348 ovar[3*ii+1] = fimcolor[jj].g ;
01349 ovar[3*ii+2] = fimcolor[jj].b ;
01350 }
01351 }
01352 break ;
01353
01354 case MRI_byte:{
01355 byte *ar_fim = MRI_BYTE_PTR(im_fim) ;
01356
01357 for( ii=0 ; ii < npix ; ii++ ){
01358 if( ZREJ(ar_fim[ii]) ) continue ;
01359 val = fac*(fimtop-ar_fim[ii]) ;
01360 if( val < 0.0 ) val = 0.0;
01361 jj = (int)(val+0.49); if( jj >= NPANE_BIG ) jj = NPANE_BIG-1;
01362 ovar[3*ii ] = fimcolor[jj].r ;
01363 ovar[3*ii+1] = fimcolor[jj].g ;
01364 ovar[3*ii+2] = fimcolor[jj].b ;
01365 }
01366 }
01367 break ;
01368
01369 case MRI_float:{
01370 float *ar_fim = MRI_FLOAT_PTR(im_fim) ;
01371
01372 for( ii=0 ; ii < npix ; ii++ ){
01373 if( ZREJ(ar_fim[ii]) ) continue ;
01374 if( zbot && ar_fim[ii] < 0.0 ) continue ;
01375 val = fac*(fimtop-ar_fim[ii]) ;
01376 if( val < 0.0 ) val = 0.0;
01377 jj = (int)(val+0.49); if( jj >= NPANE_BIG ) jj = NPANE_BIG-1;
01378 ovar[3*ii ] = fimcolor[jj].r ;
01379 ovar[3*ii+1] = fimcolor[jj].g ;
01380 ovar[3*ii+2] = fimcolor[jj].b ;
01381 }
01382 }
01383 break ;
01384 }
01385
01386 /** now apply threshold, if any **/
01387
01388 if( thresh > 0.0 && im_thr != NULL ){
01389 switch( im_thr->kind ){
01390
01391 case MRI_short:{
01392 float thr = thresh ;
01393 short *ar_thr = MRI_SHORT_PTR(im_thr) ;
01394
01395 for( ii=0 ; ii < npix ; ii++ ){
01396 if( ar_thr[ii] > -thr && ar_thr[ii] < thr )
01397 ovar[3*ii] = ovar[3*ii+1] = ovar[3*ii+2] = 0 ;
01398 }
01399 }
01400 break ;
01401
01402 case MRI_byte:{
01403 float thr = thresh ;
01404 byte *ar_thr = MRI_BYTE_PTR(im_thr) ;
01405
01406 for( ii=0 ; ii < npix ; ii++ )
01407 if( ar_thr[ii] < thr )
01408 ovar[3*ii] = ovar[3*ii+1] = ovar[3*ii+2] = 0 ;
01409 }
01410 break ;
01411
01412 case MRI_float:{
01413 float thr = thresh ;
01414 float *ar_thr = MRI_FLOAT_PTR(im_thr) ;
01415
01416 for( ii=0 ; ii < npix ; ii++ )
01417 if( ar_thr[ii] > -thr && ar_thr[ii] < thr )
01418 ovar[3*ii] = ovar[3*ii+1] = ovar[3*ii+2] = 0 ;
01419 }
01420 break ;
01421 }
01422 }
01423
01424 RETURN(im_ov) ;
01425 }
|
|
||||||||||||
|
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, AFNI_ovtemplate::dx, MRI_IMAGE::dx, AFNI_ovtemplate::dy, MRI_IMAGE::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 420 of file afni_lock.c. References AFNI_controller_index(), AFNI_equate_pbars(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, ENTRY, getenv(), GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, and MAX_CONTROLLERS. Referenced by AFNI_inten_pbar_CB().
00421 {
00422 Three_D_View *qq3d ;
00423 static int busy = 0 ; /* !=0 if this routine is "busy" */
00424 int glock , cc,ii ;
00425 char *eee ;
00426
00427 ENTRY("AFNI_pbar_lock_carryout") ;
00428
00429 /* first, determine if there is anything to do */
00430
00431 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00432
00433 if( busy ) EXRETURN; /* routine already busy */
00434 if( glock == 0 ) EXRETURN; /* nothing to do */
00435 if( !IM3D_OPEN(im3d) ) EXRETURN; /* bad input */
00436 if( GLOBAL_library.ignore_lock ) EXRETURN; /* ordered not to do anything */
00437
00438 eee = getenv( "AFNI_PBAR_LOCK" ) ; /* determine how to lock */
00439 if( eee == NULL ) EXRETURN ;
00440 if( *eee != 'Y' && *eee != 'y' ) EXRETURN ;
00441
00442 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00443
00444 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00445 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00446
00447 /* something to do? */
00448
00449 busy = 1 ; /* don't let this routine be called recursively */
00450
00451 /* loop through other controllers:
00452 for those that ARE open, ARE NOT the current one, and ARE locked */
00453
00454 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00455
00456 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00457
00458 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00459
00460 AFNI_equate_pbars( qq3d , im3d ) ;
00461 }
00462 }
00463
00464 busy = 0 ; /* OK, let this routine be activated again */
00465 EXRETURN ;
00466 }
|
|
|
Definition at line 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 }
|
|
|
Popup a message, somewhere, anywhere [05 Mar 2002]. --------------------------------------------------------------------- Definition at line 7190 of file afni_widg.c. Referenced by AFNI_process_NIML_data(), process_NIML_AFNI_dataset(), process_NIML_Node_ROI(), process_NIML_SUMA_ijk(), process_NIML_SUMA_ixyz(), and process_NIML_SUMA_node_normals(). |
|
||||||||||||
|
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 427 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_ALTERATION, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, STATUS, and Three_D_View::vinfo. Referenced by AFNI_underlay_CB().
00428 {
00429 int ir ;
00430
00431 ENTRY("AFNI_process_alteration") ;
00432
00433 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00434 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00435
00436 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00437 if( im3d->vinfo->receiver[ir] != NULL ){
00438 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00439 #if 0
00440 im3d->vinfo->receiver[ir]->receiver_func(
00441 RECEIVE_ALTERATION , 0 , NULL ,
00442 im3d->vinfo->receiver[ir]->receiver_data ) ;
00443 #else
00444 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00445 int,RECEIVE_ALTERATION , int,0 ,
00446 void *,NULL ,
00447 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00448 #endif
00449 }
00450 }
00451
00452 EXRETURN ;
00453 }
|
|
||||||||||||||||||||||||||||
|
Process drawn points:
Definition at line 683 of file afni_receive.c. References AFNI_3d_linefill(), AFNI_CALL_VOID_4ARG, AFNI_process_drawnotice(), AFNI_view_info::drawing_enabled, DRAWING_FILL, DRAWING_LINES, AFNI_view_info::drawing_mode, DRAWING_NODRAW, DRAWING_POINTS, ENTRY, free, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_DRAWING_MASK, RECEIVE_POINTS, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, Three_D_View::vinfo, xn, yn, and zn. Referenced by AFNI_gra_send_CB(), and AFNI_seq_send_CB().
00685 {
00686 int ii , nn , ir , nsent ;
00687 int *vp[4] , *xn=NULL , *yn=NULL , *zn=NULL ;
00688
00689 ENTRY("AFNI_process_drawing") ;
00690
00691 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00692 im3d->vinfo->num_receiver == 0 ||
00693 npts < 0 || im3d->vinfo->drawing_enabled == 0 ) EXRETURN ;
00694
00695 if(PRINT_TRACING){
00696 char str[256] ; sprintf(str,"received %d points",npts) ; STATUS(str) ;
00697 }
00698
00699 /*-- if no further treatment is needed,
00700 just flag input data to be set to receiver --*/
00701
00702 if( im3d->vinfo->drawing_mode == DRAWING_POINTS ||
00703 im3d->vinfo->drawing_mode == DRAWING_NODRAW || npts <= 1 ){
00704
00705 xn = xd ; yn = yd ; zn = zd ; nn = npts ;
00706 }
00707
00708 /*-- must fill in the lines:
00709 create arrays xn, yn, zn of length nn --*/
00710
00711 else if( im3d->vinfo->drawing_mode == DRAWING_LINES ){
00712
00713 AFNI_3d_linefill( npts , xd,yd,zd , &nn , &xn , &yn , &zn ) ;
00714 }
00715
00716 /*-- must fill in the polygon --*/
00717
00718 else if( im3d->vinfo->drawing_mode == DRAWING_FILL ){
00719
00720 /* this just fills the lines like above --
00721 need to write a real polygon filling routine? */
00722
00723 AFNI_3d_linefill( npts , xd,yd,zd , &nn , &xn , &yn , &zn ) ;
00724 }
00725
00726 /*-- send data to receivers that want it --*/
00727
00728 #if 0
00729 fprintf(stderr,"Sending %d points to receiver\n",nn) ;
00730 #endif
00731
00732 vp[3] = &mode ; /* how the points are arranged */
00733
00734 vp[0] = xn ; vp[1] = yn ; vp[2] = zn ;
00735
00736 for( nsent=ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00737
00738 if( im3d->vinfo->receiver[ir] != NULL &&
00739 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_DRAWING_MASK) ){
00740
00741 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00742 #if 0
00743 im3d->vinfo->receiver[ir]->receiver_func(
00744 RECEIVE_POINTS , nn ,
00745 (void *) vp , im3d->vinfo->receiver[ir]->receiver_data ) ;
00746 #else
00747 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00748 int,RECEIVE_POINTS , int,nn ,
00749 void *,vp ,
00750 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00751 #endif
00752 nsent++ ;
00753 }
00754 }
00755
00756 /* 30 Mar 1999: also send DRAWNOTICE to receivers that like this stuff */
00757
00758 if( nsent > 0 ) AFNI_process_drawnotice( im3d ) ;
00759
00760 /*-- free any created arrays --*/
00761
00762 if( xn != xd ){ free(xn); free(yn); free(zn); }
00763 EXRETURN ;
00764 }
|
|
|
Definition at line 459 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_DRAWNOTICE, RECEIVE_DRAWNOTICE_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_process_drawing(), DRAW_fillin_CB(), DRAW_quit_CB(), DRAW_redo_CB(), DRAW_ttatlas_CB(), DRAW_undo_CB(), NUD_doall_CB(), NUD_quit_CB(), NUD_update_base(), and process_NIML_Node_ROI().
00460 {
00461 int ir ;
00462
00463 ENTRY("AFNI_process_drawnotice") ;
00464
00465 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00466 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00467
00468 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00469
00470 if( im3d->vinfo->receiver[ir] != NULL &&
00471 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_DRAWNOTICE_MASK) ){
00472
00473 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00474 #if 0
00475 im3d->vinfo->receiver[ir]->receiver_func(
00476 RECEIVE_DRAWNOTICE , 0 , NULL ,
00477 im3d->vinfo->receiver[ir]->receiver_data ) ;
00478 #else
00479 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00480 int,RECEIVE_DRAWNOTICE , int,0 ,
00481 void *,NULL ,
00482 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00483 #endif
00484 }
00485 }
00486
00487 EXRETURN ;
00488 }
|
|
|
Definition at line 494 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_DSETCHANGE, RECEIVE_DSETCHANGE_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_rescan_all_CB(), and AFNI_rescan_CB().
00495 {
00496 int ir ;
00497
00498 ENTRY("AFNI_process_dsetchange") ;
00499
00500 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00501 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00502
00503 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00504
00505 if( im3d->vinfo->receiver[ir] != NULL &&
00506 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_DSETCHANGE_MASK) ){
00507
00508 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00509 #if 0
00510 im3d->vinfo->receiver[ir]->receiver_func(
00511 RECEIVE_DSETCHANGE , 0 , NULL ,
00512 im3d->vinfo->receiver[ir]->receiver_data ) ;
00513 #else
00514 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00515 int,RECEIVE_DSETCHANGE , int,0 ,
00516 void *,NULL ,
00517 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00518 #endif
00519 }
00520 }
00521
00522 EXRETURN ;
00523 }
|
|
|
Send funcdisplay notification to receivers that care [05 Mar 2002]. --------------------------------------------------------------------- Definition at line 635 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_FUNCDISPLAY, RECEIVE_FUNCDISPLAY_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_bucket_CB(), AFNI_redisplay_func(), and AFNI_time_index_CB().
00636 {
00637 int ir ;
00638
00639 ENTRY("AFNI_process_funcdisplay") ;
00640
00641 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00642 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00643
00644 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00645 if( im3d->vinfo->receiver[ir] != NULL &&
00646 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_FUNCDISPLAY_MASK) ){
00647
00648 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00649 #if 0
00650 im3d->vinfo->receiver[ir]->receiver_func(
00651 RECEIVE_FUNCDISPLAY , 0 , NULL ,
00652 im3d->vinfo->receiver[ir]->receiver_data ) ;
00653 #else
00654 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00655 int,RECEIVE_FUNCDISPLAY , int,0 ,
00656 void *,NULL ,
00657 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00658 #endif
00659 }
00660 }
00661
00662 EXRETURN ;
00663 }
|
|
|
Definition at line 2087 of file afni_fimmer.c. References XtPointer_array::ar, ev, GLOBAL_library, AFNI_library_type::interruptables, XtPointer_array::num, and MCW_interruptables::windows. Referenced by RCREND_autocompute_CB(), RCREND_read_exec_CB(), REND_autocompute_CB(), and REND_read_exec_CB().
02088 {
02089 Display * dis = XtDisplay(w) ;
02090 XEvent ev ;
02091 int ii , nwin ;;
02092
02093 /* make sure server has everything from us, then make sure display is OK */
02094
02095 XFlush( dis ) ; XmUpdateDisplay( w ) ;
02096
02097 /* if no windows are set to allow interrupts, then go home to mother */
02098
02099 if( GLOBAL_library.interruptables.windows == NULL ||
02100 GLOBAL_library.interruptables.windows->num == 0 ) return ;
02101
02102 nwin = GLOBAL_library.interruptables.windows->num ;
02103
02104 /* check for events;
02105 if they are in a window on our list, let Xt handle them;
02106 loop until all pending events have been handled or discarded */
02107
02108 while( XCheckMaskEvent( dis ,
02109 ButtonPressMask | ButtonReleaseMask |
02110 ButtonMotionMask | PointerMotionMask |
02111 KeyPressMask | KeyReleaseMask , &ev ) ){
02112
02113 for( ii=0 ; ii < nwin ; ii++ ){
02114 if( ev.xany.window ==
02115 (Window) GLOBAL_library.interruptables.windows->ar[ii] ){
02116
02117 XtDispatchEvent( &ev ) ; /* was on our list! */
02118 break ;
02119 }
02120 }
02121
02122 if( ii == nwin ) XBell( dis , 100 ) ; /* beep for non-allowed event */
02123 XUngrabPointer( dis , CurrentTime ) ; /* 17 Jun 2005 */
02124 }
02125
02126 return ;
02127 }
|
|
|
Send redisplay notification to receivers that care [04 Mar 2002]. --------------------------------------------------------------------- Definition at line 601 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_REDISPLAY, RECEIVE_REDISPLAY_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_set_viewpoint().
00602 {
00603 int ir ;
00604
00605 ENTRY("AFNI_process_redisplay") ;
00606
00607 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00608 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00609
00610 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00611 if( im3d->vinfo->receiver[ir] != NULL &&
00612 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_REDISPLAY_MASK) ){
00613
00614 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00615 #if 0
00616 im3d->vinfo->receiver[ir]->receiver_func(
00617 RECEIVE_REDISPLAY , 0 , NULL ,
00618 im3d->vinfo->receiver[ir]->receiver_data ) ;
00619 #else
00620 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00621 int,RECEIVE_REDISPLAY , int,0 ,
00622 void *,NULL ,
00623 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00624 #endif
00625 }
00626 }
00627
00628 EXRETURN ;
00629 }
|
|
|
Send time index change notice to receivers that care [29 Jan 2003] --------------------------------------------------------------------- Definition at line 567 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_TIMEINDEX, RECEIVE_TIMEINDEX_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_setup_viewing(), and AFNI_time_index_CB().
00568 {
00569 int ir ;
00570
00571 ENTRY("AFNI_process_timeindex") ;
00572
00573 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00574 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00575
00576 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00577 if( im3d->vinfo->receiver[ir] != NULL &&
00578 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_TIMEINDEX_MASK) ){
00579
00580 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00581 #if 0
00582 im3d->vinfo->receiver[ir]->receiver_func(
00583 RECEIVE_TIMEINDEX , 0 , NULL ,
00584 im3d->vinfo->receiver[ir]->receiver_data ) ;
00585 #else
00586 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00587 int,RECEIVE_TIMEINDEX , int,0 ,
00588 void *,NULL ,
00589 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00590 #endif
00591 }
00592 }
00593
00594 EXRETURN ;
00595 }
|
|
|
|
|
|
Definition at line 529 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, ENTRY, AFNI_view_info::i1, IM3D_VALID, AFNI_view_info::j2, AFNI_view_info::k3, AFNI_view_info::num_receiver, RECEIVE_VIEWPOINT, RECEIVE_VIEWPOINT_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, STATUS, and Three_D_View::vinfo. Referenced by AFNI_crosshair_visible_CB(), and AFNI_set_viewpoint().
00530 {
00531 int ir , ijk[3] ;
00532
00533 ENTRY("AFNI_process_viewpoint") ;
00534
00535 if( !IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ||
00536 im3d->vinfo->num_receiver == 0 ) EXRETURN ;
00537
00538 ijk[0] = im3d->vinfo->i1 ;
00539 ijk[1] = im3d->vinfo->j2 ;
00540 ijk[2] = im3d->vinfo->k3 ;
00541
00542 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00543 if( im3d->vinfo->receiver[ir] != NULL &&
00544 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_VIEWPOINT_MASK) ){
00545
00546 STATUS(im3d->vinfo->receiver[ir]->receiver_funcname) ;
00547 #if 0
00548 im3d->vinfo->receiver[ir]->receiver_func(
00549 RECEIVE_VIEWPOINT , 3 , ijk ,
00550 im3d->vinfo->receiver[ir]->receiver_data ) ;
00551 #else
00552 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00553 int,RECEIVE_VIEWPOINT , int,3 ,
00554 void *,ijk ,
00555 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00556 #endif
00557 }
00558 }
00559
00560 EXRETURN ;
00561 }
|
|
|
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 }
|
|
||||||||||||||||
|
"AFNI Version Check!" logo * Definition at line 3384 of file afni_widg.c.
03415 { char * hh[] = { "View data direct from brick" ,
|
|
||||||||||||
|
Definition at line 4513 of file afni_func.c. Referenced by AFNI_set_func_range().
04514 {
04515 Three_D_View *im3d = (Three_D_View *) cd ;
04516
04517 ENTRY("AFNI_range_av_CB") ;
04518
04519 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04520
04521 im3d->vinfo->fim_range = av->fval ;
04522 AFNI_redisplay_func( im3d ) ;
04523
04524 AFNI_range_lock_carryout(im3d) ; /* 23 Feb 2004 */
04525
04526 AFNI_hintize_pbar( im3d->vwid->func->inten_pbar ,
04527 (im3d->vinfo->fim_range != 0.0) ? im3d->vinfo->fim_range
04528 : im3d->vinfo->fim_autorange );
04529 EXRETURN ;
04530 }
|
|
||||||||||||||||
|
|
Definition at line 4332 of file afni_func.c. References AFNI_view_info::anat_index, Three_D_View::anat_now, AV_fval_to_char(), THD_statistics::bstat, DSET_VALID_BSTAT, ENTRY, AFNI_view_info::fim_index, Three_D_View::fim_now, IM3D_OPEN, ISVALID_3DIM_DATASET, ISVALID_STATISTIC, THD_brick_stats::max, THD_brick_stats::min, RELOAD_STATS, RETURN, THD_3dim_dataset::stats, AFNI_view_info::stats_anat_ok, AFNI_view_info::stats_func_ok, AFNI_view_info::stats_thresh_ok, STATUS, AFNI_view_info::thr_index, and Three_D_View::vinfo. Referenced by AFNI_reset_func_range().
04333 {
04334 char anat_minch[10] = " --------" , anat_maxch[10] = " --------" ,
04335 fim_minch[10] = " --------" , fim_maxch[10] = " --------" ,
04336 thr_minch[10] = " --------" , thr_maxch[10] = " --------" ;
04337 char buf[256] , qbuf[16] ;
04338 XmString xstr ;
04339 int iv ;
04340
04341 ENTRY("AFNI_range_label") ;
04342
04343 if( im3d != NULL && im3d->vinfo != NULL ){ /* 30 Mar 2005 */
04344 im3d->vinfo->stats_anat_ok =
04345 im3d->vinfo->stats_func_ok =
04346 im3d->vinfo->stats_thresh_ok = 0 ;
04347 }
04348
04349 /*** anat statistics ***/
04350
04351 if( IM3D_OPEN(im3d) ){
04352 STATUS("RELOAD_STATS(anat_now)") ;
04353 RELOAD_STATS(im3d->anat_now) ;
04354 }
04355
04356 if( IM3D_OPEN(im3d) &&
04357 ISVALID_3DIM_DATASET(im3d->anat_now) &&
04358 ISVALID_STATISTIC(im3d->anat_now->stats) ){
04359
04360 iv = im3d->vinfo->anat_index ;
04361
04362 if( DSET_VALID_BSTAT(im3d->anat_now,iv) ){
04363 STATUS("anat_now statistics") ;
04364 AV_fval_to_char( im3d->anat_now->stats->bstat[iv].min , qbuf ) ;
04365 sprintf( anat_minch , "%9.9s" , qbuf ) ;
04366 AV_fval_to_char( im3d->anat_now->stats->bstat[iv].max , qbuf ) ;
04367 sprintf( anat_maxch , "%9.9s" , qbuf ) ;
04368 im3d->vinfo->stats_anat_ok = 1 ;
04369 } else {
04370 STATUS("can't load anat_now bstat") ;
04371 }
04372 }
04373
04374 /*** func statistics ***/
04375
04376 if( IM3D_OPEN(im3d) ){
04377 STATUS("RELOAD_STATS(fim_now)") ;
04378 RELOAD_STATS(im3d->fim_now) ;
04379 }
04380
04381 if( IM3D_OPEN(im3d) &&
04382 ISVALID_3DIM_DATASET(im3d->fim_now) &&
04383 ISVALID_STATISTIC(im3d->fim_now->stats) ){
04384
04385 iv = im3d->vinfo->fim_index ;
04386
04387 if( DSET_VALID_BSTAT(im3d->fim_now,iv) ){
04388 STATUS("fim_now statistics") ;
04389 AV_fval_to_char( im3d->fim_now->stats->bstat[iv].min , qbuf ) ;
04390 sprintf( fim_minch , "%9.9s" , qbuf ) ;
04391 AV_fval_to_char( im3d->fim_now->stats->bstat[iv].max , qbuf ) ;
04392 sprintf( fim_maxch , "%9.9s" , qbuf ) ;
04393 im3d->vinfo->stats_func_ok = 1 ;
04394 } else {
04395 STATUS("can't load fim_now bstat") ;
04396 }
04397
04398 iv = im3d->vinfo->thr_index ;
04399
04400 if( DSET_VALID_BSTAT(im3d->fim_now,iv) ){
04401 STATUS("thr_now statistics") ;
04402 AV_fval_to_char( im3d->fim_now->stats->bstat[iv].min , qbuf ) ;
04403 sprintf( thr_minch , "%9.9s" , qbuf ) ;
04404 AV_fval_to_char( im3d->fim_now->stats->bstat[iv].max , qbuf ) ;
04405 sprintf( thr_maxch , "%9.9s" , qbuf ) ;
04406 im3d->vinfo->stats_thresh_ok = 1 ;
04407 } else {
04408 STATUS("can't load thr_now bstat") ;
04409 }
04410 }
04411
04412 /*** make label ***/
04413
04414 STATUS("make buf label") ;
04415
04416 sprintf( buf , "ULay %s:%s\nOLay %s:%s\nThr %s:%s" ,
04417 anat_minch,anat_maxch, fim_minch,fim_maxch, thr_minch,thr_maxch ) ;
04418
04419 STATUS(buf) ;
04420
04421 xstr = XmStringCreateLtoR( buf , XmFONTLIST_DEFAULT_TAG ) ;
04422
04423 RETURN(xstr) ;
04424 }
|
|
|
Definition at line 555 of file afni_lock.c. References AFNI_controller_index(), AFNI_driver(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, ENTRY, AFNI_view_info::fim_range, AFNI_widget_set::func, getenv(), GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, MAX_CONTROLLERS, MCW_val_bbox(), AFNI_function_widgets::range_bbox, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_range_bbox_CB().
00556 {
00557 Three_D_View *qq3d ;
00558 static int busy = 0 ; /* !=0 if this routine is "busy" */
00559 int glock , cc,ii,nn ;
00560 float val ;
00561 char cmd[64] , *eee ;
00562
00563 ENTRY("AFNI_range_lock_carryout") ;
00564
00565 /* first, determine if there is anything to do */
00566
00567 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00568
00569 if( busy ) EXRETURN; /* routine already busy */
00570 if( glock == 0 ) EXRETURN; /* nothing to do */
00571 if( !IM3D_OPEN(im3d) ) EXRETURN; /* bad input */
00572 if( GLOBAL_library.ignore_lock ) EXRETURN; /* ordered not to do anything */
00573
00574 eee = getenv( "AFNI_RANGE_LOCK" ); /* determine how to lock */
00575 if( eee == NULL ) EXRETURN;
00576 if( *eee != 'Y' && *eee != 'y' ) EXRETURN;
00577
00578 ii = AFNI_controller_index(im3d); /* which one am I? */
00579
00580 if( ii < 0 ) EXRETURN; /* nobody? bad input! */
00581 if( ((1<<ii) & glock) == 0 ) EXRETURN; /* input not locked */
00582
00583 /* get range of this controller */
00584
00585 val = im3d->vinfo->fim_range ;
00586 if( val <= 0.0 ) EXRETURN; /* shouldn't happen */
00587
00588 /* count how OTHER controllers are are open and locked;
00589 if none of them, there is nothing to do [29 Apr 2005] */
00590
00591 for( nn=cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00592 qq3d = GLOBAL_library.controllers[cc] ;
00593 if( qq3d != im3d && IM3D_OPEN(qq3d) && ((1<<cc) & glock) != 0 ) nn++ ;
00594 }
00595 if( nn < 1 ) EXRETURN ;
00596
00597 /* something to do? */
00598
00599 busy = 1 ; /* don't let this routine be called recursively */
00600
00601 /* loop through other controllers:
00602 for those that ARE open, and ARE locked, set the new range */
00603
00604 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00605
00606 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00607
00608 if( IM3D_OPEN(qq3d) && ((1<<cc) & glock) != 0 ){ /* open and locked */
00609
00610 if( qq3d == im3d && /* no need to set current if not autoRanged */
00611 MCW_val_bbox(im3d->vwid->func->range_bbox) == 0 ) continue;
00612
00613 sprintf( cmd , "SET_FUNC_RANGE %c.%.6f" , 'A'+cc , val ) ;
00614 AFNI_driver( cmd ) ;
00615 }
00616 }
00617
00618 busy = 0 ; /* OK, let this routine be activated again */
00619 EXRETURN ;
00620 }
|
|
||||||||||||
|
Definition at line 312 of file afni_func.c. References event.
00313 {
00314 MCW_pbar *pbar = (MCW_pbar *) cd ;
00315 int ddd ;
00316
00317 ENTRY("AFNI_range_rotate_av_CB") ;
00318
00319 /* which way to rotate? */
00320
00321 if( av->fval > av->old_fval ) ddd = +1 ;
00322 else ddd = -1 ;
00323
00324 /* Shift+click ==> rotate by 4 (useful for bigmode) */
00325
00326 if( av->xev.type == ButtonPress ){
00327 XButtonEvent *event = (XButtonEvent *) (&av->xev) ;
00328 if( event->state & ShiftMask ) ddd *= 4 ;
00329 }
00330
00331 rotate_MCW_pbar( pbar , ddd ) ;
00332 EXRETURN ;
00333 }
|
|
||||||||||||
|
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 }
|
|
||||||||||||||||
|
(The following is from AFNI_read_inputs) * Definition at line 2700 of file afni_func.c. References AFNI_finalize_read_1D_CB(), AFNI_make_file_dialog(), ENTRY, AFNI_widget_set::file_cb, AFNI_widget_set::file_cd, AFNI_widget_set::file_dialog, AFNI_widget_set::file_sbox, RWC_visibilize_widget(), and Three_D_View::vwid.
02701 {
02702 Three_D_View *im3d = (Three_D_View *) cd ;
02703 XmString xstr ;
02704
02705 ENTRY("AFNI_read_1D_CB") ;
02706
02707 AFNI_make_file_dialog( im3d ) ;
02708
02709 XtAddCallback( im3d->vwid->file_sbox , XmNokCallback ,
02710 AFNI_finalize_read_1D_CB , cd ) ;
02711
02712 XtAddCallback( im3d->vwid->file_sbox , XmNcancelCallback ,
02713 AFNI_finalize_read_1D_CB , cd ) ;
02714
02715 XtAddCallback( im3d->vwid->file_sbox , XmNhelpCallback ,
02716 AFNI_finalize_read_1D_CB , cd ) ;
02717
02718 /* 02 Feb 1998: put *.1D* in the filename pattern */
02719
02720 xstr = XmStringCreateLtoR( "*.1D*" , XmFONTLIST_DEFAULT_TAG ) ;
02721 XtVaSetValues( im3d->vwid->file_sbox ,
02722 XmNpattern , xstr ,
02723 NULL ) ;
02724 XmStringFree(xstr) ;
02725
02726 im3d->vwid->file_cb = AFNI_finalize_read_1D_CB ;
02727 im3d->vwid->file_cd = cd ;
02728
02729 XtVaSetValues( im3d->vwid->file_dialog,
02730 XmNtitle, "AFNI: Read 1D Timeseries",
02731 NULL ) ;
02732
02733 XtPopup( im3d->vwid->file_dialog , XtGrabNone ) ;
02734 RWC_visibilize_widget( im3d->vwid->file_dialog ) ; /* 09 Nov 1999 */
02735
02736 EXRETURN ;
02737 }
|
|
||||||||||||
|
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, AF_options::dy, MRI_IMAGE::dy, AF_options::dz, MRI_IMAGE::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_datablock::kl, THD_3dim_dataset::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_datablock::nvals, THD_diskptr::nvals, MRI_IMAGE::nx, THD_dataxes::nxx, MRI_IMAGE::ny, THD_dataxes::nyy, nz, THD_dataxes::nzz, OR3OK, ORCODE, AF_options::orient_code, THD_dataxes::parent, THD_datablock::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_3dim_dataset::type, THD_dataxes::type, THD_datablock::type, THD_diskptr::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(), XtPointer_array::num, THD_string_array::num, THD_session::num_dsset, THD_sessionlist::num_sess, THD_session::parent, THD_sessionlist::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_session::type, THD_sessionlist::type, UNITS_SEC_TYPE, VIEW_ORIGINAL_TYPE, THD_3dim_dataset::view_type, AF_options::warp_4D, AFNI_library_type::warptable, THD_session::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 }
|
|
||||||||||||||||
|
change button labels to conform to other AFNI dialogs * Definition at line 2445 of file afni_func.c. References AFNI_finalize_read_sess_CB(), AFNI_make_file_dialog(), ENTRY, AFNI_widget_set::file_cb, AFNI_widget_set::file_cd, AFNI_widget_set::file_dialog, AFNI_widget_set::file_sbox, GLOBAL_library, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, NORMAL_cursorize, THD_sessionlist::num_sess, RWC_visibilize_widget(), AFNI_library_type::sslist, THD_MAX_NUM_SESSION, and Three_D_View::vwid.
02446 {
02447 Three_D_View *im3d = (Three_D_View *) cd ;
02448
02449 ENTRY("AFNI_read_sess_CB") ;
02450
02451 if( GLOBAL_library.sslist->num_sess >= THD_MAX_NUM_SESSION ){
02452 (void) MCW_popup_message( w ,
02453 "********************************\n"
02454 "** Maximum number of sessions **\n"
02455 "** would be exceeded. Sorry! **\n"
02456 "********************************"
02457 , MCW_USER_KILL | MCW_TIMER_KILL ) ;
02458 EXRETURN ;
02459 }
02460
02461 AFNI_make_file_dialog( im3d ) ;
02462
02463 XtAddCallback( im3d->vwid->file_sbox , XmNokCallback ,
02464 AFNI_finalize_read_sess_CB , cd ) ;
02465
02466 XtAddCallback( im3d->vwid->file_sbox , XmNcancelCallback ,
02467 AFNI_finalize_read_sess_CB , cd ) ;
02468
02469 XtAddCallback( im3d->vwid->file_sbox , XmNhelpCallback ,
02470 AFNI_finalize_read_sess_CB , cd ) ;
02471
02472 im3d->vwid->file_cb = AFNI_finalize_read_sess_CB ;
02473 im3d->vwid->file_cd = cd ;
02474
02475 XtVaSetValues( im3d->vwid->file_dialog,
02476 XmNtitle, "AFNI: Read Session",
02477 NULL ) ;
02478
02479 XtPopup( im3d->vwid->file_dialog , XtGrabNone ) ;
02480 RWC_visibilize_widget( im3d->vwid->file_dialog ) ; /* 09 Nov 1999 */
02481 NORMAL_cursorize( im3d->vwid->file_dialog ) ;
02482
02483 EXRETURN ;
02484 }
|
|
||||||||||||||||
|
try to read a new timeseries * Definition at line 2810 of file afni_func.c. References AFNI_finalize_read_Web_CB(), ENTRY, and MCW_choose_string().
02811 {
02812 Three_D_View *im3d = (Three_D_View *) cd ;
02813 XmString xstr ;
02814
02815 ENTRY("AFNI_read_Web_CB") ;
02816
02817 MCW_choose_string( w ,
02818 "Complete http:// or ftp:// address of dataset (.HEAD or .mnc or .mnc.gz):\n"
02819 "Examples: ftp://afni.nimh.nih.gov/AFNI/data/astrip+orig.HEAD\n"
02820 " http://afni.nimh.nih.gov/afni/norm305.mnc.gz"
02821 , NULL , AFNI_finalize_read_Web_CB , (XtPointer) im3d ) ;
02822
02823 EXRETURN ;
02824 }
|
|
||||||||||||||||||||
|
Control how the receiver works:
Definition at line 183 of file afni_receive.c. References AFNI_toggle_drawing(), arg, Three_D_View::dc, DRAWING_FILL, DRAWING_LINES, DRAWING_LINEWIDTH, AFNI_view_info::drawing_mode, DRAWING_NODRAW, DRAWING_OVCINDEX, AFNI_view_info::drawing_pixel, DRAWING_POINTS, DRAWING_SHUTDOWN, DRAWING_STARTUP, DRAWING_X11PIXEL, DRAWNOTICE_SHUTDOWN, DRAWNOTICE_STARTUP, drive_MCW_imseq(), DSETCHANGE_SHUTDOWN, DSETCHANGE_STARTUP, ENTRY, EVERYTHING_SHUTDOWN, free, FUNCDISPLAY_SHUTDOWN, FUNCDISPLAY_STARTUP, IM3D_VALID, ind, isqDR_button2_mode, isqDR_button2_pixel, isqDR_button2_width, key, MCW_DCOV::ncol_ov, AFNI_view_info::num_receiver, MCW_DC::ovc, OVERLAY_SHUTDOWN, OVERLAY_STARTUP, MCW_DCOV::pix_ov, RECEIVE_ALL_MASK, RECEIVE_DRAWING_MASK, RECEIVE_DRAWNOTICE_MASK, RECEIVE_DSETCHANGE_MASK, RECEIVE_FUNCDISPLAY_MASK, RECEIVE_OVERLAY_MASK, RECEIVE_REDISPLAY_MASK, RECEIVE_TIMEINDEX_MASK, RECEIVE_VIEWPOINT_MASK, AFNI_view_info::receiver, REDISPLAY_SHUTDOWN, REDISPLAY_STARTUP, RETURN, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, TIMEINDEX_SHUTDOWN, TIMEINDEX_STARTUP, VIEWPOINT_SHUTDOWN, VIEWPOINT_STARTUP, and Three_D_View::vinfo. Referenced by DRAW_color_CB(), DRAW_done_CB(), DRAW_finalize_dset_CB(), DRAW_mode_CB(), DRAW_quit_CB(), DSET2_dset_recv(), DSETN_dset_recv(), r_save_dataset_as(), RCREND_done_CB(), REND_done_CB(), and TTget_main().
00184 {
00185 ENTRY("AFNI_receive_control") ;
00186
00187 /* check input for OK-osity */
00188
00189 if( ! IM3D_VALID(im3d) || im3d->vinfo->receiver == NULL ) RETURN(-1) ;
00190 if( key < 0 || key >= im3d->vinfo->num_receiver ) RETURN(-1) ;
00191 if( im3d->vinfo->receiver[key] == NULL ) RETURN(-1) ;
00192
00193 /* take appropriate actions */
00194
00195 switch( code ){
00196
00197 default: RETURN(-1) ;
00198
00199 case DRAWNOTICE_STARTUP:{ /* 30 Mar 1999 */
00200 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_DRAWNOTICE_MASK ;
00201 }
00202 break ;
00203
00204 case DRAWNOTICE_SHUTDOWN:{ /* 30 Mar 1999 */
00205 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_DRAWNOTICE_MASK) ;
00206 }
00207 break ;
00208
00209 case DSETCHANGE_STARTUP:{ /* 31 Mar 1999 */
00210 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_DSETCHANGE_MASK ;
00211 }
00212 break ;
00213
00214 case DSETCHANGE_SHUTDOWN:{ /* 30 Mar 1999 */
00215 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_DSETCHANGE_MASK) ;
00216 }
00217 break ;
00218
00219 case DRAWING_STARTUP:{
00220 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_DRAWING_MASK ;
00221 AFNI_toggle_drawing( im3d ) ;
00222 }
00223 break ;
00224
00225 case DRAWING_SHUTDOWN:{
00226 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_DRAWING_MASK) ;
00227 AFNI_toggle_drawing( im3d ) ;
00228 }
00229 break ;
00230
00231 case DRAWING_OVCINDEX:{
00232 int ind = (int) arg ;
00233
00234 if( ind <= 0 || ind >= im3d->dc->ovc->ncol_ov ){
00235 RETURN(-1) ;
00236 } else {
00237 Pixel ppp = im3d->dc->ovc->pix_ov[ind] ;
00238 drive_MCW_imseq( im3d->s123, isqDR_button2_pixel, (XtPointer)ppp ) ;
00239 drive_MCW_imseq( im3d->s231, isqDR_button2_pixel, (XtPointer)ppp ) ;
00240 drive_MCW_imseq( im3d->s312, isqDR_button2_pixel, (XtPointer)ppp ) ;
00241 im3d->vinfo->drawing_pixel = ppp ;
00242 }
00243 }
00244 break ;
00245
00246 case DRAWING_X11PIXEL:{
00247 Pixel ppp = (Pixel) arg ;
00248 drive_MCW_imseq( im3d->s123, isqDR_button2_pixel, (XtPointer)ppp ) ;
00249 drive_MCW_imseq( im3d->s231, isqDR_button2_pixel, (XtPointer)ppp ) ;
00250 drive_MCW_imseq( im3d->s312, isqDR_button2_pixel, (XtPointer)ppp ) ;
00251 im3d->vinfo->drawing_pixel = ppp ;
00252 }
00253 break ;
00254
00255 case DRAWING_LINES:
00256 case DRAWING_FILL:
00257 case DRAWING_POINTS:
00258 case DRAWING_NODRAW:{
00259 im3d->vinfo->drawing_mode = code ;
00260 drive_MCW_imseq( im3d->s123, isqDR_button2_mode, (XtPointer)code ) ;
00261 drive_MCW_imseq( im3d->s231, isqDR_button2_mode, (XtPointer)code ) ;
00262 drive_MCW_imseq( im3d->s312, isqDR_button2_mode, (XtPointer)code ) ;
00263 }
00264 break ;
00265
00266 case DRAWING_LINEWIDTH:{ /* 08 Oct 2002 */
00267 int ww = (int) arg ;
00268 if( ww >= 0 ){
00269 drive_MCW_imseq( im3d->s123, isqDR_button2_width, (XtPointer)ww ) ;
00270 drive_MCW_imseq( im3d->s231, isqDR_button2_width, (XtPointer)ww ) ;
00271 drive_MCW_imseq( im3d->s312, isqDR_button2_width, (XtPointer)ww ) ;
00272 }
00273 }
00274 break ;
00275
00276 case VIEWPOINT_STARTUP:{
00277 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_VIEWPOINT_MASK ;
00278 }
00279 break ;
00280
00281 case VIEWPOINT_SHUTDOWN:{
00282 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_VIEWPOINT_MASK) ;
00283 }
00284 break ;
00285
00286 case REDISPLAY_STARTUP:{
00287 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_REDISPLAY_MASK ;
00288 }
00289 break ;
00290
00291 case REDISPLAY_SHUTDOWN:{
00292 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_REDISPLAY_MASK) ;
00293 }
00294 break ;
00295
00296 case FUNCDISPLAY_STARTUP:{
00297 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_FUNCDISPLAY_MASK ;
00298 }
00299 break ;
00300
00301 case FUNCDISPLAY_SHUTDOWN:{
00302 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_FUNCDISPLAY_MASK) ;
00303 }
00304 break ;
00305
00306 case OVERLAY_STARTUP:{
00307 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_OVERLAY_MASK ;
00308 }
00309 break ;
00310
00311 case OVERLAY_SHUTDOWN:{
00312 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_OVERLAY_MASK) ;
00313 }
00314 break ;
00315
00316 case TIMEINDEX_STARTUP:{
00317 im3d->vinfo->receiver[key]->receiver_mask |= RECEIVE_TIMEINDEX_MASK ;
00318 }
00319 break ;
00320
00321 case TIMEINDEX_SHUTDOWN:{
00322 im3d->vinfo->receiver[key]->receiver_mask &= (RECEIVE_ALL_MASK - RECEIVE_TIMEINDEX_MASK) ;
00323 }
00324 break ;
00325
00326 case EVERYTHING_SHUTDOWN:{
00327 im3d->vinfo->receiver[key]->receiver_mask = 0 ;
00328 AFNI_toggle_drawing( im3d ) ;
00329 }
00330 break ;
00331
00332 } /* end of switch on codes */
00333
00334 /* possibly remove this receiver, and maybe even all receivers */
00335
00336 if( im3d->vinfo->receiver[key]->receiver_mask == 0 ){ /* receiving nothing at all? */
00337 int ir , nn=0 ;
00338
00339 if( im3d->vinfo->receiver[key]->receiver_funcname != NULL )
00340 free( im3d->vinfo->receiver[key]->receiver_funcname ) ;
00341
00342 free( im3d->vinfo->receiver[key] ) ; /* toss this one fer shur */
00343 im3d->vinfo->receiver[key] = NULL ;
00344
00345 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ) /* see if any are left */
00346 if( im3d->vinfo->receiver[ir] != NULL ) nn++ ;
00347
00348 if( nn == 0 ) im3d->vinfo->num_receiver = 0 ; /* if not, toss them all */
00349 }
00350
00351 RETURN(0) ;
00352 }
|
|
|
Turn off all reception for this viewer. --------------------------------------------------------------------------- Definition at line 135 of file afni_receive.c. References AFNI_CALL_VOID_4ARG, AFNI_view_info::drawing_enabled, DRAWING_LINES, AFNI_view_info::drawing_mode, ENTRY, free, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_CLOSURE, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, and Three_D_View::vinfo. Referenced by AFNI_closedown_3dview().
00136 {
00137 int ir ;
00138
00139 ENTRY("AFNI_receive_destroy") ;
00140
00141 if( !IM3D_VALID(im3d) ) EXRETURN ;
00142
00143 if( im3d->vinfo->receiver != NULL && im3d->vinfo->num_receiver > 0 ){
00144
00145 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ ){
00146
00147 if( im3d->vinfo->receiver[ir] != NULL ){
00148 #if 0
00149 im3d->vinfo->receiver[ir]->receiver_func(
00150 RECEIVE_CLOSURE , 0 , NULL ,
00151 im3d->vinfo->receiver[ir]->receiver_data ) ;
00152 #else
00153 AFNI_CALL_VOID_4ARG( im3d->vinfo->receiver[ir]->receiver_func ,
00154 int,RECEIVE_CLOSURE , int,0 ,
00155 void *,NULL ,
00156 void *,im3d->vinfo->receiver[ir]->receiver_data ) ;
00157 #endif
00158
00159 if( im3d->vinfo->receiver[ir]->receiver_funcname != NULL )
00160 free( im3d->vinfo->receiver[ir]->receiver_funcname ) ;
00161 free( im3d->vinfo->receiver[ir] ) ;
00162 im3d->vinfo->receiver[ir] = NULL ;
00163 }
00164 }
00165
00166 im3d->vinfo->num_receiver = 0 ;
00167 im3d->vinfo->drawing_enabled = 0 ;
00168 im3d->vinfo->drawing_mode = DRAWING_LINES ; /* default */
00169 }
00170
00171 EXRETURN ;
00172 }
|
|
||||||||||||||||||||||||
|
Set up to have AFNI send data to a receiver: rmask = bitwise OR (|) mask of RECEIVE_*_MASK (cf. afni.h) cb = callback function to receive data; will be called like cb( int why , int np , void * vp , void * cb_data ) where why = a RECEIVE_* code (cf. below) np = count of data in vp (may be 0) vp = pointer to data being sent (may be NULL) cb_data = pointer passed into this routine cbname = string to identify callback func (for debugging) why = RECEIVE_VIEWPOINT --> np = 3, vp = int *, pointing to array of dataset voxel indices just jumped to; vp[0] = x index, etc. why = RECEIVE_REDISPLAY --> the user did something to cause an image redisplay besides changing the viewpoint. For this call, np and vp are unused. why = RECEIVE_FUNCDISPLAY --> the user did something to cause the function display to change. For this call, np and vp are unused. why = RECEIVE_POINTS --> np = number of points drawn vp = int **, pointer to array of arrays of dataset voxel indices: vp[0][i] = x index of point i vp[1][i] = y index of point i vp[2][i] = z index of point i, vp[3][0] = sending mode for i=0..np-1 why = RECEIVE_DRAWNOTICE --> the user drew something and that information was sent to a receiver. This call will occur AFTER all the RECEIVE_POINTS calls have been done. If no RECEIVE_POINTS calls are made, then no RECEIVE_DRAWNOTICE calls will be made either. For this call, np and vp are unused. why = RECEIVE_DSETCHANGE --> the user did something (like rescan a session) that may have changed dataset pointers. The receiving routine should use dataset idcodes to re-find the correct dataset pointers. For this call, np and vp are unused. why = RECEIVE_CLOSURE --> the user closed the controller window, which means that no more data will be coming from it -- even if it is reopened, AFNI_receive_init must be called again. For this call, np and vp are unused. why = RECEIVE_ALTERATION --> the user changed something in the controller -- the dataset, the time index, the resampling, .... This is basically a warning message. For this call, np and vp are unused. why = RECEIVE_TIMEINDEX --> the time index changed in im3d; for this call, np,vp are unused. The new time index is in im3d->vinfo->time_index This function returns a non-negative int if all is OK -- this value is the "key" that is used in calls to AFNI_receive_control when you want to manipulate the status of this connection. This function returns -1 if an error occurs. Modified 29 Mar 1999 to allow for multiple receivers (but drawing can only be done in one mode). --------------------------------------------------------------------- Definition at line 93 of file afni_receive.c. References AFMALL, AFNI_toggle_drawing(), AFREALL, ENTRY, gen_func, IM3D_VALID, AFNI_view_info::num_receiver, RECEIVE_ALL_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_data, AFNI_receiver::receiver_func, AFNI_receiver::receiver_funcname, AFNI_receiver::receiver_mask, RETURN, and Three_D_View::vinfo. Referenced by AFNI_init_niml(), DRAW_finalize_dset_CB(), DSET2_main(), DSETN_main(), RCREND_main(), REND_main(), and TTget_main().
00095 {
00096 int ir ;
00097
00098 ENTRY("AFNI_receive_init") ;
00099
00100 /* check for invalid entries */
00101
00102 if( ! IM3D_VALID(im3d) || /* no good? */
00103 cb == NULL || /* no receiver? */
00104 (rmask & RECEIVE_ALL_MASK) == 0 ) RETURN(-1) ; /* no action? */
00105
00106 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ )
00107 if( im3d->vinfo->receiver[ir] == NULL ) break ;
00108
00109 if( ir == im3d->vinfo->num_receiver ){
00110 #if 0
00111 fprintf(stderr,"AFNI_receive_init AFREALL() with ir=%d num_receiver=%d\n",
00112 ir,im3d->vinfo->num_receiver ) ;
00113 #endif
00114 im3d->vinfo->receiver = AFREALL( im3d->vinfo->receiver, AFNI_receiver *, ir+1 );
00115 im3d->vinfo->num_receiver ++ ;
00116 }
00117 im3d->vinfo->receiver[ir] = AFMALL( AFNI_receiver, sizeof(AFNI_receiver)) ;
00118
00119 im3d->vinfo->receiver[ir]->receiver_func = cb ;
00120 im3d->vinfo->receiver[ir]->receiver_mask = rmask ;
00121 im3d->vinfo->receiver[ir]->receiver_data = cb_data ;
00122
00123 im3d->vinfo->receiver[ir]->receiver_funcname =
00124 strdup( (cbname != NULL) ? cbname : "[unknown func]" ) ;
00125
00126 AFNI_toggle_drawing( im3d ) ;
00127
00128 RETURN(ir) ; /* 15 Jun 1999: used to return 0, which is not correct! */
00129 }
|
|
|
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 }
|
|
||||||||||||||||||||
|
09 Dec 1997: resam_mode is now ignored * Definition at line 3913 of file afni_func.c. References AFNI_dataset_slice(), AFNI_view_info::anat_resam_mode, THD_diskptr::brick_name, THD_diskptr::byte_order, COMPRESS_fclose(), COMPRESS_fopen_write(), COMPRESS_unlink(), DATABLOCK_MEM_MALLOC, DATABLOCK_MEM_MMAP, DATABLOCK_MEM_UNDEFINED, DATAXES_TYPE, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, DBLK_BRICK_FACTOR, DBLK_BRICK_TYPE, DBLK_mmapfix, THD_diskptr::dimsizes, THD_diskptr::directory_name, THD_datablock::diskptr, DSET_BRICK_STATCODE, DSET_BRICK_TYPE, DSET_unlock, ENTRY, far, AFNI_view_info::func_resam_mode, IM3D_OPEN, ISFUNC, MRI_IMAGE::kind, logo_pixmap, THD_datablock::malloc_type, MCW_popdown_meter(), MCW_popup_meter(), MCW_set_meter(), METER_TOP_WIDE, MMAP_THRESHOLD, mri_data_pointer(), mri_datum_size(), mri_free(), mri_short_order(), mri_swap2(), mri_swap4(), MRI_TYPE_NAME, myXtFree, myXtNew, THD_datablock::nvals, THD_diskptr::nvals, MRI_IMAGE::nx, THD_dataxes::nxx, MRI_IMAGE::ny, THD_dataxes::nyy, nz, THD_dataxes::nzz, AFNI_widget_set::picture, PICTURIZE, PURGE_DSET, RETURN, THD_3dim_dataset::self_warp, STATUS, STORAGE_BY_BRICK, THD_diskptr::storage_mode, STORAGE_UNDEFINED, THD_get_write_compression(), THD_get_write_order(), THD_init_datablock_brick(), THD_is_directory(), THD_load_statistics(), THD_MKDIR_MODE, THD_write_3dim_dataset(), AFNI_view_info::thr_resam_mode, AFNI_widget_set::top_shell, THD_datablock::total_bytes, tross_Append_History(), typ, THD_dataxes::type, THD_warp::type, UNPICTURIZE, Three_D_View::vinfo, THD_3dim_dataset::vox_warp, Three_D_View::vwid, THD_3dim_dataset::wod_daxes, THD_3dim_dataset::wod_flag, XtMalloc, and THD_dataxes::zzorient. Referenced by AFNI_do_many_writes(), and AFNI_write_dataset_CB().
03916 {
03917 THD_datablock *dblk = dset->dblk ;
03918 THD_diskptr *dkptr = dset->dblk->diskptr ;
03919 Boolean good ;
03920 int npix , nx,ny,nz,nv , kk , ival , code , nzv , dsiz , isfunc , cmode ;
03921 MRI_IMAGE *im ;
03922 void *imar ;
03923 FILE *far ;
03924 float brfac_save ;
03925 int native_order , save_order ; /* 23 Nov 1999 */
03926
03927 Boolean picturize ;
03928 Pixmap brain_pixmap ;
03929
03930 #ifndef DONT_USE_METER
03931 Widget meter = NULL ;
03932 int meter_perc , meter_pold ;
03933 #endif
03934
03935 ENTRY("AFNI_refashion_dataset") ;
03936
03937 picturize = IM3D_OPEN(im3d) && im3d->vwid->picture != NULL &&
03938 afni48_pixmap != XmUNSPECIFIED_PIXMAP ;
03939
03940 if( picturize ){
03941 switch( ORIENT_xyz[daxes->zzorient] ){
03942 default: brain_pixmap = XmUNSPECIFIED_PIXMAP ; break ;
03943 case 'x': brain_pixmap = afni48sag_pixmap ; break ;
03944 case 'y': brain_pixmap = afni48cor_pixmap ; break ;
03945 case 'z': brain_pixmap = afni48axi_pixmap ; break ;
03946 }
03947 }
03948
03949 #ifndef DONT_USE_METER
03950 meter = MCW_popup_meter( im3d->vwid->top_shell , METER_TOP_WIDE ) ;
03951 meter_pold = 0 ;
03952 #endif
03953
03954 /* set up for warp-on-demand */
03955
03956 dset->wod_daxes = myXtNew(THD_dataxes) ; /* 02 Nov 1996 */
03957 dset->wod_daxes->type = DATAXES_TYPE ; /* 02 Nov 1996 */
03958 dset->vox_warp = myXtNew(THD_warp) ; /* 02 Nov 1996 */
03959 dset->self_warp = NULL ; /* 26 Aug 2002 */
03960
03961 *(dset->wod_daxes) = *daxes ; /* copy insides of daxes */
03962 dset->wod_flag = True ; /* mark for warp-on-demand */
03963 dset->vox_warp->type = ILLEGAL_TYPE ; /* mark for recomputation */
03964
03965 /* copy the new geometric information into various places */
03966
03967 *(dset->daxes) = *(daxes) ; /* Make daxes permanent */
03968 dkptr->dimsizes[0] = dset->daxes->nxx ; /* Will cause trouble */
03969 dkptr->dimsizes[1] = dset->daxes->nyy ; /* if diskptr and */
03970 dkptr->dimsizes[2] = dset->daxes->nzz ; /* daxes don't match! */
03971
03972 /* write the header out */
03973
03974 good = THD_write_3dim_dataset( NULL,NULL , dset , False ) ;
03975 if( !good ){
03976 fprintf(stderr,"\a\n*** cannot write dataset header ***\n") ;
03977 if( picturize ) UNPICTURIZE ;
03978 RETURN(False) ;
03979 }
03980 STATUS("wrote output header file") ;
03981
03982 /* purge the datablock that now exists,
03983 then delete the file on disk that now exists (if any) */
03984
03985 DSET_unlock( dset ) ; /* Feb 1998 */
03986 PURGE_DSET( dset ) ;
03987 COMPRESS_unlink(dkptr->brick_name) ;
03988
03989 /* refashion its brick data structure,
03990 which requires first saving in a temporary
03991 array the datum type for each sub-brick */
03992
03993 { int ibr ; int *typ ;
03994 typ = (int *) XtMalloc( sizeof(int) * dblk->nvals ) ;
03995 for( ibr=0 ; ibr < dblk->nvals ; ibr++ )
03996 typ[ibr] = DBLK_BRICK_TYPE(dblk,ibr) ;
03997 THD_init_datablock_brick( dblk , dblk->nvals , typ ) ;
03998 myXtFree( typ ) ;
03999 }
04000
04001 if( dblk->total_bytes > 500*1024*1024 ){
04002 int mb = (int)(dblk->total_bytes/(1024*1024)) ;
04003 fprintf(stderr,"++ WARNING: output filesize will be %d Mbytes!\n"
04004 "++ SUGGEST: increasing voxel size to save disk space!\n",mb) ;
04005 }
04006
04007 dkptr->storage_mode = STORAGE_UNDEFINED ; /* just for now */
04008 dblk->malloc_type = DATABLOCK_MEM_UNDEFINED ;
04009
04010 /*--- open the output file
04011 (N.B.: much of the following code is from THD_write_datablock) ---*/
04012
04013 /*-- create directory if necessary --*/
04014
04015 if( ! THD_is_directory(dkptr->directory_name) ){
04016 kk = mkdir( dkptr->directory_name , THD_MKDIR_MODE ) ;
04017 if( kk != 0 ){
04018 fprintf(stderr,
04019 "\a\n*** cannot mkdir new directory: %s\n",dkptr->directory_name) ;
04020 if( picturize ) UNPICTURIZE ;
04021 RETURN(False) ;
04022 }
04023 STATUS("created subdirectory") ;
04024 }
04025
04026 /*-- open output file --*/
04027
04028 cmode = THD_get_write_compression() ;
04029 far = COMPRESS_fopen_write( dkptr->brick_name , cmode ) ;
04030 if( far == NULL ){
04031 fprintf(stderr,
04032 "\a\n*** cannot open output file %s\n",dkptr->brick_name) ;
04033 if( picturize ) UNPICTURIZE ;
04034 RETURN(False) ;
04035 }
04036 STATUS("created output brick file") ;
04037
04038 /*--------- now, create each slice and write it out ----------*/
04039
04040 nx = dset->daxes->nxx ;
04041 ny = dset->daxes->nyy ; npix = nx*ny ;
04042 nz = dset->daxes->nzz ;
04043 nv = dkptr->nvals ; nzv = nz*nv ;
04044
04045 isfunc = ISFUNC(dset) ; /* 09 Dec 1997 */
04046 if( ! isfunc )
04047 resam_mode = im3d->vinfo->anat_resam_mode ;
04048
04049 native_order = mri_short_order() ; /* 23 Nov 1999 */
04050 save_order = (dkptr->byte_order > 0) ? dkptr->byte_order
04051 : THD_get_write_order() ;
04052
04053 for( ival=0 ; ival < nv ; ival++ ){ /* for each sub-brick */
04054
04055 dsiz = mri_datum_size( DSET_BRICK_TYPE(dset,ival) ) ;
04056
04057 /** force return of unscaled slices for output **/
04058
04059 brfac_save = DBLK_BRICK_FACTOR(dblk,ival) ;
04060 DBLK_BRICK_FACTOR(dblk,ival) = 0.0 ;
04061
04062 if( isfunc )
04063 resam_mode = (DSET_BRICK_STATCODE(dset,ival) > 0) /* 09 Dec 1997 */
04064 ? im3d->vinfo->thr_resam_mode
04065 : im3d->vinfo->func_resam_mode ;
04066
04067 for( kk=0 ; kk < nz ; kk++ ){ /* for each slice */
04068
04069 im = AFNI_dataset_slice( dset , 3 , kk , ival , resam_mode ) ;
04070 STATUS("have new image") ;
04071
04072 if( im == NULL ){
04073 fprintf(stderr,"\a\n*** failure to compute dataset slice %d\n",kk) ;
04074 COMPRESS_fclose(far) ;
04075 COMPRESS_unlink( dkptr->brick_name ) ;
04076 if( picturize ) UNPICTURIZE ;
04077 #ifndef DONT_USE_METER
04078 MCW_popdown_meter(meter) ;
04079 #endif
04080 RETURN(False) ;
04081 }
04082
04083 #ifdef AFNI_DEBUG
04084 { char str[256] ;
04085 sprintf(str,"writing slice %d: type=%s nx=%d ny=%d\n",
04086 kk,MRI_TYPE_NAME(im) , im->nx,im->ny ) ;
04087 STATUS(str) ; }
04088 #endif
04089
04090 imar = mri_data_pointer(im) ;
04091 if( save_order != native_order ){ /* 23 Nov 1999 */
04092 switch( im->kind ){
04093 case MRI_short: mri_swap2( npix,imar) ; break ;
04094 case MRI_float:
04095 case MRI_int: mri_swap4( npix,imar) ; break ;
04096 case MRI_complex: mri_swap4(2*npix,imar) ; break ;
04097 }
04098 }
04099 code = fwrite( imar , dsiz , npix , far ) ;
04100 mri_free(im) ;
04101
04102 if( code != npix ){
04103 fprintf(stderr,
04104 "\a\n*** failure to write dataset slice %d (is disk full?)\n",kk) ;
04105 COMPRESS_fclose(far) ;
04106 COMPRESS_unlink( dkptr->brick_name ) ;
04107 if( picturize ) UNPICTURIZE ;
04108 #ifndef DONT_USE_METER
04109 MCW_popdown_meter(meter) ;
04110 #endif
04111 RETURN(False) ;
04112 }
04113
04114 if( picturize && kk%7 == 0 ){
04115 Pixmap pp ;
04116 pp = (kk%2 == 0) ? brain_pixmap : afni48_pixmap ;
04117 PICTURIZE(pp) ;
04118 XmUpdateDisplay( im3d->vwid->picture ) ;
04119 }
04120
04121 #ifndef DONT_USE_METER
04122 meter_perc = (int) ( 100.0 * (kk+ival*nz) / nzv ) ;
04123 if( meter_perc != meter_pold ){
04124 MCW_set_meter( meter , meter_perc ) ;
04125 meter_pold = meter_perc ;
04126 }
04127 #endif
04128
04129 } /* end of loop over kk (z-direction) */
04130
04131 /* restore the correct scaling of this sub-brick */
04132
04133 DBLK_BRICK_FACTOR(dblk,ival) = brfac_save ;
04134
04135 } /* end of loop over iv (nvals direction) */
04136 STATUS("all slices written") ;
04137
04138 /*--------------------- done!!! ---------------------*/
04139
04140 COMPRESS_fclose(far) ;
04141 STATUS("output file closed") ;
04142
04143 if( picturize ) PICTURIZE(logo_pixmap) ;
04144 #ifndef DONT_USE_METER
04145 MCW_set_meter( meter , 100 ) ;
04146 #endif
04147
04148 /*--- do a little surgery on the dataset's storage flags ---*/
04149
04150 dkptr->storage_mode = STORAGE_BY_BRICK ;
04151 #if MMAP_THRESHOLD > 0
04152 dblk->malloc_type = (dblk->total_bytes > MMAP_THRESHOLD)
04153 ? DATABLOCK_MEM_MMAP : DATABLOCK_MEM_MALLOC ;
04154
04155 if( cmode >= 0 ) dblk->malloc_type = DATABLOCK_MEM_MALLOC ;
04156 DBLK_mmapfix(dblk) ; /* 28 Mar 2005 */
04157 #else
04158 dblk->malloc_type = DATABLOCK_MEM_MALLOC ;
04159 #endif
04160
04161 /*--- recompute the statistics and rewrite the header to hold them ---*/
04162
04163 STATUS("recomputing statistics") ;
04164
04165 THD_load_statistics( dset ) ;
04166
04167 STATUS("rewriting header") ;
04168
04169 tross_Append_History( dset , "AFNI: resampled and rewritten" ) ;
04170 (void) THD_write_3dim_dataset( NULL,NULL , dset , False ) ;
04171
04172 STATUS("purging datablock") ;
04173
04174 PURGE_DSET( dset ) ;
04175
04176 if( picturize ) UNPICTURIZE ;
04177 #ifndef DONT_USE_METER
04178 MCW_popdown_meter(meter) ;
04179 #endif
04180
04181 myXtFree(dset->wod_daxes) ; myXtFree(dset->vox_warp) ; /* 02 Nov 1996 */
04182
04183 RETURN(True) ;
04184 }
|
|
||||||||||||||||||||
|
Definition at line 75 of file afni_fimfunc.c. References ENTRY, MCW_function_list::flags, MCW_function_list::func_code, MCW_function_list::func_data, FUNC_FIM, MCW_function_list::func_init, MCW_function_list::funcs, generic_func, GLOBAL_library, MCW_function_list::labels, MCW_function_list::num, AFNI_library_type::registered_fim, user_data, and XtRealloc. Referenced by MAIN_workprocess().
00077 {
00078 MCW_function_list *rlist = &(GLOBAL_library.registered_fim) ;
00079 int num = rlist->num ;
00080
00081 ENTRY("AFNI_register_fimfunc") ;
00082
00083 if( menu_name == NULL || menu_name[0] == '\0' ||
00084 nbrik <= 0 || user_func == NULL ) EXRETURN ; /* bad inputs! */
00085
00086 if( num == sizeof(int) ) EXRETURN ; /* too many already! */
00087
00088 if( num == 0 ){
00089 rlist->flags=NULL; rlist->labels=NULL; rlist->funcs=NULL;
00090 rlist->func_data=NULL; rlist->func_code=NULL; rlist->func_init=NULL;
00091 }
00092
00093 rlist->flags = (int *) XtRealloc( (char *)rlist->flags, sizeof(int)*(num+1) ) ;
00094
00095 rlist->labels = (char **) XtRealloc( (char *)rlist->labels ,
00096 sizeof(char *)*(num+1) ) ;
00097
00098 rlist->funcs = (generic_func **) XtRealloc( (char *)rlist->funcs ,
00099 sizeof(generic_func *)*(num+1) ) ;
00100
00101 rlist->func_data = (void **) XtRealloc( (char *)rlist->func_data ,
00102 sizeof(void *)*(num+1) ) ;
00103
00104 rlist->func_code = (int *) XtRealloc( (char *)rlist->func_code, sizeof(int)*(num+1) ) ;
00105
00106 rlist->func_init = (generic_func **) XtRealloc( (char *)rlist->func_init ,
00107 sizeof(generic_func *)*(num+1) ) ;
00108
00109 rlist->flags[num] = nbrik ;
00110 rlist->labels[num] = XtNewString(menu_name) ;
00111 rlist->funcs[num] = user_func ;
00112 rlist->func_data[num] = user_data ;
00113 rlist->func_code[num] = FUNC_FIM ;
00114 rlist->func_init[num] = NULL ;
00115
00116 rlist->num = num+1 ;
00117 EXRETURN ;
00118 }
|
|
||||||||||||
|
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 MCW_function_list::flags, 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 1560 of file afni_func.c. References MCW_arrowval::ival.
01561 {
01562 return RESAM_shortstr[av->ival] ;
01563 }
|
|
||||||||||||
|
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 2984 of file afni_func.c. References AFNI_process_dsetchange(), AFNI_rescan_session(), AFNI_library_type::controllers, ENTRY, GLOBAL_library, IM3D_OPEN, MAX_CONTROLLERS, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, THD_sessionlist::num_sess, POPDOWN_strlist_chooser, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, and AFNI_library_type::sslist.
02985 {
02986 int iss , cc=0 ;
02987 Three_D_View *im3d ;
02988
02989 ENTRY("AFNI_rescan_all_CB") ;
02990
02991 SHOW_AFNI_PAUSE ;
02992 for( iss=0 ; iss < GLOBAL_library.sslist->num_sess ; iss++ )
02993 cc += AFNI_rescan_session( iss ) ;
02994 if( cc > 0 ){
02995 char str[256] ;
02996 POPDOWN_strlist_chooser ;
02997 sprintf(str," \n"
02998 " Added %d datasets total \n" , cc ) ;
02999 (void) MCW_popup_message( w , str , MCW_USER_KILL | MCW_TIMER_KILL ) ;
03000 } else {
03001 (void) MCW_popup_message( w ,
03002 " \n Found no new datasets \n" ,
03003 MCW_USER_KILL | MCW_TIMER_KILL ) ;
03004 }
03005
03006 #if 1
03007 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){ /* 31 Mar 1999 */
03008 im3d = GLOBAL_library.controllers[cc] ;
03009 if( IM3D_OPEN(im3d) ) AFNI_process_dsetchange( im3d ) ;
03010 }
03011 #endif
03012
03013 SHOW_AFNI_READY ;
03014 EXRETURN ;
03015 }
|
|
||||||||||||||||
|
loop over all datasets in array, place in current session * Definition at line 2951 of file afni_func.c. References AFNI_process_dsetchange(), AFNI_rescan_session(), AFNI_library_type::controllers, ENTRY, GLOBAL_library, IM3D_OPEN, MAX_CONTROLLERS, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, POPDOWN_strlist_chooser, AFNI_view_info::sess_num, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, THD_sessionlist::ssar, AFNI_library_type::sslist, THD_MAX_NAME, and Three_D_View::vinfo. Referenced by AFNI_drive_rescan_controller().
02952 {
02953 Three_D_View *im3d = (Three_D_View *) cd , *qq3d ;
02954 int cc ;
02955 char str[256+THD_MAX_NAME] ;
02956
02957 ENTRY("AFNI_rescan_CB") ;
02958
02959 SHOW_AFNI_PAUSE ;
02960 cc = AFNI_rescan_session( im3d->vinfo->sess_num ) ;
02961 POPDOWN_strlist_chooser ;
02962 if( cc > 0 ){
02963 sprintf(str," \n"
02964 " Added %d datasets to \n"
02965 " %s\n" ,
02966 cc ,
02967 GLOBAL_library.sslist->ssar[im3d->vinfo->sess_num]->sessname ) ;
02968 (void) MCW_popup_message( w , str , MCW_USER_KILL | MCW_TIMER_KILL ) ;
02969 }
02970
02971 #if 1
02972 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){ /* 31 Mar 1999 */
02973 qq3d = GLOBAL_library.controllers[cc] ;
02974 if( IM3D_OPEN(qq3d) ) AFNI_process_dsetchange( qq3d ) ;
02975 }
02976 #endif
02977
02978 SHOW_AFNI_READY ;
02979 EXRETURN ;
02980 }
|
|
|
Use the old or the new rescan session methods -- 07 Feb 2003. ------------------------------------------------------------------------ Definition at line 3338 of file afni_func.c. References AFNI_rescan_session_NEW(), AFNI_rescan_session_OLD(), and getenv(). Referenced by AFNI_rescan_all_CB(), and AFNI_rescan_CB().
03339 {
03340 char *eee = getenv("AFNI_RESCAN_METHOD") ;
03341
03342 return ( eee == NULL || strcmp(eee,"REPLACE") != 0 )
03343 ? AFNI_rescan_session_NEW( sss )
03344 : AFNI_rescan_session_OLD( sss ) ;
03345 }
|
|
||||||||||||||||
|
Definition at line 3351 of file afni_func.c. References ADDTO_IMARR, ADDTO_SARR, BEEPIT, DESTROY_SARR, ENTRY, FREE_IMARR, GLOBAL_library, AFNI_library_type::have_dummy_dataset, IMARR_COUNT, IMARR_SUBIMAGE, INIT_SARR, mri_free(), MRI_IMAGE::name, THD_sessionlist::num_sess, POPDOWN_timeseries_chooser, THD_session::sessname, THD_sessionlist::ssar, AFNI_library_type::sslist, THD_get_many_timeseries(), and AFNI_library_type::timeseries. Referenced by AFNI_finalize_read_sess_CB().
03352 {
03353 int iss , inew , jold , nnew , nold , nadd=0 ;
03354 THD_string_array *dlist ;
03355 THD_session *ss ;
03356 MRI_IMARR *newtsar ;
03357 MRI_IMAGE *newim , *oldim ;
03358
03359 ENTRY("AFNI_rescan_timeseries_CB") ;
03360
03361 /** assemble list of directories **/
03362
03363 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; EXRETURN ; }
03364
03365 INIT_SARR( dlist ) ;
03366
03367 for( iss=0 ; iss < GLOBAL_library.sslist->num_sess ; iss++ ){
03368 ss = GLOBAL_library.sslist->ssar[iss] ;
03369 ADDTO_SARR(dlist,ss->sessname) ;
03370 }
03371
03372 /** read timeseries into a new array **/
03373
03374 newtsar = THD_get_many_timeseries( dlist ) ;
03375 DESTROY_SARR( dlist ) ;
03376 if( newtsar == NULL ) EXRETURN ;
03377
03378 /** check to see which ones are in the old list **/
03379
03380 nnew = IMARR_COUNT(newtsar) ;
03381 nold = IMARR_COUNT(GLOBAL_library.timeseries) ;
03382
03383 for( inew=0 ; inew < nnew ; inew++ ){
03384 newim = IMARR_SUBIMAGE(newtsar,inew) ; /* new timeseries */
03385 for( jold=0 ; jold < nold ; jold++ ){
03386 oldim = IMARR_SUBIMAGE(GLOBAL_library.timeseries,jold) ; /* old one */
03387
03388 if( oldim != NULL && oldim->name != NULL && /* break out of loop */
03389 strcmp(oldim->name,newim->name) == 0 ) break ; /* when new == old */
03390 }
03391
03392 if( jold == nold ){
03393 ADDTO_IMARR(GLOBAL_library.timeseries,newim); nadd++; /* is new */
03394 } else {
03395 mri_free(newim) ; /* is old */
03396 }
03397 }
03398
03399 if( nadd > 0 ) POPDOWN_timeseries_chooser ;
03400 FREE_IMARR(newtsar) ;
03401 EXRETURN ;
03402 }
|
|
|
Definition at line 4589 of file afni_func.c. References AFNI_autorange_label(), AFNI_range_label(), AFNI_view_info::autorange_label, ENTRY, AFNI_view_info::fim_autorange, AFNI_view_info::fim_range, AFNI_widget_set::func, MCW_arrowval::fval, HINTIZE_pbar, IM3D_VALID, MCW_expose_widget(), AFNI_view_info::old_range_label, RANGE_AUTOBUT, AFNI_function_widgets::range_av, AFNI_function_widgets::range_bbox, AFNI_function_widgets::range_label, AFNI_view_info::use_autorange, Three_D_View::vinfo, Three_D_View::vwid, and MCW_bbox::wbut. Referenced by AFNI_do_many_writes(), AFNI_fimmer_redisplay(), AFNI_func_overlay(), AFNI_setup_viewing(), AFNI_write_dataset_CB(), and PLUTO_dset_redisplay_mode().
04590 {
04591 XmString xstr ;
04592 Boolean same ;
04593
04594 ENTRY("AFNI_reset_func_range") ;
04595
04596 if( ! IM3D_VALID(im3d) ) EXRETURN ;
04597
04598 /*-- the range label widget --*/
04599
04600 xstr = AFNI_range_label( im3d ) ;
04601 same = XmStringCompare( xstr , im3d->vinfo->old_range_label ) ;
04602
04603 if( same == False ){
04604 XtVaSetValues( im3d->vwid->func->range_label , /* redisplay */
04605 XmNlabelString , xstr , /* if changed */
04606 NULL ) ;
04607 MCW_expose_widget( im3d->vwid->func->range_label ) ; /* redraw now! */
04608 XmStringFree(im3d->vinfo->old_range_label) ; /* toss old */
04609 im3d->vinfo->old_range_label = xstr ; /* new old */
04610 } else {
04611 XmStringFree( xstr ) ; /* was same --> don't need this copy */
04612 }
04613
04614 /*-- the autorange toggle widget --*/
04615
04616 xstr = AFNI_autorange_label( im3d ) ;
04617 same = XmStringCompare( xstr , im3d->vinfo->autorange_label ) ;
04618
04619 if( same == False ){
04620 Widget www = im3d->vwid->func->range_bbox->wbut[RANGE_AUTOBUT] ;
04621 XtVaSetValues( www , XmNlabelString , xstr , NULL ) ;
04622 MCW_expose_widget( www ) ;
04623 XmStringFree(im3d->vinfo->autorange_label) ;
04624 im3d->vinfo->autorange_label = xstr ;
04625 } else {
04626 XmStringFree( xstr ) ; /* was same --> don't need this copy */
04627 }
04628
04629 /*-- the functional range itself --*/
04630
04631 im3d->vinfo->fim_range =
04632 (im3d->vinfo->use_autorange) ? (im3d->vinfo->fim_autorange)
04633 : (im3d->vwid->func->range_av->fval) ;
04634
04635 HINTIZE_pbar(im3d) ; /* 22 Aug 2001 */
04636
04637 EXRETURN ;
04638 }
|
|
||||||||||||||||
|
Get a filename to run as an AFNI script. 22 Jan 2003 - RWCox. ----------------------------------------------------------------------------- Definition at line 1709 of file afni_splash.c. References AFNI_finalrun_script_CB(), ENTRY, MCW_choose_string(), AFNI_widget_set::picture, and Three_D_View::vwid.
01710 {
01711 Three_D_View *im3d = (Three_D_View *) cd ;
01712
01713 ENTRY("AFNI_run_script_CB") ;
01714
01715 MCW_choose_string( im3d->vwid->picture ,
01716 "Enter AFNI script filename:" ,
01717 NULL , AFNI_finalrun_script_CB , cd ) ;
01718 EXRETURN ;
01719 }
|
|
||||||||||||||||
|
Definition at line 1406 of file afni_splash.c. References AFNI_finalsave_layout_CB(), ENTRY, MCW_choose_string(), AFNI_widget_set::picture, and Three_D_View::vwid.
01407 {
01408 Three_D_View *im3d = (Three_D_View *) cd ;
01409
01410 ENTRY("AFNI_save_layout_CB") ;
01411
01412 MCW_choose_string( im3d->vwid->picture ,
01413 "Layout filename [blank => .afni.startup_script]:" ,
01414 NULL , AFNI_finalsave_layout_CB , cd ) ;
01415 EXRETURN ;
01416 }
|
|
||||||||||||||||
|
Definition at line 18 of file afni_func.c. References AFNI_disable_suma_overlay(), AFNI_redisplay_func(), ENTRY, Three_D_View::fim_now, AFNI_view_info::func_visible, IM3D_VALID, ISVALID_3DIM_DATASET, MCW_set_bbox(), MCW_val_bbox(), RESET_AFNI_QUIT, AFNI_viewing_widgets::see_func_bbox, AFNI_widget_set::view, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_set_func_visible().
00019 {
00020 Three_D_View *im3d = (Three_D_View *) cd ;
00021 int old_val , new_val ;
00022
00023 ENTRY("AFNI_see_func_CB") ;
00024
00025 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00026
00027 old_val = (im3d->vinfo->func_visible) ? 1 : 0 ;
00028 new_val = MCW_val_bbox( im3d->vwid->view->see_func_bbox ) ;
00029
00030 if( old_val != new_val ){
00031 im3d->vinfo->func_visible = (new_val == 1) ? True : False ;
00032 if( ! ISVALID_3DIM_DATASET(im3d->fim_now) ){ /* 29 Apr 1997 */
00033 im3d->vinfo->func_visible = False ;
00034 MCW_set_bbox( im3d->vwid->view->see_func_bbox , 0 ) ; /* 29 Jan 1999 */
00035 }
00036 AFNI_disable_suma_overlay( 0 ) ; /* 16 Jun 2003 */
00037 AFNI_redisplay_func( im3d ) ; /* 05 Mar 2002 */
00038 }
00039
00040 RESET_AFNI_QUIT(im3d) ;
00041 EXRETURN ;
00042 }
|
|
||||||||||||||||
|
Definition at line 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, MCW_imseq::status, 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 195 of file afni_func.c. References DSET_BRICK_STATAUX, DSET_BRICK_STATCODE, ENTRY, Three_D_View::fim_now, AFNI_widget_set::func, AFNI_view_info::func_pval, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, IM3D_VALID, ISVALID_3DIM_DATASET, MCW_set_widget_label(), STATUS, THD_stat_to_pval(), AFNI_view_info::thr_index, AFNI_function_widgets::thr_pval_label, THR_PVAL_LABEL_NONE, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_fimmer_redisplay(), AFNI_set_thresh_top(), AFNI_setup_viewing(), AFNI_thr_scale_CB(), AFNI_thr_scale_drag_CB(), and AFNI_thrdrag_lock_carryout().
00196 {
00197 float thresh , pval ;
00198 int dec ;
00199 char buf[16] ;
00200
00201 ENTRY("AFNI_set_thr_pval") ;
00202
00203 if( ! IM3D_VALID(im3d) || ! ISVALID_3DIM_DATASET(im3d->fim_now) ) EXRETURN ;
00204
00205 /* get the "true" threshold (scaled up from being in [0,1]) */
00206
00207 thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ;
00208
00209 /* get the p-value that goes with this threshold, for this functional dataset */
00210
00211 pval = THD_stat_to_pval( thresh ,
00212 DSET_BRICK_STATCODE(im3d->fim_now,im3d->vinfo->thr_index) ,
00213 DSET_BRICK_STATAUX (im3d->fim_now,im3d->vinfo->thr_index) ) ;
00214
00215 im3d->vinfo->func_pval = pval ; /* 06 Feb 2004 */
00216
00217 if(PRINT_TRACING)
00218 { char buf[128] ;
00219 sprintf( buf, "thresh=%g top=%g pval=%g",
00220 thresh,im3d->vinfo->func_thresh_top,pval ) ; STATUS(buf) ; }
00221
00222 if( pval < 0.0 ){
00223 strcpy( buf , THR_PVAL_LABEL_NONE ) ;
00224 } else {
00225 if( pval == 0.0 ){
00226 strcpy( buf , "p = 0" ) ;
00227 } else if( pval >= 0.9999 ){
00228 strcpy( buf , "p = 1" ) ;
00229 } else if( pval >= 0.0010 ){
00230 char qbuf[16] ;
00231 sprintf( qbuf , "%5.4f" , pval ) ;
00232 strcpy( buf , qbuf+1 ) ;
00233 } else {
00234 int dec = (int)(0.999 - log10(pval)) ;
00235 pval = pval * pow( 10.0 , (double) dec ) ; /* between 1 and 10 */
00236 if( dec < 10 ) sprintf( buf , "%3.1f-%1d" , pval , dec ) ;
00237 else sprintf( buf , "%1d.-%2d" , (int)rint(pval), dec ) ;
00238 }
00239 }
00240 MCW_set_widget_label( im3d->vwid->func->thr_pval_label , buf ) ;
00241 EXRETURN ;
00242 }
|
|
||||||||||||
|
Definition at line 125 of file afni_func.c. References AFNI_set_thr_pval(), AV_assign_ival(), ENTRY, FIX_SCALE_SIZE, FIX_SCALE_VALUE, AFNI_widget_set::func, AFNI_view_info::func_thresh_top, IM3D_OPEN, MCW_arrowval::ival, AFNI_function_widgets::thr_scale, AFNI_function_widgets::thr_top_av, THR_TOP_EXPON, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_drive_set_threshnew(), AFNI_drive_set_threshold(), and AFNI_thresh_top_CB().
00126 {
00127 int decim ;
00128
00129 ENTRY("AFNI_set_thresh_top") ;
00130
00131 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
00132
00133 if( tval <= 0.0 ) tval = 1.0 ;
00134
00135 decim = (2*THR_TOP_EXPON) - (int)(THR_TOP_EXPON + 0.01 + log10(tval)) ;
00136 if( decim < 0 ) decim = 0 ;
00137
00138 XtVaSetValues( im3d->vwid->func->thr_scale, XmNdecimalPoints, decim, NULL ) ;
00139
00140 im3d->vinfo->func_thresh_top = tval ;
00141
00142 FIX_SCALE_VALUE(im3d) ;
00143 FIX_SCALE_SIZE(im3d) ; /* 09 May 2001 */
00144 AFNI_set_thr_pval( im3d ) ;
00145
00146 /** fix the option menu at the bottom of the scale **/
00147
00148 decim = THR_TOP_EXPON - decim ;
00149 if( decim != im3d->vwid->func->thr_top_av->ival )
00150 AV_assign_ival( im3d->vwid->func->thr_top_av , decim ) ;
00151
00152 EXRETURN ;
00153 }
|
|
||||||||||||||||
|
Definition at line 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, AFNI_view_info::i1, 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 1847 of file afni_func.c. References AFNI_controller_label(), Three_D_View::anat_now, Three_D_View::anat_wod_flag, THD_3dim_dataset::dblk, THD_diskptr::directory_name, THD_datablock::diskptr, drive_MCW_grapher(), drive_MCW_imseq(), ENTRY, THD_diskptr::filecode, Three_D_View::fim_now, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, GLOBAL_argopt, graDR_title, IM3D_OPEN, isqDR_title, ISVALID_3DIM_DATASET, THD_3dim_dataset::label2, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, SESSTRAIL, THD_MAX_NAME, THD_trailname(), AF_options::title_name, AFNI_widget_set::top_shell, USE_TITLE2, Three_D_View::vwid, and Three_D_View::window_title. Referenced by AFNI_underlay_CB(), ENV_redraw_titles(), ENV_sesstrail(), and PLUTO_fixup_names().
01848 {
01849 Boolean redo_title ;
01850 char ttl[THD_MAX_NAME] , nam[THD_MAX_NAME] ;
01851 char *tnam ;
01852
01853 ENTRY("AFNI_set_window_titles") ;
01854
01855 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
01856
01857 if( im3d->anat_wod_flag )
01858 sprintf(ttl , "{warp} %s%s: " ,
01859 AFNI_controller_label(im3d),GLOBAL_argopt.title_name) ;
01860 else
01861 sprintf(ttl , "%s%s: " ,
01862 AFNI_controller_label(im3d),GLOBAL_argopt.title_name) ;
01863
01864 if( USE_TITLE2(im3d->anat_now) ){
01865 strcat( ttl , im3d->anat_now->label2 ) ;
01866 } else {
01867 strcpy( nam , im3d->anat_now->dblk->diskptr->directory_name ) ;
01868 strcat( nam , im3d->anat_now->dblk->diskptr->filecode ) ;
01869 tnam = THD_trailname(nam,SESSTRAIL+1) ;
01870 strcat( ttl , tnam ) ;
01871 }
01872
01873 if( ISVALID_3DIM_DATASET(im3d->fim_now) ){
01874 strcat( ttl , " & " ) ;
01875 if( USE_TITLE2(im3d->fim_now) ){
01876 strcat( ttl , im3d->fim_now->label2 ) ;
01877 } else {
01878 strcat( ttl , im3d->fim_now->dblk->diskptr->filecode ) ;
01879 }
01880 }
01881
01882 redo_title = (Boolean) (strcmp(ttl,im3d->window_title) != 0 ) ;
01883 if( redo_title ){
01884 strcpy( im3d->window_title , ttl ) ;
01885 XtVaSetValues( im3d->vwid->top_shell , XmNtitle , ttl , NULL ) ;
01886
01887 if( im3d->s123 != NULL )
01888 drive_MCW_imseq( im3d->s123 , isqDR_title , (XtPointer) ttl ) ;
01889
01890 if( im3d->s231 != NULL )
01891 drive_MCW_imseq( im3d->s231 , isqDR_title , (XtPointer) ttl ) ;
01892
01893 if( im3d->s312 != NULL )
01894 drive_MCW_imseq( im3d->s312 , isqDR_title , (XtPointer) ttl ) ;
01895
01896 if( im3d->g123 != NULL )
01897 drive_MCW_grapher( im3d->g123 , graDR_title , (XtPointer) ttl ) ;
01898
01899 if( im3d->g231 != NULL )
01900 drive_MCW_grapher( im3d->g231 , graDR_title , (XtPointer) ttl ) ;
01901
01902 if( im3d->g312 != NULL )
01903 drive_MCW_grapher( im3d->g312 , graDR_title , (XtPointer) ttl ) ;
01904 }
01905
01906 EXRETURN ;
01907 }
|
|
|
6/01/95: changed to put the initialization constants in tables initialized in afni.c, not here. * Definition at line 345 of file afni_func.c. References Three_D_View::dc, ENTRY, AFNI_widget_set::func, i, IM3D_VALID, INIT_ovin_pos, INIT_ovin_sgn, INIT_pval_pos, INIT_pval_sgn, AFNI_function_widgets::inten_pbar, MIN, MCW_pbar::mode, MCW_DCOV::ncol_ov, NPANE_MAX, NPANE_MIN, MCW_pbar::num_panes, MCW_pbar::ov_index, MCW_DC::ovc, MCW_pbar::ovin_save, MCW_pbar::pval, MCW_pbar::pval_save, MCW_pbar::update_me, and Three_D_View::vwid.
00346 {
00347 MCW_pbar *pbar ;
00348 int np , i , jm , lcol ;
00349
00350 ENTRY("AFNI_setup_inten_pbar") ;
00351
00352 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00353
00354 pbar = im3d->vwid->func->inten_pbar ;
00355 jm = pbar->mode ;
00356 lcol = im3d->dc->ovc->ncol_ov - 1 ;
00357
00358 /** load the 'save' values for all possible pane counts **/
00359
00360 for( np=NPANE_MIN ; np <= NPANE_MAX ; np++ ){
00361
00362 for( i=0 ; i <= np ; i++ ){
00363 pbar->pval_save[np][i][0] = INIT_pval_sgn[np][i] ;
00364 pbar->pval_save[np][i][1] = INIT_pval_pos[np][i] ;
00365 }
00366
00367 for( i=0 ; i < np ; i++ ){
00368 pbar->ovin_save[np][i][0] = MIN( lcol , INIT_ovin_sgn[np][i] ) ;
00369 pbar->ovin_save[np][i][1] = MIN( lcol , INIT_ovin_pos[np][i] ) ;
00370 }
00371 }
00372
00373 /** load the values for the current pane count **/
00374
00375 np = pbar->num_panes ;
00376 jm = pbar->mode ;
00377
00378 for( i=0 ; i <= np ; i++ ) pbar->pval[i] = pbar->pval_save[np][i][jm] ;
00379 for( i=0 ; i < np ; i++ ) pbar->ov_index[i] = pbar->ovin_save[np][i][jm] ;
00380
00381 pbar->update_me = 1 ;
00382 EXRETURN ;
00383 }
|
|
||||||||||||
|
Definition at line 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, THD_3dim_dataset::view_type, AFNI_view_info::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_bbox::wrowcol, MCW_arrowval::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 }
|
|
||||||||||||||||
|
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 }
|
|
|
Definition at line 58 of file afni_splash.c. References COX_clock_time(), do_write, drive_MCW_imseq(), ENTRY, getenv(), handle, isqDR_reimage, mri_data_pointer(), mri_free(), myXtFree, MRI_IMAGE::nvox, MRI_IMAGE::pixel_size, PLUGIN_impopper::seq, SPLASH_popup_image(), and strtod(). Referenced by AFNI_splashup(), AFNI_startup_layout_CB(), and MAIN_workprocess().
00059 {
00060 PLUGIN_impopper *ppp = (PLUGIN_impopper *) handle ;
00061
00062 ENTRY("AFNI_splashdown") ;
00063
00064 if( handle != NULL ){
00065 #ifdef USE_FADING
00066 float max_splash = 3.0 ;
00067 char *hh = getenv("AFNI_SPLASHTIME") ;
00068 if( hh != NULL ) max_splash = strtod(hh,NULL) ;
00069 if( max_splash > 0.0 ){
00070 if( imspl != NULL ){ /* fade gently away */
00071 byte *bspl ; int ii , nv , kk ; double et ;
00072 bspl = mri_data_pointer(imspl) ;
00073 nv = (imspl->pixel_size) * (imspl->nvox) ;
00074 et = COX_clock_time() ;
00075 do_write = 0 ;
00076 for( kk=0 ; kk < 10 ; kk++ ){
00077 #if 0
00078 for( ii=0 ; ii < nv ; ii++ ) bspl[ii] *= 0.92 ;
00079 #else
00080 for( ii=0 ; ii < nv ; ii++ ) bspl[ii] = (15*bspl[ii]) >> 4 ;
00081 #endif
00082 SPLASH_popup_image(handle,imspl) ;
00083 drive_MCW_imseq( ppp->seq , isqDR_reimage , (XtPointer) 0 ) ;
00084 if( COX_clock_time()-et > 2.1 ) break ;
00085 }
00086 }
00087 }
00088 #endif
00089 SPLASH_popup_image(handle,NULL); myXtFree(handle) ; /* get rid of window */
00090 }
00091 mri_free(imspl) ; imspl = NULL ;
00092 do_write = ( (lrand48() >> 8) % 3 == 0 ) ? 2 : 1 ;
00093 EXRETURN ;
00094 }
|
|
|
Definition at line 46 of file afni_splash.c. References handle, ISQ_REALZ, PLUGIN_impopper::seq, and MCW_imseq::wtop. Referenced by AFNI_startup_layout_CB().
00046 : bring splash window to the top */ 00047 { 00048 PLUGIN_impopper *ppp = (PLUGIN_impopper *) handle ; 00049 00050 if( ppp != NULL && ISQ_REALZ(ppp->seq) ) 00051 XMapRaised( XtDisplay(ppp->seq->wtop) , XtWindow(ppp->seq->wtop) ) ; 00052 00053 return ; 00054 } |
|
|
Definition at line 105 of file afni_splash.c. References AFNI_find_jpegs(), AFNI_find_todays_face(), AFNI_splashdown(), AFNI_library_type::dc, drive_MCW_imseq(), ENTRY, first_splash, fname_face, fname_splash, getenv(), GLOBAL_library, handle, MCW_DC::height, ISQ_options::improc_code, ISQ_IMPROC_SHARP, ISQ_REALZ, isqDR_clearstat, isqDR_getoptions, isqDR_imhelptext, isqDR_offwid, isqDR_onoffwid, isqDR_options, isqDR_realize, isqDR_reimage, isqDR_title, IXOVER, JYOVER, malloc, MAX_XOVER, MAX_YOVER, mri_free(), mri_invert_inplace(), mri_overlay_2D(), mri_read_stuff(), mri_resize(), NC_blank, NC_facetitle, NLINE_facetitle, NORMAL_cursorize, NOVER, num_face, num_splash, MRI_IMAGE::nx, NX_facetitle, NX_TOPOVER, MRI_IMAGE::ny, NY_facetitle, NY_TOPOVER, PLUTO_popup_open, reload_DC_colordef(), PLUGIN_impopper::seq, SPLASH_decode26(), SPLASH_decodexx(), SPLASH_popup_image(), STATUS, MCW_DC::width, MCW_imseq::wimage, and MCW_imseq::wtop. Referenced by MAIN_workprocess().
00106 {
00107 PLUGIN_impopper *ppp ;
00108 MRI_IMAGE *imov ;
00109 int dd,ee ;
00110 char bb ;
00111 byte *bspl ;
00112 int sxx,syy ;
00113 char *sen ;
00114 static int ncall=0 , nov , dnov , nm=-1 ;
00115
00116 ENTRY("AFNI_splashup") ;
00117
00118 /*--- create splash image ---*/
00119
00120 if( ! PLUTO_popup_open(handle) ){
00121
00122 int nxov,nyov,ff ;
00123
00124 /* get some fun stuff, first time in */
00125
00126 if( ncall == 0 ){
00127 num_face = AFNI_find_jpegs( "face_" , &fname_face ) ;
00128 num_splash = AFNI_find_jpegs( "splash_" , &fname_splash ) ;
00129 if( num_splash > 0 ){
00130 int np ;
00131 for( np=0 ; np < num_splash ; np++ )
00132 if( strstr(fname_splash[np],"sscc") != NULL ) break ;
00133 if( np < num_splash ) first_splash = np ;
00134 #if 0
00135 for( np=0 ; np < num_splash ; np++ )
00136 fprintf(stderr,"SPLASH: %s\n",fname_splash[np]) ;
00137 #endif
00138 }
00139 }
00140
00141 /* create basic splash image */
00142
00143 mri_free(imspl) ;
00144 imspl = SPLASH_decodexx( NX_blank, NY_blank, NLINE_blank, NC_blank,
00145 RMAP_blank,GMAP_blank,BMAP_blank, BAR_blank ) ;
00146
00147 if( ncall==0 ){ /* initialize random */
00148 nov = (lrand48() >> 8) % NOVER ; /* sub-image overlay */
00149 dnov = 2*((lrand48() >> 8) % 2) - 1 ; /* index & direction */
00150 }
00151
00152 /* Facial overlay: */
00153 /* if have face jpegs, use them; else, use builtin faces [28 Mar 2003] */
00154
00155 imov = NULL ; ff = 0 ;
00156 if( num_face > 0 ){ /* external face_*.jpg files */
00157 static int *dold=NULL, ndold=0 ; int qq ;
00158 dd = AFNI_find_todays_face() ; /* 30 Mar 2005: find a */
00159 if( dd >= 0 ){ ff=-1; goto Have_dd; } /* special face for today */
00160 if( ndold == 0 && num_face > 1 ){
00161 ndold = num_face/2 ;
00162 dold = (int *) malloc(sizeof(int)*ndold) ;
00163 for( qq=0 ; qq < ndold ; qq++ ) dold[qq] = -1 ;
00164 }
00165 Retry_dd:
00166 dd = (lrand48() >> 8) % num_face ; /* pick random file */
00167 if( num_face > 1 ){ /* check if used recently */
00168 for( qq=0 ; qq < ndold && dold[qq] != dd ; qq++ ) ; /* nada */
00169 if( qq < ndold ) goto Retry_dd ; /* was recent */
00170 for( qq=1 ; qq < ndold ; qq++ ) /* wasn't, so save in list */
00171 dold[qq-1] = dold[qq] ;
00172 dold[ndold-1] = dd ;
00173 }
00174 Have_dd:
00175 imov = mri_read_stuff( fname_face[dd] ) ; /* read file */
00176 if( imov != NULL && (imov->nx > MAX_XOVER || imov->ny > MAX_YOVER) ){
00177 float xfac=MAX_XOVER/(float)(imov->nx),
00178 yfac=MAX_YOVER/(float)(imov->ny) ; /* rescale if too big */
00179 int nxnew,nynew ; MRI_IMAGE *imq ;
00180 if( xfac > yfac ) xfac = yfac ;
00181 nxnew = (int)(xfac*imov->nx) ; nynew = (int)(xfac*imov->ny) ;
00182 imq = mri_resize( imov , nxnew,nynew ) ; /* kind of slow */
00183 mri_free(imov); imov = imq; /* replace with rescaled image */
00184 }
00185 if( ff == 0 && imov != NULL ){ /* ff = 2 for me, 1 for everyone else */
00186 ff = (strstr(fname_face[dd],"_rwcox") != NULL) ? 2 : 1 ;
00187 }
00188 }
00189 if( imov == NULL ){ /* if didn't get face jpeg above */
00190 nov = (nov+dnov+NOVER) % NOVER ;
00191 imov = SPLASH_decode26( xover[nov], yover[nov], lover[nov], bover[nov] ) ;
00192 }
00193 nxov = imov->nx ; nyov = imov->ny ; /* size of overlay image */
00194 dd = IXOVER + (MAX_XOVER-nxov)/2 ; /* and location to put it */
00195 ee = JYOVER + (MAX_YOVER-nyov)/2 ;
00196 mri_overlay_2D( imspl, imov, dd,ee ); mri_free(imov);
00197 if( ff > 0 ){ /* overlay title under face */
00198 imov = SPLASH_decodexx( NX_facetitle,NY_facetitle,NLINE_facetitle,
00199 NC_facetitle,RMAP_facetitle,
00200 RMAP_facetitle,RMAP_facetitle ,
00201 BAR_facetitle ) ;
00202 if( ff == 2 ) mri_invert_inplace( imov ) ; /* for me only */
00203 dd = IXOVER + (MAX_XOVER-imov->nx)/2 ; ee += nyov+1 ;
00204 mri_overlay_2D( imspl, imov, dd,ee ) ; mri_free(imov) ;
00205 }
00206
00207 /* possibly replace the splash image at the top [26 Nov 2003] */
00208
00209 if( (ncall > 0 || first_splash >= 0) && num_splash > 0 &&
00210 (ncall <= num_splash || ((lrand48() >> 8 ) % 7) != 0) ){
00211
00212 static int np=-1 , dp ;
00213 if( np < 0 ){
00214 np = (first_splash >= 0) ? first_splash
00215 : (lrand48() >> 8) % num_splash ;
00216 dp = 2*((lrand48() >> 8)%2)-1 ; /* -1 or +1 */
00217 } else
00218 np = (np+dp+num_splash)%(num_splash) ;
00219 imov = mri_read_stuff( fname_splash[np] ) ;
00220 if( imov != NULL ){
00221 #if 0
00222 reload_DC_colordef( GLOBAL_library.dc ) ;
00223 if( imov->nx != NX_TOPOVER || imov->ny != NY_TOPOVER ){
00224 MRI_IMAGE *imq ;
00225 imq = mri_resize( imov , NX_TOPOVER,NY_TOPOVER ) ; /* kind of slow */
00226 if( imq != NULL ){ mri_free(imov); imov = imq; }
00227 }
00228 #endif
00229 STATUS("overlaying splash image") ;
00230 mri_overlay_2D( imspl , imov , 0,0 ) ;
00231 mri_free(imov) ;
00232 }
00233
00234 } /* end of replacing splash image */
00235
00236 /*-- show the image at last! --*/
00237
00238 handle = SPLASH_popup_image( handle, imspl ) ;
00239 #ifndef USE_FADING
00240 mri_free(imspl) ; imspl = NULL ;
00241 #endif
00242
00243 /* modify image display properties */
00244
00245 ppp = (PLUGIN_impopper *) handle ;
00246
00247 if( ncall==0 ){ dd = MWM_DECOR_BORDER ;
00248 ee = 0 ;
00249 } else { dd = MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MENU ;
00250 ee = MWM_FUNC_MOVE | MWM_FUNC_CLOSE ;
00251 }
00252
00253 /* 21 Sep 2000 -- allow user to control splash position */
00254
00255 sxx = (GLOBAL_library.dc->width-NX_blank)/2 ;
00256 syy = 100 ;
00257 sen = getenv("AFNI_SPLASH_XY") ;
00258 if( sen != NULL ){
00259 int n,x,y ;
00260 n = sscanf(sen,"%d:%d",&x,&y) ;
00261 if( n == 2 && x >= 0 && x < GLOBAL_library.dc->width &&
00262 y >= 0 && y < GLOBAL_library.dc->height ){
00263
00264 sxx = x ; syy = y ;
00265 }
00266 }
00267
00268 XtVaSetValues( ppp->seq->wtop ,
00269 XmNx , sxx ,
00270 XmNy , syy ,
00271 XmNmwmDecorations , dd ,
00272 XmNmwmFunctions , ee ,
00273 /** XmNoverrideRedirect , True , **/
00274 NULL ) ;
00275
00276 /* actually popup image display */
00277
00278 drive_MCW_imseq( ppp->seq , isqDR_realize , NULL ) ;
00279 drive_MCW_imseq( ppp->seq , isqDR_onoffwid , (XtPointer) isqDR_offwid ) ;
00280 drive_MCW_imseq( ppp->seq , isqDR_clearstat , NULL ) ;
00281 #if 0
00282 drive_MCW_imseq( ppp->seq , isqDR_reimage , (XtPointer) 0 ) ;
00283 #endif
00284
00285 NORMAL_cursorize( ppp->seq->wimage ) ; /* 07 Dec 2001 */
00286
00287 /* some super-frivolities */
00288
00289 if( ncall==0 ){
00290 drive_MCW_imseq( ppp->seq , isqDR_title , (XtPointer) "AFNI!" ) ;
00291 drive_MCW_imseq( ppp->seq , isqDR_imhelptext,
00292 (XtPointer)
00293 " \n"
00294 " Thou art indeed just, Lord, if I contend\n"
00295 " With thee; but, sir, so what I plead is just.\n"
00296 " Why do sinners' ways prosper? and why must\n"
00297 " Disappointment all I endeavour end?\n"
00298 " Wert thou my enemy, O thou my friend,\n"
00299 " How wouldst thou worse, I wonder, than thou dost\n"
00300 " Defeat, thwart me? Oh, the sots and thralls of lust\n"
00301 " Do in spare hours more thrive than I that spend,\n"
00302 " Sir, life upon thy cause. See, banks and brakes\n"
00303 " Now, leaved how thick! laced they are again\n"
00304 " With fretty chervil, look, and fresh wind shakes\n"
00305 " Them; birds build -- but not I build; no, but strain,\n"
00306 " Time's eunuch, and not breed one work that wakes.\n"
00307 " Mine, O thou lord of life, send my roots rain.\n"
00308 ) ;
00309
00310 #if 0
00311 { /* 21 Jun 2000 -- turn sharpening on */
00312 ISQ_options opt ;
00313 drive_MCW_imseq( ppp->seq , isqDR_getoptions , (XtPointer) &opt ) ;
00314 opt.improc_code |= ISQ_IMPROC_SHARP ;
00315 drive_MCW_imseq( ppp->seq , isqDR_options , (XtPointer) &opt ) ;
00316 }
00317 #endif
00318 }
00319
00320 /*--- destroy splash image ---*/
00321
00322 } else {
00323 ppp = (PLUGIN_impopper *) handle ;
00324
00325 /* bring splash window to the top */
00326
00327 if( ISQ_REALZ(ppp->seq) )
00328 XMapRaised( XtDisplay(ppp->seq->wtop) , XtWindow(ppp->seq->wtop) ) ;
00329
00330 AFNI_splashdown() ; /* off with their heads */
00331 }
00332
00333 ncall++ ; EXRETURN ;
00334 }
|
|
|
Start the Web fetch to check the AFNI version in a child process. To complete things, call AFNI_version_check() somewhat later. -------------------------------------------------------------------------- Definition at line 47 of file afni_version.c. References AFNI_noenv(), atexit(), disabled, FAIL_MESSAGE, getenv(), iochan_clearcheck(), iochan_enable_perror(), iochan_init(), iochan_sendall(), iochan_sleep(), iochan_writecheck(), NI_free_element(), NI_get_attribute(), NI_read_element(), NI_stream_close(), NI_stream_open(), read_URL(), set_HTTP_10(), set_HTTP_user_agent(), STR_CHILD, vc_child_pid, vc_exit(), VERSION_URL, vexit(), and VSIZE. Referenced by main().
00048 {
00049 pid_t child_pid ;
00050
00051 #ifdef CYGWIN /* 18 Dec 2002 */
00052 FAIL_MESSAGE("not possible under Cygwin") ;
00053 return ;
00054 #else
00055
00056 /*-- decide if we are to do anything --*/
00057
00058 if( AFNI_noenv("AFNI_VERSION_CHECK") ){ /* never check */
00059 FAIL_MESSAGE("AFNI_VERSION_CHECK forbids") ;
00060 return ;
00061 }
00062
00063 #undef VDELAY
00064 #define VDELAY 429999 /* 429999 s = 5 days */
00065 /* check if we did this in the last VDELAY seconds */
00066
00067 { char *home=getenv("HOME") , mname[VSIZE]="file:" ;
00068 NI_stream ns ;
00069 if( home != NULL ) strcat(mname,home) ;
00070 strcat(mname,"/.afni.vctime") ;
00071 ns = NI_stream_open( mname , "r" ) ;
00072 if( ns != NULL ){
00073 NI_element *nel = NI_read_element(ns,22) ;
00074 NI_stream_close(ns) ;
00075 if( nel != NULL ){
00076 char *rhs ;
00077 rhs = NI_get_attribute( nel , "version_check_time" ) ;
00078 if( rhs != NULL ){
00079 int last_time = strtol(rhs,NULL,10) ;
00080 int dtime = ((int)time(NULL)) - last_time ;
00081 if( dtime >= 0 && dtime < VDELAY ){ /* don't check */
00082 NI_free_element(nel) ; disabled = 1 ; return ;
00083 }
00084 }
00085 rhs = NI_get_attribute(nel,"version_string") ; /* 27 Jan 2003 */
00086 if( rhs != NULL && strcmp(rhs,VERSION) != 0 ){
00087 fprintf(stderr,
00088 "\n** Your AFNI version changed from %s to %s since last check\n",
00089 rhs , VERSION ) ;
00090 }
00091 NI_free_element(nel) ;
00092 }
00093 }
00094 }
00095
00096 /*-- OK, start the child process --*/
00097
00098 child_pid = fork() ;
00099 if( child_pid == (pid_t)(-1) ){ /* bad */
00100 FAIL_MESSAGE("can't fork") ;
00101 return ;
00102 }
00103
00104 if( child_pid > 0 ){ /* I'm the parent */
00105
00106 /*-- save PID of child for later use --*/
00107
00108 vc_child_pid = child_pid ;
00109
00110 /*-- open a shared mem segment to talk to child --*/
00111
00112 vc_ioc = iochan_init( STR_CHILD , "accept" ) ;
00113 if( vc_ioc == NULL ){
00114 kill(child_pid,SIGTERM) ; /* cf. Abraham and Isaac */
00115 vc_child_pid = (pid_t)(-1) ;
00116 FAIL_MESSAGE("can't open connection to child") ;
00117 } else {
00118 fprintf(stderr,"\n** Version check: " VERSION_URL "\n" ); /* 13 Jan 2003 */
00119 atexit( vc_exit ) ; /* 12 Dec 2002 */
00120 }
00121 return ;
00122
00123 } else { /* I'm the child */
00124 /* (never returns) */
00125 int nbuf=0 , jj ;
00126 char *vbuf=NULL ;
00127 IOCHAN *ioc ;
00128 struct utsname ubuf ;
00129 char ua[512] ;
00130
00131 iochan_enable_perror(0) ; /* don't print TCP/IP error messages */
00132 signal( SIGTERM , vexit ) ; /* if parent kills us, call vexit() */
00133
00134 /*-- get information from the AFNI server --*/
00135
00136 #define USE_HTTP_10
00137
00138 #ifdef USE_HTTP_10
00139 # undef PCLAB
00140 # ifdef SHOWOFF
00141 # undef SHSH
00142 # undef SHSHSH
00143 # define SHSH(x) #x
00144 # define SHSHSH(x) SHSH(x)
00145 # define PCLAB SHSHSH(SHOWOFF)
00146 # else
00147 # define PCLAB "Unknown"
00148 # endif
00149 #endif
00150
00151 /** 25 Mar 2005: send more info in the request header **/
00152
00153 #ifdef USE_HTTP_10
00154 ubuf.nodename[0] = ubuf.sysname[0] = ubuf.machine[0] = '\0' ;
00155 jj = uname( &ubuf ) ;
00156 if( jj >= 0 && ubuf.nodename[0] != '\0' )
00157 sprintf( ua ,
00158 "afni (avers='%s'; prec='%s' node='%s'; sys='%s'; mach='%s')" ,
00159 VERSION, PCLAB, ubuf.nodename, ubuf.sysname, ubuf.machine ) ;
00160 else
00161 sprintf( ua , "afni (avers='%s'; prec='%s')" , VERSION , PCLAB ) ;
00162
00163 set_HTTP_10( 1 ) ;
00164 set_HTTP_user_agent( ua ) ;
00165 #else
00166 set_HTTP_10( 0 ) ;
00167 #endif
00168
00169 /* send the request */
00170
00171 nbuf = read_URL( VERSION_URL , &vbuf ) ; /* may take a while */
00172
00173 set_HTTP_10( 0 ) ;
00174
00175 /*-- if this failed, quit --*/
00176
00177 if( nbuf <= 0 || vbuf == NULL || vbuf[0] == '\0' ) vexit(1);
00178
00179 /*-- talk to parent process thru shared memory --*/
00180
00181 ioc = iochan_init( STR_CHILD , "create" ) ;
00182 if( ioc == NULL ) vexit(2);
00183
00184 /*-- wait until ioc is ready for writing --*/
00185
00186 jj = iochan_writecheck(ioc,-1) ;
00187 if( jj < 0 ) vexit(3);
00188
00189 /*-- send the info in vbuf --*/
00190
00191 iochan_sendall( ioc , vbuf , nbuf ) ;
00192 while( ! iochan_clearcheck(ioc,10) ) /* loop until cleared */
00193 iochan_sleep(10) ; /* by parent process */
00194
00195 iochan_sleep(10); /* a little extra napping */ _exit(0);
00196 }
00197 #endif /* not CYGWIN */
00198 }
|
|
|
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 886 of file afni_splash.c. References ACTIVATE_MASK, AFNI_crosshair_visible_CB(), AFNI_decode_geom(), AFNI_make_controller(), AFNI_splashdown(), AFNI_splashraise(), AFNI_suck_file(), AFNI_view_xyz_CB(), AFNI_XHAIRS_SINGLE, AV_assign_ival(), client_data, AFNI_library_type::controllers, AFNI_imaging_widgets::crosshair_av, Three_D_View::dc, DC_find_overlay_color(), drive_MCW_grapher(), drive_MCW_imseq(), ENTRY, MCW_grapher::fdw_graph, FRAC_MIN, free, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, get_linbuf(), GLOBAL_library, graDR_setmatrix, graDR_setpinnum, AFNI_imaging_widgets::graph_xyz_pb, AFNI_imaging_widgets::graph_yzx_pb, AFNI_imaging_widgets::graph_zxy_pb, AFNI_widget_set::imag, AFNI_imaging_widgets::image_xyz_pb, AFNI_imaging_widgets::image_yzx_pb, AFNI_imaging_widgets::image_zxy_pb, isq, isqDR_setifrac, isqDR_setmontage, ISTARRED, linbuf, malloc, MAX_CONTROLLERS, MONT_NMAX, mp, my_getenv(), NGMAX, NLBUF, AFNI_widget_set::nplugbut, NULL_MASK, NWBUF, PLUG_startup_plugin_CB(), AFNI_widget_set::plugbut, AFNI_widget_set::plugint, AFNI_widget_set::pluglab, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, STATUS, strtod(), AFNI_widget_set::top_shell, Three_D_View::vwid, MCW_imseq::wtop, and YESSISH.
00887 {
00888 char *fname = (char *) client_data ;
00889 int nbuf , ii , goslow ;
00890 char *fbuf , *fptr ;
00891 char lword[NWBUF] ;
00892
00893 int controller_mask[MAX_CONTROLLERS] ;
00894 char controller_geom[MAX_CONTROLLERS][NGMAX] ;
00895
00896 int image_mask [MAX_CONTROLLERS][3] ;
00897 char image_geom [MAX_CONTROLLERS][3][NGMAX] ;
00898 float image_ifrac [MAX_CONTROLLERS][3] ;
00899 char image_mont [MAX_CONTROLLERS][3][NGMAX] ;
00900
00901 int graph_mask [MAX_CONTROLLERS][3] ;
00902 char graph_geom [MAX_CONTROLLERS][3][NGMAX] ;
00903 int graph_matrix [MAX_CONTROLLERS][3] ;
00904 int graph_pinnum [MAX_CONTROLLERS][3] ;
00905
00906 int cc,ww , gww,ghh,gxx,gyy ;
00907 char *e_asp ;
00908 int e_turnoff=0 ;
00909
00910 int * plugin_cont = NULL ;
00911 char **plugin_geom = NULL ;
00912 int ipl ;
00913
00914 Three_D_View *im3d = GLOBAL_library.controllers[0] ; /* already open */
00915
00916 #ifdef ALLOW_PLUGINS
00917 int npbut = im3d->vwid->nplugbut ; /* how many plugins */
00918 char ** pluglab = im3d->vwid->pluglab ; /* their labels */
00919 PLUGIN_interface ** plugint = im3d->vwid->plugint ; /* their interfaces */
00920 #endif
00921
00922 ENTRY("AFNI_startup_layout_CB") ;
00923
00924 if( fname == NULL || fname[0] == '\0' ){ AFNI_splashdown(); EXRETURN; }
00925
00926 /* read layout file */
00927
00928 fbuf = AFNI_suck_file(fname); if( fbuf == NULL ){ AFNI_splashdown(); EXRETURN; }
00929 nbuf = strlen(fbuf) ; if( nbuf == 0 ){ AFNI_splashdown(); EXRETURN; }
00930
00931 fptr = fbuf ; linbuf = (char *) malloc(sizeof(char)*(NLBUF+1)) ;
00932
00933 if(PRINT_TRACING)
00934 { char str[256] ;
00935 sprintf(str,"Reading AFNI layout file = %s (%d bytes)",fname,nbuf) ;
00936 STATUS(str);}
00937
00938 /*-- read lines until find "***LAYOUT" --*/
00939
00940 do {
00941 ii = get_linbuf( fptr ) ; fptr += ii ;
00942 if( linbuf[0] == '\0' || fptr-fbuf >= nbuf ){ /* didn't find it */
00943 STATUS("no ***LAYOUT found") ;
00944 fprintf(stderr,"\n*** LAYOUT not found in layout file %s\n",fname);
00945 free(fbuf); free(linbuf); AFNI_splashdown(); EXRETURN;
00946 }
00947 } while( strncmp(linbuf,"***LAYOUT",9) != 0 ) ;
00948
00949 goslow = (strstr(linbuf,"slow") != NULL) ; /* slow down the startup? */
00950
00951 /*-- initialize controllers, images, and graphs to do nothing --*/
00952
00953 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00954 controller_geom[cc][0] =
00955 image_geom[cc][0][0] = image_geom[cc][1][0] = image_geom[cc][2][0] =
00956 image_mont[cc][0][0] = image_mont[cc][1][0] = image_mont[cc][2][0] =
00957 graph_geom[cc][0][0] = graph_geom[cc][1][0] = graph_geom[cc][1][0] = '\0' ;
00958
00959 controller_mask[cc] =
00960 image_mask[cc][0] = image_mask[cc][1] = image_mask[cc][2] =
00961 graph_mask[cc][0] = graph_mask[cc][1] = graph_mask[cc][2] = NULL_MASK ;
00962
00963 image_ifrac[cc][0] = image_ifrac[cc][1] = image_ifrac[cc][2] = 0.0 ;
00964
00965 graph_pinnum[cc][0] = graph_pinnum[cc][1] = graph_pinnum[cc][2] =
00966 graph_matrix[cc][0] = graph_matrix[cc][1] = graph_matrix[cc][2] = 0 ;
00967 }
00968
00969 /*-- initialize list of plugins --*/
00970
00971 #ifdef ALLOW_PLUGINS
00972 if( npbut > 0 ){
00973 plugin_cont = (int *) malloc(sizeof(int) *npbut) ;
00974 plugin_geom = (char **) malloc(sizeof(char *)*npbut) ;
00975 for( ipl=0 ; ipl < npbut ; ipl++ ){
00976 plugin_cont[ipl] = -1 ; /* controller index to start it with */
00977 plugin_geom[ipl] = NULL ; /* geometry string to start it with */
00978 }
00979 }
00980 #endif
00981
00982 /*-- read and process further lines until a "***" line is found, or the end --*/
00983
00984 do {
00985 ii = get_linbuf( fptr ) ; fptr += ii ;
00986 if( linbuf[0] == '\0' || ISTARRED(linbuf) ) break ; /* end of layout commands */
00987
00988 /*-- first character of command determines controller --*/
00989
00990 cc = linbuf[0] - 'A' ;
00991 if( cc < 0 || cc >= MAX_CONTROLLERS ) continue ; /* illegal value */
00992
00993 controller_mask[cc] |= ACTIVATE_MASK ; /* must activate this one */
00994
00995 if( linbuf[1] == '\0' ) continue; /* nothing more to do */
00996
00997 /*-- do controller options --*/
00998
00999 if( isspace(linbuf[1]) ){
01000
01001 int jj=1 , nn ;
01002
01003 do { /* scan option words */
01004 nn = 0 ; lword[0] = '\0' ;
01005 sscanf(linbuf+jj,"%s%n",lword,&nn) ;
01006 if( nn == 0 || lword[0] == '\0' ) break ; /* no more options */
01007 jj += nn ; /* position for next word */
01008
01009 if( strncmp(lword,"geom=",5) == 0 ){ /* geom= */
01010 strcpy(controller_geom[cc],lword+5) ;
01011 } else { /* ILLEGAL */
01012 fprintf(stderr,"\n** Illegal LAYOUT controller option: %s\n",lword) ;
01013 continue ;
01014 }
01015 } while(1) ;
01016
01017 /*-- do sub-windows (images and graphs) --*/
01018
01019 } else if( linbuf[1] == '.' && strncmp(linbuf+1,".plugin.",8) != 0 ){
01020
01021 int jj=2 , nn ;
01022
01023 nn = 0 ; lword[0] = '\0' ; /* get window name */
01024 sscanf(linbuf+jj,"%s%n",lword,&nn) ;
01025 if( nn == 0 || lword[0] == '\0' ) continue ; /* not present -> goto next line */
01026 jj += nn ;
01027
01028 if( strncmp(lword,"axial" ,5) == 0 ) ww = 0 ; /* get window orientation */
01029 else if( strncmp(lword,"sagittal",8) == 0 ) ww = 1 ;
01030 else if( strncmp(lword,"coronal" ,7) == 0 ) ww = 2 ;
01031 else {
01032 fprintf(stderr,"\n** Illegal LAYOUT sub-window line: %s\n",linbuf) ;
01033 continue ;
01034 }
01035
01036 /*-- images --*/
01037
01038 if( strstr(lword,"image") != NULL ){
01039
01040 image_mask[cc][ww] |= ACTIVATE_MASK ; /* mark to open */
01041
01042 do { /* scan option words */
01043 nn = 0 ; lword[0] = '\0' ;
01044 sscanf(linbuf+jj,"%s%n",lword,&nn) ;
01045 if( nn == 0 || lword[0] == '\0' ) break ; /* no more options */
01046 jj += nn ;
01047
01048 if( strncmp(lword,"geom=",5) == 0 ){ /* geom= */
01049 strcpy(image_geom[cc][ww],lword+5) ;
01050 } else if( strncmp(lword,"ifrac=",6) == 0 ){ /* ifrac= */
01051 image_ifrac[cc][ww] = strtod( lword+6 , NULL ) ;
01052 } else if( strncmp(lword,"mont=",5) == 0 ){ /* mont= */
01053 strcpy(image_mont[cc][ww],lword+5) ;
01054 } else {
01055 fprintf(stderr,"\n** Illegal LAYOUT image option: %s\n",lword) ;
01056 continue ;
01057 }
01058 } while(1) ;
01059
01060 /*-- graphs --*/
01061
01062 } else if( strstr(lword,"graph") != NULL ){ /* a graph window */
01063
01064 graph_mask[cc][ww] |= ACTIVATE_MASK ; /* mark to open */
01065
01066 do { /* scan option words */
01067 nn = 0 ; lword[0] = '\0' ;
01068 sscanf(linbuf+jj,"%s%n",lword,&nn) ;
01069 if( nn == 0 || lword[0] == '\0' ) break ; /* no more options */
01070 jj += nn ;
01071
01072 if( strncmp(lword,"geom=",5) == 0 ){ /* geom= */
01073 strcpy(graph_geom[cc][ww],lword+5) ;
01074 } else if( strncmp(lword,"matrix=",7) == 0 ){ /* matrix= */
01075 graph_matrix[cc][ww] = (int) strtod( lword+7 , NULL ) ;
01076 } else if( strncmp(lword,"pinnum=",7) == 0 ){ /* pinnum= */
01077 graph_pinnum[cc][ww] = (int) strtod( lword+7 , NULL ) ;
01078 } else {
01079 fprintf(stderr,"\n** Illegal LAYOUT image option: %s\n",lword) ;
01080 continue ;
01081 }
01082 } while(1) ;
01083
01084 } else { /* ILLEGAL */
01085 fprintf(stderr,"\n** Illegal LAYOUT line: %s\n",linbuf) ;
01086 continue ;
01087 }
01088
01089 /*-- plugin windows --*/
01090
01091 } else if( strncmp(linbuf+1,".plugin.",8) == 0 ){
01092
01093 #ifdef ALLOW_PLUGINS
01094 char *pname = linbuf+9 ;
01095 int pl,ll,qq , jj,nn ;
01096
01097 /* check name after .plugin. to match a plugin
01098 (but skip blanks in the plugin's label) */
01099
01100 pl = strlen(pname) ;
01101 if( pl < 1 ){
01102 fprintf(stderr,"\n** LAYOUT: unknown plugin line: %s\n",linbuf) ;
01103 continue ;
01104 }
01105
01106 for( ipl=0 ; ipl < npbut ; ipl++ ){
01107 for( ll=strlen(pluglab[ipl]) ; /* truncate trailing blanks */
01108 ll >= 0 && isspace(pluglab[ipl][ll]) ; ll-- ) ; /* nada */
01109 if( ll < 0 ) continue ; /* all blanks?! ERROR */
01110 if( pl < ll ) continue ; /* too short to match */
01111 for( qq=0 ; qq < ll ; qq++ ) /* match each nonblank */
01112 if( !isspace(pluglab[ipl][qq]) && pname[qq]!=pluglab[ipl][qq] ) break ;
01113 if( qq == ll ) break ; /* found a match */
01114 }
01115 if( ipl >= npbut ){
01116 fprintf(stderr,"\n** LAYOUT: unknown plugin line: %s\n",linbuf) ;
01117
01118 if( strncmp(pname,"RT Options",10) == 0 ||
01119 strncmp(pname,"RT_Options",10) == 0 )
01120 fprintf(stderr,"** [Realtime plugin is not active!]\n") ;
01121
01122 continue ;
01123 }
01124
01125 /* mark plugin to be turned on by this controller */
01126
01127 if( plugin_cont[ipl] >= 0 )
01128 fprintf(stderr,"\n** LAYOUT: 2nd callout for this plugin: %s\n",linbuf) ;
01129
01130 plugin_cont[ipl] = cc ;
01131 if( plugin_geom[ipl] != NULL ){ /* in case was set earlier */
01132 free(plugin_geom[ipl]) ; plugin_geom[ipl] = NULL ;
01133 }
01134
01135 jj = 9+ll ;
01136 do { /* scan option words */
01137 nn = 0 ; lword[0] = '\0' ;
01138 sscanf(linbuf+jj,"%s%n",lword,&nn) ;
01139 if( nn == 0 || lword[0] == '\0' ) break ; /* no more options */
01140 jj += nn ; /* position for next word */
01141
01142 if( strncmp(lword,"geom=",5) == 0 ){ /* geom= */
01143 plugin_geom[ipl] = strdup(lword+5) ;
01144 } else { /* ILLEGAL */
01145 fprintf(stderr,"\n** Illegal LAYOUT .plugin. option: %s\n",lword) ;
01146 continue ;
01147 }
01148 } while(1) ;
01149 #endif
01150
01151 /*-- Quien Sabe? --*/
01152
01153 } else { /* bad news city, Arizona */
01154
01155 fprintf(stderr,"\n** Illegal LAYOUT line: %s\n",linbuf) ;
01156 continue ;
01157 }
01158
01159 } while(1) ; /* end of loop over layout command lines */
01160
01161 free(fbuf) ; free(linbuf) ; /* toss the trash */
01162
01163 /*-- if any image geom commands are present,
01164 we might need to enforce the aspect ratio --*/
01165
01166 e_asp = my_getenv("AFNI_ENFORCE_ASPECT") ;
01167 if( !YESSISH(e_asp) ){
01168 putenv("AFNI_ENFORCE_ASPECT=YES") ;
01169 e_turnoff = 1 ;
01170 }
01171
01172 /*-- now do the commanded work --*/
01173
01174 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){ /* loop over controllers */
01175
01176 MCW_imseq *isq ;
01177 MCW_grapher *gra ;
01178 int singleton=0 ;
01179
01180 /*-- determine if this controller is to be active --*/
01181
01182 if( (controller_mask[cc] & ACTIVATE_MASK) == 0 ) continue ; /* skip */
01183
01184 AFNI_make_controller( cc ) ; /* open this controller (if not already open) */
01185
01186 if( GLOBAL_library.controllers[cc] == NULL ) continue ; /* ERROR */
01187
01188 if(goslow || PRINT_TRACING) sleep(1);
01189
01190 /* set location (ignore size part of geometry, if present) */
01191
01192 if( controller_geom[cc][0] != '\0' ){
01193 AFNI_decode_geom( controller_geom[cc] , &gww,&ghh,&gxx,&gyy ) ;
01194 if( gxx >= 0 && gyy >= 0 )
01195 XtVaSetValues( GLOBAL_library.controllers[cc]->vwid->top_shell ,
01196 XmNx , gxx , XmNy , gyy , NULL ) ;
01197 }
01198
01199 AFNI_splashraise() ;
01200
01201 if(goslow || PRINT_TRACING) sleep(1);
01202
01203 /*-- loop over image windows for this controller --*/
01204
01205 for( ww=0 ; ww < 3 ; ww++ ){
01206
01207 /* determine if this image is to be activated */
01208
01209 if( (image_mask[cc][ww] & ACTIVATE_MASK) == 0 ) continue ; /* skip */
01210
01211 /* simulate the button press */
01212
01213 AFNI_view_xyz_CB( (ww == 0) ? GLOBAL_library.controllers[cc]->vwid->imag->image_xyz_pb
01214 :(ww == 1) ? GLOBAL_library.controllers[cc]->vwid->imag->image_yzx_pb
01215 : GLOBAL_library.controllers[cc]->vwid->imag->image_zxy_pb ,
01216 GLOBAL_library.controllers[cc] , NULL ) ;
01217
01218 isq = (ww == 0) ? GLOBAL_library.controllers[cc]->s123 /* get the image */
01219 :(ww == 1) ? GLOBAL_library.controllers[cc]->s231 /* viewer struct */
01220 : GLOBAL_library.controllers[cc]->s312 ;
01221
01222 if( isq == NULL ) continue ; /* ERROR */
01223
01224 if(goslow || PRINT_TRACING) sleep(1);
01225
01226 /* change the image fraction? */
01227
01228 if( image_ifrac[cc][ww] >= FRAC_MIN && image_ifrac[cc][ww] <= 1.0 ){
01229
01230 drive_MCW_imseq( isq , isqDR_setifrac , (XtPointer) &(image_ifrac[cc][ww]) ) ;
01231
01232 if(goslow || PRINT_TRACING) sleep(1);
01233 }
01234
01235 /* change the image montage layout? */
01236
01237 if( image_mont[cc][ww][0] != '\0' ){ /* decode montage WxH[:spacing[:gap[:color]]] */
01238 int mww=-1 , mhh=-1 , msp=-1 , mgap=-1 , nn ;
01239 char mcol[128] = "\0" ;
01240
01241 nn = sscanf( image_mont[cc][ww] , "%dx%d:%d:%d:%s" , &mww,&mhh,&msp,&mgap,mcol ) ;
01242
01243 if( nn >= 2 && mww >= 1 && mww <= MONT_NMAX && mhh >= 1 && mhh <= MONT_NMAX ){
01244 int mp[5] ;
01245 mp[0] = mww ; mp[1] = mhh ; mp[2] = msp ; mp[3] = mgap ;
01246 mp[4] = DC_find_overlay_color(GLOBAL_library.controllers[cc]->dc,mcol);
01247 drive_MCW_imseq( isq , isqDR_setmontage , (XtPointer) mp ) ;
01248
01249 if( msp == 1 ) singleton++ ;
01250
01251 if(goslow || PRINT_TRACING) sleep(1);
01252 }
01253 }
01254
01255 /* change the image geometry? */
01256
01257 if( image_geom[cc][ww][0] != '\0' ){
01258 AFNI_decode_geom( image_geom[cc][ww] , &gww,&ghh,&gxx,&gyy ) ;
01259 if( gxx >= 0 && gyy >= 0 )
01260 XtVaSetValues( isq->wtop , XmNx , gxx , XmNy , gyy , NULL ) ;
01261 if( gww > 0 && ghh > 0 )
01262 XtVaSetValues( isq->wtop , XmNwidth , gww , XmNheight , ghh , NULL ) ;
01263
01264 if(goslow || PRINT_TRACING) sleep(1);
01265 }
01266
01267 AFNI_splashraise() ;
01268
01269 } /* end of loop over images */
01270
01271 /* 11 Oct 2000: change crosshairs if any mont spacing=1 */
01272
01273 if( singleton ){
01274 AV_assign_ival(
01275 GLOBAL_library.controllers[cc]->vwid->imag->crosshair_av ,
01276 AFNI_XHAIRS_SINGLE ) ;
01277
01278 AFNI_crosshair_visible_CB(
01279 GLOBAL_library.controllers[cc]->vwid->imag->crosshair_av ,
01280 GLOBAL_library.controllers[cc] ) ;
01281 }
01282
01283 /*-- loop over graphs --*/
01284
01285 for( ww=0 ; ww < 3 ; ww++ ){
01286
01287 /* is this graph to be opened? */
01288
01289 if( (graph_mask[cc][ww] & ACTIVATE_MASK) == 0 ) continue ; /* skip */
01290
01291 /* simulate the button press */
01292
01293 AFNI_view_xyz_CB( (ww == 0) ? GLOBAL_library.controllers[cc]->vwid->imag->graph_xyz_pb
01294 :(ww == 1) ? GLOBAL_library.controllers[cc]->vwid->imag->graph_yzx_pb
01295 : GLOBAL_library.controllers[cc]->vwid->imag->graph_zxy_pb ,
01296 GLOBAL_library.controllers[cc] , NULL ) ;
01297
01298 gra = (ww == 0) ? GLOBAL_library.controllers[cc]->g123 /* get the graph */
01299 :(ww == 1) ? GLOBAL_library.controllers[cc]->g231 /* viewer struct */
01300 : GLOBAL_library.controllers[cc]->g312 ;
01301
01302 if( gra == NULL ) continue ; /* ERROR */
01303
01304 if(goslow || PRINT_TRACING) sleep(1);
01305
01306 /* change the graph matrix (i.e., how many sub-graphs)? */
01307
01308 if( graph_matrix[cc][ww] > 0 ){
01309 drive_MCW_grapher( gra , graDR_setmatrix , (XtPointer) graph_matrix[cc][ww] ) ;
01310 if(goslow || PRINT_TRACING) sleep(1);
01311 }
01312
01313 /* make the graph length pinned? */
01314
01315 if( graph_pinnum[cc][ww] > 1 ){
01316 drive_MCW_grapher( gra, graDR_setpinnum, (XtPointer)graph_pinnum[cc][ww] );
01317 if(goslow || PRINT_TRACING) sleep(1);
01318 }
01319
01320 /* change the graph window geometry? */
01321
01322 if( graph_geom[cc][ww][0] != '\0' ){
01323 AFNI_decode_geom( graph_geom[cc][ww] , &gww,&ghh,&gxx,&gyy ) ;
01324 if( gxx >= 0 && gyy >= 0 )
01325 XtVaSetValues( gra->fdw_graph , XmNx , gxx , XmNy , gyy , NULL ) ;
01326 if( gww > 0 && ghh > 0 )
01327 XtVaSetValues( gra->fdw_graph , XmNwidth , gww , XmNheight , ghh , NULL ) ;
01328 if(goslow || PRINT_TRACING) sleep(1);
01329 }
01330
01331 AFNI_splashraise() ;
01332
01333 } /* end of loop over graphs */
01334
01335 #if 0
01336 XmUpdateDisplay( im3d->vwid->top_shell ) ;
01337 #endif
01338
01339 } /* end of loop over controllers */
01340
01341 #ifdef ALLOW_PLUGINS
01342 /*-- now loop over plugins --*/
01343
01344 for( ipl=0 ; ipl < npbut ; ipl++ ){
01345
01346 cc = plugin_cont[ipl] ; if( cc < 0 ) continue ;
01347
01348 if( GLOBAL_library.controllers[cc] == NULL ) continue ; /* ERROR */
01349
01350 PLUG_startup_plugin_CB( GLOBAL_library.controllers[cc]->vwid->plugbut[ipl] ,
01351 GLOBAL_library.controllers[cc]->vwid->plugint[ipl] ,
01352 NULL ) ;
01353
01354 if(goslow || PRINT_TRACING) sleep(1);
01355
01356 /* 13 Nov 2001: don't check interface widgets for customized plugins */
01357
01358 if( GLOBAL_library.controllers[cc]->vwid->plugint[ipl]->call_method == PLUGIN_CALL_IMMEDIATELY )
01359 continue ;
01360
01361 /* check interface widgets to see if plugin opened */
01362
01363 if( GLOBAL_library.controllers[cc]->vwid->plugint[ipl]->wid == NULL ||
01364 GLOBAL_library.controllers[cc]->vwid->plugint[ipl]->wid->shell == NULL ){
01365
01366 fprintf(stderr,"\n** LAYOUT: couldn't start plugin %s\n",pluglab[ipl]) ;
01367 continue ;
01368 }
01369
01370 /* set the location of the interface widgets */
01371
01372 if( plugin_geom[ipl] != NULL ){
01373 AFNI_decode_geom( plugin_geom[ipl] , &gww,&ghh,&gxx,&gyy ) ;
01374 if( gxx >= 0 && gyy >= 0 ){
01375 XtVaSetValues(
01376 GLOBAL_library.controllers[cc]->vwid->plugint[ipl]->wid->shell,
01377 XmNx , gxx , XmNy , gyy , NULL ) ;
01378 if(goslow || PRINT_TRACING) sleep(1);
01379 }
01380 }
01381
01382 AFNI_splashraise() ;
01383
01384 } /* end of loop over plugins */
01385 #endif
01386
01387 /*--- done ---*/
01388
01389 #ifdef ALLOW_PLUGINS
01390 if( npbut > 0 ){
01391 for( ipl=0 ; ipl < npbut ; ipl++ )
01392 if( plugin_geom[ipl] != NULL ) free(plugin_geom[ipl]) ;
01393 free(plugin_cont) ; free(plugin_geom) ;
01394 }
01395 #endif
01396
01397 if( e_turnoff ) putenv("AFNI_ENFORCE_ASPECT=NO") ;
01398
01399 AFNI_splashdown() ; EXRETURN ;
01400 }
|
|
||||||||||||
|
Run the startup script [21 Jan 2003]. Definition at line 1674 of file afni_splash.c. References AFNI_driver(), AFNI_suck_file(), client_data, ENTRY, free, get_linbuf(), GLOBAL_library, AFNI_library_type::ignore_lock, linbuf, malloc, and NLBUF. Referenced by AFNI_finalrun_script_CB().
01675 {
01676 char *fname = (char *)client_data ;
01677 char *fbuf , *fptr ;
01678 int ii , nbuf ;
01679
01680 ENTRY("AFNI_startup_script_CB") ;
01681
01682 if( fname == NULL ) EXRETURN ;
01683
01684 if( strchr(fname,' ') != NULL ){ /* if contains a blank, */
01685 AFNI_driver(fname) ; /* execute a single command */
01686 EXRETURN ;
01687 }
01688
01689 fbuf = AFNI_suck_file(fname); if( fbuf == NULL ) EXRETURN ;
01690 nbuf = strlen(fbuf) ; if( nbuf == 0 ) EXRETURN ;
01691
01692 fptr = fbuf ; linbuf = (char *) malloc(sizeof(char)*(NLBUF+1)) ;
01693
01694 GLOBAL_library.ignore_lock = 1 ; /* 06 Feb 2004 */
01695
01696 while(1){
01697 ii = get_linbuf( fptr ) ; fptr += ii ;
01698 if( linbuf[0] == '\0' || fptr-fbuf >= nbuf ){ free(linbuf); break; }
01699 AFNI_driver( linbuf ) ;
01700 }
01701
01702 GLOBAL_library.ignore_lock = 0 ; EXRETURN ;
01703 }
|
|
||||||||||||
|
Definition at line 110 of file to3d.c. References AFNI_yesenv(), to3d_widget_set::anatomy_parent_label, client_data, CURSOR_normalize, to3d_widget_set::geometry_parent_label, MCW_help_CB(), MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, myXtFree, myXtNew, negative_shorts, nfloat_err, to3d_data::ntt, THD_timeaxis::ntt, nvox_total, outliers_checked, T3D_check_outliers(), and THD_3dim_dataset::taxis. Referenced by main().
00111 {
00112 char msg[512] ;
00113
00114 MCW_help_CB(NULL,NULL,NULL) ;
00115 CURSOR_normalize ;
00116
00117 if( negative_shorts && !AFNI_yesenv("AFNI_NO_NEGATIVES_WARNING") ){ /* 19 Jan 2000 */
00118 float perc = (100.0*negative_shorts)/nvox_total ;
00119 sprintf(msg , " \n"
00120 " to3d WARNING: %d negative voxels (%g%%)\n"
00121 " were read in images of shorts.\n"
00122 " It is possible the input\n"
00123 " images need byte-swapping.\n \n"
00124 " ** I recommend that you View Images. **\n" ,
00125 negative_shorts , perc ) ;
00126
00127 (void) MCW_popup_message( wset.anatomy_parent_label , msg ,
00128 MCW_USER_KILL | MCW_TIMER_KILL ) ;
00129 }
00130
00131 if( nfloat_err ){ /* 20 Jan 2000 */
00132 sprintf(msg , " \n"
00133 " to3d WARNING: %d errors in floating point images\n"
00134 " were detected. It is possible that\n"
00135 " the inputs need to be 4swap-ed, or\n"
00136 " otherwise repaired.\n \n"
00137 " ** Erroneous values have been replaced by **\n"
00138 " ** zeros. I recommend that you View Images. **\n" ,
00139 nfloat_err ) ;
00140
00141 (void) MCW_popup_message( wset.geometry_parent_label , msg ,
00142 MCW_USER_KILL | MCW_TIMER_KILL ) ;
00143 }
00144
00145 if( user_inputs.ntt > 5 ){ /* 15 Aug 2001 */
00146 dset->taxis = myXtNew( THD_timeaxis ) ;
00147 dset->taxis->ntt = user_inputs.ntt ;
00148 T3D_check_outliers(0) ; outliers_checked = 1 ;
00149 myXtFree(dset->taxis) ;
00150 }
00151 }
|
|
||||||||||||
|
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 51 of file afni_func.c. References AFNI_redisplay_func(), AFNI_set_thr_pval(), AFNI_thresh_lock_carryout(), client_data, DOING_REALTIME_WORK, ENTRY, FIX_SCALE_SIZE, FIX_SCALE_VALUE, AFNI_widget_set::func, AFNI_view_info::func_pval, AFNI_view_info::func_threshold, AFNI_view_info::func_visible, IM3D_VALID, MCW_register_hint(), REDISPLAY_OPTIONAL, REDISPLAY_OVERLAY, RESET_AFNI_QUIT, THR_FACTOR, AFNI_function_widgets::thr_pval_label, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_drive_set_threshnew(), and AFNI_drive_set_threshold().
00052 {
00053 Three_D_View *im3d = (Three_D_View *) client_data ;
00054 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data ;
00055 float fff ;
00056 int redisplay , ival ;
00057
00058 ENTRY("AFNI_thr_scale_CB") ;
00059
00060 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00061
00062 if( cbs != NULL ) ival = cbs->value ;
00063 else XmScaleGetValue( w , &ival ) ;
00064
00065 fff = THR_FACTOR * ival ;
00066 if( fff >= 0.0 && fff <= 1.0 ) im3d->vinfo->func_threshold = fff ;
00067
00068 FIX_SCALE_VALUE(im3d) ;
00069 FIX_SCALE_SIZE(im3d) ; /* 09 May 2001 */
00070
00071 redisplay = (im3d->vinfo->func_visible) ? REDISPLAY_OVERLAY
00072 : REDISPLAY_OPTIONAL ;
00073 AFNI_set_thr_pval( im3d ) ;
00074
00075 if( im3d->vinfo->func_pval >= 0.0 && im3d->vinfo->func_pval <= 1.0 ){
00076 char pstr[32] ;
00077 sprintf( pstr , "nominal p=%.5e" , im3d->vinfo->func_pval ) ;
00078 MCW_register_hint( im3d->vwid->func->thr_pval_label , pstr ) ;
00079 } else {
00080 MCW_register_hint( im3d->vwid->func->thr_pval_label ,
00081 "Nominal p-value per voxel" ) ;
00082 }
00083
00084 if( ! DOING_REALTIME_WORK )
00085 AFNI_redisplay_func( im3d ) ;
00086
00087 AFNI_thresh_lock_carryout(im3d) ; /* 06 Feb 2004 */
00088
00089 RESET_AFNI_QUIT(im3d) ;
00090 EXRETURN ;
00091 }
|
|
||||||||||||||||
|
Definition at line 98 of file afni_func.c. References AFNI_set_thr_pval(), AFNI_thrdrag_lock_carryout(), client_data, DSET_BRICK_STATCODE, ENTRY, Three_D_View::fim_now, FIX_SCALE_VALUE, FUNC_HAVE_PVAL, AFNI_view_info::func_threshold, IM3D_OPEN, ISVALID_3DIM_DATASET, THR_FACTOR, AFNI_view_info::thr_index, and Three_D_View::vinfo.
00099 {
00100 Three_D_View *im3d = (Three_D_View *) client_data ;
00101 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data ;
00102 float fff ;
00103
00104 ENTRY("AFNI_thr_scale_drag CB") ;
00105
00106 if( IM3D_OPEN(im3d) && ISVALID_3DIM_DATASET(im3d->fim_now) ){
00107
00108 fff = THR_FACTOR * cbs->value ;
00109 if( fff >= 0.0 && fff <= 1.0 ) im3d->vinfo->func_threshold = fff ;
00110
00111 FIX_SCALE_VALUE(im3d) ;
00112 if( FUNC_HAVE_PVAL(DSET_BRICK_STATCODE(im3d->fim_now,im3d->vinfo->thr_index)) )
00113 AFNI_set_thr_pval( im3d ) ;
00114
00115 AFNI_thrdrag_lock_carryout( im3d ) ; /* 10 Feb 2004 */
00116 }
00117 EXRETURN ;
00118 }
|
|
|
Definition at line 470 of file afni_lock.c. References AFNI_controller_index(), AFNI_set_thr_pval(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, DSET_BRICK_STATAUX, DSET_BRICK_STATCODE, ENTRY, Three_D_View::fim_now, AFNI_widget_set::func, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, getenv(), GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, MAX_CONTROLLERS, THD_pval_to_stat(), THD_stat_to_pval(), THR_FACTOR, AFNI_view_info::thr_index, AFNI_function_widgets::thr_scale, THR_TOP_EXPON, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_thr_scale_drag_CB().
00471 {
00472 Three_D_View *qq3d ;
00473 static int busy = 0 ; /* !=0 if this routine is "busy" */
00474 int glock , cc,ii , dothresh,dopval , ival , stop ;
00475 float thresh , pval , tval ;
00476 char *eee ;
00477
00478 ENTRY("AFNI_thrdrag_lock_carryout") ;
00479
00480 /* first, determine if there is anything to do */
00481
00482 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00483
00484 if( busy ) EXRETURN; /* routine already busy */
00485 if( glock == 0 ) EXRETURN; /* nothing to do */
00486 if( !IM3D_OPEN(im3d) ) EXRETURN; /* bad input */
00487 if( GLOBAL_library.ignore_lock ) EXRETURN; /* ordered not to do anything */
00488
00489 eee = getenv( "AFNI_THRESH_LOCK" ) ; /* determine how to lock */
00490 if( eee == NULL ) EXRETURN ;
00491 dothresh = (*eee == 'V' || *eee == 'v') ;
00492 dopval = (*eee == 'P' || *eee == 'p') && im3d->fim_now != NULL ;
00493 if( !dothresh && !dopval ) EXRETURN ; /* no command? */
00494
00495 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00496
00497 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00498 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00499
00500 /* something to do? */
00501
00502 busy = 1 ; /* don't let this routine be called recursively */
00503
00504 ival = rint(im3d->vinfo->func_threshold/THR_FACTOR) ;
00505 thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ;
00506 stop = (int)( rint( pow(10.0,THR_TOP_EXPON) ) - 1.0 ) ;
00507
00508 if( dopval ){
00509 pval = THD_stat_to_pval( thresh ,
00510 DSET_BRICK_STATCODE(im3d->fim_now,im3d->vinfo->thr_index) ,
00511 DSET_BRICK_STATAUX (im3d->fim_now,im3d->vinfo->thr_index) ) ;
00512 if( pval < 0.0 || pval > 1.0 ){ dopval = 0; dothresh = 1; }
00513 }
00514
00515 /* loop through other controllers:
00516 for those that ARE open, ARE NOT the current
00517 one, and ARE locked, set the new threshold */
00518
00519 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00520
00521 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00522
00523 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00524
00525 if( qq3d->vinfo->func_thresh_top == im3d->vinfo->func_thresh_top ){
00526
00527 if( dopval && qq3d->fim_now != NULL &&
00528 DSET_BRICK_STATCODE(qq3d->fim_now,qq3d->vinfo->thr_index) > 0 ){
00529
00530 tval = THD_pval_to_stat( pval ,
00531 DSET_BRICK_STATCODE(qq3d->fim_now,qq3d->vinfo->thr_index),
00532 DSET_BRICK_STATAUX (qq3d->fim_now,qq3d->vinfo->thr_index) );
00533 ival = rint( tval/(THR_FACTOR*qq3d->vinfo->func_thresh_top) ) ;
00534 if( ival < 0 ) ival = 0 ; else if( ival > stop ) ival = stop ;
00535
00536 } else if( !dothresh ){
00537 continue ; /* skip this [dopval set, but not a statistic] */
00538 }
00539
00540 /* set the slider and pval marker */
00541
00542 XmScaleSetValue( qq3d->vwid->func->thr_scale , ival ) ;
00543 qq3d->vinfo->func_threshold = THR_FACTOR * ival ;
00544 AFNI_set_thr_pval( qq3d ) ;
00545 }
00546 }
00547 }
00548
00549 busy = 0 ; /* OK, let this routine be activated again */
00550 EXRETURN ;
00551 }
|
|
|
Definition at line 307 of file afni_lock.c. References AFNI_controller_index(), AFNI_driver(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, DSET_BRICK_STATAUX, DSET_BRICK_STATCODE, ENTRY, Three_D_View::fim_now, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, getenv(), GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, MAX_CONTROLLERS, THD_stat_to_pval(), AFNI_view_info::thr_index, and Three_D_View::vinfo. Referenced by AFNI_thr_scale_CB(), and AFNI_thresh_top_CB().
00308 {
00309 Three_D_View *qq3d ;
00310 static int busy = 0 ; /* !=0 if this routine is "busy" */
00311 int glock , cc,ii , dopval,dothresh ;
00312 float thresh , pval , tval ;
00313 char cmd[64] , *eee ;
00314
00315 ENTRY("AFNI_thresh_lock_carryout") ;
00316
00317 /* first, determine if there is anything to do */
00318
00319 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00320
00321 if( busy ) EXRETURN; /* routine already busy */
00322 if( glock == 0 ) EXRETURN; /* nothing to do */
00323 if( !IM3D_OPEN(im3d) ) EXRETURN; /* bad input */
00324 if( GLOBAL_library.ignore_lock ) EXRETURN; /* ordered not to do anything */
00325
00326 eee = getenv( "AFNI_THRESH_LOCK" ) ; /* determine how to lock */
00327 if( eee == NULL ) EXRETURN ;
00328 dothresh = (*eee == 'V' || *eee == 'v') ;
00329 dopval = (*eee == 'P' || *eee == 'p') && im3d->fim_now != NULL ;
00330 if( !dothresh && !dopval ) EXRETURN ; /* no command? */
00331
00332 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00333
00334 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00335 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00336
00337 /* something to do? */
00338
00339 busy = 1 ; /* don't let this routine be called recursively */
00340
00341 /* get true threshold of this controller => all others get this value, too*/
00342
00343 thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top ;
00344
00345 /* get p-value corresponding, if that is what's being locked */
00346
00347 if( dopval ){
00348 pval = THD_stat_to_pval( thresh ,
00349 DSET_BRICK_STATCODE(im3d->fim_now,im3d->vinfo->thr_index) ,
00350 DSET_BRICK_STATAUX (im3d->fim_now,im3d->vinfo->thr_index) ) ;
00351 if( pval < 0.0 || pval > 1.0 ){ dopval = 0; dothresh = 1; }
00352 }
00353
00354 /* loop through other controllers:
00355 for those that ARE open, ARE NOT the current
00356 one, and ARE locked, set the new threshold */
00357
00358 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00359
00360 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00361
00362 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00363
00364 if( dothresh )
00365 sprintf( cmd , "SET_THRESHNEW %c %.4f **" , 'A'+cc , thresh ) ;
00366 else if( dopval && qq3d->fim_now != NULL &&
00367 DSET_BRICK_STATCODE(qq3d->fim_now,qq3d->vinfo->thr_index) > 0 )
00368 sprintf( cmd , "SET_THRESHNEW %c %g *p" , 'A'+cc , pval ) ;
00369 else
00370 continue ; /* pval, but not a statistic? */
00371
00372 AFNI_driver( cmd ) ;
00373 }
00374 }
00375
00376 busy = 0 ; /* OK, let this routine be activated again */
00377 EXRETURN ;
00378 }
|
|
||||||||||||
|
fix the option menu at the bottom of the scale * Definition at line 159 of file afni_func.c. References MCW_arrowval::ival.
00160 {
00161 static char tlab[8] ;
00162 sprintf(tlab,"%d",av->ival) ;
00163 return tlab ;
00164 }
|
|
||||||||||||
|
Definition at line 170 of file afni_func.c. References AFNI_redisplay_func(), AFNI_set_thresh_top(), AFNI_thresh_lock_carryout(), ENTRY, AFNI_view_info::func_thresh_top, AFNI_view_info::func_visible, IM3D_OPEN, MCW_arrowval::ival, and Three_D_View::vinfo.
00171 {
00172 Three_D_View *im3d = (Three_D_View *) cd ;
00173 static float tval[9] = { 1.0 , 10.0 , 100.0 , 1000.0 , 10000.0 ,
00174 100000.0 , 1000000.0 , 10000000.0 , 100000000.0 } ;
00175
00176 ENTRY("AFNI_thresh_top_CB") ;
00177
00178 if( IM3D_OPEN(im3d) && im3d->vinfo->func_thresh_top != tval[av->ival] ){
00179
00180 AFNI_set_thresh_top( im3d , tval[av->ival] ) ;
00181
00182 if( im3d->vinfo->func_visible ) AFNI_redisplay_func( im3d ) ;
00183
00184 AFNI_thresh_lock_carryout(im3d) ; /* 06 Feb 2004 */
00185 }
00186
00187 EXRETURN ;
00188 }
|
|
||||||||||||
|
|
Definition at line 41 of file afni_lock.c. References AFNI_controller_index(), AFNI_time_index_CB(), AV_assign_ival(), AFNI_library_type::controller_lock, AFNI_library_type::controllers, ENTRY, GLOBAL_library, AFNI_library_type::ignore_lock, IM3D_OPEN, AFNI_widget_set::imag, MCW_arrowval::ival, MAX_CONTROLLERS, AFNI_view_info::time_index, AFNI_imaging_widgets::time_index_av, AFNI_library_type::time_lock, AFNI_view_info::time_on, AFNI_view_info::top_index, Three_D_View::vinfo, and Three_D_View::vwid. Referenced by AFNI_lock_enforce_CB(), and AFNI_time_index_CB().
00042 {
00043 Three_D_View *qq3d ;
00044 MCW_arrowval *tav ;
00045 int new_index , qq_index , qq_top , cc , glock , ii ;
00046 static int busy = 0 ; /* !=0 if this routine is "busy" */
00047
00048 ENTRY("AFNI_time_lock_carryout") ;
00049
00050 /* first, determine if there is anything to do */
00051
00052 glock = GLOBAL_library.controller_lock ; /* not a handgun */
00053
00054 if( busy ) EXRETURN ; /* routine already busy */
00055 if( glock == 0 ) EXRETURN ; /* nothing to do */
00056 if( !IM3D_OPEN(im3d) ) EXRETURN ; /* bad input */
00057 if( GLOBAL_library.ignore_lock ) EXRETURN ; /* ordered not to do anything */
00058 if( ! GLOBAL_library.time_lock ) EXRETURN ; /* don't lock time */
00059
00060 ii = AFNI_controller_index(im3d) ; /* which one am I? */
00061
00062 if( ii < 0 ) EXRETURN ; /* nobody? bad input! */
00063 if( ((1<<ii) & glock) == 0 ) EXRETURN ; /* input not locked */
00064
00065 /* something to do? */
00066
00067 busy = 1 ; /* don't let this routine be called recursively */
00068
00069 /* load time index of this controller => all others get this value, too*/
00070
00071 new_index = im3d->vinfo->time_index ;
00072
00073 /* loop through other controllers:
00074 for those that ARE open, ARE NOT the current
00075 one, and ARE locked, jump to the new time index */
00076
00077 for( cc=0 ; cc < MAX_CONTROLLERS ; cc++ ){
00078
00079 qq3d = GLOBAL_library.controllers[cc] ; /* controller */
00080
00081 if( IM3D_OPEN(qq3d) && qq3d != im3d && ((1<<cc) & glock) != 0 ){
00082
00083 qq_index = qq3d->vinfo->time_index ; /* old index */
00084 qq_top = qq3d->vinfo->top_index ; /* max allowed */
00085
00086 if( qq3d->vinfo->time_on && qq_top > 1 && qq_index != new_index ){
00087 tav = qq3d->vwid->imag->time_index_av ;
00088 AV_assign_ival( tav , new_index ) ; /* will check range */
00089 if( tav->ival != qq_index )
00090 AFNI_time_index_CB( tav , (XtPointer) qq3d ) ;
00091 }
00092 }
00093 }
00094
00095 busy = 0 ; /* OK, let this routine be activated again */
00096 EXRETURN ;
00097 }
|
|
||||||||||||||||
|
Definition at line 7 of file afni_lock.c. References AFNI_library_type::controllers, AFNI_widget_set::dmode, ENTRY, GLOBAL_library, IM3D_VALID, MAX_CONTROLLERS, MCW_set_bbox(), MCW_val_bbox(), RESET_AFNI_QUIT, AFNI_library_type::time_lock, AFNI_datamode_widgets::time_lock_bbox, and Three_D_View::vwid.
00008 {
00009 Three_D_View *im3d = (Three_D_View *) cd ;
00010 Three_D_View *qq3d ;
00011 int bval , ii , bold ;
00012
00013 ENTRY("AFNI_time_lock_change_CB") ;
00014
00015 if( ! IM3D_VALID(im3d) ) EXRETURN ;
00016
00017 /* get current global setting and compare to changed lock box */
00018
00019 bold = GLOBAL_library.time_lock ;
00020 bval = MCW_val_bbox( im3d->vwid->dmode->time_lock_bbox ) ;
00021 if( bval == bold ) EXRETURN ; /* same --> nothing to do */
00022
00023 /* new value --> save in global setting */
00024
00025 GLOBAL_library.time_lock = bval ;
00026
00027 /* set all other controller lock boxes to the same value */
00028
00029 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00030 qq3d = GLOBAL_library.controllers[ii] ;
00031 if( qq3d == im3d || ! IM3D_VALID(qq3d) ) continue ;
00032
00033 MCW_set_bbox( qq3d->vwid->dmode->time_lock_bbox , bval ) ;
00034 }
00035 RESET_AFNI_QUIT(im3d) ;
00036 EXRETURN ;
00037 }
|
|
|
Definition at line 358 of file afni_receive.c. References AFNI_view_info::drawing_enabled, AFNI_view_info::drawing_mode, AFNI_view_info::drawing_pixel, drive_MCW_grapher(), drive_MCW_imseq(), ENTRY, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, graDR_button2_disable, graDR_button2_enable, IM3D_OPEN, isqDR_button2_disable, isqDR_button2_enable, isqDR_button2_mode, isqDR_button2_pixel, AFNI_view_info::num_receiver, RECEIVE_DRAWING_MASK, AFNI_view_info::receiver, AFNI_receiver::receiver_mask, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, and Three_D_View::vinfo. Referenced by AFNI_receive_control(), AFNI_receive_init(), and AFNI_view_xyz_CB().
00359 {
00360 int turn_on = 0 ;
00361
00362 ENTRY("AFNI_toggle_drawing") ;
00363
00364 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
00365
00366 /* count up how many receivers want the drawing */
00367
00368 if( im3d->vinfo->receiver != NULL ){
00369 int ir ;
00370 for( ir=0 ; ir < im3d->vinfo->num_receiver ; ir++ )
00371 if( im3d->vinfo->receiver[ir] != NULL &&
00372 (im3d->vinfo->receiver[ir]->receiver_mask & RECEIVE_DRAWING_MASK) )
00373 turn_on++ ;
00374 }
00375 im3d->vinfo->drawing_enabled = (turn_on != 0) ;
00376
00377 if( ! im3d->vinfo->drawing_enabled ){
00378
00379 /*-- quench the flames --*/
00380
00381 drive_MCW_imseq( im3d->s123 , isqDR_button2_disable , NULL ) ;
00382 drive_MCW_imseq( im3d->s231 , isqDR_button2_disable , NULL ) ;
00383 drive_MCW_imseq( im3d->s312 , isqDR_button2_disable , NULL ) ;
00384
00385 drive_MCW_grapher( im3d->g123 , graDR_button2_disable , NULL ) ;
00386 drive_MCW_grapher( im3d->g231 , graDR_button2_disable , NULL ) ;
00387 drive_MCW_grapher( im3d->g312 , graDR_button2_disable , NULL ) ;
00388
00389 } else {
00390
00391 /*-- come on baby, light my fire --*/
00392
00393 drive_MCW_imseq( im3d->s123 , isqDR_button2_enable , NULL ) ;
00394 drive_MCW_imseq( im3d->s231 , isqDR_button2_enable , NULL ) ;
00395 drive_MCW_imseq( im3d->s312 , isqDR_button2_enable , NULL ) ;
00396
00397 if( im3d->vinfo->drawing_pixel > 0 ){
00398 drive_MCW_imseq( im3d->s123, isqDR_button2_pixel,
00399 (XtPointer)im3d->vinfo->drawing_pixel ) ;
00400 drive_MCW_imseq( im3d->s231, isqDR_button2_pixel,
00401 (XtPointer)im3d->vinfo->drawing_pixel ) ;
00402 drive_MCW_imseq( im3d->s312, isqDR_button2_pixel,
00403 (XtPointer)im3d->vinfo->drawing_pixel ) ;
00404 }
00405
00406 drive_MCW_imseq( im3d->s123, isqDR_button2_mode,
00407 (XtPointer)im3d->vinfo->drawing_mode ) ;
00408 drive_MCW_imseq( im3d->s231, isqDR_button2_mode,
00409 (XtPointer)im3d->vinfo->drawing_mode ) ;
00410 drive_MCW_imseq( im3d->s312, isqDR_button2_mode,
00411 (XtPointer)im3d->vinfo->drawing_mode ) ;
00412
00413 drive_MCW_grapher( im3d->g123 , graDR_button2_enable , NULL ) ;
00414 drive_MCW_grapher( im3d->g231 , graDR_button2_enable , NULL ) ;
00415 drive_MCW_grapher( im3d->g312 , graDR_button2_enable , NULL ) ;
00416
00417 }
00418
00419 EXRETURN ;
00420 }
|
|
||||||||||||||||
|
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 17 of file afni_fimmer.c. References ENTRY, GLOBAL_library, IMARR_COUNT, IMARR_SUBIMAGE, RETURN, and AFNI_library_type::timeseries. Referenced by AFNI_fimmer_setort(), AFNI_fimmer_setref(), AFNI_gra_send_CB(), and PLUG_choose_timeseries_CB().
00018 {
00019 int its ;
00020
00021 ENTRY("AFNI_ts_in_library") ;
00022
00023 if( GLOBAL_library.timeseries != NULL &&
00024 IMARR_COUNT(GLOBAL_library.timeseries) > 0 && tsim != NULL ){
00025
00026 for( its=0 ; its < IMARR_COUNT(GLOBAL_library.timeseries) ; its++ )
00027 if( tsim == IMARR_SUBIMAGE(GLOBAL_library.timeseries,its) )
00028 RETURN(its) ;
00029 }
00030
00031 RETURN(-1) ;
00032 }
|
|
||||||||||||||||||||||||||||
|
now apply threshold, if any * Definition at line 1436 of file afni_func.c. References AFNI_slice_flip(), Three_D_View::anat_now, DSET_load, DSET_NVOX, DSET_NZ, ENTRY, TTRR_params::hemi, TTRR_params::meth, MRI_BYTE_PTR, mri_free(), mri_new_conforming, MRI_SHORT_PTR, TTRR_params::num, MRI_IMAGE::nvox, RESAM_NN_TYPE, RETURN, STATUS, TT_retrieve_atlas(), TT_retrieve_atlas_nz, TTRR_params::ttbrik, TTRR_params::ttovc, TTRR_get_params(), TTRR_HEMI_BOTH, TTRR_HEMI_LEFT, TTRR_HEMI_RIGHT, TTRR_METH_FAG, TTRR_METH_FGA, TTRR_METH_GAF, and TTRR_params::ttval. Referenced by AFNI_overlay().
01439 {
01440 THD_3dim_dataset *dseTT ;
01441 TTRR_params *ttp ;
01442 byte *b0 , *b1 , *brik, *val, *ovc , g_ov,a_ov,final_ov ;
01443 short *ovar ;
01444 MRI_IMAGE *ovim=NULL , *b0im , *b1im ;
01445 int gwin , fwin , nreg , ii,jj , nov ;
01446
01447 ENTRY("AFNI_ttatlas_overlay") ;
01448
01449 /* setup and sanity checks */
01450
01451 STATUS("checking if have Atlas dataset") ;
01452
01453 /* 01 Aug 2001: retrieve atlas based on z-axis size of underlay dataset */
01454 #if 1
01455 dseTT = TT_retrieve_atlas_nz( DSET_NZ(im3d->anat_now) ) ;
01456 if( dseTT == NULL ) RETURN(NULL) ;
01457 #else
01458 dseTT = TT_retrieve_atlas() ; if( dseTT == NULL ) RETURN(NULL) ;
01459 #endif
01460
01461 /* make sure Atlas and current dataset match in size */
01462
01463 STATUS("checking if Atlas and anat dataset match") ;
01464
01465 if( DSET_NVOX(dseTT) != DSET_NVOX(im3d->anat_now) ) RETURN(NULL) ;
01466
01467 /* make sure we are actually drawing something */
01468
01469 STATUS("checking if Atlas Colors is on") ;
01470
01471 ttp = TTRR_get_params() ; if( ttp == NULL ) RETURN(NULL) ;
01472
01473 /* at this time, hemisphere processing doesn't work in this function */
01474
01475 #if 0
01476 switch( ttp->hemi ){
01477 case TTRR_HEMI_LEFT: hbot=HEMX+1 ; break ;
01478 case TTRR_HEMI_RIGHT: hbot= 0 ; break ;
01479 case TTRR_HEMI_BOTH: hbot= 0 ; break ;
01480 }
01481 #endif
01482
01483 /* get slices from TTatlas dataset */
01484
01485 STATUS("loading Atlas bricks") ;
01486
01487 DSET_load(dseTT) ;
01488 b0im = AFNI_slice_flip( n , 0 , RESAM_NN_TYPE , ax_1,ax_2,ax_3 , dseTT ) ;
01489 if( b0im == NULL ) RETURN(NULL) ;
01490
01491 b1im = AFNI_slice_flip( n , 1 , RESAM_NN_TYPE , ax_1,ax_2,ax_3 , dseTT ) ;
01492 if( b1im == NULL ){ mri_free(b0im) ; RETURN(NULL) ; }
01493
01494 /* make a new overlay image, or just operate on the old one */
01495
01496 if( fov == NULL ){
01497 STATUS("making new overlay for Atlas") ;
01498 ovim = mri_new_conforming( b0im , MRI_short ) ; /* new overlay */
01499 ovar = MRI_SHORT_PTR(ovim) ;
01500 memset( ovar , 0 , ovim->nvox * sizeof(short) ) ;
01501 } else{
01502 STATUS("re-using old overlay for Atlas") ;
01503 ovim = fov ; /* old overlay */
01504 ovar = MRI_SHORT_PTR(ovim) ;
01505 if( ovim->nvox != b0im->nvox ){ /* shouldn't */
01506 mri_free(b0im) ; mri_free(b1im) ; RETURN(NULL) ; /* happen! */
01507 }
01508 }
01509
01510 b0 = MRI_BYTE_PTR(b0im) ; b1 = MRI_BYTE_PTR(b1im) ;
01511
01512 /* fwin => function 'wins' over Atlas */
01513 /* gwin => gyral Atlas brick 'wins' over 'area' Atlas brick */
01514
01515 fwin = (ttp->meth == TTRR_METH_FGA) || (ttp->meth == TTRR_METH_FAG) ;
01516 gwin = (ttp->meth == TTRR_METH_FGA) || (ttp->meth == TTRR_METH_GAF) ;
01517
01518 nreg = ttp->num ; /* number of 'on' regions */
01519 brik = ttp->ttbrik ; /* which sub-brick in atlas */
01520 val = ttp->ttval ; /* which code in that sub-brick */
01521 ovc = ttp->ttovc ; /* which overlay color index */
01522
01523 /* loop over image voxels, find overlays from Atlas */
01524
01525 STATUS("doing Atlas overlay") ;
01526
01527 for( nov=ii=0 ; ii < ovim->nvox ; ii++ ){
01528
01529 if( ovar[ii] && fwin ) continue ; /* function wins */
01530
01531 /* check Atlas 'on' regions for hits */
01532
01533 g_ov = a_ov = 0 ;
01534 for( jj=0 ; (g_ov==0 || a_ov==0) && jj<nreg ; jj++ ){
01535 if( b0[ii] == val[jj] ) g_ov = ovc[jj] ;
01536 else if( b1[ii] == val[jj] ) a_ov = ovc[jj] ;
01537 }
01538
01539 if( g_ov==0 && a_ov==0 ) continue ; /* no hit */
01540
01541 /* find the winner */
01542
01543 if( g_ov && (gwin || a_ov==0) ) final_ov = g_ov ;
01544 else final_ov = a_ov ;
01545
01546 ovar[ii] = final_ov ; /* and the winner is ... */
01547 nov++ ;
01548 }
01549
01550 mri_free(b0im) ; mri_free(b1im) ; /* free at last */
01551
01552 if(PRINT_TRACING)
01553 { char str[256]; sprintf(str,"Atlas overlaid %d pixels",nov); STATUS(str); }
01554
01555 RETURN(ovim) ;
01556 }
|
|
|
Definition at line 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 }
|
|
||||||||||||||||
|
Definition at line 1623 of file afni_func.c. References AFNI_first_tog(), AFNI_IGNORE_EVERYTHING, AFNI_IGNORE_NOTHING, AFNI_IGNORE_REDRAWS, AFNI_process_alteration(), AFNI_set_viewpoint(), AFNI_set_window_titles(), Three_D_View::b123_anat, Three_D_View::b123_fim, Three_D_View::b123_ulay, Three_D_View::b231_anat, Three_D_View::b231_fim, Three_D_View::b231_ulay, Three_D_View::b312_anat, Three_D_View::b312_fim, Three_D_View::b312_ulay, BRICK_DRAWABLE, BRICK_GRAPHABLE, CLEAR_MONTAGE, Three_D_View::dc, MCW_DC::display, drive_MCW_grapher(), drive_MCW_imseq(), FD_brick::dset, DSET_GRAPHABLE, ENTRY, Three_D_View::fim_now, AFNI_widget_set::func, Three_D_View::g123, Three_D_View::g231, Three_D_View::g312, graDR_destroy, graDR_newdata, AFNI_imaging_widgets::graph_xyz_pb, AFNI_imaging_widgets::graph_yzx_pb, AFNI_imaging_widgets::graph_zxy_pb, HINTIZE_pbar, Three_D_View::ignore_seq_callbacks, IM3D_OPEN, AFNI_widget_set::imag, AFNI_imaging_widgets::image_xyz_pb, AFNI_imaging_widgets::image_yzx_pb, AFNI_imaging_widgets::image_zxy_pb, isqDR_destroy, isqDR_newseq, isqDR_sendmontage, ISVALID_DSET, LAST_UNDERLAY_TYPE, MCW_set_bbox(), REDISPLAY_ALL, Three_D_View::s123, Three_D_View::s231, Three_D_View::s312, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, UNDERLAY_ALLFUNC, UNDERLAY_ANAT, AFNI_function_widgets::underlay_bbox, AFNI_view_info::underlay_type, Three_D_View::vinfo, Three_D_View::vwid, and MCW_bbox::wbut. Referenced by AFNI_setup_viewing().
01624 {
01625 Three_D_View *im3d = (Three_D_View *) cd ;
01626 int bval ;
01627 Boolean seq_exist ;
01628
01629 ENTRY("AFNI_underlay_CB") ;
01630
01631 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
01632
01633 if( w != NULL ) bval = AFNI_first_tog( LAST_UNDERLAY_TYPE+1 ,
01634 im3d->vwid->func->underlay_bbox->wbut ) ;
01635 else bval = im3d->vinfo->underlay_type ;
01636
01637 if( bval == im3d->vinfo->underlay_type && w != NULL ) EXRETURN ; /* nothing */
01638
01639 im3d->vinfo->underlay_type = bval ;
01640
01641 /*----- set the bricks to use for the underlay images -----*/
01642
01643 switch( im3d->vinfo->underlay_type ){
01644
01645 default:
01646 XBell( im3d->dc->display , 100 ) ; /* beep and fall through! */
01647
01648 case UNDERLAY_ANAT: /* set underlay to anat */
01649
01650 STATUS("anatomy underlay") ;
01651
01652 im3d->b123_ulay = im3d->b123_anat ;
01653 im3d->b231_ulay = im3d->b231_anat ;
01654 im3d->b312_ulay = im3d->b312_anat ;
01655 break ;
01656
01657 case UNDERLAY_ALLFUNC:
01658 if( ISVALID_DSET(im3d->fim_now) ){
01659
01660 STATUS("functional underlay") ;
01661
01662 im3d->b123_ulay = im3d->b123_fim ;
01663 im3d->b231_ulay = im3d->b231_fim ;
01664 im3d->b312_ulay = im3d->b312_fim ;
01665 } else {
01666
01667 STATUS("defaulted anatomy underlay") ;
01668
01669 XBell( im3d->dc->display , 100 ) ;
01670
01671 im3d->b123_ulay = im3d->b123_anat ;
01672 im3d->b231_ulay = im3d->b231_anat ;
01673 im3d->b312_ulay = im3d->b312_anat ;
01674
01675 MCW_set_bbox( im3d->vwid->func->underlay_bbox , 1<<UNDERLAY_ANAT ) ;
01676 }
01677 break ;
01678 }
01679
01680 /*--- May 1996: destroy useless graph windows ---*/
01681
01682 im3d->ignore_seq_callbacks = AFNI_IGNORE_REDRAWS ; /* 16 Feb 97 */
01683
01684 if( !DSET_GRAPHABLE(im3d->b123_ulay->dset) || !BRICK_GRAPHABLE(im3d->b123_ulay) ){
01685 if( im3d->g123 != NULL ){
01686 drive_MCW_grapher( im3d->g123 , graDR_destroy , NULL ) ;
01687 im3d->g123 = NULL ;
01688 }
01689 XtSetSensitive( im3d->vwid->imag->graph_xyz_pb , False ) ;
01690 } else {
01691 XtSetSensitive( im3d->vwid->imag->graph_xyz_pb , True ) ;
01692 }
01693
01694 if( !DSET_GRAPHABLE(im3d->b231_ulay->dset) || !BRICK_GRAPHABLE(im3d->b231_ulay) ){
01695 if( im3d->g231 != NULL ){
01696 drive_MCW_grapher( im3d->g231 , graDR_destroy , NULL ) ;
01697 im3d->g231 = NULL ;
01698 }
01699 XtSetSensitive( im3d->vwid->imag->graph_yzx_pb , False ) ;
01700 } else {
01701 XtSetSensitive( im3d->vwid->imag->graph_yzx_pb , True ) ;
01702 }
01703
01704 if( !DSET_GRAPHABLE(im3d->b312_ulay->dset) || !BRICK_GRAPHABLE(im3d->b312_ulay) ){
01705 if( im3d->g312 != NULL ){
01706 drive_MCW_grapher( im3d->g312 , graDR_destroy , NULL ) ;
01707 im3d->g312 = NULL ;
01708 }
01709 XtSetSensitive( im3d->vwid->imag->graph_zxy_pb , False ) ;
01710 } else {
01711 XtSetSensitive( im3d->vwid->imag->graph_zxy_pb , True ) ;
01712 }
01713
01714 /** 05 Mar 1997: disable viewers if x or y dimension is 1 pixel **/
01715
01716 if( !BRICK_DRAWABLE(im3d->b123_ulay) ){
01717 if( im3d->s123 != NULL ){
01718 drive_MCW_imseq( im3d->s123 , isqDR_destroy , NULL ) ;
01719 im3d->s123 = NULL ;
01720 }
01721 XtSetSensitive( im3d->vwid->imag->image_xyz_pb , False ) ;
01722 } else {
01723 XtSetSensitive( im3d->vwid->imag->image_xyz_pb , True ) ;
01724 }
01725
01726 if( !BRICK_DRAWABLE(im3d->b231_ulay) ){
01727 if( im3d->s231 != NULL ){
01728 drive_MCW_imseq( im3d->s231 , isqDR_destroy , NULL ) ;
01729 im3d->s231 = NULL ;
01730 }
01731 XtSetSensitive( im3d->vwid->imag->image_yzx_pb , False ) ;
01732 } else {
01733 XtSetSensitive( im3d->vwid->imag->image_yzx_pb , True ) ;
01734 }
01735
01736 if( !BRICK_DRAWABLE(im3d->b312_ulay) ){
01737 if( im3d->s312 != NULL ){
01738 drive_MCW_imseq( im3d->s312 , isqDR_destroy , NULL ) ;
01739 im3d->s312 = NULL ;
01740 }
01741 XtSetSensitive( im3d->vwid->imag->image_zxy_pb , False ) ;
01742 } else {
01743 XtSetSensitive( im3d->vwid->imag->image_zxy_pb , True ) ;
01744 }
01745
01746 im3d->ignore_seq_callbacks = AFNI_IGNORE_NOTHING ; /* 16 Feb 97 */
01747
01748 /*--- attach any changes to open image displays ---*/
01749
01750 seq_exist = (im3d->s123 != NULL) || (im3d->s231 != NULL) || (im3d->s312 != NULL) ||
01751 (im3d->g123 != NULL) || (im3d->g231 != NULL) || (im3d->g312 != NULL) ;
01752
01753 /* set the title for all windows */
01754
01755 AFNI_set_window_titles( im3d ) ;
01756
01757 if( seq_exist ){
01758
01759 im3d->ignore_seq_callbacks = AFNI_IGNORE_EVERYTHING ;
01760
01761 if( im3d->s123 != NULL )
01762 drive_MCW_imseq( im3d->s123 , isqDR_newseq ,
01763 (XtPointer) im3d->b123_ulay ) ;
01764
01765 if( im3d->s231 != NULL )
01766 drive_MCW_imseq( im3d->s231 , isqDR_newseq ,
01767 (XtPointer) im3d->b231_ulay ) ;
01768
01769 if( im3d->s312 != NULL )
01770 drive_MCW_imseq( im3d->s312 , isqDR_newseq ,
01771 (XtPointer) im3d->b312_ulay ) ;
01772
01773 if( im3d->g123 != NULL )
01774 drive_MCW_grapher( im3d->g123 , graDR_newdata ,
01775 (XtPointer) im3d->b123_ulay ) ;
01776
01777 if( im3d->g231 != NULL )
01778 drive_MCW_grapher( im3d->g231 , graDR_newdata ,
01779 (XtPointer) im3d->b231_ulay ) ;
01780
01781 if( im3d->g312 != NULL )
01782 drive_MCW_grapher( im3d->g312 , graDR_newdata ,
01783 (XtPointer) im3d->b312_ulay ) ;
01784
01785 im3d->ignore_seq_callbacks = AFNI_IGNORE_REDRAWS ;
01786
01787 /** July 1996: get the sequences to send their montaging status **/
01788
01789 if( im3d->s123 != NULL )
01790 drive_MCW_imseq( im3d->s123 , isqDR_sendmontage , NULL ) ;
01791 else
01792 CLEAR_MONTAGE( im3d , im3d->b123_ulay ) ;
01793
01794 if( im3d->s231 != NULL )
01795 drive_MCW_imseq( im3d->s231 , isqDR_sendmontage , NULL ) ;
01796 else
01797 CLEAR_MONTAGE( im3d , im3d->b231_ulay ) ;
01798
01799 if( im3d->s312 != NULL )
01800 drive_MCW_imseq( im3d->s312 , isqDR_sendmontage , NULL ) ;
01801 else
01802 CLEAR_MONTAGE( im3d , im3d->b312_ulay ) ;
01803
01804 im3d->ignore_seq_callbacks = AFNI_IGNORE_NOTHING ;
01805
01806 if( w != NULL ){ /* a real callback */
01807 SHOW_AFNI_PAUSE ;
01808 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_ALL ) ;
01809 SHOW_AFNI_READY ;
01810 }
01811 }
01812
01813 /* Feb 1998: if a receiver is open
01814 send it a message that something has altered */
01815
01816 AFNI_process_alteration(im3d) ;
01817
01818 HINTIZE_pbar(im3d) ; /* 15 Aug 2001 */
01819
01820 EXRETURN ;
01821 }
|
|
|
Update all surface widgets everywhere that touch this session. Definition at line 758 of file afni_sumafunc.c. References AFNI_update_surface_widgets(), AFNI_library_type::controllers, ENTRY, GLOBAL_library, IM3D_OPEN, MAX_CONTROLLERS, and Three_D_View::ss_now. Referenced by process_NIML_Node_ROI(), and process_NIML_SUMA_ixyz().
00759 {
00760 int ii ;
00761 Three_D_View *im3d ;
00762 ENTRY("AFNI_update_all_surface_widgets") ;
00763 for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00764 im3d = GLOBAL_library.controllers[ii] ;
00765 if( IM3D_OPEN(im3d) && im3d->ss_now == sess )
00766 AFNI_update_surface_widgets( im3d ) ;
00767 }
00768 EXRETURN ;
00769 }
|
|
|
Update surface widgets for this controller; that is, set labels, manage/unmanage widget rows, et cetera. Definition at line 678 of file afni_sumafunc.c. References AFNI_controller_label(), AFNI_viewing_widgets::choose_surf_pb, Three_D_View::dc, DC_find_closest_overlay_color(), ENTRY, getenv(), IM3D_OPEN, SUMA_surface::label, MAKE_SURF_ROW, MCW_register_hint(), MCW_set_widget_label(), MIN, AFNI_surface_widgets::nall, MCW_DCOV::ncol_ov, AFNI_surface_widgets::nrow, SUMA_surface::num_ijk, SUMA_surface::num_ixyz, MCW_DC::ovc, SENSITIZE, THD_session::sessname, SESSTRAIL, Three_D_View::ss_now, THD_session::su_num, THD_session::su_surf, AFNI_surface_widgets::surf_bbox, AFNI_surface_widgets::surf_ledg_av, AFNI_surface_widgets::surf_line_av, AFNI_surface_widgets::surf_node_av, AFNI_surface_widgets::surf_rc, AFNI_viewing_widgets::swid, THD_MAX_NAME, THD_trailname(), AFNI_surface_widgets::top_lab, AFNI_widget_set::view, Three_D_View::vwid, MCW_bbox::wbut, and XtRealloc. Referenced by AFNI_choose_surface_CB(), AFNI_setup_viewing(), and AFNI_update_all_surface_widgets().
00679 {
00680 AFNI_surface_widgets *swid ;
00681 int num , ii , nwid,nall ;
00682 char str[64] , nam[THD_MAX_NAME] , *tnam ;
00683
00684 ENTRY("AFNI_update_surface_widgets") ;
00685
00686 if( !IM3D_OPEN(im3d) || im3d->ss_now == NULL ) EXRETURN ; /* bad */
00687
00688 num = im3d->ss_now->su_num ; /* # of surfaces in current session */
00689 swid = im3d->vwid->view->swid ; /* pointer to surface widget struct */
00690
00691 SENSITIZE( im3d->vwid->view->choose_surf_pb , (Boolean)(num > 0) ) ;
00692
00693 if( swid == NULL ) EXRETURN ; /* nothing to update */
00694
00695 /* put session label in top of panel */
00696
00697 strcpy( nam , im3d->ss_now->sessname ) ;
00698 tnam = THD_trailname(nam,SESSTRAIL+1) ;
00699 ii = strlen(tnam) ; if( ii > 50 ) tnam += (ii-50) ;
00700 sprintf(str ,"%-.50s %s" , tnam, AFNI_controller_label(im3d) ) ;
00701 MCW_set_widget_label( swid->top_lab , str ) ;
00702
00703 /* make more widget rows? (1 per surface is needed) */
00704
00705 if( swid->nall < num ){
00706 char *eee ; int line_col,box_col ;
00707
00708 swid->surf_rc = (Widget *) XtRealloc( (char *)swid->surf_rc ,num*sizeof(Widget) );
00709 swid->surf_bbox = (MCW_bbox **) XtRealloc( (char *)swid->surf_bbox ,num*sizeof(MCW_bbox *) );
00710 swid->surf_node_av = (MCW_arrowval **) XtRealloc( (char *)swid->surf_node_av,num*sizeof(MCW_arrowval *) );
00711 swid->surf_line_av = (MCW_arrowval **) XtRealloc( (char *)swid->surf_line_av,num*sizeof(MCW_arrowval *) );
00712 swid->surf_ledg_av = (MCW_arrowval **) XtRealloc( (char *)swid->surf_line_av,num*sizeof(MCW_arrowval *) );
00713
00714
00715 eee = getenv( "AFNI_SUMA_LINECOLOR" ) ;
00716 line_col = DC_find_closest_overlay_color( im3d->dc, eee ) ;
00717 if( line_col < 0 ) line_col = MIN(6,im3d->dc->ovc->ncol_ov-1) ;
00718
00719 eee = getenv( "AFNI_SUMA_BOXCOLOR" ) ;
00720 box_col = DC_find_closest_overlay_color( im3d->dc, eee ) ;
00721 if( box_col < 0 ) box_col = 0 ;
00722
00723 for( ii=swid->nall ; ii < num ; ii++ ){
00724 MAKE_SURF_ROW(ii) ;
00725 }
00726 swid->nall = num ;
00727 }
00728
00729 /* map or unmap widget rows? (1 per surface is needed) */
00730
00731 if( swid->nrow < num ){
00732 for( ii=swid->nrow ; ii < num ; ii++ )
00733 XtManageChild( swid->surf_rc[ii] ) ;
00734 } else if( swid->nrow > num ){
00735 for( ii=num ; ii < swid->nrow ; ii++ )
00736 XtUnmanageChild( swid->surf_rc[ii] ) ;
00737 }
00738 swid->nrow = num ; /* # of managed rows */
00739
00740 /* change labels for each row */
00741
00742 for( ii=0 ; ii < num ; ii++ ){
00743 sprintf(str,"%-14.14s: ",im3d->ss_now->su_surf[ii]->label) ;
00744 MCW_set_widget_label( swid->surf_bbox[ii]->wbut[0] , str ) ;
00745
00746 sprintf(str,"%d Nodes; %d Triangles", /* 20 Aug 2002: */
00747 im3d->ss_now->su_surf[ii]->num_ixyz , /* put a hint */
00748 im3d->ss_now->su_surf[ii]->num_ijk ) ; /* on each label */
00749 MCW_register_hint( swid->surf_bbox[ii]->wbut[0] , str ) ;
00750 }
00751
00752 EXRETURN ;
00753 }
|
|
|
Complete the version check by seeing if the child process has any data to report from the AFNI web site. Returns 1 if the version at the AFNI site doesn't match the version of this program; returns 0 if they match, or it can't tell. Also prints stuff out. -------------------------------------------------------------------------- Definition at line 217 of file afni_version.c. References AFMALL, AFNI_HOST, free, getenv(), IOCHAN_CLOSE, iochan_readcheck(), iochan_recv(), KAPUT, NI_new_data_element(), NI_set_attribute(), NI_stream_close(), NI_stream_open(), NI_TEXT_MODE, NI_write_element(), vc_child_pid, and VSIZE. Referenced by AFNI_startup_timeout_CB().
00218 {
00219 int jj , nbuf=0 ;
00220 char *vbuf=NULL ;
00221 char vv[128]="none" ;
00222 char *sname , *vvbuf ;
00223
00224 #ifdef CYGWIN /* 30 Jun 2005 [rickr] */
00225
00226 return 0;
00227
00228 #else
00229
00230 /* if something is rotten, then toss it out */
00231
00232 if( disabled ) return 0 ; /* 27 Jan 2003 */
00233
00234 if( vc_ioc == NULL || vc_child_pid == (pid_t)(-1) ) KAPUT("bad child state");
00235
00236 jj = kill(vc_child_pid,0) ; /* is child alive? */
00237 if( jj < 0 ){
00238 IOCHAN_CLOSE(vc_ioc); vc_child_pid=(pid_t)(-1);
00239 KAPUT("child not alive");
00240 }
00241
00242 jj = iochan_readcheck( vc_ioc , 333 ) ; /* is iochan open yet? */
00243 if( jj <= 0 ){
00244 IOCHAN_CLOSE(vc_ioc); kill(vc_child_pid,SIGTERM); vc_child_pid=(pid_t)(-1);
00245 KAPUT("connection to child gone bad");
00246 }
00247
00248 /* if here, have data ready to read from child! */
00249
00250 nbuf = 0 ;
00251 vbuf = AFMALL( char, VSIZE) ;
00252 while(1){
00253 jj = iochan_recv( vc_ioc , vbuf+nbuf , VSIZE-nbuf ) ;
00254 if( jj < 1 ) break ;
00255 nbuf += jj ;
00256 if( nbuf >= VSIZE-1 ) break ;
00257 jj = iochan_readcheck( vc_ioc , 5 ) ;
00258 if( jj < 1 ) break ;
00259 }
00260
00261 /* now wait for child to kill itself */
00262
00263 waitpid(vc_child_pid,NULL,WNOHANG); vc_child_pid = (pid_t)(-1);
00264 IOCHAN_CLOSE(vc_ioc);
00265
00266 /* no data? */
00267
00268 if( nbuf <= 0 ){ free(vbuf); vbuf = NULL; KAPUT("bad version data"); } /* unlikely */
00269
00270 /* extract version and data/time strings from data */
00271
00272 #ifdef USE_HTTP_10
00273 vvbuf = strstr(vbuf,"\r\n\r\n") ;
00274 if( vvbuf == NULL ) vvbuf = vbuf ;
00275 else vvbuf = vvbuf + 4 ;
00276 #else
00277 vvbuf = vbuf ;
00278 #endif
00279
00280 sscanf( vvbuf , "%127s" , vv ); free(vbuf);
00281
00282 /* record the current time, so we don't check too often */
00283
00284 { char *home=getenv("HOME") , mname[VSIZE]="file:" ;
00285 NI_stream ns ;
00286 if( home != NULL ) strcat(mname,home) ;
00287 strcat(mname,"/.afni.vctime") ;
00288 ns = NI_stream_open( mname , "w" ) ;
00289 if( ns != NULL ){
00290 NI_element *nel=NI_new_data_element("AFNI_vctime",0); char rhs[32];
00291 sprintf(rhs,"%d",(int)time(NULL)) ;
00292 NI_set_attribute( nel , "version_check_time" , rhs ) ;
00293 if( strcmp(vv,"none") != 0 ) /* 27 Jan 2003 */
00294 NI_set_attribute( nel , "version_string" , VERSION ) ;
00295 NI_write_element( ns , nel , NI_TEXT_MODE ) ;
00296 NI_stream_close(ns) ;
00297 }
00298 }
00299
00300 /* compare version strings */
00301
00302 if( strcmp(vv,VERSION) == 0 ){ /* versions match */
00303 fprintf(stderr,"\n** Version check: you are up-to-date!\n"
00304 "** To disable future version checks:\n"
00305 "** set environment variable AFNI_VERSION_CHECK to NO.\n"
00306 "** Version checks are done about every %.1f days.\n",
00307 rint(VDELAY/86400.0) ) ;
00308 return 0 ;
00309 }
00310
00311 /* print a message about version mismatch */
00312
00313 fprintf(stderr, "\n"
00314 "****************************************************\n"
00315 " This AFNI was compiled with the following settings:\n"
00316 " Version ID = %s\n"
00317 " Latest version at %s\n"
00318 " Version ID = %s\n"
00319 "****************************************************\n"
00320 " To disable future version checks:\n"
00321 " set environment variable AFNI_VERSION_CHECK to NO\n"
00322 "****************************************************\n"
00323 , VERSION, AFNI_HOST , vv ) ;
00324
00325 return 1 ;
00326
00327 #endif /* CYGWIN */
00328 }
|
|
||||||||||||
|
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(), THD_brick_stats::min, 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 }
|
|
||||||||||||||||||||
|
Create a nodal color overlay from a voxel map.
Definition at line 29 of file afni_sumafunc.c. References SUMA_irgba::a, AFNI_GOOD_FUNC_DTYPE, SUMA_irgba::b, rgbyte::b, MCW_pbar::bigbot, MCW_pbar::bigcolor, MCW_pbar::bigmode, MCW_pbar::bigtop, cmap, THD_3dim_dataset::daxes, Three_D_View::dc, DCOV_BLUEBYTE, DCOV_GREENBYTE, DCOV_REDBYTE, SUMA_vnlist::dset, DSET_BRICK, DSET_BRICK_FACTOR, DSET_load, DSET_LOADED, DSET_NVALS, ENTRY, EQUIV_DATAXES, AFNI_view_info::fim_autorange, AFNI_view_info::fim_index, Three_D_View::fim_now, AFNI_view_info::fim_range, free, AFNI_widget_set::func, AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, SUMA_irgba::g, rgbyte::g, SUMA_irgba::id, SUMA_ixyz::id, IM3D_VALID, ind, AFNI_function_widgets::inten_pbar, SUMA_surface::ixyz, MRI_IMAGE::kind, malloc, mmm, MRI_BYTE_PTR, MRI_FLOAT_PTR, MRI_RGB_PTR, MRI_SHORT_PTR, SUMA_vnlist::nlist, NPANE_BIG, NPANE_MAX, SUMA_surface::num_ixyz, MCW_pbar::num_panes, SUMA_vnlist::numnod, SUMA_vnlist::nvox, MCW_pbar::ov_index, MCW_pbar::pval, r, SUMA_irgba::r, rgbyte::r, realloc, RETURN, Three_D_View::ss_now, THD_session::su_num, THD_session::su_surf, SUMA_destroy_vnlist(), SUMA_make_vnlist(), AFNI_view_info::thr_index, AFNI_view_info::use_posfunc, Three_D_View::vinfo, SUMA_surface::vn, SUMA_vnlist::voxijk, and Three_D_View::vwid.
00031 {
00032 MRI_IMAGE *im_thr , *im_fim ;
00033 short fim_ovc[NPANE_MAX+1] ;
00034 byte ovc_r[NPANE_MAX+1], ovc_g[NPANE_MAX+1], ovc_b[NPANE_MAX+1] ;
00035 int ii,jj,nn , lp , num_lp , ival ;
00036 float scale_factor , scale_thr=1.0 , scale_fim=1.0 ;
00037 MCW_pbar * pbar ;
00038 int simult_thr , need_thr ;
00039 THD_3dim_dataset *fdset ;
00040 SUMA_irgba *mmm ;
00041 SUMA_ixyz *ixyz ;
00042 int nvox,nnod,nout , *numnod , *voxijk , *nlist ;
00043 int *vlist ;
00044 int nvout ; /* 13 Mar 2002 */
00045
00046 int bm , zbot=0 , kk ; /* 02 Feb 2003: colorscale stuff */
00047 float fbot=0.0,ftop=0.0,ffac=0.0 , val ;
00048 rgbyte *cmap=NULL ;
00049
00050 THD_session *ss ; /* 22 Jan 2004 */
00051 SUMA_surface *surf ;
00052 SUMA_vnlist *vn ;
00053
00054 ENTRY("AFNI_vnlist_func_overlay") ;
00055
00056 /* check inputs for goodness sakes */
00057
00058 if( map == NULL || !IM3D_VALID(im3d) ) RETURN(-1) ; /* that was easy */
00059
00060 if( nvused != NULL ) *nvused = 0 ; /* set default return value here */
00061
00062 /* check datasets for goodness */
00063 /* 12 Dec 2002: ks is now input (we used to compute it) */
00064
00065 ss = im3d->ss_now ; /* session must */
00066 if( ss == NULL || /* have surface #ks */
00067 ss->su_num == 0 ||
00068 ks < 0 ||
00069 ss->su_num <= ks ||
00070 ss->su_surf[ks] == NULL ) RETURN(-1) ;
00071
00072 surf = ss->su_surf[ks] ; /* the surface in question */
00073
00074 fdset = im3d->fim_now ; if( fdset == NULL ) RETURN(-1) ;
00075
00076 ival = im3d->vinfo->thr_index ; /* threshold sub-brick index */
00077
00078 /* get the component images */
00079
00080 need_thr = im3d->vinfo->func_threshold > 0.0 ;
00081
00082 if( need_thr ) im_thr = DSET_BRICK(fdset,ival) ;
00083 else im_thr = NULL ;
00084
00085 if( im_thr != NULL && !AFNI_GOOD_FUNC_DTYPE(im_thr->kind) ) im_thr = NULL ;
00086
00087 if( im_thr != NULL ){
00088 scale_thr = DSET_BRICK_FACTOR(fdset,ival) ;
00089 if( scale_thr == 0.0 || im_thr->kind == MRI_float ) scale_thr = 1.0 ;
00090 }
00091
00092 { int ind ;
00093
00094 ind = im3d->vinfo->fim_index ;
00095 if( ind >= DSET_NVALS(fdset) )
00096 ind = DSET_NVALS(fdset) - 1 ;
00097
00098 im_fim = DSET_BRICK(fdset,ind) ; /* the sub-brick to show */
00099 scale_factor = im3d->vinfo->fim_range ;
00100 if( scale_factor == 0.0 ) scale_factor = im3d->vinfo->fim_autorange ;
00101 if( scale_factor == 0.0 ) scale_factor = 1.0 ;
00102
00103 scale_fim = DSET_BRICK_FACTOR(fdset,ind) ;
00104 if( scale_fim == 0.0 ) scale_fim = 1.0 ;
00105
00106 }
00107
00108 /* if component images not good, quit now */
00109
00110 if( im_fim == NULL ) RETURN(-1) ; /* no function!? */
00111
00112 if( !AFNI_GOOD_FUNC_DTYPE(im_fim->kind) ){
00113 RETURN(-1) ; /* bad function - no soup for you */
00114 }
00115
00116 /* maybe need to build a voxel-to-node list for func dataset */
00117 /* (this is where the 3D-to-2D mapping is encapsulated, Ziad) */
00118
00119 if( surf->vn == NULL ||
00120 !EQUIV_DATAXES(surf->vn->dset->daxes,fdset->daxes) ){
00121
00122 /* if have an old one
00123 (that doesn't match current dataset grid),
00124 then delete it from the Universe */
00125
00126 if( surf->vn != NULL ) SUMA_destroy_vnlist( surf->vn ) ;
00127
00128 /* make the new list */
00129
00130 surf->vn = SUMA_make_vnlist( surf , fdset ) ;
00131 if( surf->vn == NULL ) RETURN(-1) ;
00132 }
00133
00134 vn = surf->vn ; /* voxel-to-node list for this surface */
00135
00136 /* create array of voxel indexes (vlist);
00137 will put in there the voxels that are above threshold */
00138
00139 nvox = vn->nvox ; if( nvox < 1 ) RETURN(0);
00140 voxijk = vn->voxijk ; /* list of voxels with surface nodes */
00141 numnod = vn->numnod ; /* number of nodes in each voxel */
00142
00143 nnod = surf->num_ixyz ; if( nnod < 1 ) RETURN(0);
00144 ixyz = surf->ixyz ; /* array of surface nodes */
00145
00146 DSET_load(fdset) ; /* if isn't in memory now */
00147 if( !DSET_LOADED(fdset) ) RETURN(-1) ; /* what the hell? */
00148
00149 /** if don't have threshold, will process all voxels for color **/
00150
00151 if( im_thr == NULL ){
00152
00153 vlist = voxijk ; /* list of voxels to process = all voxels */
00154 nout = nnod ; /* number of output nodes */
00155
00156 /** if have threshold, cut out voxels below threshold (set vlist[]=-1) **/
00157
00158 } else {
00159
00160 vlist = (int *) malloc(sizeof(int)*nvox) ; /* copy voxel list */
00161 memcpy( vlist , voxijk , sizeof(int)*nvox ) ; /* then prune it */
00162
00163 switch( im_thr->kind ){
00164 case MRI_short:{
00165 float thresh = im3d->vinfo->func_threshold
00166 * im3d->vinfo->func_thresh_top / scale_thr ;
00167 short *ar_thr = MRI_SHORT_PTR(im_thr) ;
00168 for( ii=0 ; ii < nvox ; ii++ ){ /* voxel cutting time */
00169 jj = vlist[ii] ; /* actual voxel index in func brick */
00170 if( ar_thr[jj] > -thresh && ar_thr[jj] < thresh ) vlist[ii] = -1 ;
00171 }
00172 }
00173 break ;
00174
00175 case MRI_byte:{
00176 float thresh = im3d->vinfo->func_threshold
00177 * im3d->vinfo->func_thresh_top / scale_thr ;
00178 byte *ar_thr = MRI_BYTE_PTR(im_thr) ;
00179 for( ii=0 ; ii < nvox ; ii++ ){
00180 jj = vlist[ii] ;
00181 if( ar_thr[jj] < thresh ) vlist[ii] = -1 ;
00182 }
00183 }
00184 break ;
00185
00186 case MRI_float:{
00187 float thresh = im3d->vinfo->func_threshold
00188 * im3d->vinfo->func_thresh_top / scale_thr ;
00189 float *ar_thr = MRI_FLOAT_PTR(im_thr) ;
00190 for( ii=0 ; ii < nvox ; ii++ ){
00191 jj = vlist[ii] ;
00192 if( ar_thr[jj] > -thresh && ar_thr[jj] < thresh ) vlist[ii] = -1 ;
00193 }
00194 }
00195 break ;
00196 } /* end of switch on threshold sub-brick type */
00197
00198 /* count surviving voxels; exit if there aren't any */
00199
00200 for( jj=ii=0 ; ii < nvox ; ii++ )
00201 if( vlist[ii] >= 0 ) jj++ ;
00202 if( jj == 0 ){ free(vlist) ; RETURN(0) ; }
00203
00204 /* count output nodes inside each surviving voxel */
00205
00206 for( nout=ii=0 ; ii < nvox ; ii++ )
00207 if( vlist[ii] >= 0 ) nout += numnod[ii] ;
00208
00209 } /* end of if on existence of threshold sub-brick */
00210
00211 /** allocate output structure (maybe too big, but will clip it later) **/
00212
00213 mmm = (SUMA_irgba *) malloc( sizeof(SUMA_irgba) * nout ) ;
00214
00215 /** set overlay colors **/
00216
00217 pbar = im3d->vwid->func->inten_pbar ;
00218 num_lp = pbar->num_panes ;
00219 bm = pbar->bigmode ; /* 02 Feb 2003 */
00220
00221 if( !bm ){ /* indexed colors */
00222 for( lp=0 ; lp < num_lp ; lp++ ) /* overlay color indexes */
00223 fim_ovc[lp] = pbar->ov_index[lp] ; /* run from top of pbar down */
00224
00225 /* overlay color index for values below bottom of pbar */
00226
00227 fim_ovc[num_lp] = (im3d->vinfo->use_posfunc) ? (0) : (fim_ovc[num_lp-1]) ;
00228
00229 /* get the actual RGB colors of each pane on the pbar */
00230
00231 for( lp=0 ; lp <= num_lp ; lp++ ){
00232 ovc_r[lp] = DCOV_REDBYTE (im3d->dc,fim_ovc[lp]) ;
00233 ovc_g[lp] = DCOV_GREENBYTE(im3d->dc,fim_ovc[lp]) ;
00234 ovc_b[lp] = DCOV_BLUEBYTE (im3d->dc,fim_ovc[lp]) ;
00235 }
00236
00237 } else { /* colorscale colors - 02 Feb 2003 */
00238 fbot = (scale_factor/scale_fim)*pbar->bigbot ;
00239 ftop = (scale_factor/scale_fim)*pbar->bigtop ;
00240 ffac = NPANE_BIG / (ftop-fbot) ;
00241 cmap = pbar->bigcolor ;
00242 zbot = (fbot == 0.0) ;
00243 }
00244
00245 /** process im_fim into overlay, depending on data type **/
00246
00247 switch( im_fim->kind ){
00248
00249 default: nvout = nout = 0 ; break ; /* should never happen! */
00250
00251 case MRI_rgb:{ /* 17 Apr 2002 */
00252 byte *ar_fim = MRI_RGB_PTR(im_fim); /* colors direct from fim */
00253 byte r,g,b ;
00254
00255 nvout = nout = 0 ; /* num output nodes & voxels */
00256 for( ii=0 ; ii < nvox ; ii++ ){
00257 jj = vlist[ii] ; if( jj < 0 ) continue ; /* skip voxel? */
00258 r = ar_fim[3*jj]; g = ar_fim[3*jj+1]; b = ar_fim[3*jj+2];
00259 if( r == 0 && g ==0 && b == 0 ) continue ; /* uncolored */
00260 nlist = vn->nlist[ii] ; /* list of nodes */
00261 for( nn=0 ; nn < numnod[ii] ; nn++ ){ /* loop over nodes */
00262 mmm[nout].id = ixyz[nlist[nn]].id ;
00263 mmm[nout].r = r ; mmm[nout].g = g ;
00264 mmm[nout].b = b ; mmm[nout].a = 255 ; nout++ ;
00265 }
00266 nvout++ ; /* number of voxels used */
00267 }
00268 }
00269 break ;
00270
00271 case MRI_short:{
00272 short * ar_fim = MRI_SHORT_PTR(im_fim) ;
00273 float fim_thr[NPANE_MAX] ;
00274 byte r,g,b ;
00275
00276 if( !bm ){ /* indexed colors from panes */
00277 for( lp=0 ; lp < num_lp ; lp++ ) /* thresholds for each pane */
00278 fim_thr[lp] = (scale_factor/scale_fim) * pbar->pval[lp+1] ;
00279 }
00280
00281 nvout = nout = 0 ; /* num output nodes & voxels */
00282 for( ii=0 ; ii < nvox ; ii++ ){
00283 jj = vlist[ii] ; if( jj < 0 ) continue ; /* skip voxel? */
00284 if( ar_fim[jj] == 0 ) continue ; /* no func? */
00285 if( !bm ){ /* find pane this voxel is in */
00286 for( lp=0; lp < num_lp && ar_fim[jj] < fim_thr[lp]; lp++ ) ; /*nada*/
00287 if( fim_ovc[lp] == 0 ) continue ; /* uncolored pane */
00288 r = ovc_r[lp]; g = ovc_g[lp]; b = ovc_b[lp];
00289 } else { /* colorscale - 02 Feb 2003 */
00290 if( zbot && ar_fim[jj] < 0 ) continue ;
00291 val = ffac*(ftop-ar_fim[jj]) ;
00292 if( val < 0.0 ) val = 0.0;
00293 kk = (int)(val+0.49); if( kk >= NPANE_BIG ) kk = NPANE_BIG-1;
00294 r = cmap[kk].r; g = cmap[kk].g; b = cmap[kk].b;
00295 if( r == 0 && g ==0 && b == 0 ) continue ; /* black == uncolored */
00296 }
00297 nlist = vn->nlist[ii] ; /* list of nodes */
00298 for( nn=0 ; nn < numnod[ii] ; nn++ ){ /* loop over nodes */
00299 mmm[nout].id = ixyz[nlist[nn]].id ;
00300 mmm[nout].r = r ; mmm[nout].g = g ;
00301 mmm[nout].b = b ; mmm[nout].a = 255 ; nout++ ;
00302 }
00303 nvout++ ; /* number of voxels used */
00304 }
00305 }
00306 break ;
00307
00308 case MRI_byte:{
00309 byte * ar_fim = MRI_BYTE_PTR(im_fim) ;
00310 float fim_thr[NPANE_MAX] ;
00311 byte r,g,b ;
00312
00313 if( !bm ){ /* indexed colors from panes */
00314 for( lp=0 ; lp < num_lp ; lp++ )
00315 if( pbar->pval[lp+1] <= 0.0 )
00316 fim_thr[lp] = 0 ;
00317 else
00318 fim_thr[lp] = (scale_factor/scale_fim) * pbar->pval[lp+1] ;
00319 }
00320
00321 nvout = nout = 0 ; /* num output nodes */
00322 for( ii=0 ; ii < nvox ; ii++ ){
00323 jj = vlist[ii] ; if( jj < 0 ) continue ; /* skip voxel? */
00324 if( ar_fim[jj] == 0 ) continue ; /* no func? */
00325 if( !bm ){ /* find pane this voxel is in */
00326 for( lp=0; lp < num_lp && ar_fim[jj] < fim_thr[lp]; lp++ ) ; /*nada*/
00327 if( fim_ovc[lp] == 0 ) continue ; /* uncolored pane */
00328 r = ovc_r[lp]; g = ovc_g[lp]; b = ovc_b[lp];
00329 } else { /* colorscale - 02 Feb 2003 */
00330 val = ffac*(ftop-ar_fim[jj]) ;
00331 if( val < 0.0 ) val = 0.0;
00332 kk = (int)(val+0.49); if( kk >= NPANE_BIG ) kk = NPANE_BIG-1;
00333 r = cmap[kk].r; g = cmap[kk].g; b = cmap[kk].b;
00334 if( r == 0 && g ==0 && b == 0 ) continue ; /* black == uncolored */
00335 }
00336 nlist = vn->nlist[ii] ; /* list of nodes */
00337 for( nn=0 ; nn < numnod[ii] ; nn++ ){ /* loop over nodes */
00338 mmm[nout].id = ixyz[nlist[nn]].id ;
00339 mmm[nout].r = r ; mmm[nout].g = g ;
00340 mmm[nout].b = b ; mmm[nout].a = 255 ; nout++ ;
00341 }
00342 nvout++ ; /* number of voxels used */
00343 }
00344 }
00345 break ;
00346
00347 case MRI_float:{
00348 float * ar_fim = MRI_FLOAT_PTR(im_fim) ;
00349 float fim_thr[NPANE_MAX] ;
00350 byte r,g,b ;
00351
00352 if( !bm ){ /* indexed colors from panes */
00353 for( lp=0 ; lp < num_lp ; lp++ )
00354 fim_thr[lp] = (scale_factor/scale_fim) * pbar->pval[lp+1] ;
00355 }
00356
00357 nvout = nout = 0 ; /* num output nodes */
00358 for( ii=0 ; ii < nvox ; ii++ ){
00359 jj = vlist[ii] ; if( jj < 0 ) continue ; /* skip voxel? */
00360 if( ar_fim[jj] == 0.0 ) continue ; /* no func? */
00361 if( !bm ){ /* find pane this voxel is in */
00362 for( lp=0; lp < num_lp && ar_fim[jj] < fim_thr[lp]; lp++ ) ; /*nada*/
00363 if( fim_ovc[lp] == 0 ) continue ; /* uncolored pane */
00364 r = ovc_r[lp]; g = ovc_g[lp]; b = ovc_b[lp];
00365 } else { /* colorscale - 02 Feb 2003 */
00366 if( zbot && ar_fim[jj] < 0.0 ) continue ;
00367 val = ffac*(ftop-ar_fim[jj]) ;
00368 if( val < 0.0 ) val = 0.0;
00369 kk = (int)(val+0.49); if( kk >= NPANE_BIG ) kk = NPANE_BIG-1;
00370 r = cmap[kk].r; g = cmap[kk].g; b = cmap[kk].b;
00371 if( r == 0 && g ==0 && b == 0 ) continue ; /* black == uncolored */
00372 }
00373 nlist = vn->nlist[ii] ; /* list of nodes */
00374 for( nn=0 ; nn < numnod[ii] ; nn++ ){ /* loop over nodes */
00375 mmm[nout].id = ixyz[nlist[nn]].id ;
00376 mmm[nout].r = r ; mmm[nout].g = g ;
00377 mmm[nout].b = b ; mmm[nout].a = 255 ; nout++ ;
00378 }
00379 nvout++ ; /* number of voxels used */
00380 }
00381 }
00382 break ;
00383
00384 } /* end of switch on fim data type */
00385
00386 /** finished: clean up and exit **/
00387
00388 if( vlist != voxijk ) free(vlist) ; /* toss trash, if it is trash */
00389
00390 if( nout == 0 ){ free(mmm); RETURN(0); } /* no overlay? */
00391
00392 /* map gets the array of node IDs + colors */
00393
00394 *map = (SUMA_irgba *) realloc( mmm , sizeof(SUMA_irgba)*nout ) ;
00395
00396 /* nvused gets the number of voxels used */
00397
00398 if( nvused != NULL ) *nvused = nvout ; /* 13 Mar 2002 */
00399
00400 RETURN(nout) ; /* number of entries in map */
00401 }
|
|
||||||||||||||||||||||||||||||||
|
Create a nodal color overlay from a voxel map.
Definition at line 50 of file afni_vol2surf.c. References AFNI_GOOD_FUNC_DTYPE, afni_vol2surf(), v2s_opts_t::debug, v2s_opts_t::dnode, DSET_BRICK, DSET_load, DSET_LOADED, ENTRY, AFNI_view_info::fim_index, Three_D_View::fim_now, free, free_v2s_results(), AFNI_view_info::func_thresh_top, AFNI_view_info::func_threshold, IM3D_VALID, MRI_IMAGE::kind, SUMA_surface::label, map_v2s_results(), v2s_plugin_opts::ready, RETURN, v2s_plugin_opts::sopt, Three_D_View::ss_now, THD_session::su_num, THD_session::su_surf, SUMA_destroy_vnlist(), thd_mask_from_brick(), AFNI_view_info::thr_index, v2s_results::vals, Three_D_View::vinfo, and SUMA_surface::vn. Referenced by AFNI_niml_redisplay_CB().
00052 {
00053 THD_3dim_dataset * oset; /* overlay dataset */
00054 THD_session * ss;
00055 SUMA_surface * sA, * sB;
00056 MRI_IMAGE * im_oim;
00057 v2s_plugin_opts * go;
00058 v2s_results * results;
00059 byte * cmask;
00060 int nout, oind, debug;
00061
00062 ENTRY("AFNI_vol2surf_func_overlay") ;
00063
00064 /* check inputs */
00065 if ( map == NULL || !IM3D_VALID(im3d) ) RETURN(-1);
00066
00067 go = &gv2s_plug_opts;
00068 if ( ! use_defaults && ! go->ready ) RETURN(-1);
00069
00070 debug = go->sopt.debug; /* because I'm lazy */
00071
00072 ss = im3d->ss_now; /* session must have needed surface(s) */
00073 if( ss == NULL ||
00074 ss->su_num <= 0 ||
00075 surfA < 0 ||
00076 ss->su_num <= surfA ||
00077 ss->su_num <= surfB ||
00078 ss->su_surf[surfA] == NULL ||
00079 (surfB >= 0 && ss->su_surf[surfB] == NULL) )
00080 {
00081 if ( debug > 1 )
00082 {
00083 if ( !ss ) fprintf(stderr,"** v2s: NULL session\n");
00084 else
00085 fprintf(stderr,"** v2s: bad session data:\n"
00086 " su_num, surfA, surfB = %d, %d, %d\n",
00087 ss->su_num, surfA, surfB);
00088 }
00089 RETURN(-1);
00090 }
00091
00092 /* init return values */
00093 if ( Rdata ) *Rdata = NULL;
00094 if ( Rthr ) *Rthr = 0.0;
00095
00096 /* set surface pointers */
00097 sA = ss->su_surf[surfA];
00098 sB = ( surfB >= 0 ) ? ss->su_surf[surfB] : NULL;
00099
00100 if ( debug )
00101 {
00102 fprintf(stderr,"++ v2s overlay: sa,sb = %d,%d\n", surfA, surfB);
00103 if ( debug > 1 )
00104 fprintf(stderr," surfA is %s, surfB is %s\n",
00105 sA->label[0] ? sA->label : "<no label>",
00106 sB ? (sB->label[0] ? sB->label : "<no label>") : "<not used>");
00107 }
00108
00109 /*-------------------- overlay image --------------------*/
00110 oset = im3d->fim_now;
00111 oind = im3d->vinfo->fim_index; /* overlay sub-brick index */
00112
00113 if( oset == NULL )
00114 {
00115 if ( debug > 1 ) fprintf(stderr,"** v2s: no overlay dset\n");
00116 RETURN(-1);
00117 }
00118 im_oim = DSET_BRICK(oset,oind);
00119
00120 if( ! im_oim || ! AFNI_GOOD_FUNC_DTYPE(im_oim->kind) )
00121 {
00122 if ( debug > 1 ) fprintf(stderr,"** v2s: no overlay image\n");
00123 RETURN(-1);
00124 }
00125 DSET_load(oset); /* to be sure */
00126 if( !DSET_LOADED(oset) ) RETURN(-1);
00127
00128 /*-------------------- mask from threshold --------------------*/
00129 cmask = NULL;
00130 if( im3d->vinfo->func_threshold > 0.0 ) /* then want a threshold */
00131 {
00132 MRI_IMAGE * im_thr;
00133 float thresh;
00134 int tind = im3d->vinfo->thr_index;
00135
00136 im_thr = DSET_BRICK(oset,tind);
00137
00138 /* note real threshold */
00139 thresh = im3d->vinfo->func_threshold * im3d->vinfo->func_thresh_top;
00140
00141 /* maybe we want to return this */
00142 if ( Rthr ) *Rthr = thresh;
00143
00144 if( im_thr && !AFNI_GOOD_FUNC_DTYPE(im_thr->kind) )
00145 im_thr = NULL;
00146
00147 /* create the mask, if this fails, just continue... */
00148 if( im_thr != NULL )
00149 {
00150 int nset;
00151 if ( debug > 1 )
00152 fprintf(stderr,"++ mask from index %d and thresh %f\n",
00153 tind,thresh);
00154 nset = thd_mask_from_brick(oset, tind, thresh, &cmask, 1);
00155 if ( debug > 1 )
00156 {
00157 if ( ! cmask )
00158 fprintf(stderr,"-- no mask created\n");
00159 else
00160 fprintf(stderr,"++ mask has %d set voxels\n", nset);
00161 }
00162 }
00163 else if ( debug > 1 )
00164 fprintf(stderr,"-- no threshold mask\n");
00165 }
00166
00167 /*-------------------- vol2surf computation --------------------*/
00168 results = afni_vol2surf(oset, oind, sA, sB, cmask, use_defaults);
00169
00170 if ( cmask ) free(cmask); /* we're done with the mask */
00171 if ( ! results )
00172 {
00173 if ( debug ) fprintf(stderr,"-- vol2surf failure\n");
00174 RETURN(-1); /* failure? */
00175 }
00176
00177 /*-------------------- lose old vnlist --------------------*/
00178 /* vol2surf has no method for counting voxels (right now) */
00179 if( sA->vn )
00180 {
00181 if ( debug > 1 ) fprintf(stderr,"-- destroying vnlist\n");
00182 SUMA_destroy_vnlist( sA->vn ) ;
00183 sA->vn = NULL;
00184 }
00185
00186 /*-------------------- set overlay colors --------------------*/
00187 nout = map_v2s_results(results, im3d, map, debug, go->sopt.dnode);
00188
00189 /* before free()ing results, check whether we want to return the values */
00190 if ( Rdata )
00191 {
00192 *Rdata = results->vals[0];
00193 results->vals[0] = NULL; /* do not let free_v2s_results() free it */
00194 }
00195
00196 free_v2s_results(results);
00197
00198 if ( debug > 1 ) fprintf(stderr,"++ map_v2s_results: nout = %d\n", nout);
00199
00200 /* check failure */
00201 if ( ! *map ) RETURN(-1);
00202
00203 RETURN(nout);
00204 }
|
|
||||||||||||||||
|
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 }
|
|
||||||||||||||||
|
for any controllers whose active datasets were written out, we need to set the "See Brick" buttons to be sensitive. * Definition at line 3759 of file afni_func.c. References AFNI_refashion_dataset(), AFNI_reset_func_range(), AFNI_set_viewpoint(), Three_D_View::anat_now, AFNI_view_info::anat_resam_mode, AFNI_datamode_widgets::anatmode_bbox, BEEPIT, CURRENT_DAXES, DATAXES_TYPE, THD_3dim_dataset::daxes, Three_D_View::dc, AF_options::destruct, MCW_DC::display, AFNI_widget_set::dmode, DMODE_BRICK, DSET_IS_1D, DSET_IS_ANALYZE, DSET_IS_CTFMRI, DSET_IS_CTFSAM, DSET_IS_MINC, DSET_IS_NIFTI, DSET_WRITEABLE, ENTRY, Three_D_View::fim_now, FIRST_RESAM_TYPE, AFNI_view_info::func_resam_mode, AFNI_datamode_widgets::funcmode_bbox, GLOBAL_argopt, GLOBAL_library, AFNI_library_type::have_dummy_dataset, IM3D_VALID, ISFUNC, ISVALID_3DIM_DATASET, LAST_RESAM_TYPE, LOAD_DSET_VIEWS, MCW_CALLER_KILL, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, REDISPLAY_OVERLAY, AFNI_view_info::resam_vox, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, STATUS, THD_edit_dataxes(), AFNI_widget_set::top_shell, THD_dataxes::type, Three_D_View::vinfo, Three_D_View::vwid, MCW_bbox::wbut, THD_3dim_dataset::wod_flag, AFNI_datamode_widgets::write_anat_pb, AFNI_datamode_widgets::write_func_pb, and AFNI_view_info::writeownsize.
03760 {
03761 Three_D_View *im3d = (Three_D_View *) cd ;
03762 THD_3dim_dataset *dset = NULL ;
03763 THD_dataxes new_daxes ;
03764 Widget wmsg ;
03765 int resam_mode ;
03766 Boolean good , destroy ;
03767
03768 ENTRY("AFNI_write_dataset_CB") ;
03769
03770 if( ! IM3D_VALID(im3d) || w == NULL ||
03771 ! XtIsWidget(w) || ! XtIsRealized(w) ) EXRETURN ;
03772 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; EXRETURN ; }
03773
03774 if( w == im3d->vwid->dmode->write_anat_pb ){ /* write anatomy */
03775 dset = im3d->anat_now ;
03776 resam_mode = im3d->vinfo->anat_resam_mode ;
03777
03778 } else if( w == im3d->vwid->dmode->write_func_pb ){ /* write function */
03779 dset = im3d->fim_now ;
03780 resam_mode = im3d->vinfo->func_resam_mode ;
03781 }
03782
03783 good = ISVALID_3DIM_DATASET(dset) && /* check for bad data */
03784 resam_mode >= FIRST_RESAM_TYPE &&
03785 resam_mode <= LAST_RESAM_TYPE &&
03786 im3d->vinfo->resam_vox > 0.0 &&
03787 !DSET_IS_MINC(dset) && /* 29 Oct 2001 */
03788 !DSET_IS_ANALYZE(dset) && /* 27 Aug 2002 */
03789 !DSET_IS_CTFSAM(dset) &&
03790 !DSET_IS_CTFMRI(dset) &&
03791 !DSET_IS_1D(dset) &&
03792 !DSET_IS_NIFTI(dset) /* 28 Aug 2003 */
03793 ;
03794
03795 destroy = !DSET_WRITEABLE(dset) ; /* check for destruction */
03796
03797 if( good && destroy ){
03798 if( GLOBAL_argopt.destruct ){
03799 (void) MCW_popup_message( w ,
03800 "******************************\n"
03801 "** Potentially destructive **\n"
03802 "** dataset write initiated! **\n"
03803 "******************************" ,
03804 MCW_USER_KILL | MCW_TIMER_KILL ) ;
03805 } else {
03806 good = False ; /* destruction not OK */
03807 }
03808 }
03809
03810 if( !good ){
03811
03812 XBell(im3d->dc->display,100) ; /* for the fun of it! */
03813
03814 (void) MCW_popup_message( w ,
03815 "****************************************************\n"
03816 "** Cannot write dataset for one of these reasons: **\n"
03817 "** -- It isn't allowed to write data in the **\n"
03818 "** Original View. **\n"
03819 "** -- It isn't allowed to overwrite data that **\n"
03820 "** is not warped from some other dataset. **\n"
03821 "** -- An internal program error has occured! **\n"
03822 "****************************************************" ,
03823 MCW_USER_KILL | MCW_TIMER_KILL ) ;
03824
03825 EXRETURN;
03826 }
03827
03828 SHOW_AFNI_PAUSE ;
03829
03830 wmsg = MCW_popup_message( w ,
03831 "*******************************\n"
03832 "** Please wait for dataset **\n"
03833 "** computations and disk I/O **\n"
03834 "*******************************" , MCW_CALLER_KILL ) ;
03835
03836 XtSetSensitive( im3d->vwid->top_shell , False ) ;
03837 XmUpdateDisplay( im3d->vwid->top_shell ) ;
03838
03839 LOAD_DSET_VIEWS(im3d) ; /* 02 Nov 1996 */
03840
03841 new_daxes.type = DATAXES_TYPE ;
03842
03843 #ifdef USE_WRITEOWNSIZE
03844 if( im3d->vinfo->writeownsize )
03845 THD_edit_dataxes( im3d->vinfo->resam_vox , dset->daxes , &new_daxes ) ;
03846 else
03847 #endif
03848 new_daxes = *CURRENT_DAXES(im3d->anat_now) ;
03849
03850 good = AFNI_refashion_dataset( im3d , dset , &new_daxes , resam_mode ) ;
03851
03852 if(PRINT_TRACING){
03853 if( good ){
03854 STATUS("successful refashioning") ;
03855 } else {
03856 STATUS("failed refashioning") ;
03857 }}
03858
03859 if( good && ISFUNC(dset) ){
03860 AFNI_reset_func_range( im3d ) ;
03861 AFNI_set_viewpoint( im3d , -1,-1,-1 , REDISPLAY_OVERLAY ) ; /* redraw */
03862 }
03863
03864 XtSetSensitive( im3d->vwid->top_shell , True ) ;
03865
03866 XtDestroyWidget( wmsg ) ;
03867 SHOW_AFNI_READY ;
03868
03869 /* allow the "use data brick" button, if we just wrote the anat out */
03870
03871 if( good && w == im3d->vwid->dmode->write_anat_pb ){
03872 STATUS("resetting 'use anat brick' button") ;
03873 XtSetSensitive( im3d->vwid->dmode->anatmode_bbox->wbut[DMODE_BRICK] , True ) ;
03874 }
03875
03876 if( good && w == im3d->vwid->dmode->write_func_pb ){
03877 STATUS("resetting 'use func brick' button") ;
03878 XtSetSensitive( im3d->vwid->dmode->funcmode_bbox->wbut[DMODE_BRICK] , True ) ;
03879 }
03880
03881 if( ! good ){ /* bad news! */
03882
03883 XBell(im3d->dc->display,100) ; /* for the fun of it! */
03884 (void) MCW_popup_message( w ,
03885 "***************************************\n"
03886 "** Attempt to write dataset failed **\n"
03887 "** for unknown reasons! Check files! **\n"
03888 "***************************************" ,
03889 MCW_USER_KILL ) ;
03890
03891 dset->wod_flag = True ;
03892 }
03893
03894 EXRETURN ;
03895 }
|
|
||||||||||||||||
|
Definition at line 3521 of file afni_func.c. References ADDTO_SARR, AFNI_do_many_writes(), BEEPIT, THD_3dim_dataset::dblk, Three_D_View::dc, THD_diskptr::directory_name, THD_datablock::diskptr, MCW_DC::display, DSET_NUM_TIMES, DSET_NVALS, DSET_WRITEABLE, THD_session::dsset, ENTRY, THD_diskptr::filecode, THD_3dim_dataset::func_type, GLOBAL_library, AFNI_library_type::have_dummy_dataset, THD_3dim_dataset::idcode, IM3D_OPEN, INIT_SARR, ISANAT, ISANATBUCKET, ISFUNC, ISFUNCBUCKET, MAX, MCW_choose_multi_editable_strlist(), MCW_choose_multi_strlist(), MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, mcwCT_multi_mode, MIN, myXtFree, THD_session::num_dsset, THD_sessionlist::num_sess, SESSTRAIL, THD_sessionlist::ssar, AFNI_library_type::sslist, THD_MAX_NAME, THD_trailname(), AFNI_view_info::view_type, Three_D_View::vinfo, and XtRealloc.
03522 {
03523 Three_D_View *im3d = (Three_D_View *) cd ;
03524 static MCW_idcode * idclist = NULL ;
03525 static char **strlist = NULL ;
03526 static int num_dset = -1 ;
03527
03528 int iss , id , vv , llen , ltop ;
03529 THD_session *ss ;
03530 THD_3dim_dataset *dset ;
03531 char nam[THD_MAX_NAME+16] , *tnam , qnam[THD_MAX_NAME+16] ;
03532
03533 ENTRY("AFNI_write_many_dataset_CB") ;
03534
03535 if( ! IM3D_OPEN(im3d) ) EXRETURN ;
03536 if( GLOBAL_library.have_dummy_dataset ){ BEEPIT ; EXRETURN ; }
03537
03538 if( num_dset > 0 && strlist != NULL )
03539 for( id=0 ; id < num_dset ; id++ ) myXtFree(strlist[id]) ;
03540 myXtFree(idclist) ; myXtFree(strlist) ;
03541
03542 vv = im3d->vinfo->view_type ; /* select view type */
03543
03544 /** scan once to find longest string name **/
03545
03546 ltop = 4 ;
03547 for( iss=0 ; iss < GLOBAL_library.sslist->num_sess ; iss++ ){
03548 ss = GLOBAL_library.sslist->ssar[iss] ;
03549
03550 for( id=0 ; id < ss->num_dsset ; id++ ){
03551 dset = ss->dsset[id][vv] ;
03552 if( DSET_WRITEABLE(dset) ){
03553 strcpy( nam , dset->dblk->diskptr->directory_name ) ;
03554 strcat( nam , dset->dblk->diskptr->filecode ) ;
03555 tnam = THD_trailname(nam,SESSTRAIL+1) ;
03556 llen = strlen(tnam) ; ltop = MAX(ltop,llen) ;
03557 }
03558 }
03559 }
03560 ltop = MIN(ltop,THD_MAX_NAME) ; /* 06 Aug 2002 */
03561
03562 num_dset = 0 ;
03563 for( iss=0 ; iss < GLOBAL_library.sslist->num_sess ; iss++ ){
03564 ss = GLOBAL_library.sslist->ssar[iss] ;
03565
03566 /* check anat datasets */
03567
03568 for( id=0 ; id < ss->num_dsset ; id++ ){
03569 dset = ss->dsset[id][vv] ;
03570 if( DSET_WRITEABLE(dset) ){
03571 num_dset++ ;
03572 idclist = (MCW_idcode *) XtRealloc( (char *) idclist ,
03573 sizeof(MCW_idcode) * num_dset ) ;
03574 strlist = (char **) XtRealloc( (char *) strlist ,
03575 sizeof(char *) * num_dset ) ;
03576
03577 strcpy( nam , dset->dblk->diskptr->directory_name ) ;
03578 strcat( nam , dset->dblk->diskptr->filecode ) ;
03579 tnam = THD_trailname(nam,SESSTRAIL+1) ;
03580
03581 if( ISANAT(dset) ){
03582 if( ISANATBUCKET(dset) ) /* 30 Nov 1997 */
03583 sprintf(qnam,"%-*s [%s:%d]" ,
03584 ltop,tnam , ANAT_prefixstr[dset->func_type] , DSET_NVALS(dset) ) ;
03585
03586 else if( DSET_NUM_TIMES(dset) == 1 )
03587 sprintf(qnam,"%-*s [%s]" ,
03588 ltop,tnam ,ANAT_prefixstr[dset->func_type] ) ;
03589
03590 else
03591 sprintf(qnam,"%-*s [%s:3D+t]" ,
03592 ltop,tnam , ANAT_prefixstr[dset->func_type] ) ;
03593
03594 } else if( ISFUNC(dset) ){
03595 if( ISFUNCBUCKET(dset) ) /* 30 Nov 1997 */
03596 sprintf(qnam,"%-*s [%s:%d]" ,
03597 ltop,tnam , FUNC_prefixstr[dset->func_type] , DSET_NVALS(dset) ) ;
03598
03599 else if( DSET_NUM_TIMES(dset) == 1 )
03600 sprintf(qnam,"%-*s [%s]" ,
03601 ltop,tnam , FUNC_prefixstr[dset->func_type] ) ;
03602
03603 else
03604 sprintf(qnam,"%-*s [%s:3D+t]" ,
03605 ltop,tnam , FUNC_prefixstr[dset->func_type] ) ;
03606 }
03607
03608 strlist[num_dset-1] = XtNewString(qnam) ;
03609 idclist[num_dset-1] = dset->idcode ;
03610 }
03611 } /* end of loop over datasets */
03612
03613 } /* end of loop over sessions */
03614
03615 if( num_dset <= 0 ){
03616 XBell(im3d->dc->display,100) ; /* for the fun of it! */
03617
03618 (void) MCW_popup_message( w ,
03619 "*******************************\n"
03620 "** No datasets are available **\n"
03621 "** to write out to disk. **\n"
03622 "*******************************" ,
03623 MCW_USER_KILL | MCW_TIMER_KILL ) ;
03624 EXRETURN ;
03625 }
03626
03627 #if 1
03628 MCW_choose_multi_strlist( w , "Datasets to Write" , mcwCT_multi_mode ,
03629 num_dset , NULL , strlist ,
03630 AFNI_do_many_writes , (XtPointer) idclist ) ;
03631 #else
03632 { THD_string_array *sar ; /*** This code is for experiments only! ***/
03633 INIT_SARR(sar) ;
03634 for( id=0 ; id < num_dset ; id++ ) ADDTO_SARR(sar,strlist[id]) ;
03635
03636 MCW_choose_multi_editable_strlist( w , "Datasets to Write" , mcwCT_multi_mode ,
03637 sar , NULL ,
03638 AFNI_do_many_writes , (XtPointer) idclist ) ;
03639 }
03640 #endif
03641
03642 XtVaSetValues( w , XmNuserData , (XtPointer) im3d , NULL ) ;
03643
03644 EXRETURN ;
03645 }
|
|
||||||||||||||||
|
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 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 908 of file afni_receive.c. References ISVALID_DSET, TEMP_FVEC3, THD_3dmm_to_dicomm(), and THD_fvec3::xyz.
00911 {
00912 THD_fvec3 fv ;
00913
00914 if( ! ISVALID_DSET(dset) ) return ;
00915
00916 fv = THD_3dmm_to_dicomm( dset , TEMP_FVEC3(xx,yy,zz) ) ;
00917 *xd = fv.xyz[0] ;
00918 *yd = fv.xyz[1] ;
00919 *zd = fv.xyz[2] ;
00920 return ;
00921 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 893 of file afni_receive.c. References THD_ivec3::ijk, ISVALID_DSET, TEMP_FVEC3, and THD_3dmm_to_3dind().
00896 {
00897 THD_ivec3 iv ;
00898
00899 if( ! ISVALID_DSET(dset) ) return ;
00900
00901 iv = THD_3dmm_to_3dind ( dset , TEMP_FVEC3(xx,yy,zz) ) ;
00902 *ii = iv.ijk[0] ;
00903 *jj = iv.ijk[1] ;
00904 *kk = iv.ijk[2] ;
00905 return ;
00906 }
|
|
|
Determine if dset is in the AFNI global session - 21 Dec 2001. ---------------------------------------------------------------------- Definition at line 1913 of file afni_func.c. References THD_slist_find::dset, FIND_IDCODE, GLOBAL_library, THD_3dim_dataset::idcode, ISVALID_DSET, AFNI_library_type::session, and THD_dset_in_session(). Referenced by AFNI_choose_dataset_CB(), AFNI_force_adoption(), AFNI_make_descendants_old(), and AFNI_rescan_session_OLD().
01914 {
01915 THD_slist_find find ;
01916
01917 if( !ISVALID_DSET(dset) ) return 0 ;
01918
01919 find = THD_dset_in_session( FIND_IDCODE ,
01920 &(dset->idcode) ,
01921 GLOBAL_library.session ) ;
01922
01923 return (find.dset != NULL) ;
01924 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 539 of file afni_pplug_env.c. References ENV_NUMBER_EDITABLE, ENV_NUMBER_FIXED, generic_func, HINT_NMAX, malloc, MCW_strncpy, NAME_NMAX, NUM_env_var, realloc, ENV_var::vbot, ENV_var::vdecim, ENV_var::vdef, ENV_var::vfunc, ENV_var::vtop, and ENV_var::vtype. Referenced by ENV_init().
00542 {
00543 int ii ;
00544
00545 if( vname == NULL || vname[0] == '\0' ) return ;
00546 if( vhint == NULL || vhint[0] == '\0' ) return ;
00547 if( vbot >= vtop ) return ;
00548
00549 if( NUM_env_var == 0 )
00550 env_var = (ENV_var *) malloc(sizeof(ENV_var)) ;
00551 else
00552 env_var = (ENV_var *) realloc(env_var,(NUM_env_var+1)*sizeof(ENV_var)) ;
00553
00554 ii = NUM_env_var ; NUM_env_var++ ;
00555
00556 MCW_strncpy( env_var[ii].vname , vname , NAME_NMAX ) ;
00557 MCW_strncpy( env_var[ii].vhint , vhint , HINT_NMAX ) ;
00558
00559 env_var[ii].vtype = (vtop-vbot < 100) ? ENV_NUMBER_FIXED
00560 : ENV_NUMBER_EDITABLE ;
00561
00562 env_var[ii].vbot = vbot ;
00563 env_var[ii].vtop = vtop ;
00564 env_var[ii].vdecim = vdecim ;
00565 env_var[ii].vdef = vdef ;
00566 env_var[ii].vfunc = cbfunc ;
00567
00568 return ;
00569 }
|
|
||||||||||||||||||||||||
|
Definition at line 577 of file afni_pplug_env.c. References ENV_STRING, generic_func, HINT_NMAX, malloc, MCW_strncpy, NAME_NMAX, NUM_env_var, realloc, ENV_var::vcount, ENV_var::vfunc, ENV_var::vlist, and ENV_var::vtype. Referenced by ENV_add_yesno(), and ENV_init().
00579 {
00580 int ii ;
00581
00582 if( vname == NULL || vname[0] == '\0' ) return ;
00583 if( vhint == NULL || vhint[0] == '\0' ) return ;
00584 if( vcount < 0 ) return ;
00585 if( vcount > 0 && vlist == NULL ) return ;
00586
00587 if( NUM_env_var == 0 )
00588 env_var = (ENV_var *) malloc(sizeof(ENV_var)) ;
00589 else
00590 env_var = (ENV_var *) realloc(env_var,(NUM_env_var+1)*sizeof(ENV_var)) ;
00591
00592 ii = NUM_env_var ; NUM_env_var++ ;
00593
00594 MCW_strncpy( env_var[ii].vname , vname , NAME_NMAX ) ;
00595 MCW_strncpy( env_var[ii].vhint , vhint , HINT_NMAX ) ;
00596
00597 env_var[ii].vtype = ENV_STRING ;
00598 env_var[ii].vcount = vcount ;
00599 env_var[ii].vlist = vlist ;
00600 env_var[ii].vfunc = cbfunc ;
00601
00602 return ;
00603 }
|
|
||||||||||||
|
Definition at line 571 of file afni_pplug_env.c. References ENV_add_string(), NUM_yesno_list, and yesno_list. Referenced by ENV_init().
00572 {
00573 ENV_add_string( vname , vhint ,
00574 NUM_yesno_list , yesno_list , NULL ) ;
00575 }
|
|
|
Definition at line 173 of file afni_pplug_env.c. References AV_SHIFT_VAL, cord_strings, ENV_add_numeric(), ENV_add_string(), ENV_add_yesno(), ENV_compressor(), ENV_coorder(), ENV_cwd(), env_fixed, ENV_globalrange(), ENV_leftisleft(), ENV_main(), ENV_marksquality(), ENV_NUMBER_EDITABLE, ENV_NUMBER_FIXED, ENV_redisplay(), ENV_redraw_titles(), ENV_sesstrail(), ENV_STRING, ENV_trusthost(), free, getenv(), help_end, help_mid, help_start, malloc, NAME_NMAX, NUM_COMPRESS_elist, NUM_cord_strings, NUM_env_fixed, NUM_env_var, NUM_threshlock_list, NUM_yesno_list, PLUTO_add_hint(), PLUTO_set_runlabels(), PLUTO_string_index(), SESSTRAIL, strtod(), THD_zzprintf(), threshlock_list, VAL_NMAX, ENV_var::vbot, ENV_var::vcount, ENV_var::vdef, ENV_var::vlist, ENV_var::vtop, ENV_var::vtype, and yesno_list. Referenced by AFNI_misc_CB().
00174 {
00175 PLUGIN_interface *plint ; /* will be the output of this routine */
00176
00177 char *helpstring=NULL , *ept , *eval ;
00178 int ii ;
00179
00180 /*------- some environment variables for AFNI ------*/
00181
00182 { static char buf[VAL_NMAX] = "AFNI_CWD=" ; /* 22 Feb 2001 */
00183 ept = getcwd( buf+9 , VAL_NMAX-9 ) ;
00184 if( ept != NULL ){
00185 putenv(buf) ;
00186 ENV_add_string( "AFNI_CWD" ,
00187 "Current working directory (gets output files)" ,
00188 0,NULL , ENV_cwd ) ;
00189 }
00190 }
00191
00192 ENV_add_string( "AFNI_ENFORCE_ASPECT" ,
00193 "To make AFNI enforce image window aspect ratio?" ,
00194 NUM_yesno_list , yesno_list , NULL ) ;
00195
00196 ENV_add_numeric( "AFNI_FIM_PERCENT_LIMIT" ,
00197 "Upper limit on % Change in FIM" ,
00198 10,1000,0,100 , NULL ) ;
00199
00200 ENV_add_numeric( "AFNI_IMAGE_MINFRAC" ,
00201 "Minimum size of image window" ,
00202 0,10,2,2 , NULL ) ;
00203
00204 ENV_add_string( "AFNI_LEFT_IS_LEFT" ,
00205 "To show subject's left on image left?" ,
00206 NUM_yesno_list , yesno_list , ENV_leftisleft ) ;
00207
00208 ENV_add_string( "AFNI_NO_SIDES_LABELS" ,
00209 "Skip showing image window left-side label?" ,
00210 NUM_yesno_list , yesno_list , NULL ) ;
00211
00212 ENV_add_string( "AFNI_VIEW_ANAT_BRICK" ,
00213 "Show OverLay brick whenever possible" ,
00214 NUM_yesno_list , yesno_list , NULL ) ;
00215
00216 ENV_add_string( "AFNI_VIEW_FUNC_BRICK" ,
00217 "Show UnderLay brick whenever possible" ,
00218 NUM_yesno_list , yesno_list , NULL ) ;
00219
00220 ENV_add_string( "AFNI_ORIENT" ,
00221 "Coordinate display orientation" ,
00222 NUM_cord_strings,cord_strings , ENV_coorder ) ;
00223
00224 ENV_add_string( "AFNI_MARKERS_NOQUAL" ,
00225 "Skip markers quality checking?" ,
00226 NUM_yesno_list , yesno_list , ENV_marksquality ) ;
00227
00228 ENV_add_string( "AFNI_COMPRESSOR" ,
00229 "Output BRIK compression method" ,
00230 NUM_COMPRESS_elist,COMPRESS_elist , ENV_compressor ) ;
00231
00232 ENV_add_string( "AFNI_AUTOGZIP" ,
00233 "Use gzip on output if BRIK seems highly compressible" ,
00234 NUM_yesno_list , yesno_list , NULL ) ;
00235
00236 #if 0
00237 ENV_add_string( "AFNI_BYTEORDER" ,
00238 "Byte ordering for output BRIKs" ,
00239 NUM_byteorder_list , byteorder_list , ENV_byteorder ) ;
00240 #endif
00241
00242 #if 0
00243 ENV_add_string( "AFNI_NOMMAP" ,
00244 "Whether to read BRIKs using mmap()" ,
00245 NUM_yesno_list , yesno_list , NULL ) ;
00246 #endif
00247
00248 ENV_add_string( "AFNI_FLOATSCAN" ,
00249 "Scan floating BRIKs for errors on input?" ,
00250 NUM_yesno_list , yesno_list , NULL ) ;
00251
00252 #ifdef USE_SESSTRAIL
00253 ENV_add_numeric( "AFNI_SESSTRAIL" ,
00254 "# directory levels seen in Switch Session, etc." ,
00255 0,9,0,SESSTRAIL , ENV_sesstrail ) ;
00256 #endif
00257
00258 ENV_add_string( "AFNI_PBAR_IMXY" ,
00259 "Sizes of 'Save to PPM' for color pbars" ,
00260 0,NULL , NULL ) ;
00261
00262 ENV_add_string( "AFNI_PSPRINT" ,
00263 "Command to send stdin to PostScript printer" ,
00264 0,NULL , NULL ) ;
00265
00266 ENV_add_string( "AFNI_TRUSTHOST" ,
00267 "Name of host to trust for plugouts and realtime data" ,
00268 0,NULL , ENV_trusthost ) ;
00269
00270 ENV_add_string( "AFNI_IMAGE_LABEL_COLOR" ,
00271 "Name of color for image overlay labels" , /* 21 Sep 2001 */
00272 0,NULL , NULL ) ;
00273
00274 ENV_add_numeric( "AFNI_IMAGE_LABEL_SETBACK" ,
00275 "Size of setback for image overlay labels" ,
00276 0 , 40 , 3 , 3 , NULL ) ;
00277
00278 if( SUMA_ENABLED ){
00279 ENV_add_string( "AFNI_SUMA_BOXCOLOR" , /* 21 Sep 2001 */
00280 "Color name for surface node overlays [or none]" ,
00281 0,NULL , NULL ) ;
00282
00283 ENV_add_numeric( "AFNI_SUMA_BOXSIZE" , /* 10 Mar 2002 */
00284 "Box size for surface node overlays" ,
00285 1 , 10 , 1 , 2 , NULL ) ;
00286
00287 ENV_add_string( "AFNI_SUMA_LINECOLOR" , /* 10 Mar 2002 */
00288 "Color name for surface line overlays [or none]" ,
00289 0,NULL , NULL ) ;
00290
00291 ENV_add_numeric( "AFNI_SUMA_LINESIZE" , /* 15 Jan 2003 */
00292 "Line thickness for surface intersection overlay" ,
00293 0 , 30 , 3 , 0 , NULL ) ;
00294 }
00295
00296 #ifndef NO_FRIVOLITIES
00297 ENV_add_string( "AFNI_IMAGE_PGMFILE" ,
00298 "Image file for AFNI splash window" ,
00299 0,NULL , NULL ) ;
00300 #endif
00301
00302 /* 08 Aug 2001 */
00303
00304 ENV_add_yesno( "AFNI_DONT_MOVE_MENUS" ,
00305 "Move popup menus to enhance visibility?" ) ;
00306
00307 /* 07 Mar 2002 */
00308
00309 ENV_add_numeric( "AFNI_GRAPH_TEXTLIMIT" ,
00310 "Max rows in Graph Button-3 popup" ,
00311 1 , 99 , 0 , 40 , NULL ) ;
00312
00313 /* 16 Mar 2002 */
00314
00315 ENV_add_string( "AFNI_KEEP_PANNING" ,
00316 "Keep 'pan' turned on in image viewers?" ,
00317 NUM_yesno_list , yesno_list , NULL ) ;
00318
00319 /* 18 Mar 2002 */
00320
00321 ENV_add_string( "AFNI_VALUE_LABEL" ,
00322 "Turn on the Define Overlay dataset value label?" ,
00323 NUM_yesno_list , yesno_list , NULL ) ;
00324
00325 /* 22 Mar 2002 */
00326
00327 ENV_add_string( "AFNI_CROSSHAIR_LINES" ,
00328 "Draw crosshairs with lines, not overlay voxels?" ,
00329 NUM_yesno_list , yesno_list , NULL ) ;
00330
00331 /* 25 Mar 2002 */
00332
00333 ENV_add_string( "AFNI_CROP_ZOOMSAVE" ,
00334 "Crop zoomed images when saving to disk?" ,
00335 NUM_yesno_list , yesno_list , NULL ) ;
00336
00337 /* 23 Aug 2003 */
00338
00339 ENV_add_numeric( "AFNI_MAX_OPTMENU" ,
00340 "Max buttons in an Option Menu" ,
00341 100 , 100000 , 0 , 255 , NULL ) ;
00342
00343 /* 23 Oct 2003 */
00344
00345 ENV_add_numeric( "AFNI_STROKE_THRESHOLD" ,
00346 "Coarseness of grayscale stroking" ,
00347 8 , 99 , 0 , 32 , NULL ) ;
00348
00349 ENV_add_string( "AFNI_STROKE_AUTOPLOT" ,
00350 "To automatically draw grayscale-data value plot?" ,
00351 NUM_yesno_list , yesno_list , NULL ) ;
00352
00353 /* 04 Nov 2003 */
00354
00355 ENV_add_string( "AFNI_IMAGE_MINTOMAX" ,
00356 "Set image viewers to do min-to-max grayscaling?" ,
00357 NUM_yesno_list , yesno_list , NULL ) ;
00358
00359 ENV_add_string( "AFNI_IMAGE_GLOBALRANGE" ,
00360 "Set image viewers to use 3D global data range min-to-max?" ,
00361 NUM_yesno_list , yesno_list , ENV_globalrange ) ;
00362
00363 /* 19 Nov 2003 */
00364
00365 ENV_add_numeric( "AFNI_DRAW_UNDOSIZE" ,
00366 "Megabytes allowed for Drawing Undo" ,
00367 1 , 999 , 0 , 6 , NULL ) ;
00368
00369 #if !defined(NO_FRIVOLITIES) && defined(DARWIN)
00370 ENV_add_yesno( "AFNI_SPEECH" , "Allow speech synthesis?" ) ; /* 03 Dec 2003 */
00371 #endif
00372
00373 ENV_add_numeric( "AFNI_VIDEO_DELAY" , /* 04 Dec 2003 */
00374 "Image redraw interval for 'V' or 'v' (ms)." ,
00375 1,9000,0,1 , NULL ) ;
00376
00377 ENV_add_numeric( "AFNI_IMAGE_ENTROPY" ,
00378 "Entropy threshold: below this, 2%-98% is off." ,
00379 0,10,1,0 , NULL ) ;
00380
00381 ENV_add_string( "AFNI_THRESH_LOCK" , /* 06 Feb 2004 */
00382 "Lock Threshold slider values together?" ,
00383 NUM_threshlock_list , threshlock_list , NULL ) ;
00384
00385 ENV_add_yesno( "AFNI_PBAR_LOCK" , "Lock Color Pbars together?" ) ; /* 07 Feb 2004 */
00386 ENV_add_yesno( "AFNI_RANGE_LOCK", "Lock OLay Ranges together?" ) ; /* 23 Feb 2004 */
00387
00388 ENV_add_yesno( "AFNI_DISP_SCROLLBARS" , "Image Disp menu get scrollbars?" ) ;
00389
00390 /* 23 Feb 2004 [rickr] */
00391 ENV_add_yesno( "AFNI_IMAGE_ZOOM_NN" ,
00392 "Use Nearest Neighbor interpolation for image Zoom?" ) ;
00393
00394 /* 22 Mar 2004 [RWCox] */
00395 ENV_add_yesno( "AFNI_SLAVE_FUNCTIME" , "Time Index affects functional overlay?" ) ;
00396 ENV_add_yesno( "AFNI_SLAVE_THRTIME" , "Time Index affects threshold overlay?" ) ;
00397
00398 ENV_add_string( "AFNI_REALTIME_MP_HOST_PORT" , /* 31 Mar 2004 [rickr] */
00399 "Supply host:port string for realtime motion parameters." ,
00400 0,NULL , NULL ) ;
00401
00402 /* 07 Apr 2004 [RWCox] */
00403 ENV_add_yesno( "AFNI_X11_REDECORATE" , "Try to set X11 window 'decorations'?" ) ;
00404
00405 /* 21 Dec 2004 [RWCox] */
00406 ENV_add_string( "AFNI_TITLE_LABEL2" ,
00407 "Use 'label2' field for window titles?" ,
00408 NUM_yesno_list , yesno_list , ENV_redraw_titles ) ;
00409
00410 /* 21 Mar 2005 [RWCox] */
00411 ENV_add_string( "AFNI_EDGIZE_OVERLAY" ,
00412 "Display color overlay as edges only?" ,
00413 NUM_yesno_list , yesno_list , ENV_redisplay ) ;
00414
00415 /* 08 Apr 2005 [rickr] */
00416 ENV_add_numeric( "AFNI_NIFTI_DEBUG" ,
00417 "Set nifti_io debug level (should then do Rescan:This)" ,
00418 0,5,0,0 , NULL ) ;
00419
00420 /* 20 Apr 2005 [RWCox] */
00421 ENV_add_string( "AFNI_OVERLAY_ZERO" ,
00422 "Do 0 values get color in an Overlay?" ,
00423 NUM_yesno_list , yesno_list , ENV_redisplay ) ;
00424
00425 /*---------------- compute helpstring -----------------------*/
00426
00427 helpstring = THD_zzprintf( helpstring , "%s\n" , help_start ) ;
00428
00429 for( ii=0 ; ii < NUM_env_fixed ; ii++ ){
00430 ept = getenv(env_fixed[ii]) ;
00431 if( ept == NULL )
00432 eval = "(Not set)" ;
00433 else if( ept[0] == '\0' )
00434 eval = "(Set to empty string)" ;
00435 else
00436 eval = ept ;
00437 helpstring = THD_zzprintf( helpstring, " %-25.25s= %s\n",
00438 env_fixed[ii],eval ) ;
00439 }
00440
00441 helpstring = THD_zzprintf( helpstring , "%s\n" , help_mid ) ;
00442
00443 for( ii=0 ; ii < NUM_env_var ; ii++ ){
00444 helpstring = THD_zzprintf( helpstring, " %-25.25s: %s\n" ,
00445 env_var[ii].vname , env_var[ii].vhint ) ;
00446 }
00447
00448 helpstring = THD_zzprintf( helpstring , "%s\n" , help_end ) ;
00449
00450 /*---------------- set titles and call point ----------------*/
00451
00452 plint = PLUTO_new_interface( "Environment" ,
00453 "Environment variables control" ,
00454 helpstring ,
00455 PLUGIN_CALL_VIA_MENU , ENV_main ) ;
00456 free(helpstring) ;
00457
00458 PLUTO_add_hint( plint , "Environment variables control" ) ;
00459
00460 PLUTO_set_runlabels( plint , "Set+Keep" , "Set+Close" ) ; /* 04 Nov 2003 */
00461
00462 /*--------- make interface lines: 1 for each variable -----------*/
00463
00464 for( ii=0 ; ii < NUM_env_var ; ii++ ){
00465
00466 PLUTO_add_option( plint ,
00467 "" , /* label at left of input line */
00468 env_var[ii].vname , /* tag to return to plugin */
00469 FALSE /* is this mandatory? */
00470 ) ;
00471
00472 ept = getenv( env_var[ii].vname ) ;
00473
00474 switch( env_var[ii].vtype ){
00475
00476 default: break ; /* should never happen */
00477
00478 case ENV_NUMBER_FIXED:
00479 case ENV_NUMBER_EDITABLE:{
00480 double dval=env_var[ii].vdef ; int ival ;
00481
00482 if( ept != NULL ){
00483 dval = strtod(ept,NULL) ;
00484 AV_SHIFT_VAL(-env_var[ii].vdecim,dval) ;
00485 }
00486 ival = rint(dval) ;
00487 if( ival < env_var[ii].vbot ) ival = env_var[ii].vbot ;
00488 else if( ival > env_var[ii].vtop ) ival = env_var[ii].vtop ;
00489
00490 PLUTO_add_number( plint ,
00491 env_var[ii].vname ,
00492 env_var[ii].vbot ,
00493 env_var[ii].vtop ,
00494 env_var[ii].vdecim,
00495 ival,(env_var[ii].vtype==ENV_NUMBER_EDITABLE) ) ;
00496 PLUTO_add_hint( plint , env_var[ii].vhint ) ; /* 8 Apr 2005 rickr */
00497 }
00498 break ;
00499
00500 case ENV_STRING:{
00501 if( env_var[ii].vcount <= 0 ){
00502 PLUTO_add_string( plint ,
00503 env_var[ii].vname ,
00504 0 , &ept , NAME_NMAX ) ;
00505 PLUTO_add_hint( plint , env_var[ii].vhint ) ;
00506 } else {
00507 int dval , jj ;
00508 char ** sval ;
00509
00510 dval = 1 + PLUTO_string_index( ept , env_var[ii].vcount ,
00511 env_var[ii].vlist ) ;
00512
00513 sval = (char **) malloc( sizeof(char *)*(1+env_var[ii].vcount) ) ;
00514 sval[0] = "(Not set)" ;
00515 for( jj=0 ; jj < env_var[ii].vcount ; jj++ )
00516 sval[jj+1] = env_var[ii].vlist[jj] ;
00517
00518 PLUTO_add_string( plint ,
00519 env_var[ii].vname ,
00520 1+env_var[ii].vcount , sval , dval ) ;
00521 PLUTO_add_hint( plint , env_var[ii].vhint ) ;
00522 free(sval) ;
00523 }
00524 }
00525 break ;
00526 } /* end of switch over variable type */
00527
00528 } /* end of loop over variables */
00529
00530 /*--------- done with interface setup ---------*/
00531
00532 return plint ;
00533 }
|
|
||||||||||||
|
Definition at line 145 of file afni_transforms.c. References qmed_float().
00146 {
00147 float vv,ww , med=qmed_float(n,ar) ;
00148 int ii , jj ;
00149
00150 jj = 0 ; vv = fabs(ar[0]-med) ; /* Find the value */
00151 for( ii=1 ; ii < n ; ii++ ){ /* furthest from */
00152 ww = fabs(ar[ii]-med) ; /* the median. */
00153 if( ww > vv ){ vv=ww; jj=ii; }
00154 }
00155 return ar[jj] ;
00156 }
|
|
|
Definition at line 79 of file afni_pplug_1dfunc.c. References AFMALL, AFNI_register_1D_function, alpha, chain_do, chain_ff, F1D_chainfunc(), F1D_main(), MCW_function_list::flags, func0D, func1D, funcname, MCW_function_list::funcs, generic_func, GLOBAL_library, helpstring, MCW_function_list::labels, malloc, n0, n1, MCW_function_list::num, num0D, num1D, NUM_CHAIN, numfunc, PLUTO_add_hint(), PLUTO_set_runlabels(), realloc, AFNI_library_type::registered_0D, and AFNI_library_type::registered_1D. Referenced by AFNI_misc_CB().
00080 {
00081 PLUGIN_interface * plint ; /* will be the output of this routine */
00082 int ii , num , ll ;
00083 char str[16] ;
00084 MCW_function_list * rlist ;
00085
00086 /*---------------- set titles and call point ----------------*/
00087
00088 plint = PLUTO_new_interface( "1D Chain Func" ,
00089 "Control 1DChain function" ,
00090 helpstring ,
00091 PLUGIN_CALL_VIA_MENU ,
00092 (char *(*)())F1D_main ) ;
00093
00094 PLUTO_add_hint( plint , "Control 1DChain function" ) ;
00095
00096 PLUTO_set_runlabels( plint , "Set+Keep" , "Set+Close" ) ; /* 04 Nov 2003 */
00097
00098 /*-------- Initialize list of all functions that can be chained -----*/
00099
00100 numfunc = 1 ;
00101 funcname = (char **) malloc(sizeof(char **)) ;
00102 funcname[0] = "Expr 9 ---->" ;
00103
00104 /*-------- Get list of pre-registered functions --------*/
00105
00106 rlist = &(GLOBAL_library.registered_0D) ;
00107 num0D = rlist->num ;
00108 if( num0D > 0 ){
00109 int n0 = 0 ;
00110 funcname = (char **) realloc( (void *)funcname, sizeof(char **)*(numfunc+num0D) );
00111 func0D = (generic_func **) malloc( sizeof(generic_func *)*num0D ) ;
00112 for( ii=0 ; ii < num0D ; ii++ ){
00113 if( rlist->flags[ii] == 0 ){ /* 18 Dec 2003: only allow "normal" funcs */
00114 ll = strlen(rlist->labels[ii]) ;
00115 funcname[numfunc] = AFMALL(char, ll+8) ;
00116 strcpy(funcname[numfunc],"0D: ") ;
00117 strcat(funcname[numfunc],rlist->labels[ii]) ;
00118 func0D[n0++] = rlist->funcs[ii] ;
00119 numfunc++ ;
00120 }
00121 }
00122 num0D = n0 ;
00123 }
00124
00125 rlist = &(GLOBAL_library.registered_1D) ;
00126 num1D = rlist->num ;
00127 if( num1D > 0 ){
00128 int n1 = 0 ;
00129 funcname = (char **) realloc( (void *)funcname, sizeof(char **)*(numfunc+num1D) );
00130 func1D = (generic_func **) malloc( sizeof(generic_func *)*num1D ) ;
00131 for( ii=0 ; ii < num1D ; ii++ ){
00132 if( rlist->flags[ii] == 0 ){ /* 18 Dec 2003: only allow "normal" funcs */
00133 ll = strlen(rlist->labels[ii]) ;
00134 funcname[numfunc] = AFMALL(char, ll+8) ;
00135 strcpy(funcname[numfunc],"1D: ") ;
00136 strcat(funcname[numfunc],rlist->labels[ii]) ;
00137 func1D[n1++] = rlist->funcs[ii] ;
00138 numfunc++ ;
00139 }
00140 }
00141 num1D = n1 ;
00142 }
00143
00144 AFNI_register_1D_function( "1DChain" , F1D_chainfunc ) ; /* add this only now */
00145
00146 /*--------- make interface lines -----------*/
00147
00148 for( ii=0 ; ii < NUM_CHAIN ; ii++ ){
00149
00150 chain_do[ii] = 0 ; /* off */
00151 chain_pc[ii] = NULL ;
00152 chain_ff[ii] = NULL ;
00153
00154 str[0] = alpha[ii] ; str[1] = '\0' ;
00155
00156 PLUTO_add_option( plint ,
00157 str , /* label at left of input line */
00158 str , /* tag to return to plugin */
00159 FALSE /* is this mandatory? */
00160 ) ;
00161
00162 PLUTO_add_string( plint , "Function" ,
00163 numfunc , funcname , 0 ) ;
00164
00165 PLUTO_add_string( plint , "Expr 9" , 0,NULL,32 ) ;
00166 }
00167
00168 /*--------- done with interface setup ---------*/
00169
00170 return plint ;
00171 }
|
|
|
Definition at line 85 of file afni_pplug_2dfunc.c. References AFMALL, AFNI_register_2D_function, alpha, chain_do, chain_ff, F2D_chainfunc(), F2D_main(), MCW_function_list::flags, func0D, func2D, funcname, MCW_function_list::funcs, generic_func, GLOBAL_library, helpstring, MCW_function_list::labels, malloc, n0, n2, MCW_function_list::num, num0D, num2D, NUM_CHAIN, numfunc, PLUTO_add_hint(), PLUTO_set_runlabels(), realloc, AFNI_library_type::registered_0D, and AFNI_library_type::registered_2D. Referenced by AFNI_misc_CB().
00086 {
00087 PLUGIN_interface * plint ; /* will be the output of this routine */
00088 int ii , num , ll ;
00089 char str[16] ;
00090 MCW_function_list * rlist ;
00091
00092 /*---------------- set titles and call point ----------------*/
00093
00094 plint = PLUTO_new_interface( "2D Chain Func" ,
00095 "Control 2DChain function" ,
00096 helpstring ,
00097 PLUGIN_CALL_VIA_MENU ,
00098 (char *(*)())F2D_main ) ;
00099
00100 PLUTO_add_hint( plint , "Control 2DChain function" ) ;
00101
00102 PLUTO_set_runlabels( plint , "Set+Keep" , "Set+Close" ) ; /* 04 Nov 2003 */
00103
00104 /*-------- Initialize list of all functions that can be chained -----*/
00105
00106 numfunc = 1 ;
00107 funcname = (char **) malloc(sizeof(char **)) ;
00108 funcname[0] = "Expr 3x3 -->" ;
00109
00110 /*-------- Get list of pre-registered functions --------*/
00111
00112 rlist = &(GLOBAL_library.registered_0D) ;
00113 num0D = rlist->num ;
00114 if( num0D > 0 ){
00115 int n0 = 0 ;
00116 funcname = (char **) realloc( funcname, sizeof(char **)*(numfunc+num0D) );
00117 func0D = (generic_func **) malloc( sizeof(generic_func *)*num0D ) ;
00118 for( ii=0 ; ii < num0D ; ii++ ){
00119 if( rlist->flags[ii] == 0 ){ /* 18 Dec 2003: only allow "normal" funcs */
00120 ll = strlen(rlist->labels[ii]) ;
00121 funcname[numfunc] = AFMALL(char,ll+8) ;
00122 strcpy(funcname[numfunc],"0D: ") ;
00123 strcat(funcname[numfunc],rlist->labels[ii]) ;
00124 func0D[n0++] = rlist->funcs[ii] ;
00125 numfunc++ ;
00126 }
00127 }
00128 num0D = n0 ;
00129 }
00130
00131 rlist = &(GLOBAL_library.registered_2D) ;
00132 num2D = rlist->num ;
00133 if( num2D > 0 ){
00134 int n2 = 0 ;
00135 funcname = (char **) realloc( funcname, sizeof(char **)*(numfunc+num2D) );
00136 func2D = (generic_func **) malloc( sizeof(generic_func *)*num2D ) ;
00137 for( ii=0 ; ii < num2D ; ii++ ){
00138 if( rlist->flags[ii] == 0 ){ /* 18 Dec 2003: only allow "normal" funcs */
00139 ll = strlen(rlist->labels[ii]) ;
00140 funcname[numfunc] = AFMALL(char, ll+8) ;
00141 strcpy(funcname[numfunc],"2D: ") ;
00142 strcat(funcname[numfunc],rlist->labels[ii]) ;
00143 func2D[n2++] = rlist->funcs[ii] ;
00144 numfunc++ ;
00145 }
00146 }
00147 num2D = n2 ;
00148 }
00149
00150 AFNI_register_2D_function( "2DChain" , F2D_chainfunc ) ; /* add this only now */
00151
00152 /*--------- make interface lines -----------*/
00153
00154 for( ii=0 ; ii < NUM_CHAIN ; ii++ ){
00155
00156 chain_do[ii] = 0 ; /* off */
00157 chain_pc[ii] = NULL ;
00158 chain_ff[ii] = NULL ;
00159
00160 str[0] = alpha[ii] ; str[1] = '\0' ;
00161
00162 PLUTO_add_option( plint ,
00163 str , /* label at left of input line */
00164 str , /* tag to return to plugin */
00165 FALSE /* is this mandatory? */
00166 ) ;
00167
00168 PLUTO_add_string( plint , "Function" ,
00169 numfunc , funcname , 0 ) ;
00170
00171 PLUTO_add_string( plint , "Expr 3x3" , 0,NULL,32 ) ;
00172 }
00173
00174 /*--------- done with interface setup ---------*/
00175
00176 return plint ;
00177 }
|
|
|
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 }
|
|
||||||||||||||||||||||||
|
process copy of input back into the input array * Definition at line 470 of file afni_transforms.c. References CABS, csfft_cox(), csfft_nextup_one35(), free, complex::i, malloc, and complex::r.
00471 {
00472 complex *cxar , *cpt ;
00473 int nxup,nyup , ii,jj ;
00474 float fi,fj , *fpt ;
00475
00476 if( nx < 5 || ny < 5 ) return ;
00477
00478 nxup = csfft_nextup_one35(nx) ; /* get FFT size */
00479 nyup = csfft_nextup_one35(ny) ;
00480
00481 cxar = (complex *) malloc(sizeof(complex)*nxup*nyup) ;
00482
00483 /* copy input to output, sign-alternating and zero-padding along the way */
00484
00485 cpt = cxar ;
00486 fpt = ar ;
00487 fj = 1.0 ;
00488 for( jj=0 ; jj < ny ; jj++ ){
00489 fi = fj ; fj = -fj ;
00490 for(ii=0; ii<nx ; ii++){cpt->r=*fpt*fi; cpt->i=0.0; cpt++;fpt++;fi=-fi;}
00491 for( ; ii<nxup; ii++){cpt->r=cpt->i=0.0; cpt++;}
00492 }
00493 for( ; jj < nyup ; jj++ ){cpt->r=cpt->i=0.0; cpt++;}
00494
00495 /* row FFTs */
00496
00497 for( jj=0 ; jj < ny ; jj++ )
00498 csfft_cox( -1 , nxup , cxar+jj*nxup ) ;
00499
00500 /* column FFTs */
00501
00502 cpt = (complex *) malloc(sizeof(complex)*nyup) ;
00503
00504 for( ii=0 ; ii < nxup ; ii++ ){
00505 for( jj=0 ; jj < nyup ; jj++ ) cpt[jj] = cxar[ii+jj*nxup] ;
00506 csfft_cox( -1 , nyup , cpt ) ;
00507 for( jj=0 ; jj < nyup ; jj++ ) cxar[ii+jj*nxup] = cpt[jj] ;
00508 }
00509
00510 /* copy to output */
00511
00512 for( jj=0 ; jj < ny ; jj++ )
00513 for( ii=0 ; ii < nx ; ii++ )
00514 ar[ii+jj*nx] = CABS(cxar[ii+jj*nxup]) ;
00515
00516 free(cxar) ; free(cpt) ; return ;
00517 }
|
|
||||||||||||
|
Definition at line 5 of file afni_transforms.c.
00006 {
00007 int ii ;
00008 float vmax , vmin ;
00009
00010 if( num <= 0 || vec == NULL ) return ;
00011
00012 /* find largest element */
00013
00014 vmax = vec[0] ;
00015 for( ii=1 ; ii < num ; ii++ ) vmax = MAX( vmax , vec[ii] ) ;
00016
00017 /* if all are nonpositive, return all zeros */
00018
00019 if( vmax <= 0.0 ){
00020 for( ii=0 ; ii < num ; ii++ ) vec[ii] = 0.0 ;
00021 return ;
00022 }
00023
00024 /* find smallest positive element */
00025
00026 vmin = vmax ;
00027 for( ii=0 ; ii < num ; ii++ )
00028 if( vec[ii] > 0.0 ) vmin = MIN( vmin , vec[ii] ) ;
00029
00030 /* take log10 of each positive element;
00031 nonpositive elements get the log10 of vmin instead */
00032
00033 vmin = log10(vmin) ;
00034 for( ii=0 ; ii < num ; ii++ )
00035 vec[ii] = (vec[ii] > 0.0) ? log10(vec[ii]) : vmin ;
00036
00037 return ;
00038 }
|
|
||||||||||||
|
Definition at line 129 of file afni_transforms.c. References v.
|
|
||||||||||||
|
Definition at line 137 of file afni_transforms.c. References v.
|
|
||||||||||||||||||||||||
|
process copy of input back into the input array * Definition at line 355 of file afni_transforms.c. References atemp, isort_float(), MAKE_ATEMP, and qmed_float().
00356 {
00357 int ii , jj , nxy , joff ;
00358 float aa[21] ;
00359 float *ajj , *ajm , *ajp , *ajmm , *ajpp ;
00360
00361 if( nx < 5 || ny < 5 ) return ;
00362
00363 /** make space and copy input into it **/
00364
00365 nxy = nx * ny ;
00366 MAKE_ATEMP(nxy) ; if( atemp == NULL ) return ;
00367 memcpy(atemp,ar,sizeof(float)*nxy) ;
00368
00369 /** process copy of input back into the input array **/
00370
00371 for( jj=1 ; jj < ny-1 ; jj++ ){
00372
00373 joff = jj * nx ; /* offset into this row */
00374 ajj = atemp + joff ; /* pointer to this row */
00375
00376 ajm = ajj-nx ; /* pointer to last row */
00377 ajp = ajj+nx ; /* pointer to next row */
00378
00379 ajmm = (jj == 1 ) ? ajm : ajm-nx ; /* to last last row */
00380 ajpp = (jj ==ny-2) ? ajp : ajp+nx ; /* to next next row */
00381
00382 /* do interior points of this row */
00383
00384 for( ii=2 ; ii < nx-2 ; ii++ ){
00385 aa[0]=ajmm[ii-1]; aa[1]=ajmm[ii]; aa[2]=ajmm[ii+1];
00386
00387 aa[ 3]=ajm[ii-2]; aa[ 4]=ajm[ii-1]; aa[ 5]=ajm[ii]; aa[ 6]=ajm[ii+1]; aa[ 7]=ajm[ii+2];
00388 aa[ 8]=ajj[ii-2]; aa[ 9]=ajj[ii-1]; aa[10]=ajj[ii]; aa[11]=ajj[ii+1]; aa[12]=ajj[ii+2];
00389 aa[13]=ajp[ii-2]; aa[14]=ajp[ii-1]; aa[15]=ajp[ii]; aa[16]=ajp[ii+1]; aa[17]=ajp[ii+2];
00390
00391 aa[18]=ajpp[ii-1]; aa[19]=ajpp[ii]; aa[20]=ajpp[ii+1];
00392
00393 #if 0
00394 isort_float( 21 , aa ) ; ar[ii+joff] = aa[10] ;
00395 #else
00396 ar[ii+joff] = qmed_float(21,aa) ; /* 25 Oct 2000 */
00397 #endif
00398 }
00399
00400 }
00401 return ;
00402 }
|
|
||||||||||||||||||||
|
Definition at line 75 of file afni_transforms.c. References dt, MEDIAN, and vec.
|
|
||||||||||||||||||||||||
|
Definition at line 175 of file afni_transforms.c. References atemp, isort_float(), MAKE_ATEMP, and qmed_float().
00176 {
00177 int ii , jj , nxy , joff ;
00178 float aa[9] ;
00179 float *ajj , *ajm , *ajp ;
00180
00181 if( nx < 3 || ny < 3 ) return ;
00182
00183 /** make space and copy input into it **/
00184
00185 nxy = nx * ny ;
00186 MAKE_ATEMP(nxy) ; if( atemp == NULL ) return ;
00187 memcpy(atemp,ar,sizeof(float)*nxy) ;
00188
00189 /** process copy of input back into the input array **/
00190
00191 for( jj=0 ; jj < ny ; jj++ ){
00192
00193 joff = jj * nx ; /* offset into this row */
00194 ajj = atemp + joff ; /* pointer to this row */
00195
00196 ajm = (jj==0 ) ? ajj : ajj-nx ; /* pointer to last row */
00197 ajp = (jj==ny-1) ? ajj : ajj+nx ; /* pointer to next row */
00198
00199 /* do interior points of this row */
00200
00201 for( ii=1 ; ii < nx-1 ; ii++ ){
00202 aa[0] = ajm[ii-1] ; aa[1] = ajm[ii] ; aa[2] = ajm[ii+1] ;
00203 aa[3] = ajj[ii-1] ; aa[4] = ajj[ii] ; aa[5] = ajj[ii+1] ;
00204 aa[6] = ajp[ii-1] ; aa[7] = ajp[ii] ; aa[8] = ajp[ii+1] ;
00205 #if 0
00206 isort_float( 9 , aa ) ; ar[ii+joff] = aa[4] ;
00207 #else
00208 ar[ii+joff] = qmed_float(9,aa) ; /* 25 Oct 2000 */
00209 #endif
00210 }
00211
00212 /* do leading edge point (ii=0) */
00213
00214 aa[0] = ajm[0] ; aa[1] = ajm[0] ; aa[2] = ajm[1] ;
00215 aa[3] = ajj[0] ; aa[4] = ajj[0] ; aa[5] = ajj[1] ;
00216 aa[6] = ajp[0] ; aa[7] = ajp[0] ; aa[8] = ajp[1] ;
00217 #if 0
00218 isort_float( 9 , aa ) ; ar[joff] = aa[4] ;
00219 #else
00220 ar[joff] = qmed_float(9,aa) ; /* 25 Oct 2000 */
00221 #endif
00222
00223 /* do trailing edge point (ii=nx-1) */
00224
00225 aa[0] = ajm[nx-2] ; aa[1] = ajm[nx-1] ; aa[2] = ajm[nx-1] ;
00226 aa[3] = ajj[nx-2] ; aa[4] = ajj[nx-1] ; aa[5] = ajj[nx-1] ;
00227 aa[6] = ajp[nx-2] ; aa[7] = ajp[nx-1] ; aa[8] = ajp[nx-1] ;
00228 #if 0
00229 isort_float( 9 , aa ) ; ar[nx-1+joff] = aa[4] ;
00230 #else
00231 ar[nx-1+joff] = qmed_float(9,aa) ; /* 25 Oct 2000 */
00232 #endif
00233 }
00234 return ;
00235 }
|
|
||||||||||||
|
Definition at line 121 of file afni_transforms.c. References v.
|
|
||||||||||||||||
|
Definition at line 7233 of file afni_widg.c. Referenced by MAIN_workprocess(). |
|
||||||||||||||||||||
|
Definition at line 59 of file afni_transforms.c. References dt, OSFILT, and vec.
|
|
||||||||||||||||||||||||
|
process copy of input back into the input array * Definition at line 297 of file afni_transforms.c. References atemp, isort_float(), and MAKE_ATEMP. Referenced by lacy9_box_func().
00298 {
00299 int ii , jj , nxy , joff ;
00300 float aa[9] ;
00301 float *ajj , *ajm , *ajp ;
00302
00303 if( nx < 3 || ny < 3 ) return ;
00304
00305 /** make space and copy input into it **/
00306
00307 nxy = nx * ny ;
00308 MAKE_ATEMP(nxy) ; if( atemp == NULL ) return ;
00309 memcpy(atemp,ar,sizeof(float)*nxy) ;
00310
00311 /** process copy of input back into the input array **/
00312
00313 for( jj=0 ; jj < ny ; jj++ ){
00314
00315 joff = jj * nx ; /* offset into this row */
00316 ajj = atemp + joff ; /* pointer to this row */
00317
00318 ajm = (jj==0 ) ? ajj : ajj-nx ; /* pointer to last row */
00319 ajp = (jj==ny-1) ? ajj : ajj+nx ; /* pointer to next row */
00320
00321 /* do interior points of this row */
00322
00323 #undef OSUM
00324 #define OSUM(a,b,c,d,e) ( 0.1*((a)+(e)) + 0.2*((b)+(d)) + 0.4*(c) )
00325
00326 for( ii=1 ; ii < nx-1 ; ii++ ){
00327 aa[0] = ajm[ii-1] ; aa[1] = ajm[ii] ; aa[2] = ajm[ii+1] ;
00328 aa[3] = ajj[ii-1] ; aa[4] = ajj[ii] ; aa[5] = ajj[ii+1] ;
00329 aa[6] = ajp[ii-1] ; aa[7] = ajp[ii] ; aa[8] = ajp[ii+1] ;
00330 isort_float( 9 , aa ) ;
00331 ar[ii+joff] = OSUM( aa[2],aa[3],aa[4],aa[5],aa[6] ) ;
00332 }
00333
00334 /* do leading edge point (ii=0) */
00335
00336 aa[0] = ajm[0] ; aa[1] = ajm[0] ; aa[2] = ajm[1] ;
00337 aa[3] = ajj[0] ; aa[4] = ajj[0] ; aa[5] = ajj[1] ;
00338 aa[6] = ajp[0] ; aa[7] = ajp[0] ; aa[8] = ajp[1] ;
00339 isort_float( 9 , aa ) ;
00340 ar[joff] = OSUM( aa[2],aa[3],aa[4],aa[5],aa[6] ) ;
00341
00342 /* do trailing edge point (ii=nx-1) */
00343
00344 aa[0] = ajm[nx-2] ; aa[1] = ajm[nx-1] ; aa[2] = ajm[nx-1] ;
00345 aa[3] = ajj[nx-2] ; aa[4] = ajj[nx-1] ; aa[5] = ajj[nx-1] ;
00346 aa[6] = ajp[nx-2] ; aa[7] = ajp[nx-1] ; aa[8] = ajp[nx-1] ;
00347 isort_float( 9 , aa ) ;
00348 ar[nx-1+joff] = OSUM( aa[2],aa[3],aa[4],aa[5],aa[6] ) ;
00349 }
00350 return ;
00351 }
|
|
||||||||||||||||||||||||
|
Definition at line 423 of file afni_fimfunc.c. References EDIT_BRICK_LABEL, EDIT_BRICK_TO_FICO, fd, free, FIMdata::ignore, malloc, MRI_FLOAT_PTR, MRI_IMAGE::nx, MRI_IMAGE::ny, FIMdata::polort, quadrant_corr_prepare(), quadrant_manycorr(), rank_order_float(), FIMdata::ref_ts, and v.
00424 {
00425 static float *tsc=NULL , *refc=NULL , *refv=NULL , **rr ;
00426 static int *keep=NULL ;
00427 static int ntsc , nref , nkeep , polort,ignore , ncall;
00428
00429 int ii , kk ;
00430 float *v ;
00431
00432 /*--- handle special cases ---*/
00433
00434 if( ts == NULL ){
00435
00436 /*--- the initialization call ---*/
00437
00438 if( n > 0 ){
00439
00440 FIMdata *fd = (FIMdata *) val ;
00441
00442 polort = fd->polort ; /* not used here */
00443 ignore = fd->ignore ;
00444 ncall = 0 ; /* how many times we have been called */
00445
00446 /* make workspace for copy of ts data when it arrives */
00447
00448 ntsc = n ;
00449 if( tsc != NULL ) free(tsc) ;
00450 tsc = (float *) malloc(sizeof(float)*ntsc) ;
00451
00452 /* make copy of ref data */
00453
00454 nref = fd->ref_ts->ny ;
00455 if( refc != NULL ) free(refc) ;
00456 if( refv != NULL ) free(refv) ;
00457 if( keep != NULL ) free(keep) ;
00458 if( rr != NULL ) free(rr) ;
00459 refc = (float *) malloc(sizeof(float)*ntsc*nref) ; /* copy of ref */
00460 refv = (float *) malloc(sizeof(float)*nref) ; /* rank variances */
00461 keep = (int *) malloc(sizeof(int)*ntsc) ; /* keeper indices */
00462 rr = (float **)malloc(sizeof(float *)*nref) ; /* convenience ptrs */
00463
00464 for( kk=0 ; kk < nref ; kk++ ){
00465 rr[kk] = refc+kk*ntsc ; /* compute ptr */
00466 memcpy( rr[kk] , /* copy data */
00467 MRI_FLOAT_PTR(fd->ref_ts) + kk*fd->ref_ts->nx ,
00468 sizeof(float)*ntsc ) ;
00469 }
00470
00471 /* mark those places we will keep (where ref is OK) */
00472
00473 for( nkeep=0,ii=ignore ; ii < ntsc ; ii++ ){ /* for each time point */
00474 for( kk=0 ; kk < nref ; kk++ ) /* check each ref */
00475 if( rr[kk][ii] >= WAY_BIG ) break ;
00476
00477 if( kk == nref ) keep[nkeep++] = ii ; /* mark if all are OK */
00478 }
00479
00480 /* compress ref, eliminating non-keepers */
00481
00482 if( nkeep < ntsc ){
00483 for( ii=0 ; ii < nkeep ; ii++ ){
00484 for( kk=0 ; kk < nref ; kk++ )
00485 rr[kk][ii] = rr[kk][keep[ii]] ; /* copy backwards */
00486 }
00487 }
00488
00489 /* prepare each ref vector for rank processing */
00490
00491 for( kk=0 ; kk < nref ; kk++ )
00492 refv[kk] = quadrant_corr_prepare( nkeep , rr[kk] ) ;
00493
00494 #if 0
00495 fprintf(stderr,"quadrant_fimfunc: initialize ntsc=%d nkeep=%d nref=%d\n",
00496 ntsc,nkeep,nref);
00497 #endif
00498
00499 return ;
00500
00501 /*--- the ending call ---*/
00502
00503 } else {
00504 THD_3dim_dataset *dset = (THD_3dim_dataset *) val ;
00505 int kb = -n ;
00506
00507 free(tsc) ; tsc = NULL ; /* free workspaces */
00508 free(refc) ; refc = NULL ;
00509 free(refv) ; refv = NULL ;
00510 free(keep) ; keep = NULL ;
00511 free(rr) ; rr = NULL ;
00512 rank_order_float(0,NULL) ;
00513
00514 /* edit sub-brick statistical parameters and name */
00515
00516 EDIT_BRICK_TO_FICO( dset , kb , nkeep , (nref==1)?1:2 , 1 ) ;
00517 EDIT_BRICK_LABEL( dset , kb , "Quadrant CC" ) ;
00518
00519 #if 0
00520 fprintf(stderr,"quadrant_fimfunc: finalize with kb=%d\n",kb);
00521 #endif
00522
00523 return ;
00524 }
00525 }
00526
00527 /*--- the normal case [with data] ---*/
00528
00529 ncall++ ;
00530 #if 0
00531 if(ncall%1000==0) fprintf(stderr,"quadrant_fimfunc: ncall=%d\n",ncall);
00532 #endif
00533
00534 /* copy input timeseries data (since we will mangle it) */
00535
00536 if( nkeep < ntsc )
00537 for( ii=0 ; ii < nkeep ; ii++ ) tsc[ii] = ts[keep[ii]]; /* the hard way */
00538 else
00539 memcpy(tsc,ts,sizeof(float)*ntsc) ; /* the easy way */
00540
00541 /* compute our single result */
00542
00543 v = (float *) val ;
00544 v[0] = quadrant_manycorr( nkeep , tsc , nref , refv , rr ) ;
00545
00546 return ;
00547 }
|
|
|
|
|
||||||||||||||||||||||||
|
Definition at line 293 of file afni_fimfunc.c. References EDIT_BRICK_LABEL, EDIT_BRICK_TO_FICO, fd, free, FIMdata::ignore, malloc, MRI_FLOAT_PTR, MRI_IMAGE::nx, MRI_IMAGE::ny, FIMdata::polort, rank_order_float(), FIMdata::ref_ts, spearman_rank_manycorr(), spearman_rank_prepare(), and v.
00294 {
00295 static float *tsc=NULL , *refc=NULL , *refv=NULL , **rr ;
00296 static int *keep=NULL ;
00297 static int ntsc , nref , nkeep , polort,ignore , ncall;
00298
00299 int ii , kk ;
00300 float *v ;
00301
00302 /*--- handle special cases ---*/
00303
00304 if( ts == NULL ){
00305
00306 /*--- the initialization call ---*/
00307
00308 if( n > 0 ){
00309
00310 FIMdata *fd = (FIMdata *) val ;
00311
00312 polort = fd->polort ; /* not used here */
00313 ignore = fd->ignore ;
00314 ncall = 0 ; /* how many times we have been called */
00315
00316 /* make workspace for copy of ts data when it arrives */
00317
00318 ntsc = n ;
00319 if( tsc != NULL ) free(tsc) ;
00320 tsc = (float *) malloc(sizeof(float)*ntsc) ;
00321
00322 /* make copy of ref data */
00323
00324 nref = fd->ref_ts->ny ;
00325 if( refc != NULL ) free(refc) ;
00326 if( refv != NULL ) free(refv) ;
00327 if( keep != NULL ) free(keep) ;
00328 if( rr != NULL ) free(rr) ;
00329 refc = (float *) malloc(sizeof(float)*ntsc*nref) ; /* copy of ref */
00330 refv = (float *) malloc(sizeof(float)*nref) ; /* rank variances */
00331 keep = (int *) malloc(sizeof(int)*ntsc) ; /* keeper indices */
00332 rr = (float **)malloc(sizeof(float *)*nref) ; /* convenience ptrs */
00333
00334 for( kk=0 ; kk < nref ; kk++ ){
00335 rr[kk] = refc+kk*ntsc ; /* compute ptr */
00336 memcpy( rr[kk] , /* copy data */
00337 MRI_FLOAT_PTR(fd->ref_ts) + kk*fd->ref_ts->nx ,
00338 sizeof(float)*ntsc ) ;
00339 }
00340
00341 /* mark those places we will keep (where ref is OK) */
00342
00343 for( nkeep=0,ii=ignore ; ii < ntsc ; ii++ ){ /* for each time point */
00344 for( kk=0 ; kk < nref ; kk++ ) /* check each ref */
00345 if( rr[kk][ii] >= WAY_BIG ) break ;
00346
00347 if( kk == nref ) keep[nkeep++] = ii ; /* mark if all are OK */
00348 }
00349
00350 /* compress ref, eliminating non-keepers */
00351
00352 if( nkeep < ntsc ){
00353 for( ii=0 ; ii < nkeep ; ii++ ){
00354 for( kk=0 ; kk < nref ; kk++ )
00355 rr[kk][ii] = rr[kk][keep[ii]] ; /* copy backwards */
00356 }
00357 }
00358
00359 /* prepare each ref vector for rank processing */
00360
00361 for( kk=0 ; kk < nref ; kk++ )
00362 refv[kk] = spearman_rank_prepare( nkeep , rr[kk] ) ;
00363
00364 #if 0
00365 fprintf(stderr,"spearman_fimfunc: initialize ntsc=%d nkeep=%d nref=%d\n",
00366 ntsc,nkeep,nref);
00367 #endif
00368
00369 return ;
00370
00371 /*--- the ending call ---*/
00372
00373 } else {
00374 THD_3dim_dataset *dset = (THD_3dim_dataset *) val ;
00375 int kb = -n ;
00376
00377 free(tsc) ; tsc = NULL ; /* free workspaces */
00378 free(refc) ; refc = NULL ;
00379 free(refv) ; refv = NULL ;
00380 free(keep) ; keep = NULL ;
00381 free(rr) ; rr = NULL ;
00382 rank_order_float(0,NULL) ;
00383
00384 /* edit sub-brick statistical parameters and name */
00385
00386 EDIT_BRICK_TO_FICO( dset , kb , nkeep , (nref==1)?1:2 , 1 ) ;
00387 EDIT_BRICK_LABEL( dset , kb , "Spearman CC" ) ;
00388
00389 #if 0
00390 fprintf(stderr,"spearman_fimfunc: finalize with kb=%d\n",kb);
00391 #endif
00392
00393 return ;
00394 }
00395 }
00396
00397 /*--- the normal case [with data] ---*/
00398
00399 ncall++ ;
00400 #if 0
00401 if(ncall%1000==0) fprintf(stderr,"spearman_fimfunc: ncall=%d\n",ncall);
00402 #endif
00403
00404 /* copy input timeseries data (since we will mangle it) */
00405
00406 if( nkeep < ntsc )
00407 for( ii=0 ; ii < nkeep ; ii++ ) tsc[ii] = ts[keep[ii]]; /* the hard way */
00408 else
00409 memcpy(tsc,ts,sizeof(float)*ntsc) ; /* the easy way */
00410
00411 /* compute our single result */
00412
00413 v = (float *) val ;
00414 v[0] = spearman_rank_manycorr( nkeep , tsc , nref , refv , rr ) ;
00415
00416 return ;
00417 }
|
|
||||||||||||
|
Definition at line 42 of file afni_transforms.c. References vec.
00043 {
00044 int ii ;
00045 double val ;
00046
00047 if( num <= 0 || vec == NULL ) return ;
00048
00049 for( ii=0 ; ii < num ; ii++ ){
00050 val = sqrt(fabs(vec[ii])) ; /* will be positive */
00051 vec[ii] = (vec[ii] >= 0.0) ? val : -val ; /* output sign = input sign */
00052 }
00053
00054 return ;
00055 }
|
|
|
Definition at line 577 of file afni_ttren.c. References ENTRY, TTRR_params::hemi, TTRR_controls::hemi_av, MCW_arrowval::ival, malloc, TTRR_params::meth, TTRR_controls::meth_av, myXtNew, TTRR_params::num, TTRR_controls::reg_av, TTRR_controls::reg_num, TTRR_controls::reg_ttbrik, TTRR_controls::reg_ttovc, TTRR_controls::reg_ttval, RETURN, TTRR_params::ttbrik, TTRR_params::ttovc, TTRR_METH_OFF, and TTRR_params::ttval. Referenced by AFNI_ttatlas_overlay(), RCREND_overlay_ttatlas(), and REND_overlay_ttatlas().
00578 {
00579 int ii,jj ;
00580
00581 ENTRY("TTRR_get_params") ;
00582
00583 if( ttc == NULL ) RETURN(NULL) ; /* report nothing */
00584
00585 if( ttc->meth_av->ival == TTRR_METH_OFF ) RETURN(NULL) ;
00586
00587 /* 1st time in: make reporting struct */
00588
00589 if( ttp == NULL ){
00590 ttp = myXtNew(TTRR_params) ;
00591 ttp->ttbrik = (byte *) malloc(sizeof(byte)*ttc->reg_num) ;
00592 ttp->ttval = (byte *) malloc(sizeof(byte)*ttc->reg_num) ;
00593 ttp->ttovc = (byte *) malloc(sizeof(byte)*ttc->reg_num) ;
00594 }
00595
00596 /* set method codes */
00597
00598 ttp->meth = ttc->meth_av->ival ;
00599 ttp->hemi = ttc->hemi_av->ival ; /* hemisphere */
00600
00601 /* make list of all 'on' regions */
00602
00603 for( ii=jj=0 ; ii < ttc->reg_num ; ii++ ){
00604 ttc->reg_ttovc[ii] = ttc->reg_av[ii]->ival ;
00605 if( ttc->reg_ttovc[ii] > 0 ){
00606 ttp->ttbrik[jj] = (byte) ttc->reg_ttbrik[ii] ;
00607 ttp->ttval [jj] = (byte) ttc->reg_ttval [ii] ;
00608 ttp->ttovc [jj] = (byte) ttc->reg_ttovc [ii] ;
00609 jj++ ;
00610 }
00611 }
00612
00613 ttp->num = jj ; /* number of 'on' regions */
00614 RETURN(ttp) ;
00615 }
|
|
|
compute information about regions * Definition at line 478 of file afni_ttren.c. References Three_D_View::dc, ENTRY, TTRR_controls::im3d, TTRR_controls::shell, and TTRR_setup_widgets(). Referenced by AFNI_imag_pop_CB().
|
|
||||||||||||||||||||||||
|
process copy of input back into the input array * Definition at line 406 of file afni_transforms.c. References atemp, isort_float(), MAKE_ATEMP, and my_getenv().
00407 {
00408 int ii , jj , nxy , joff ;
00409 float aa[21] ;
00410 float *ajj , *ajm , *ajp , *ajmm , *ajpp ;
00411
00412 static int kbot=-1 , ktop ;
00413
00414 if( nx < 5 || ny < 5 ) return ;
00415
00416 /** initialize cutoffs [07 Dec 1999] **/
00417
00418 if( kbot < 0 ){
00419 char *ee = my_getenv("AFNI_WINSOR21_CUTOFF") ;
00420 kbot = 6 ; /* default */
00421 if( ee != NULL ){
00422 ii = strtol( ee , NULL , 10 ) ;
00423 if( ii > 0 && ii < 10 ) kbot = ii ;
00424 }
00425 ktop = 20 - kbot ;
00426 }
00427
00428 /** make space and copy input into it **/
00429
00430 nxy = nx * ny ;
00431 MAKE_ATEMP(nxy) ; if( atemp == NULL ) return ;
00432 memcpy(atemp,ar,sizeof(float)*nxy) ;
00433
00434 /** process copy of input back into the input array **/
00435
00436 for( jj=1 ; jj < ny-1 ; jj++ ){
00437
00438 joff = jj * nx ; /* offset into this row */
00439 ajj = atemp + joff ; /* pointer to this row */
00440
00441 ajm = ajj-nx ; /* pointer to last row */
00442 ajp = ajj+nx ; /* pointer to next row */
00443
00444 ajmm = (jj == 1 ) ? ajm : ajm-nx ; /* to last last row */
00445 ajpp = (jj ==ny-2) ? ajp : ajp+nx ; /* to next next row */
00446
00447 /* do interior points of this row */
00448
00449 for( ii=2 ; ii < nx-2 ; ii++ ){
00450 aa[0]=ajmm[ii-1]; aa[1]=ajmm[ii]; aa[2]=ajmm[ii+1];
00451
00452 aa[ 3]=ajm[ii-2]; aa[ 4]=ajm[ii-1]; aa[ 5]=ajm[ii]; aa[ 6]=ajm[ii+1]; aa[ 7]=ajm[ii+2];
00453 aa[ 8]=ajj[ii-2]; aa[ 9]=ajj[ii-1]; aa[10]=ajj[ii]; aa[11]=ajj[ii+1]; aa[12]=ajj[ii+2];
00454 aa[13]=ajp[ii-2]; aa[14]=ajp[ii-1]; aa[15]=ajp[ii]; aa[16]=ajp[ii+1]; aa[17]=ajp[ii+2];
00455
00456 aa[18]=ajpp[ii-1]; aa[19]=ajpp[ii]; aa[20]=ajpp[ii+1];
00457
00458 isort_float( 21 , aa ) ;
00459
00460 if( ar[ii+joff] < aa[kbot] ) ar[ii+joff] = aa[kbot] ;
00461 else if( ar[ii+joff] > aa[ktop] ) ar[ii+joff] = aa[ktop] ;
00462 }
00463
00464 }
00465 return ;
00466 }
|
|
||||||||||||||||||||||||
|
process copy of input back into the input array * Definition at line 239 of file afni_transforms.c. References atemp, isort_float(), and MAKE_ATEMP.
00240 {
00241 int ii , jj , nxy , joff ;
00242 float aa[9] ;
00243 float *ajj , *ajm , *ajp ;
00244
00245 if( nx < 3 || ny < 3 ) return ;
00246
00247 /** make space and copy input into it **/
00248
00249 nxy = nx * ny ;
00250 MAKE_ATEMP(nxy) ; if( atemp == NULL ) return ;
00251 memcpy(atemp,ar,sizeof(float)*nxy) ;
00252
00253 /** process copy of input back into the input array **/
00254
00255 for( jj=0 ; jj < ny ; jj++ ){
00256
00257 joff = jj * nx ; /* offset into this row */
00258 ajj = atemp + joff ; /* pointer to this row */
00259
00260 ajm = (jj==0 ) ? ajj : ajj-nx ; /* pointer to last row */
00261 ajp = (jj==ny-1) ? ajj : ajj+nx ; /* pointer to next row */
00262
00263 /* do interior points of this row */
00264
00265 for( ii=1 ; ii < nx-1 ; ii++ ){
00266 aa[0] = ajm[ii-1] ; aa[1] = ajm[ii] ; aa[2] = ajm[ii+1] ;
00267 aa[3] = ajj[ii-1] ; aa[4] = ajj[ii] ; aa[5] = ajj[ii+1] ;
00268 aa[6] = ajp[ii-1] ; aa[7] = ajp[ii] ; aa[8] = ajp[ii+1] ;
00269 isort_float( 9 , aa ) ;
00270 if( ar[ii+joff] < aa[2] ) ar[ii+joff] = aa[2] ;
00271 else if( ar[ii+joff] > aa[6] ) ar[ii+joff] = aa[6] ;
00272 }
00273
00274 /* do leading edge point (ii=0) */
00275
00276 aa[0] = ajm[0] ; aa[1] = ajm[0] ; aa[2] = ajm[1] ;
00277 aa[3] = ajj[0] ; aa[4] = ajj[0] ; aa[5] = ajj[1] ;
00278 aa[6] = ajp[0] ; aa[7] = ajp[0] ; aa[8] = ajp[1] ;
00279 isort_float( 9 , aa ) ;
00280 if( ar[joff] < aa[2] ) ar[joff] = aa[2] ;
00281 else if( ar[joff] > aa[6] ) ar[joff] = aa[6] ;
00282
00283 /* do trailing edge point (ii=nx-1) */
00284
00285 aa[0] = ajm[nx-2] ; aa[1] = ajm[nx-1] ; aa[2] = ajm[nx-1] ;
00286 aa[3] = ajj[nx-2] ; aa[4] = ajj[nx-1] ; aa[5] = ajj[nx-1] ;
00287 aa[6] = ajp[nx-2] ; aa[7] = ajp[nx-1] ; aa[8] = ajp[nx-1] ;
00288 isort_float( 9 , aa ) ;
00289 if( ar[nx-1+joff] < aa[2] ) ar[nx-1+joff] = aa[2] ;
00290 else if( ar[nx-1+joff] > aa[6] ) ar[nx-1+joff] = aa[6] ;
00291 }
00292 return ;
00293 }
|
Variable Documentation
|
|
|
|
|
Definition at line 149 of file afni.h. Referenced by AFNI_make_widgets(). |
|
|
|
|
|
Definition at line 737 of file afni.h. Referenced by AFNI_new_fim_menu(). |
|
|
|
|
Definition at line 999 of file afni.h. Referenced by AFNI_read_inputs(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_seq_send_CB(). |
|
|
|
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_make_wid2(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_make_wid2(). |
|
|
Definition at line 1956 of file afni.h. Referenced by AFNI_load_defaults(). |
|
|
|
|
|
Definition at line 1952 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_parse_args(). |
|
|
|
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(). |
|
|
Definition at line 1954 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_make_wid2(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_drive_add_overlay_color(), AFNI_load_defaults(), AFNI_process_setup(), main(), and SUMA_Get_AFNI_Default_Color_Maps(). |
|
|
|
|
|
Definition at line 2037 of file afni.h. Referenced by AFNI_load_defaults(), AFNI_setup_inten_pbar(), RCREND_setup_color_pbar(), REND_setup_color_pbar(), and SUMA_Get_AFNI_Default_Color_Maps(). |
|
|
Definition at line 2040 of file afni.h. Referenced by AFNI_load_defaults(), AFNI_setup_inten_pbar(), RCREND_setup_color_pbar(), REND_setup_color_pbar(), and SUMA_Get_AFNI_Default_Color_Maps(). |
|
|
Definition at line 2034 of file afni.h. Referenced by AFNI_load_defaults(), RCREND_func_widgets(), and REND_func_widgets(). |
|
|
Definition at line 2034 of file afni.h. Referenced by AFNI_load_defaults(), RCREND_func_widgets(), and REND_func_widgets(). |
|
|
Definition at line 2034 of file afni.h. Referenced by AFNI_load_defaults(), RCREND_func_widgets(), and REND_func_widgets(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_parse_args(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_parse_args(). |
|
|
Definition at line 2036 of file afni.h. Referenced by AFNI_load_defaults(), AFNI_setup_inten_pbar(), RCREND_setup_color_pbar(), REND_setup_color_pbar(), and SUMA_Get_AFNI_Default_Color_Maps(). |
|
|
Definition at line 2039 of file afni.h. Referenced by AFNI_load_defaults(), AFNI_setup_inten_pbar(), RCREND_setup_color_pbar(), REND_setup_color_pbar(), and SUMA_Get_AFNI_Default_Color_Maps(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_make_wid2(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_make_wid2(). |
|
|
Definition at line 1934 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_make_wid2(). |
|
|
Definition at line 1949 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_make_wid2(). |
|
|
Definition at line 1953 of file afni.h. Referenced by AFNI_load_defaults(), and AFNI_parse_args(). |
|
|
Definition at line 1753 of file afni.h. Referenced by AFNI_imag_pop_CB(), and AFNI_talto_CB(). |
|
|
Definition at line 1752 of file afni.h. Referenced by AFNI_imag_pop_CB(). |
|
|
Definition at line 1751 of file afni.h. Referenced by AFNI_imag_pop_CB(). |
|
|
Definition at line 1750 of file afni.h. Referenced by AFNI_imag_pop_CB(), AFNI_talto_CB(), DRAW_make_widgets(), TT_whereami(), and TTRR_setup_widgets(). |
|
|
Initial value:
{ "ULay underlay" , "OLay underlay" , "OLay@Thr underlay" } |