Doxygen Source Code Documentation
to3d.h File Reference
#include "mrilib.h"#include "imseq.h"#include "killer.h"#include "afni_warp.h"#include "mcw_glob.h"#include <Xm/SeparatoG.h>#include <Xm/Display.h>#include <stdlib.h>#include <ctype.h>#include <unistd.h>Go to the source code of this file.
Data Structures | |
| struct | to3d_data |
| struct | to3d_widget_set |
Defines | |
| #define | NO_NAMES |
| #define | INCODE_NONE -666 |
| #define | INCODE_FOV 100 |
| #define | INCODE_SLAB 200 |
| #define | ORCODE(aa) |
| #define | T3D_NAME_WIDTH 25 |
| #define | T3D_FORM_SPACING 11 |
| #define | SET_ORIGIN_LABEL(ww, cc) |
| #define | VOXSHAPE_CUBICAL 1 |
| #define | VOXSHAPE_SQUARE 2 |
| #define | VOXSHAPE_IRREGULAR 4 |
| #define | VOXCONTIG_YES 1 |
| #define | VOXCONTIG_UNIF 2 |
| #define | VOXCONTIG_IRREG 4 |
| #define | XCENTERED 1 |
| #define | YCENTERED 2 |
| #define | ZCENTERED 4 |
| #define | NCOLOVR 2 |
| #define | NGRAY 80 |
| #define | GAMMA 1.0 |
| #define | RESET_QUIT T3D_quit_CB(NULL,NULL,NULL) |
Functions | |
| void | T3D_create_widgets (void) |
| void | T3D_read_images (void) |
| void | T3D_setup_stat_aux (void) |
| void | T3D_stat_aux_CB (Widget, XtPointer, XtPointer) |
| void | T3D_voxshape_CB (Widget, XtPointer, XtPointer) |
| void | T3D_voxcontig_CB (Widget, XtPointer, XtPointer) |
| void | T3D_centered_CB (Widget, XtPointer, XtPointer) |
| void | T3D_open_view_CB (Widget, XtPointer, XtPointer) |
| void | T3D_save_file_CB (Widget, XtPointer, XtPointer) |
| void | T3D_quit_CB (Widget, XtPointer, XtPointer) |
| void | T3D_swap_CB (Widget, XtPointer, XtPointer) |
| void | T3D_geometry_parent_CB (Widget, XtPointer, XtPointer) |
| void | T3D_anatomy_parent_CB (Widget, XtPointer, XtPointer) |
| void | T3D_pointer_leave_EV (Widget, XtPointer, XEvent *, Boolean *) |
| void | T3D_imseq_CB (MCW_imseq *, FD_brick *, ISQ_cbs *) |
| XtPointer | T3D_getim (int, int, FD_brick *) |
| char * | T3D_text_display (MCW_arrowval *, XtPointer) |
| void | T3D_initialize_user_data (void) |
| Boolean | T3D_check_data (Boolean) |
| void | T3D_orient_av_CB (MCW_arrowval *, XtPointer) |
| void | T3D_origin_av_CB (MCW_arrowval *, XtPointer) |
| void | T3D_fov_av_CB (MCW_arrowval *, XtPointer) |
| void | T3D_size_av_CB (MCW_arrowval *, XtPointer) |
| void | T3D_type_av_CB (MCW_arrowval *, XtPointer) |
| void | T3D_set_dependent_geometries (void) |
| void | T3D_widgets_to_data (void) |
| void | T3D_data_to_widgets (void) |
| void | T3D_poperr (char *, char *) |
| void | T3D_fix_dataset_dimen (void) |
| void | Syntax () |
| void | AFNI_load_defaults (Widget) |
| int | decode_location (char *str, float *val, int *dcode) |
| void | T3D_check_outliers (int) |
Variables | |
| char | orbuf [2] |
| char * | T3D_voxshape_label [3] |
| char * | T3D_voxcontig_label [3] |
| char * | T3D_centered_label [3] |
| char * | FD_colovr [NCOLOVR] = { "yellow" , "cyan" } |
| int | INIT_ngray |
| float | INIT_gamma |
| float | INIT_fov |
Define Documentation
|
|
Definition at line 163 of file to3d.h. Referenced by main(). |
|
|
Definition at line 65 of file to3d.h. Referenced by T3D_initialize_user_data(), and T3D_read_images(). |
|
|
Definition at line 64 of file to3d.h. Referenced by T3D_initialize_user_data(). |
|
|
Definition at line 66 of file to3d.h. Referenced by T3D_initialize_user_data(), and T3D_read_images(). |
|
|
Definition at line 159 of file to3d.h. Referenced by T3D_create_widgets(). |
|
|
Definition at line 162 of file to3d.h. Referenced by main(). |
|
|
Definition at line 23 of file to3d.h. Referenced by Syntax(), and T3D_create_widgets(). |
|
|
Value: ( ((aa)=='R'||(aa)=='r') ? ORI_R2L_TYPE \ :((aa)=='L'||(aa)=='l') ? ORI_L2R_TYPE \ :((aa)=='P'||(aa)=='p') ? ORI_P2A_TYPE \ :((aa)=='A'||(aa)=='a') ? ORI_A2P_TYPE \ :((aa)=='I'||(aa)=='i') ? ORI_I2S_TYPE \ :((aa)=='S'||(aa)=='s') ? ORI_S2I_TYPE : ILLEGAL_TYPE ) |
|
|
Definition at line 188 of file to3d.h. Referenced by T3D_centered_CB(), T3D_fov_av_CB(), T3D_open_view_CB(), T3D_orient_av_CB(), T3D_origin_av_CB(), T3D_quit_timeout_CB(), T3D_size_av_CB(), T3D_type_av_CB(), and T3D_voxshape_CB(). |
|
|
Value: ( orbuf[1] = '\0' , \ orbuf[0] = ORIENT_typestr[(cc)][0] , \ MCW_set_widget_label((ww),orbuf) ) Definition at line 128 of file to3d.h. Referenced by T3D_data_to_widgets(), and T3D_orient_av_CB(). |
|
|
Definition at line 125 of file to3d.h. Referenced by T3D_create_widgets(). |
|
|
Definition at line 124 of file to3d.h. Referenced by T3D_create_widgets(). |
|
|
|
|
|
Definition at line 147 of file to3d.h. Referenced by T3D_geometry_parent_CB(). |
|
|
Definition at line 146 of file to3d.h. Referenced by T3D_geometry_parent_CB(), and T3D_set_dependent_geometries(). |
|
|
Definition at line 139 of file to3d.h. Referenced by main(), T3D_create_widgets(), T3D_geometry_parent_CB(), T3D_set_dependent_geometries(), and T3D_voxshape_CB(). |
|
|
Definition at line 141 of file to3d.h. Referenced by main(), T3D_create_widgets(), T3D_geometry_parent_CB(), T3D_set_dependent_geometries(), and T3D_voxshape_CB(). |
|
|
Definition at line 140 of file to3d.h. Referenced by main(), T3D_create_widgets(), T3D_geometry_parent_CB(), and T3D_voxshape_CB(). |
|
|
Definition at line 153 of file to3d.h. Referenced by main(), T3D_centered_CB(), T3D_geometry_parent_CB(), T3D_read_images(), and T3D_set_dependent_geometries(). |
|
|
Definition at line 154 of file to3d.h. Referenced by main(), T3D_centered_CB(), T3D_geometry_parent_CB(), T3D_read_images(), and T3D_set_dependent_geometries(). |
|
|
Definition at line 155 of file to3d.h. Referenced by main(), T3D_centered_CB(), T3D_geometry_parent_CB(), T3D_read_images(), and T3D_set_dependent_geometries(). |
Function Documentation
|
|
initialization values (static values are used in afni.c only) * Definition at line 9765 of file afni.c. References BAD, BLUEST_COLOR, display, ENTRY, FIRST_RESAM_TYPE, INIT_bigscroll, INIT_crosshair_color, INIT_crosshair_gap, INIT_fim_polort, INIT_GR_backg_color, INIT_GR_boxes_color, INIT_GR_boxes_thick, INIT_GR_data_color, INIT_GR_data_thick, INIT_GR_dplot_color, INIT_GR_dplot_thick, INIT_GR_ggap, INIT_GR_gmat, INIT_GR_grid_color, INIT_GR_grid_thick, INIT_GR_gthick, INIT_GR_ideal_color, INIT_GR_ideal_thick, INIT_GR_ignore_color, INIT_GR_ort_color, INIT_GR_ort_thick, INIT_GR_text_color, INIT_ignore, INIT_marks1_color, INIT_marks2_color, INIT_marks_gap, INIT_marks_size, INIT_montage_periodic, INIT_ncolovr, INIT_ovin_pos, INIT_ovin_sgn, INIT_panes_hide, INIT_panes_pos, INIT_panes_sgn, INIT_posfunc, INIT_purge, INIT_pval_pos, INIT_pval_sgn, INIT_resam_anat, INIT_resam_func, INIT_resam_thr, INIT_resam_vox, INIT_tlrc_big, LAST_RESAM_TYPE, MAX_NCOLOVR, MAXOVSIZE, myXtFree, NAME2FLOAT, NAME2INT, NAME2STRING, NPANE_MAX, NPANE_MIN, and XtFree. Referenced by main().
09766 {
09767 char * xdef ;
09768 Display * display ;
09769 int ival , ii,jj ;
09770 float fval ;
09771 char * cpt ;
09772 char buf[64] ;
09773 float pthr[NPANE_MAX+1] ;
09774 int pov[NPANE_MAX+1] ;
09775
09776 ENTRY("AFNI_load_defaults") ;
09777
09778 if( w == NULL ){
09779 fprintf(stderr,"\n*** AFNI_load_defaults: NULL input widget ***\n") ;
09780 EXRETURN ;
09781 }
09782
09783 display = XtDisplay( w ) ;
09784
09785 /** initialize overlay color arrays from defaults **/
09786
09787 for( ii=0 ; ii < DEFAULT_NCOLOVR ; ii++ ){
09788 INIT_colovr[ii] = XtNewString(INIT_def_colovr[ii]) ;
09789 INIT_labovr[ii] = XtNewString(INIT_def_labovr[ii]) ;
09790 }
09791 for( ; ii < MAX_NCOLOVR ; ii++ ){
09792 INIT_colovr[ii] = INIT_labovr[ii] = NULL ;
09793 }
09794
09795 /** initialize display and overlay colors **/
09796
09797 NAME2INT("ncolors",INIT_ngray,3,MAX_COLORS) ;
09798
09799 NAME2INT("ncolovr",INIT_ncolovr,2,MAX_NCOLOVR) ;
09800
09801 NAME2FLOAT("gamma",INIT_gamma,0.1,9.9) ;
09802
09803 for( ii=0 ; ii < INIT_ncolovr ; ii++ ){
09804 sprintf( buf , "ovdef%02d" , ii+1 ) ;
09805 NAME2STRING(buf,INIT_colovr[ii] ) ;
09806
09807 sprintf( buf , "ovlab%02d" , ii+1 ) ;
09808 NAME2STRING(buf,INIT_labovr[ii] ) ;
09809 }
09810
09811 NAME2INT("ovcrosshair" , INIT_crosshair_color,0,INIT_ncolovr) ;
09812 NAME2INT("ovmarksprimary" , INIT_marks1_color ,0,INIT_ncolovr) ;
09813 NAME2INT("ovmarkssecondary" , INIT_marks2_color ,0,INIT_ncolovr) ;
09814 NAME2INT("markssize" , INIT_marks_size ,2,MAXOVSIZE ) ;
09815 NAME2INT("marksgap" , INIT_marks_gap ,0,MAXOVSIZE-1 ) ;
09816 NAME2INT("crosshairgap" , INIT_crosshair_gap ,0,MAXOVSIZE ) ;
09817 NAME2INT("bigscroll" , INIT_bigscroll ,1,MAXOVSIZE ) ;
09818
09819 NAME2INT("graph_boxes_color" ,INIT_GR_boxes_color ,BLUEST_COLOR,INIT_ncolovr) ;
09820 NAME2INT("graph_backg_color" ,INIT_GR_backg_color ,BLUEST_COLOR,INIT_ncolovr) ;
09821 NAME2INT("graph_grid_color" ,INIT_GR_grid_color ,BLUEST_COLOR,INIT_ncolovr) ;
09822 NAME2INT("graph_text_color" ,INIT_GR_text_color ,BLUEST_COLOR,INIT_ncolovr) ;
09823 NAME2INT("graph_data_color" ,INIT_GR_data_color ,BLUEST_COLOR,INIT_ncolovr) ;
09824 NAME2INT("graph_ideal_color" ,INIT_GR_ideal_color ,BLUEST_COLOR,INIT_ncolovr) ;
09825 NAME2INT("graph_ort_color" ,INIT_GR_ort_color ,BLUEST_COLOR,INIT_ncolovr) ;
09826 NAME2INT("graph_ignore_color",INIT_GR_ignore_color,BLUEST_COLOR,INIT_ncolovr) ;
09827 NAME2INT("graph_dplot_color" ,INIT_GR_dplot_color ,BLUEST_COLOR,INIT_ncolovr) ;
09828
09829 NAME2INT("graph_boxes_thick" ,INIT_GR_boxes_thick ,0,1) ;
09830 NAME2INT("graph_grid_thick" ,INIT_GR_grid_thick ,0,1) ;
09831 NAME2INT("graph_data_thick" ,INIT_GR_data_thick ,0,1) ;
09832 NAME2INT("graph_ideal_thick" ,INIT_GR_ideal_thick ,0,1) ;
09833 NAME2INT("graph_ort_thick" ,INIT_GR_ort_thick ,0,1) ;
09834 NAME2INT("graph_dplot_thick" ,INIT_GR_dplot_thick ,0,1) ;
09835
09836 NAME2INT("graph_ggap" ,INIT_GR_ggap ,0,19); /* 27 May 1999 */
09837 NAME2INT("fim_polort" ,INIT_fim_polort ,0,MAX_POLORT); /* 30 May 1999 */
09838 NAME2INT("graph_matrix" ,INIT_GR_gmat ,1,MAT_MAX); /* 10 Feb 2003 */
09839 NAME2INT("graph_gthick" ,INIT_GR_gthick ,2,10); /* 06 Oct 2004 */
09840
09841 /** initialize other junk **/
09842
09843 cpt = NULL ;
09844 NAME2STRING( "tlrc_big" , cpt ) ;
09845 if( cpt != NULL ){
09846 INIT_tlrc_big = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09847 XtFree(cpt) ;
09848 }
09849
09850 cpt = NULL ;
09851 NAME2STRING( "montage_periodic" , cpt ) ;
09852 if( cpt != NULL ){
09853 INIT_montage_periodic = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09854 XtFree(cpt) ;
09855 }
09856
09857 NAME2INT("fim_ignore",INIT_ignore,0,999) ;
09858
09859 cpt = NULL ;
09860 NAME2STRING( "purge" , cpt ) ;
09861 if( cpt != NULL ){
09862 INIT_purge = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09863 myXtFree(cpt) ;
09864 }
09865
09866 NAME2FLOAT("resam_vox",INIT_resam_vox,0.1,4.0) ;
09867 INIT_resam_vox = 0.1 * ( (int)(10*INIT_resam_vox) ) ;
09868
09869 cpt = NULL ;
09870 NAME2STRING( "resam_anat" , cpt ) ;
09871 if( cpt != NULL ){
09872 for( ii=FIRST_RESAM_TYPE ; ii <= LAST_RESAM_TYPE ; ii++ ){
09873 if( strcmp(cpt,RESAM_shortstr[ii]) == 0 ) break ;
09874 }
09875 if( ii <= LAST_RESAM_TYPE ) INIT_resam_anat = ii ;
09876 myXtFree(cpt) ;
09877 }
09878
09879 cpt = NULL ;
09880 NAME2STRING( "resam_func" , cpt ) ;
09881 if( cpt != NULL ){
09882 for( ii=FIRST_RESAM_TYPE ; ii <= LAST_RESAM_TYPE ; ii++ ){
09883 if( strcmp(cpt,RESAM_shortstr[ii]) == 0 ) break ;
09884 }
09885 if( ii <= LAST_RESAM_TYPE ) INIT_resam_func = ii ;
09886 (char*)myXtFree(cpt) ;
09887 }
09888
09889 cpt = NULL ;
09890 NAME2STRING( "resam_thr" , cpt ) ;
09891 if( cpt != NULL ){
09892 for( ii=FIRST_RESAM_TYPE ; ii <= LAST_RESAM_TYPE ; ii++ ){
09893 if( strcmp(cpt,RESAM_shortstr[ii]) == 0 ) break ;
09894 }
09895 if( ii <= LAST_RESAM_TYPE ) INIT_resam_thr = ii ;
09896 myXtFree(cpt) ;
09897 }
09898
09899 /** initialize pbar panes **/
09900
09901 cpt = NULL ;
09902 NAME2STRING( "pbar_posfunc" , cpt ) ;
09903 if( cpt != NULL ){
09904 INIT_posfunc = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09905 myXtFree(cpt) ;
09906 }
09907
09908 cpt = NULL ;
09909 NAME2STRING( "pbar_hide" , cpt ) ;
09910 if( cpt != NULL ){
09911 INIT_panes_hide = (strcmp(cpt,"True")==0) ? 1 : 0 ;
09912 myXtFree(cpt) ;
09913 }
09914
09915 NAME2INT("pbar_pos_pane_count" , INIT_panes_pos , NPANE_MIN , NPANE_MAX ) ;
09916 NAME2INT("pbar_sgn_pane_count" , INIT_panes_sgn , NPANE_MIN , NPANE_MAX ) ;
09917
09918 /* start with positive panes */
09919
09920 for( ii=NPANE_INIT+1 ; ii <= NPANE_MAX ; ii++ ){
09921 fval = 1.0 / ii ;
09922 pthr[0] = 1.0 ;
09923 pthr[ii] = 0.0 ;
09924 for( jj=1 ; jj < ii ; jj++ ) pthr[jj] = fval * (ii-jj) ;
09925 for( jj=0 ; jj < ii ; jj++ ) pov[jj] = (jj % INIT_ncolovr) + 1 ;
09926
09927 for( jj=0 ; jj <= ii ; jj++ ) INIT_pval_pos[ii][jj] = pthr[jj] ;
09928 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_pos[ii][jj] = pov[jj] ;
09929 }
09930
09931 for( ii=NPANE_MIN ; ii <= NPANE_MAX ; ii++ ){
09932
09933 for( jj=0 ; jj <= ii ; jj++ ){
09934 sprintf( buf , "pbar_pos_pane%02d_thr%02d" , ii,jj ) ;
09935 pthr[jj] = BAD ;
09936 NAME2FLOAT(buf,pthr[jj],0.0,1.0) ;
09937 }
09938
09939 for( jj=0 ; jj < ii ; jj++ ){
09940 sprintf( buf , "pbar_pos_pane%02d_ov%02d" , ii,jj ) ;
09941 pov[jj] = BAD ;
09942 NAME2INT(buf,pov[jj],0,INIT_ncolovr) ;
09943 }
09944
09945 /* check pthr for OK-ness; if not good, skip to next pane count (ii) */
09946
09947 if( pthr[0] != 1.0 || pthr[jj] != 0.0 ) continue ;
09948 for( jj=1 ; jj <= ii ; jj++ ){
09949 if( pthr[jj] == BAD || pthr[jj] >= pthr[jj-1] ) break ;
09950 }
09951 if( jj <= ii ) continue ;
09952
09953 /* check pov for OK-ness */
09954
09955 for( jj=0 ; jj < ii ; jj++ ) if( pov[jj] == BAD ) break ;
09956 if( jj < ii ) continue ;
09957
09958 /* get to here --> load pthr and pov into arrays */
09959
09960 for( jj=0 ; jj <= ii ; jj++ ) INIT_pval_pos[ii][jj] = pthr[jj] ;
09961 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_pos[ii][jj] = pov[jj] ;
09962
09963 }
09964
09965 /** initialize signed pbar panes **/
09966
09967 for( ii=NPANE_INIT+1 ; ii <= NPANE_MAX ; ii++ ){
09968 fval = 1.0 / ii ;
09969 pthr[0] = 1.0 ;
09970 pthr[ii] = -1.0 ;
09971 for( jj=1 ; jj < ii ; jj++ ) pthr[jj] = fval * (ii-2*jj) ;
09972 for( jj=0 ; jj < ii ; jj++ ) pov[jj] = (jj % INIT_ncolovr) + 1 ;
09973
09974 for( jj=0 ; jj <= ii ; jj++ ) INIT_pval_sgn[ii][jj] = pthr[jj] ;
09975 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_sgn[ii][jj] = pov[jj] ;
09976 }
09977
09978 for( ii=NPANE_MIN ; ii <= NPANE_MAX ; ii++ ){
09979
09980 for( jj=0 ; jj <= ii ; jj++ ){
09981 sprintf( buf , "pbar_sgn_pane%02d_thr%02d" , ii,jj ) ;
09982 pthr[jj] = BAD ;
09983 NAME2FLOAT(buf,pthr[jj],-1.0,1.0) ; /* 14 Apr 1999: 0.0 changed to -1.0! */
09984 }
09985
09986 for( jj=0 ; jj < ii ; jj++ ){
09987 sprintf( buf , "pbar_sgn_pane%02d_ov%02d" , ii,jj ) ;
09988 pov[jj] = BAD ;
09989 NAME2INT(buf,pov[jj],0,INIT_ncolovr) ;
09990 }
09991
09992 /* check pthr for OK-ness; if not good, skip to next pane count (ii) */
09993
09994 if( pthr[0] != 1.0 || pthr[jj] != -1.0 ) continue ;
09995 for( jj=1 ; jj <= ii ; jj++ ){
09996 if( pthr[jj] == BAD || pthr[jj] >= pthr[jj-1] ) break ;
09997 }
09998 if( jj <= ii ) continue ;
09999
10000 /* check pov for OK-ness */
10001
10002 for( jj=0 ; jj < ii ; jj++ ) if( pov[jj] == BAD ) break ;
10003 if( jj < ii ) continue ;
10004
10005 /* get to here --> load pthr and pov into arrays */
10006
10007 for( jj=0 ; jj <= ii ; jj++ ) INIT_pval_sgn[ii][jj] = pthr[jj] ;
10008 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_sgn[ii][jj] = pov[jj] ;
10009
10010 }
10011
10012 /* 10 Jun 2002: put RGB cyclic maps in place */
10013
10014 #if defined(RGBCYC_COUNT) && RGBCYC_COUNT <= NPANE_MAX
10015 ii = RGBCYC_COUNT ;
10016 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_pos[ii][jj] = RGBCYC_FIRST+jj+1 ;
10017 for( jj=0 ; jj < ii ; jj++ ) INIT_ovin_sgn[ii][jj] = RGBCYC_FIRST+jj+1 ;
10018 #endif
10019
10020 EXRETURN ;
10021 }
|
|
||||||||||||||||
|
Definition at line 5743 of file to3d.c. References ORCODE, and strtod(). Referenced by T3D_initialize_user_data().
05744 {
05745 char acod , * ptr , * sstr = str ;
05746
05747 *val = WAY_BIG ;
05748 *dcode = ILLEGAL_TYPE ;
05749 if( sstr == NULL || sstr[0] == '\0' ) return 0 ;
05750
05751 /** see if we get a legal direction code here **/
05752
05753 acod = toupper(sstr[0]) ; *dcode = ORCODE(acod) ;
05754 if( *dcode >= 0 ) sstr++ ;
05755
05756 if( sstr[0] == '\0' ) return ((*dcode < 0) ? 0 : 1) ;
05757
05758 /** get number here **/
05759
05760 *val = strtod( sstr , &ptr ) ;
05761 if( *val == 0.0 && ptr == sstr ) return ((*dcode < 0) ? 0 : 1) ;
05762 sstr = ptr ;
05763
05764 if( *dcode >= 0 || sstr[0] == '\0' ) return (sstr-str) ;
05765
05766 acod = toupper(sstr[0]) ; *dcode = ORCODE(acod) ;
05767 if( *dcode >= 0 ) sstr++ ;
05768
05769 return (sstr-str) ;
05770 }
|
|
|
31 July 1996: be more specific about errors * Definition at line 25 of file Vecwarp.c.
00026 {
00027 printf(
00028 "Usage: Vecwarp [options]\n"
00029 "Transforms (warps) a list of 3-vectors into another list of 3-vectors\n"
00030 "according to the options. Error messages, warnings, and informational\n"
00031 "messages are written to stderr. If a fatal error occurs, the program\n"
00032 "exits with status 1; otherwise, it exits with status 0.\n"
00033 "\n"
00034 "OPTIONS:\n"
00035 " -apar aaa = Use the AFNI dataset 'aaa' as the source of the\n"
00036 " transformation; this dataset must be in +acpc\n"
00037 " or +tlrc coordinates, and must contain the\n"
00038 " attributes WARP_TYPE and WARP_DATA which describe\n"
00039 " the forward transformation from +orig coordinates\n"
00040 " to the 'aaa' coordinate system.\n"
00041 " N.B.: The +orig version of this dataset must also be\n"
00042 " readable, since it is also needed when translating\n"
00043 " vectors between SureFit and AFNI coordinates.\n"
00044 " Only the .HEAD files are actually used.\n"
00045 "\n"
00046 " -matvec mmm = Read an affine transformation matrix-vector from file\n"
00047 " 'mmm', which must be in the format\n"
00048 " u11 u12 u13 v1\n"
00049 " u21 u22 u23 v2\n"
00050 " u31 u32 u33 v3\n"
00051 " where each 'uij' and 'vi' is a number. The forward\n"
00052 " transformation is defined as\n"
00053 " [ xout ] [ u11 u12 u13 ] [ xin ] [ v1 ]\n"
00054 " [ yout ] = [ u21 u22 u23 ] [ yin ] + [ v2 ]\n"
00055 " [ zout ] [ u31 u32 u33 ] [ zin ] [ v3 ]\n"
00056 "\n"
00057 " Exactly one of -apar or -matvec must be used to specify the\n"
00058 " transformation.\n"
00059 "\n"
00060 " -forward = -forward means to apply the forward transformation;\n"
00061 " *OR* -backward means to apply the backward transformation\n"
00062 " -backward * For example, if the transformation is specified by\n"
00063 " '-apar fred+tlrc', then the forward transformation\n"
00064 " is from +orig to +tlrc coordinates, and the backward\n"
00065 " transformation is from +tlrc to +orig coordinates.\n"
00066 " * If the transformation is specified by -matvec, then\n"
00067 " the matrix-vector read in defines the forward\n"
00068 " transform as above, and the backward transformation\n"
00069 " is defined as the inverse.\n"
00070 " * If neither -forward nor -backward is given, then\n"
00071 " -forward is the default.\n"
00072 "\n"
00073 " -input iii = Read input 3-vectors from file 'iii' (from stdin if\n"
00074 " 'iii' is '-' or the -input option is missing). Input\n"
00075 " data may be in one of the following ASCII formats:\n"
00076 "\n"
00077 " * SureFit .coord files:\n"
00078 " BeginHeader\n"
00079 " lines of text ...\n"
00080 " EndHeader\n"
00081 " count\n"
00082 " int x y z\n"
00083 " int x y z\n"
00084 " et cetera...\n"
00085 " In this case, everything up to and including the\n"
00086 " count is simply passed through to the output. Each\n"
00087 " (x,y,z) triple is transformed, and output with the\n"
00088 " int label that precedes it. Lines that cannot be\n"
00089 " scanned as 1 int and 3 floats are treated as comments\n"
00090 " and are passed to through to the output unchanged.\n"
00091 " N.B.: SureFit coordinates are\n"
00092 " x = distance Right of Left-most dataset corner\n"
00093 " y = distance Anterior to Posterior-most dataset corner\n"
00094 " z = distance Superior to Inferior-most dataset corner\n"
00095 " For example, if the transformation is specified by\n"
00096 " -forward -apar fred+tlrc\n"
00097 " then the input (x,y,z) are relative to fred+orig and the\n"
00098 " output (x,y,z) are relative to fred+tlrc. If instead\n"
00099 " -backward -apar fred+tlrc\n"
00100 " is used, then the input (x,y,z) are relative to fred+tlrc\n"
00101 " and the output (x,y,z) are relative to fred+orig.\n"
00102 " For this to work properly, not only fred+tlrc must be\n"
00103 " readable by Vecwarp, but fred+orig must be as well.\n"
00104 " If the transformation is specified by -matvec, then\n"
00105 " the matrix-vector transformation is applied to the\n"
00106 " (x,y,z) vectors directly, with no coordinate shifting.\n"
00107 "\n"
00108 " * AFNI .1D files with 3 columns\n"
00109 " x y z\n"
00110 " x y z\n"
00111 " et cetera...\n"
00112 " In this case, each (x,y,z) triple is transformed and\n"
00113 " written to the output. Lines that cannot be scanned\n"
00114 " as 3 floats are treated as comments and are passed\n"
00115 " through to the output unchanged.\n"
00116 " N.B.: AFNI (x,y,z) coordinates are in DICOM order:\n"
00117 " -x = Right +x = Left\n"
00118 " -y = Anterior +y = Posterior\n"
00119 " -z = Inferior +z = Superior\n"
00120 "\n"
00121 " -output ooo = Write the output to file 'ooo' (to stdout if 'ooo'\n"
00122 " is '-', or if the -output option is missing). If the\n"
00123 " file already exists, it will not be overwritten unless\n"
00124 " the -force option is also used.\n"
00125 "\n"
00126 " -force = If the output file already exists, -force can be\n"
00127 " used to overwrite it. If you want to use -force,\n"
00128 " it must come before -output on the command line.\n"
00129 "\n"
00130 "EXAMPLES:\n"
00131 "\n"
00132 " Vecwarp -apar fred+tlrc -input fred.orig.coord > fred.tlrc.coord\n"
00133 "\n"
00134 "This transforms the vectors defined in original coordinates to\n"
00135 "Talairach coordinates, using the transformation previously defined\n"
00136 "by AFNI markers.\n"
00137 "\n"
00138 " Vecwarp -apar fred+tlrc -input fred.tlrc.coord -backward > fred.test.coord\n"
00139 "\n"
00140 "This does the reverse transformation; fred.test.coord should differ from\n"
00141 "fred.orig.coord only by roundoff error.\n"
00142 "\n"
00143 "Author: RWCox - October 2001\n"
00144 ) ;
00145 exit(0) ;
00146 }
|
|
||||||||||||||||
|
Definition at line 5543 of file to3d.c. References to3d_data::anatomy_dataname, to3d_data::anatomy_parent_filename, to3d_data::anatomy_parent_idcode, client_data, DEBLANK, ENTRY, FILENAME_TO_PREFIX, THD_3dim_dataset::idcode, INERR, ISFUNC, MCW_strncpy, myXtFree, PATH_CONCAT, THD_3dim_dataset::self_name, to3d_widget_set::session_file_textfield, to3d_data::session_filename, T3D_poperr(), THD_delete_3dim_dataset(), THD_MAX_NAME, and THD_open_one_dataset(). Referenced by main(), and T3D_create_widgets().
05545 {
05546 static char * old_name = NULL ;
05547 char * new_name ;
05548 char new_path[THD_MAX_NAME] , new_pref[THD_MAX_NAME] ;
05549 Boolean isfunc ;
05550 THD_3dim_dataset * anat_dset ;
05551
05552 ENTRY("T3D_anatomy_parent_CB") ;
05553
05554 if( old_name == NULL ) old_name = XtNewString("Elvis Lives!!!") ;
05555
05556 /* see if the new text is any different from the old one */
05557
05558 if( w != NULL ){
05559 new_name = XmTextFieldGetString( w ) ; /* get the new text */
05560 } else {
05561 new_name = XtNewString( user_inputs.anatomy_parent_filename ) ;
05562 }
05563 DEBLANK(new_name) ;
05564
05565 if( strlen(new_name) == 0 ) { old_name = new_name ; EXRETURN ; }
05566 if( strcmp(new_name,old_name) == 0 ){ myXtFree(new_name) ; EXRETURN ; }
05567
05568 /* have a new filename --> try to read dataset from it */
05569
05570 myXtFree(old_name) ; old_name = new_name ;
05571
05572 /* make a pathname to the anatomy dataset */
05573
05574 if( strstr(new_name,"/") == NULL ){
05575 char * sess ;
05576 if( w != NULL ) sess = XmTextFieldGetString(wset.session_file_textfield);
05577 else sess = XtNewString( user_inputs.session_filename ) ;
05578 DEBLANK(sess) ;
05579 if( strlen(sess) > 0 ){
05580 PATH_CONCAT( new_path , sess , new_name ) ;
05581 } else {
05582 strcpy( new_path , new_name ) ;
05583 }
05584 myXtFree(sess) ;
05585 } else {
05586 strcpy( new_path , new_name ) ;
05587 }
05588
05589 FILENAME_TO_PREFIX(new_path,new_pref) ;
05590 if( strlen(new_pref) == 0 ) strcat(new_path,"+orig") ;
05591
05592 anat_dset = THD_open_one_dataset( new_path ) ;
05593 if( anat_dset == NULL ){
05594 T3D_poperr( INERR ,
05595 "Cannot read 3D dataset\nin anatomy parent file" ) ;
05596 EXRETURN ;
05597 }
05598
05599 isfunc = ISFUNC(anat_dset) ;
05600 if( isfunc ){
05601 T3D_poperr( INERR ,
05602 "Anatomy parent dataset\nis actually Function data!" ) ;
05603 THD_delete_3dim_dataset( anat_dset , False ) ;
05604 EXRETURN ;
05605 }
05606
05607 /* at this point, the anat dataset seems OK, so use it */
05608
05609 MCW_strncpy( user_inputs.anatomy_dataname ,
05610 anat_dset->self_name , THD_MAX_NAME ) ;
05611 user_inputs.anatomy_parent_idcode = anat_dset->idcode ;
05612
05613 #ifndef NO_NAMES
05614 if( w != NULL ) XmTextFieldSetString( wset.anatomy_dataname_textfield ,
05615 user_inputs.anatomy_dataname ) ;
05616 #endif
05617
05618 MCW_strncpy( user_inputs.anatomy_parent_filename ,
05619 new_name , THD_MAX_NAME ) ;
05620
05621 THD_delete_3dim_dataset( anat_dset , False ) ;
05622
05623 EXRETURN ;
05624 }
|
|
||||||||||||||||
|
|
Definition at line 5152 of file to3d.c. References AFNI_GOOD_DTYPE, AFNI_GOOD_FUNC_DTYPE, to3d_data::anatomy_dataname, argopt, DATASET_HEADER_SUFFIX, to3d_data::dataset_name, to3d_data::dataset_type, ENTRY, to3d_data::function_type, ISFUNCTYPE, to3d_data::need_stat_aux, OUTERR, to3d_data::output_filename, PATH_CONCAT, RETURN, to3d_data::session_filename, to3d_data::stat_aux, STATUS, T3D_poperr(), T3D_setup_stat_aux(), THD_is_directory(), THD_is_file(), THD_MAX_NAME, to3d_data::xorient, to3d_data::yorient, and to3d_data::zorient. Referenced by main(), and T3D_save_file_CB().
05153 {
05154 char xlab,ylab,zlab ;
05155 int ii , ll , ll_out , ll_sess ;
05156 Boolean good = True , isfunc ;
05157 char new_name[THD_MAX_NAME] ;
05158
05159 ENTRY("T3D_check_data") ;
05160
05161 /*-- check that orientations are legal --*/
05162
05163 xlab = ORIENT_xyz[user_inputs.xorient] ;
05164 ylab = ORIENT_xyz[user_inputs.yorient] ;
05165 zlab = ORIENT_xyz[user_inputs.zorient] ;
05166
05167 if( xlab == ylab || xlab == zlab || ylab == zlab ){
05168 if(perr)T3D_poperr( OUTERR , "Axes orientations are not consistent!" ) ;
05169 good = False ;
05170 }
05171
05172 /*-- check that the output filename is acceptable --*/
05173
05174 STATUS("check output filename") ;
05175
05176 ll_out = ll = strlen( user_inputs.output_filename ) ;
05177 if( ll == 0 ){
05178 if(perr)T3D_poperr( OUTERR , "No output filename provided!" ) ;
05179 good = False ;
05180 } else {
05181 for( ii=0 ; ii < ll ; ii++ )
05182 if( iscntrl(user_inputs.output_filename[ii]) ||
05183 isspace(user_inputs.output_filename[ii]) ||
05184 user_inputs.output_filename[ii] == '/' ) break ;
05185
05186 if( ii < ll ){
05187 if(perr)T3D_poperr( OUTERR ,
05188 "Output filename contains illegal character!" ) ;
05189 good = False ;
05190 }
05191 }
05192
05193 /*-- check that the session filename is acceptable --*/
05194
05195 STATUS("check session name") ;
05196
05197 ll_sess = ll = strlen( user_inputs.session_filename ) ;
05198 if( ll == 0 ){
05199 if(perr)T3D_poperr( OUTERR , "No session directory name provided!" ) ;
05200 good = False ;
05201 } else {
05202 for( ii=0 ; ii < ll ; ii++ )
05203 if( iscntrl(user_inputs.session_filename[ii]) ||
05204 isspace(user_inputs.session_filename[ii]) ) break ;
05205
05206 if( ii < ll ){
05207 if(perr)T3D_poperr( OUTERR ,
05208 "Session filename contains illegal character!" ) ;
05209 good = False ;
05210 }
05211 }
05212
05213 /* Check if the file already exists */
05214
05215 STATUS("check if file exists") ;
05216
05217 if( ll_sess > 0 && ll_out > 0 ){
05218 PATH_CONCAT( new_name , user_inputs.session_filename ,
05219 user_inputs.output_filename ) ;
05220 strcat(new_name , "+orig." DATASET_HEADER_SUFFIX ) ;
05221 ll = THD_is_file( new_name ) || THD_is_directory( new_name ) ;
05222 if( ll ){
05223 if(perr) T3D_poperr( OUTERR , "Output file already exists!" ) ;
05224 good = False ;
05225 }
05226 }
05227
05228 /*-- if the image type is functional, check
05229 that the anatomy parent dataset name has been set --*/
05230
05231 isfunc = ISFUNCTYPE(user_inputs.dataset_type) ;
05232
05233 #ifdef REQUIRE_ANAT_PARENT
05234 if( isfunc && strlen(user_inputs.anatomy_dataname) == 0 ){
05235 if(perr)T3D_poperr( OUTERR , "Anatomy parent not properly set!" ) ;
05236 good = False ;
05237 }
05238 #endif
05239
05240 /*-- check for good data types in the bricks --*/
05241
05242 STATUS("check data types") ;
05243
05244 if( isfunc ){
05245 if( ! AFNI_GOOD_FUNC_DTYPE(argopt.datum_all) ){
05246 if(perr)T3D_poperr(OUTERR , "Illegal functional datum type!" ) ;
05247 good = False ;
05248 }
05249 } else {
05250 if( ! AFNI_GOOD_DTYPE(argopt.datum_all) ){
05251 if(perr)T3D_poperr(OUTERR , "Illegal anatomical datum type!" ) ;
05252 good = False ;
05253 }
05254 }
05255
05256 /*-- check if a dataset name has been defined --*/
05257
05258 #ifndef NO_NAMES
05259 if( strlen(user_inputs.dataset_name) == 0 ){
05260 if(perr)T3D_poperr( OUTERR,"You **MUST** supply a name for the dataset!" ) ;
05261 good = False ;
05262 }
05263 #endif
05264
05265 /*-- check if the stat_aux parameters are good --*/
05266
05267 STATUS("check stat aux") ;
05268
05269 T3D_setup_stat_aux() ;
05270 if( user_inputs.need_stat_aux ){
05271
05272 for( ii=0 ; ii < FUNC_need_stat_aux[user_inputs.function_type] ; ii++ )
05273 if( user_inputs.stat_aux[ii] <= 0.0 ) break ;
05274
05275 if( ii < FUNC_need_stat_aux[user_inputs.function_type] ){
05276 if(perr)T3D_poperr(OUTERR , "Invalid statistical parameters!" ) ;
05277 good = False ;
05278 }
05279 }
05280
05281 /*-- return the status we found --*/
05282
05283 RETURN( good );
05284 }
|
|
|
get number here * Definition at line 5775 of file to3d.c. References AFMALL, CURSOR_normalize, CURSOR_watchize, to3d_data::dataset_type, ENTRY, free, to3d_widget_set::good, ISANATTYPE, MCW_CALLER_KILL, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, my_getenv(), negative_shorts, THD_timeaxis::ntt, nvox_total, outliers_fname, to3d_data::output_filename, plot_ts_lab(), to3d_widget_set::save_file_pb, skip, THD_3dim_dataset::taxis, THD_outlier_count(), to3d_widget_set::topshell, MCW_arrowval::wrowcol, and to3d_widget_set::xsize_av. Referenced by AFNI_startup_timeout_CB(), T3D_save_file_CB(), and T3D_swap_CB().
05776 {
05777 char *eee = my_getenv("AFNI_TO3D_OUTLIERS") ;
05778 int skip = (eee != NULL && (*eee == 'N' || *eee == 'n')) ;
05779 int text = (eee != NULL && (*eee == 'T' || *eee == 't')) ;
05780
05781 ENTRY("T3D_check_outliers") ;
05782
05783 if( dset->taxis != NULL &&
05784 dset->taxis->ntt > 5 &&
05785 !skip &&
05786 ISANATTYPE(user_inputs.dataset_type) &&
05787 negative_shorts < 0.01*nvox_total ){
05788
05789 int *out_count, out_ctop , cc=0 ;
05790 Widget wmsg ;
05791
05792 if( wset.topshell != NULL && wset.good ){
05793 wmsg = MCW_popup_message( wset.save_file_pb ,
05794 "****************\n"
05795 "* Checking for *\n"
05796 "* time series *\n"
05797 "* outliers *\n"
05798 "****************" ,
05799 MCW_CALLER_KILL ) ;
05800 CURSOR_watchize ;
05801 } else {
05802 fprintf(stderr,"Checking for time series outliers\n") ;
05803 }
05804
05805 THD_outlier_count( dset , 0.01 , &out_count , &out_ctop ) ;
05806
05807 if( out_count != NULL && out_ctop > 0 ){ /* compute the output message */
05808 int iv,nvals=dset->taxis->ntt ; char *msg = AFMALL(char,2048+8*nvals) ;
05809
05810 strcpy(msg," \nto3d WARNING:\nSignificant outliers detected in these sub-bricks:\n") ;
05811
05812 for( iv=0 ; iv < nvals ; iv++ ){
05813 if( out_count[iv] > out_ctop ){
05814 sprintf(msg+strlen(msg)," %3d",iv) ; cc++ ;
05815 if( cc%12 == 0 ) strcat(msg,"\n") ;
05816 }
05817 }
05818
05819 if( outliers_fname != NULL ){ /* 26 Aug 2001 */
05820 FILE *fp = fopen( outliers_fname , "w" ) ;
05821 if( fp == NULL ){
05822 fprintf(stderr,"** Can't open -save_outliers %s\n",outliers_fname);
05823 } else {
05824 for( iv=0 ; iv < nvals ; iv++ )
05825 fprintf(fp,"%3d %3d\n",out_count[iv],out_ctop) ;
05826 fclose(fp) ;
05827 }
05828 }
05829
05830 if( cc > 0 ){ /* any sub-bricks fail? */
05831 if( cc%12 > 0 ) strcat(msg,"\n") ;
05832 strcat(msg,"You should inspect the dataset for possible corruption.\n");
05833 strcat(msg," [Outliers are defined as in program 3dToutcount. ]\n");
05834 strcat(msg," [Outliers early in an EPI time series may be due to ]\n");
05835 strcat(msg," [the longitudinal magnetization equilibration effect.]\n");
05836 strcat(msg," [Other causes are subject movement, scanner problems,]\n");
05837 strcat(msg," [or anything that makes a time series look irregular.]\n");
05838 strcat(msg," [ 3dToutcount -save outnam dataset | 1dplot -stdin ]\n");
05839 strcat(msg," [can be used to make a dataset 'outnam' that marks ]\n");
05840 strcat(msg," [outlier voxels; see 3dToutcount -help for details. ]\n");
05841
05842 fprintf(stderr,"%s\n",msg) ; /* print message */
05843 if( wset.topshell != NULL && !text && wset.good ){ /* graph outlier count */
05844 float *y[2] ;
05845 y[0] = AFMALL(float, sizeof(float)*nvals) ;
05846 y[1] = AFMALL(float, sizeof(float)*nvals) ;
05847 for( iv=0 ; iv < nvals ; iv++ ){
05848 y[0][iv] = out_count[iv] ; y[1][iv] = out_ctop ;
05849 }
05850 plot_ts_lab( XtDisplay(wset.topshell) , /* graph */
05851 nvals , NULL , 2 , y ,
05852 "Sub-brick Index" ,
05853 "Outlier Count (and Threshold)" ,
05854 user_inputs.output_filename , NULL , NULL ) ;
05855 free(y[0]); free(y[1]) ;
05856 (void) MCW_popup_message( wset.xsize_av->wrowcol , /* message */
05857 msg , MCW_USER_KILL ) ;
05858 }
05859 }
05860 free(msg) ;
05861 }
05862
05863 if( out_count != NULL ) free(out_count) ;
05864
05865 if( wset.topshell != NULL && wset.good ){
05866 XtDestroyWidget(wmsg); CURSOR_normalize;
05867 if( cc == 0 )
05868 (void) MCW_popup_message( wset.save_file_pb ,
05869 " \n"
05870 "** No unusual outlier **\n"
05871 "** concentration found **\n" ,
05872 MCW_USER_KILL | MCW_TIMER_KILL ) ;
05873 } else {
05874 if( cc == 0 )
05875 fprintf(stderr,"No unusual outlier concentration found\n") ;
05876 }
05877 }
05878
05879 EXRETURN ;
05880 }
|
|
|
Mar 1997: if any FOV or SLAB command line inputs are used, then require that they all be given. * Definition at line 414 of file to3d.c. References to3d_widget_set::action_frame, to3d_widget_set::action_rowcol, MCW_arrowval::allow_wrap, to3d_data::anatomy_parent_filename, to3d_widget_set::anatomy_parent_label, to3d_widget_set::anatomy_parent_textfield, to3d_data::anatomy_type, to3d_widget_set::anatomy_type_av, argopt, AV_SENSITIZE, to3d_widget_set::button_help_pb, to3d_widget_set::centered_bbox, DATASET_BRICK_SUFFIX, DATASET_HEADER_SUFFIX, to3d_data::dataset_name, to3d_data::dataset_type, to3d_widget_set::dataset_type_av, to3d_widget_set::datum_label, to3d_widget_set::dc, ENTRY, FIRST_3DIM_TYPE, FIRST_ANAT_TYPE, FIRST_FUNC_TYPE, FIRST_ORIENT_TYPE, FIRST_VIEW_TYPE, to3d_data::fov, to3d_widget_set::fov_av, to3d_data::function_type, to3d_widget_set::function_type_av, to3d_data::geometry_parent_filename, to3d_widget_set::geometry_parent_label, to3d_widget_set::geometry_parent_textfield, to3d_widget_set::good, LABEL_ARG, LAST_3DIM_TYPE, LAST_ANAT_TYPE, LAST_FUNC_TYPE, LAST_ORIENT_TYPE, LAST_VIEW_TYPE, LONGEST_3DIM_TYPESTR, LONGEST_ANAT_TYPESTR, LONGEST_FUNC_TYPESTR, LONGEST_ORIENT_TYPESTR, LONGEST_VIEW_TYPESTR, MCW_AV_downup, MCW_AV_editext, MCW_AV_readtext, MCW_BB_check, MCW_BB_frame, MCW_BB_radio_one, MCW_new_DC(), MCW_reghelp_children(), MCW_reghint_children(), MCW_register_help(), MCW_register_hint(), MCW_set_widget_bg(), mri_datum_size(), NCOLOVR, new_MCW_arrowval(), new_MCW_bbox(), NO_NAMES, to3d_data::ntt, to3d_data::nx, to3d_data::ny, to3d_data::nzz, to3d_widget_set::open_view_pb, to3d_widget_set::output_file_label, to3d_widget_set::output_file_textfield, to3d_data::output_filename, to3d_widget_set::quit_pb, to3d_widget_set::region_separator, to3d_widget_set::save_file_pb, to3d_widget_set::seq, to3d_widget_set::session_file_label, to3d_widget_set::session_file_textfield, to3d_data::session_filename, to3d_data::short_label1, to3d_widget_set::stat_aux_label, to3d_widget_set::stat_aux_textfield, to3d_widget_set::swap_pb, T3D_anatomy_parent_CB(), T3D_centered_CB(), T3D_data_to_widgets(), T3D_FORM_SPACING, T3D_fov_av_CB(), T3D_geometry_parent_CB(), T3D_NAME_WIDTH, T3D_open_view_CB(), T3D_orient_av_CB(), T3D_origin_av_CB(), T3D_pointer_leave_EV(), T3D_quit_CB(), T3D_save_file_CB(), T3D_set_dependent_geometries(), T3D_size_av_CB(), T3D_stat_aux_CB(), T3D_swap_CB(), T3D_text_display(), T3D_type_av_CB(), T3D_voxcontig_CB(), T3D_voxshape_CB(), THD_MAX_LABEL, THD_MAX_NAME, THD_MAX_PREFIX, to3d_widget_set::topform, to3d_widget_set::topshell, to3d_data::Torg, to3d_data::TR, to3d_widget_set::TR_label, tt, to3d_data::tunits, UNITS_TYPE_LABEL, VIEW_ORIGINAL_STR, to3d_data::view_type, to3d_widget_set::view_type_av, to3d_widget_set::voxcontig_bbox, to3d_data::voxshape, to3d_widget_set::voxshape_bbox, VOXSHAPE_CUBICAL, VOXSHAPE_IRREGULAR, VOXSHAPE_SQUARE, WAIT_for_window, MCW_bbox::wbut, MCW_bbox::wrowcol, MCW_arrowval::wrowcol, MCW_arrowval::wtext, MCW_bbox::wtop, to3d_data::xorient, to3d_widget_set::xorient_av, to3d_data::xorigin, to3d_widget_set::xorigin_av, to3d_widget_set::xorigin_label, to3d_data::xsize, to3d_widget_set::xsize_av, to3d_data::yorient, to3d_widget_set::yorient_av, to3d_data::yorigin, to3d_widget_set::yorigin_av, to3d_widget_set::yorigin_label, to3d_data::ysize, to3d_widget_set::ysize_av, to3d_data::zorient, to3d_widget_set::zorient_av, to3d_data::zorigin, to3d_widget_set::zorigin_av, to3d_widget_set::zorigin_label, to3d_data::zsize, to3d_widget_set::zsize_av, to3d_data::zspacing, and to3d_widget_set::zspacing_av. Referenced by main().
00415 {
00416 ENTRY("T3D_create_widgets") ;
00417 wset.dc = MCW_new_DC( wset.topshell, argopt.ncolor,
00418 NCOLOVR,FD_colovr,FD_colovr, argopt.gamma , 0 );
00419 wset.seq = NULL ; /* no viewing open now */
00420
00421 /*---- form to hold all widgets ----*/
00422
00423 wset.topform = XtVaCreateWidget(
00424 "dialog" , xmFormWidgetClass , wset.topshell ,
00425 XmNborderWidth , 0 ,
00426 #if 1
00427 XmNtraversalOn , False ,
00428 #endif
00429 NULL ) ;
00430
00431 MCW_register_help( wset.topform ,
00432 "I weep for Adonais--he is dead!\n"
00433 "Oh, weep for Adonais! though our tears\n"
00434 "Thaw not the frost which binds so dear a head!\n"
00435 "And thou, sad Hour, selected from all years\n"
00436 "To mourn our loss, rouse thy obscure compeers,\n"
00437 "And teach them thine own sorrow, say: 'With me\n"
00438 "Died Adonais; till the Future dares\n"
00439 "Forget the Past, his fate and fame shall be\n"
00440 "An echo and a light unto eternity!'"
00441 ) ;
00442
00443 /*---- 3 arrowvals for orientation ----*/
00444
00445 wset.xorient_av = new_MCW_arrowval(
00446 wset.topform , /* parent */
00447 "x orientation\n(across screen)" , /* label */
00448 MCW_AV_downup , /* arrows */
00449 FIRST_ORIENT_TYPE , /* min */
00450 LAST_ORIENT_TYPE , /* max */
00451 user_inputs.xorient , /* init */
00452 MCW_AV_readtext , /* text */
00453 0 , /* decimals */
00454 T3D_orient_av_CB , NULL , /* callback */
00455 T3D_text_display , /* text maker */
00456 ORIENT_typestr /* and data */
00457 ) ;
00458
00459 XtVaSetValues( wset.xorient_av->wrowcol ,
00460 XmNleftAttachment , XmATTACH_FORM ,
00461 XmNleftOffset , T3D_FORM_SPACING ,
00462 XmNtopAttachment , XmATTACH_FORM ,
00463 XmNtopOffset , T3D_FORM_SPACING ,
00464 NULL ) ;
00465
00466 wset.yorient_av = new_MCW_arrowval(
00467 wset.topform , /* parent */
00468 "y orientation\n (down screen) " , /* label */
00469 MCW_AV_downup , /* arrows */
00470 FIRST_ORIENT_TYPE , /* min */
00471 LAST_ORIENT_TYPE , /* max */
00472 user_inputs.yorient , /* init */
00473 MCW_AV_readtext , /* text */
00474 0 , /* decimals */
00475 T3D_orient_av_CB , NULL , /* callback */
00476 T3D_text_display , /* text maker */
00477 ORIENT_typestr /* and data */
00478 ) ;
00479
00480 XtVaSetValues( wset.yorient_av->wrowcol ,
00481 XmNtopAttachment , XmATTACH_WIDGET ,
00482 XmNtopWidget , wset.xorient_av->wrowcol ,
00483 XmNtopOffset , T3D_FORM_SPACING ,
00484 XmNleftAttachment , XmATTACH_FORM ,
00485 XmNleftOffset , T3D_FORM_SPACING ,
00486 NULL ) ;
00487
00488 wset.zorient_av = new_MCW_arrowval(
00489 wset.topform , /* parent */
00490 "z orientation\n(slices 0,1,..)" , /* label */
00491 MCW_AV_downup , /* arrows */
00492 FIRST_ORIENT_TYPE , /* min */
00493 LAST_ORIENT_TYPE , /* max */
00494 user_inputs.zorient , /* init */
00495 MCW_AV_readtext , /* text */
00496 0 , /* decimals */
00497 T3D_orient_av_CB , NULL , /* callback */
00498 T3D_text_display , /* text maker */
00499 ORIENT_typestr /* and data */
00500 ) ;
00501
00502 XtVaSetValues( wset.zorient_av->wrowcol ,
00503 XmNtopAttachment , XmATTACH_WIDGET ,
00504 XmNtopWidget , wset.yorient_av->wrowcol ,
00505 XmNtopOffset , T3D_FORM_SPACING ,
00506 XmNleftAttachment , XmATTACH_FORM ,
00507 XmNleftOffset , T3D_FORM_SPACING ,
00508 NULL ) ;
00509
00510 XtVaSetValues( wset.xorient_av->wtext ,
00511 XmNcolumns , LONGEST_ORIENT_TYPESTR ,
00512 XmNmaxLength , LONGEST_ORIENT_TYPESTR ,
00513 NULL ) ;
00514
00515 XtVaSetValues( wset.yorient_av->wtext ,
00516 XmNcolumns , LONGEST_ORIENT_TYPESTR ,
00517 XmNmaxLength , LONGEST_ORIENT_TYPESTR ,
00518 NULL ) ;
00519
00520 XtVaSetValues( wset.zorient_av->wtext ,
00521 XmNcolumns , LONGEST_ORIENT_TYPESTR ,
00522 XmNmaxLength , LONGEST_ORIENT_TYPESTR ,
00523 NULL ) ;
00524
00525 wset.xorient_av->allow_wrap = 1 ;
00526 wset.yorient_av->allow_wrap = 1 ;
00527 wset.zorient_av->allow_wrap = 1 ;
00528
00529 MCW_reghelp_children( wset.xorient_av->wrowcol ,
00530 "Choose the anatomical orientation\n"
00531 "which fits the images when displayed\n"
00532 "in their ORIGINAL orientation:\n"
00533 "left->right, across the screen" ) ;
00534 MCW_reghint_children( wset.xorient_av->wrowcol ,
00535 "Anatomical orientation across screen" ) ;
00536
00537 MCW_reghelp_children( wset.yorient_av->wrowcol ,
00538 "Choose the anatomical orientation\n"
00539 "which fits the images when displayed\n"
00540 "in their ORIGINAL orientation:\n"
00541 "top->bottom, down the screen" ) ;
00542 MCW_reghint_children( wset.yorient_av->wrowcol ,
00543 "Anatomical orientation down screen" ) ;
00544
00545 MCW_reghelp_children( wset.zorient_av->wrowcol ,
00546 "Choose the anatomical orientation\n"
00547 "which fits the images when displayed\n"
00548 "in their ORIGINAL orientation:\n"
00549 "slice order, `thru' the screen" ) ;
00550 MCW_reghint_children( wset.zorient_av->wrowcol ,
00551 "Anatomical orientation in slice direction" ) ;
00552
00553 printf(".");fflush(stdout);
00554
00555 /*---- bbox and arrowvals for voxel sizes ----*/
00556
00557 wset.xsize_av = new_MCW_arrowval(
00558 wset.topform , /* parent */
00559 "x voxel\nsize (mm)" , /* label */
00560 MCW_AV_downup , /* arrows */
00561 1 , /* min */
00562 9999 , /* max */
00563 (int)(100*user_inputs.xsize), /* init */
00564 MCW_AV_editext , /* text */
00565 2 , /* decimals */
00566 T3D_size_av_CB , NULL , /* callback */
00567 NULL , NULL /* text maker */
00568 ) ;
00569
00570 XtVaSetValues( wset.xsize_av->wrowcol ,
00571 XmNtopAttachment , XmATTACH_FORM ,
00572 XmNtopOffset , T3D_FORM_SPACING ,
00573 XmNleftAttachment , XmATTACH_WIDGET ,
00574 XmNleftWidget , wset.xorient_av->wrowcol ,
00575 XmNleftOffset , T3D_FORM_SPACING ,
00576 NULL ) ;
00577
00578 /*
00579 AV_assign_fval( wset.xsize_av , user_inputs.xsize ) ;
00580 */
00581
00582 wset.ysize_av = new_MCW_arrowval(
00583 wset.topform , /* parent */
00584 "y voxel\nsize (mm)" , /* label */
00585 MCW_AV_downup , /* arrows */
00586 1 , /* min */
00587 9999 , /* max */
00588 (int)(100*user_inputs.ysize), /* init */
00589 MCW_AV_editext , /* text */
00590 2 , /* decimals */
00591 T3D_size_av_CB , NULL , /* callback */
00592 NULL , NULL /* text maker */
00593 ) ;
00594
00595 XtVaSetValues( wset.ysize_av->wrowcol ,
00596 XmNtopAttachment , XmATTACH_WIDGET ,
00597 XmNtopWidget , wset.xsize_av->wrowcol ,
00598 XmNtopOffset , T3D_FORM_SPACING ,
00599 XmNleftAttachment , XmATTACH_WIDGET ,
00600 XmNleftWidget , wset.xorient_av->wrowcol ,
00601 XmNleftOffset , T3D_FORM_SPACING ,
00602 NULL ) ;
00603
00604 wset.zsize_av = new_MCW_arrowval(
00605 wset.topform , /* parent */
00606 "z voxel\nsize (mm)" , /* label */
00607 MCW_AV_downup , /* arrows */
00608 1 , /* min */
00609 9999 , /* max */
00610 (int)(100*user_inputs.zsize), /* init */
00611 MCW_AV_editext , /* text */
00612 2 , /* decimals */
00613 T3D_size_av_CB , NULL , /* callback */
00614 NULL , NULL /* text maker */
00615 ) ;
00616
00617 XtVaSetValues( wset.zsize_av->wrowcol ,
00618 XmNtopAttachment , XmATTACH_WIDGET ,
00619 XmNtopWidget , wset.ysize_av->wrowcol ,
00620 XmNtopOffset , T3D_FORM_SPACING ,
00621 XmNleftAttachment , XmATTACH_WIDGET ,
00622 XmNleftWidget , wset.xorient_av->wrowcol ,
00623 XmNleftOffset , T3D_FORM_SPACING ,
00624 NULL ) ;
00625
00626 #ifdef ALLOW_NONCONTIG
00627 wset.zspacing_av = new_MCW_arrowval(
00628 wset.topform , /* parent */
00629 "z voxel\nspacing " , /* label */
00630 MCW_AV_downup , /* arrows */
00631 1 , /* min */
00632 9999 , /* max */
00633 (int)(100*user_inputs.zspacing), /* init */
00634 MCW_AV_editext , /* text */
00635 2 , /* decimals */
00636 T3D_size_av_CB , NULL , /* callback */
00637 NULL , NULL /* text maker */
00638 ) ;
00639
00640 XtVaSetValues( wset.zspacing_av->wrowcol ,
00641 XmNtopAttachment , XmATTACH_WIDGET ,
00642 XmNtopWidget , wset.zsize_av->wrowcol ,
00643 XmNtopOffset , T3D_FORM_SPACING ,
00644 XmNleftAttachment , XmATTACH_WIDGET ,
00645 XmNleftWidget , wset.xorient_av->wrowcol ,
00646 XmNleftOffset , T3D_FORM_SPACING ,
00647 NULL ) ;
00648 #endif /* ALLOW_NONCONTIG */
00649
00650 wset.fov_av = new_MCW_arrowval(
00651 wset.topform , /* parent */
00652 "Field of\nview (mm)" , /* label */
00653 MCW_AV_downup , /* arrows */
00654 1 , /* min */
00655 99999 , /* max */
00656 (int)(10*user_inputs.fov), /* init */
00657 MCW_AV_editext , /* text */
00658 1 , /* decimals */
00659 T3D_fov_av_CB , NULL , /* callback */
00660 NULL , NULL /* text maker */
00661 ) ;
00662
00663 XtVaSetValues( wset.fov_av->wrowcol ,
00664 XmNtopAttachment , XmATTACH_WIDGET ,
00665 #ifdef ALLOW_NONCONTIG
00666 XmNtopWidget , wset.zspacing_av->wrowcol ,
00667 #else
00668 XmNtopWidget , wset.zsize_av->wrowcol ,
00669 #endif
00670 XmNtopOffset , T3D_FORM_SPACING ,
00671 XmNleftAttachment , XmATTACH_WIDGET ,
00672 XmNleftWidget , wset.xorient_av->wrowcol ,
00673 XmNleftOffset , T3D_FORM_SPACING ,
00674 NULL ) ;
00675
00676 wset.voxshape_bbox = new_MCW_bbox(
00677 wset.topform , /* parent */
00678 3 , /* num buttons */
00679 T3D_voxshape_label , /* labels */
00680 MCW_BB_radio_one , /* bbox type */
00681 MCW_BB_frame , /* use a frame */
00682 T3D_voxshape_CB , /* callback */
00683 NULL /* callback data */
00684 ) ;
00685
00686 XtVaSetValues( wset.voxshape_bbox->wtop ,
00687 XmNrightAttachment , XmATTACH_WIDGET ,
00688 XmNrightWidget , wset.fov_av->wrowcol ,
00689 XmNrightOffset , T3D_FORM_SPACING ,
00690 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
00691 XmNtopWidget , wset.fov_av->wrowcol ,
00692 XmNtopOffset , 0 ,
00693 NULL ) ;
00694
00695 #ifdef ALLOW_NONCONTIG
00696 wset.voxcontig_bbox = new_MCW_bbox(
00697 wset.topform , /* parent */
00698 3 , /* num buttons */
00699 T3D_voxcontig_label , /* labels */
00700 MCW_BB_radio_one , /* bbox type */
00701 MCW_BB_frame , /* use a frame */
00702 T3D_voxcontig_CB , /* callback */
00703 NULL /* callback data */
00704 ) ;
00705
00706 XtSetSensitive( wset.voxcontig_bbox->wbut[1] , False ) ;
00707 XtSetSensitive( wset.voxcontig_bbox->wbut[2] , False ) ;
00708
00709 XtVaSetValues( wset.voxcontig_bbox->wtop ,
00710 XmNrightAttachment , XmATTACH_WIDGET ,
00711 XmNrightWidget , wset.voxshape_bbox->wtop ,
00712 XmNrightOffset , T3D_FORM_SPACING ,
00713 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
00714 XmNtopWidget , wset.voxshape_bbox->wtop ,
00715 XmNtopOffset , 0 ,
00716 NULL ) ;
00717 #endif /* ALLOW_NONCONTIG */
00718
00719 MCW_reghelp_children( wset.xsize_av->wrowcol ,
00720 "If in-slice voxel dimensions are\n"
00721 "not square, use this to set the\n"
00722 "x axis (across screen) dimension" ) ;
00723 MCW_reghint_children( wset.xsize_av->wrowcol ,
00724 "Across screen voxel size" ) ;
00725
00726 MCW_reghelp_children( wset.ysize_av->wrowcol ,
00727 "If in-slice voxel dimensions are\n"
00728 "not square, use this to set the\n"
00729 "y axis (down screen) dimension" ) ;
00730 MCW_reghint_children( wset.ysize_av->wrowcol ,
00731 "Down screen voxel size" ) ;
00732
00733 MCW_reghelp_children( wset.zsize_av->wrowcol ,
00734 "If voxels are not cubical,\n"
00735 "use this to set the z axis\n"
00736 "(slice direction) thickness" ) ;
00737 MCW_reghint_children( wset.ysize_av->wrowcol ,
00738 "Slice direction voxel size" ) ;
00739
00740 #ifdef ALLOW_NONCONTIG
00741 MCW_reghelp_children( wset.zspacing_av->wrowcol ,
00742 "If the slices are not\n"
00743 "contiguous, use this to\n"
00744 "set the center-to-center\n"
00745 "slice spacing" ) ;
00746 #endif /* ALLOW_NONCONTIG */
00747
00748 MCW_reghelp_children( wset.fov_av->wrowcol ,
00749 "If the voxels are cubical,\n"
00750 "or at least square, use this\n"
00751 "to specify the sizes by giving\n"
00752 "the Field-Of-View dimension\n"
00753 "(the width across screen of images)" ) ;
00754 MCW_reghint_children( wset.fov_av->wrowcol ,
00755 "In-slice width of entire image" ) ;
00756
00757 MCW_reghelp_children( wset.voxshape_bbox->wrowcol ,
00758 "Choose one button to\n"
00759 "specify the voxel 'shape':\n"
00760 " cubical = all dimensions equal\n"
00761 " square = x & y dimensions\n"
00762 " equal, z different\n"
00763 " irregular= all dimensions unequal" ) ;
00764 MCW_reghint_children( wset.voxshape_bbox->wrowcol ,
00765 "Specify voxel shape" ) ;
00766
00767 #ifdef ALLOW_NONCONTIG
00768 MCW_reghelp_children( wset.voxcontig_bbox->wrowcol ,
00769 "Pressed IN: slices are contiguous\n"
00770 "Pressed OUT: slices are not contiguous\n"
00771 "(i.e., z size and z spacing differ)" ) ;
00772 #endif /* ALLOW_NONCONTIG */
00773
00774 /*-- set the vox*_bbox values depending on initial sizes --*/
00775
00776 if( user_inputs.xsize != user_inputs.ysize ){
00777 user_inputs.voxshape = VOXSHAPE_IRREGULAR ;
00778 } else {
00779 if( user_inputs.xsize != user_inputs.zsize ){
00780 user_inputs.voxshape = VOXSHAPE_SQUARE ;
00781 } else {
00782 user_inputs.voxshape = VOXSHAPE_CUBICAL ;
00783 }
00784 }
00785
00786 printf(".");fflush(stdout);
00787
00788 /*---- Label to show the TR (for 3D+time datasets) ----*/
00789
00790 { char buf[96] ;
00791 XmString xstr ;
00792
00793 sprintf( buf,"TR=%.3f%s Torg=%.3f\nNR=%d Nz=%d",
00794 user_inputs.TR , UNITS_TYPE_LABEL(user_inputs.tunits) ,
00795 user_inputs.Torg,
00796 user_inputs.ntt , user_inputs.nzz ) ;
00797 xstr = XmStringCreateLtoR( buf , XmFONTLIST_DEFAULT_TAG ) ;
00798
00799 wset.TR_label =
00800 XtVaCreateManagedWidget(
00801 "dialog" , xmLabelWidgetClass , wset.topform ,
00802 XmNlabelString , xstr ,
00803 XmNrecomputeSize , False ,
00804 XmNalignment , XmALIGNMENT_BEGINNING ,
00805 XmNtopAttachment , XmATTACH_WIDGET ,
00806 XmNtopWidget , wset.fov_av->wrowcol ,
00807 XmNtopOffset , T3D_FORM_SPACING ,
00808 XmNleftAttachment , XmATTACH_WIDGET ,
00809 XmNleftWidget , wset.voxshape_bbox->wtop ,
00810 XmNleftOffset , T3D_FORM_SPACING ,
00811 NULL ) ;
00812
00813 XmStringFree( xstr ) ;
00814
00815 MCW_register_help( wset.TR_label ,
00816 "Shows the TR (inter-brick time), number\n"
00817 "of bricks NR, and number of slizes Nz,\n"
00818 "for time-dependent datasets.\n"
00819 "These CANNOT be changed interactively.\n"
00820 "They can only be set on the command line." ) ;
00821
00822 MCW_register_hint( wset.TR_label , "3D+time parameters" ) ;
00823
00824 if( user_inputs.ntt < 2 )
00825 XtUnmanageChild( wset.TR_label ) ;
00826 }
00827
00828 /*---- arrowvals for origin ----*/
00829
00830 wset.xorigin_av = new_MCW_arrowval(
00831 wset.topform , /* parent */
00832 "x origin (mm)\n[left edge]" , /* label */
00833 MCW_AV_downup , /* arrows */
00834 -99999 , /* min */
00835 99999 , /* max */
00836 (int)(100*user_inputs.xorigin), /* init */
00837 MCW_AV_editext , /* text */
00838 2 , /* decimals */
00839 T3D_origin_av_CB , NULL , /* callback */
00840 NULL , NULL /* text maker */
00841 ) ;
00842
00843 XtVaSetValues( wset.xorigin_av->wrowcol ,
00844 XmNleftAttachment , XmATTACH_WIDGET ,
00845 XmNleftWidget , wset.xsize_av->wrowcol ,
00846 XmNleftOffset , T3D_FORM_SPACING ,
00847 XmNtopAttachment , XmATTACH_FORM ,
00848 XmNtopOffset , T3D_FORM_SPACING ,
00849 NULL ) ;
00850
00851 wset.xorigin_label =
00852 XtVaCreateManagedWidget(
00853 "dialog" , xmLabelWidgetClass , wset.topform ,
00854 LABEL_ARG("X") ,
00855 XmNrecomputeSize , False ,
00856 XmNleftAttachment , XmATTACH_WIDGET ,
00857 XmNleftWidget , wset.xorigin_av->wrowcol ,
00858 XmNleftOffset , 1 ,
00859 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
00860 XmNtopWidget , wset.xorigin_av->wrowcol ,
00861 XmNtopOffset , 2 ,
00862 NULL ) ;
00863
00864 wset.yorigin_av = new_MCW_arrowval(
00865 wset.topform , /* parent */
00866 "y origin (mm)\n[top edge]" , /* label */
00867 MCW_AV_downup , /* arrows */
00868 -99999 , /* min */
00869 99999 , /* max */
00870 (int)(100*user_inputs.yorigin), /* init */
00871 MCW_AV_editext , /* text */
00872 2 , /* decimals */
00873 T3D_origin_av_CB , NULL , /* callback */
00874 NULL , NULL /* text maker */
00875 ) ;
00876
00877 XtVaSetValues( wset.yorigin_av->wrowcol ,
00878 XmNtopAttachment , XmATTACH_WIDGET ,
00879 XmNtopWidget , wset.xorigin_av->wrowcol ,
00880 XmNtopOffset , T3D_FORM_SPACING ,
00881 XmNleftAttachment , XmATTACH_WIDGET ,
00882 XmNleftWidget , wset.xsize_av->wrowcol ,
00883 XmNleftOffset , T3D_FORM_SPACING ,
00884 NULL ) ;
00885
00886 wset.yorigin_label =
00887 XtVaCreateManagedWidget(
00888 "dialog" , xmLabelWidgetClass , wset.topform ,
00889 LABEL_ARG("X") ,
00890 XmNrecomputeSize , False ,
00891 XmNleftAttachment , XmATTACH_WIDGET ,
00892 XmNleftWidget , wset.yorigin_av->wrowcol ,
00893 XmNleftOffset , 1 ,
00894 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
00895 XmNtopWidget , wset.yorigin_av->wrowcol ,
00896 XmNtopOffset , 2 ,
00897 NULL ) ;
00898
00899 wset.zorigin_av = new_MCW_arrowval(
00900 wset.topform , /* parent */
00901 "z origin (mm)\n[slice 0]" , /* label */
00902 MCW_AV_downup , /* arrows */
00903 -99999 , /* min */
00904 99999 , /* max */
00905 (int)(100*user_inputs.zorigin), /* init */
00906 MCW_AV_editext , /* text */
00907 2 , /* decimals */
00908 T3D_origin_av_CB , NULL , /* callback */
00909 NULL , NULL /* text maker */
00910 ) ;
00911
00912 XtVaSetValues( wset.zorigin_av->wrowcol ,
00913 XmNtopAttachment , XmATTACH_WIDGET ,
00914 XmNtopWidget , wset.yorigin_av->wrowcol ,
00915 XmNtopOffset , T3D_FORM_SPACING ,
00916 XmNleftAttachment , XmATTACH_WIDGET ,
00917 XmNleftWidget , wset.xsize_av->wrowcol ,
00918 XmNleftOffset , T3D_FORM_SPACING ,
00919 NULL ) ;
00920
00921 wset.zorigin_label =
00922 XtVaCreateManagedWidget(
00923 "dialog" , xmLabelWidgetClass , wset.topform ,
00924 LABEL_ARG("X") ,
00925 XmNrecomputeSize , False ,
00926 XmNleftAttachment , XmATTACH_WIDGET ,
00927 XmNleftWidget , wset.zorigin_av->wrowcol ,
00928 XmNleftOffset , 1 ,
00929 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
00930 XmNtopWidget , wset.zorigin_av->wrowcol ,
00931 XmNtopOffset , 2 ,
00932 NULL ) ;
00933
00934 wset.centered_bbox = new_MCW_bbox(
00935 wset.topform , /* parent */
00936 3 , /* num buttons */
00937 T3D_centered_label , /* labels */
00938 MCW_BB_check , /* bbox type */
00939 MCW_BB_frame , /* use a frame */
00940 T3D_centered_CB , /* callback */
00941 NULL /* callback data */
00942 ) ;
00943
00944 XtVaSetValues( wset.centered_bbox->wtop ,
00945 #if 0
00946 XmNleftAttachment , XmATTACH_WIDGET ,
00947 XmNleftWidget , wset.fov_av->wrowcol ,
00948 XmNleftOffset , T3D_FORM_SPACING ,
00949 #else
00950 XmNrightAttachment , XmATTACH_OPPOSITE_WIDGET ,
00951 XmNrightWidget , wset.zorigin_av->wrowcol ,
00952 XmNrightOffset , 0 ,
00953 #endif
00954 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
00955 XmNtopWidget , wset.fov_av->wrowcol ,
00956 XmNtopOffset , 0 ,
00957 NULL ) ;
00958
00959 MCW_reghelp_children( wset.centered_bbox->wrowcol ,
00960 "Choose any combination of\n"
00961 "buttons to indicate whether\n"
00962 "each axis is centered\n"
00963 "in the gradient coil fields:\n"
00964 "Pressed IN means centered\n"
00965 "Pressed OUT means not centered" ) ;
00966 MCW_reghint_children( wset.centered_bbox->wrowcol ,
00967 "Is data domain centered around 0?" ) ;
00968
00969 MCW_reghelp_children( wset.xorigin_av->wrowcol ,
00970 "Use the arrows (or type) to enter\n"
00971 "the x-axis distance from the center of\n"
00972 "the first voxel to the\n"
00973 "gradient coil (0,0,0) point" ) ;
00974 MCW_reghint_children( wset.xorigin_av->wrowcol ,
00975 "X-axis distance to 1st voxel center" ) ;
00976
00977 MCW_reghelp_children( wset.yorigin_av->wrowcol ,
00978 "Use the arrows (or type) to enter\n"
00979 "the y-axis distance from the center of\n"
00980 "the first voxel to the\n"
00981 "gradient coil (0,0,0) point" ) ;
00982 MCW_reghint_children( wset.yorigin_av->wrowcol ,
00983 "Y-axis distance to 1st voxel center" ) ;
00984
00985 MCW_reghelp_children( wset.zorigin_av->wrowcol ,
00986 "Use the arrows (or type) to enter\n"
00987 "the z-axis distance from the center of\n"
00988 "the first voxel to the\n"
00989 "gradient coil (0,0,0) point" ) ;
00990 MCW_reghint_children( wset.zorigin_av->wrowcol ,
00991 "Z-axis distance to 1st voxel center" ) ;
00992
00993 MCW_register_help( wset.xorigin_label ,
00994 "Shows the direction that the\n"
00995 "x origin distance applies" ) ;
00996 MCW_register_hint( wset.xorigin_label ,
00997 "Direction of x origin distance" ) ;
00998
00999 MCW_register_help( wset.yorigin_label ,
01000 "Shows the direction that the\n"
01001 "y origin distance applies" ) ;
01002 MCW_register_hint( wset.yorigin_label ,
01003 "Direction of y origin distance" ) ;
01004
01005 MCW_register_help( wset.zorigin_label ,
01006 "Shows the direction that the\n"
01007 "z origin distance applies" ) ;
01008 MCW_register_hint( wset.zorigin_label ,
01009 "Direction of z origin distance" ) ;
01010
01011 printf(".");fflush(stdout);
01012
01013 /*----- a separator to keep the geometry stuff separate -----*/
01014
01015 wset.region_separator =
01016 XtVaCreateManagedWidget(
01017 "dialog" , xmSeparatorGadgetClass , wset.topform ,
01018 XmNseparatorType , XmDOUBLE_LINE ,
01019 XmNmargin , 3 ,
01020 XmNleftAttachment , XmATTACH_FORM ,
01021 XmNrightAttachment , XmATTACH_FORM ,
01022 XmNtopAttachment , XmATTACH_WIDGET ,
01023 XmNtopOffset , T3D_FORM_SPACING ,
01024 XmNtopWidget , wset.voxshape_bbox->wtop ,
01025 NULL ) ;
01026
01027 MCW_register_help( wset.region_separator ,
01028 "Thou art indeed just, Lord, if I contend\n"
01029 "With thee; but, sir, so what I plead is just.\n"
01030 "Why do sinners' ways prosper? and why must\n"
01031 "Disappointment all I endeavour end?\n"
01032 "Wert thou my enemy, O thou my friend,\n"
01033 "How wouldst thou worse, I wonder, than thou dost\n"
01034 "Defeat, thwart me? Oh, the sots and thralls of lust\n"
01035 "Do in spare hours more thrive than I that spend,\n"
01036 "Sir, life upon thy cause. See, banks and brakes\n"
01037 "Now, leav`ed how thick! lac`ed they are again\n"
01038 "With fretty chervil, look, and fresh wind shakes\n"
01039 "Them; birds build -- but not I build; no, but strain,\n"
01040 "Time's eunuch, and not breed one work that wakes.\n"
01041 "Mine, O thou lord of life, send my roots rain."
01042 ) ;
01043
01044 /*---- April 1996: arrowval for view_type ----*/
01045
01046 wset.view_type_av = new_MCW_arrowval(
01047 wset.topform , /* parent */
01048 "View: " , /* label */
01049 MCW_AV_downup , /* arrows */
01050 FIRST_VIEW_TYPE , /* min */
01051 LAST_VIEW_TYPE , /* max */
01052 user_inputs.view_type , /* init */
01053 MCW_AV_readtext , /* text */
01054 0 , /* decimals */
01055 T3D_orient_av_CB , NULL , /* callback */
01056 T3D_text_display , /* text maker */
01057 VIEW_typestr /* and data */
01058 ) ;
01059
01060 XtVaSetValues( wset.view_type_av->wrowcol ,
01061 XmNbottomAttachment , XmATTACH_WIDGET ,
01062 XmNbottomWidget , wset.region_separator ,
01063 XmNbottomOffset , T3D_FORM_SPACING ,
01064 XmNleftAttachment , XmATTACH_FORM ,
01065 XmNleftOffset , T3D_FORM_SPACING ,
01066 NULL ) ;
01067
01068 XtVaSetValues( wset.view_type_av->wtext ,
01069 XmNcolumns , LONGEST_VIEW_TYPESTR ,
01070 XmNmaxLength , LONGEST_VIEW_TYPESTR ,
01071 NULL ) ;
01072
01073 MCW_reghelp_children( wset.view_type_av->wrowcol ,
01074 "Sets the view type for the\n"
01075 "dataset being created. Except\n"
01076 "under unusual circumstances,\n"
01077 "this should be " VIEW_ORIGINAL_STR ) ;
01078
01079 /*---- Label to show what kind of data is stored ----*/
01080
01081 { char buf[32] ;
01082 sprintf( buf , "Datum: %s [%dx%d]\n" ,
01083 MRI_TYPE_name[argopt.datum_all], user_inputs.nx,user_inputs.ny ) ;
01084 wset.datum_label =
01085 XtVaCreateManagedWidget(
01086 "dialog" , xmLabelWidgetClass , wset.topform ,
01087 LABEL_ARG(buf) ,
01088 XmNbottomAttachment , XmATTACH_WIDGET ,
01089 XmNbottomWidget , wset.view_type_av->wrowcol ,
01090 XmNbottomOffset , 1 ,
01091 XmNleftAttachment , XmATTACH_FORM ,
01092 XmNleftOffset , T3D_FORM_SPACING ,
01093 XmNmarginHeight , 0 ,
01094 XmNmarginWidth , 0 ,
01095 NULL ) ;
01096
01097 }
01098 MCW_register_help( wset.datum_label ,
01099 "This shows the type of data stored\n"
01100 "in the images as read into to3d.\n"
01101 "You can only alter this by exiting\n"
01102 "the program and using the -datum\n"
01103 "option when you run to3d again." ) ;
01104 MCW_register_hint( wset.datum_label , "Type of data stored in images" ) ;
01105
01106 /*----- textfield widgets below the bar -----*/
01107
01108 /** name widgets not being used no more **/
01109
01110 #ifndef NO_NAMES
01111 wset.dataset_name_label =
01112 XtVaCreateManagedWidget(
01113 "dialog" , xmLabelWidgetClass , wset.topform ,
01114 LABEL_ARG("Dataset name: ") ,
01115 XmNtopAttachment , XmATTACH_WIDGET ,
01116 XmNtopWidget , wset.region_separator ,
01117 XmNtopOffset , T3D_FORM_SPACING ,
01118 XmNleftAttachment , XmATTACH_FORM ,
01119 XmNleftOffset , T3D_FORM_SPACING ,
01120 NULL ) ;
01121
01122 wset.dataset_name_textfield =
01123 XtVaCreateManagedWidget(
01124 "dialog" , xmTextFieldWidgetClass , wset.topform ,
01125 XmNcolumns , 80 ,
01126 XmNeditable , True ,
01127 XmNmaxLength , THD_MAX_NAME-1 ,
01128 XmNresizeWidth , False ,
01129 XmNcursorPositionVisible , True ,
01130 XmNblinkRate , 0 ,
01131 /*
01132 XmNmarginHeight , 1 ,
01133 XmNmarginWidth , 1 ,
01134 */
01135 XmNvalue , user_inputs.dataset_name ,
01136
01137 XmNleftAttachment , XmATTACH_WIDGET ,
01138 XmNleftWidget , wset.dataset_name_label ,
01139 XmNleftOffset , T3D_FORM_SPACING ,
01140 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
01141 XmNtopWidget , wset.dataset_name_label ,
01142 XmNtopOffset , 0 ,
01143 NULL ) ;
01144
01145 MCW_register_help( wset.dataset_name_label ,
01146 "Every 3D dataset needs a name;\n"
01147 "Type in what you need to remind\n"
01148 "you of the subject/experiment" ) ;
01149
01150 MCW_register_help( wset.dataset_name_textfield ,
01151 "Every 3D dataset needs a label;\n"
01152 "Type in what you need to remind\n"
01153 "you of the subject/experiment" ) ;
01154
01155 wset.short_label1_label =
01156 XtVaCreateManagedWidget(
01157 "dialog" , xmLabelWidgetClass , wset.topform ,
01158 LABEL_ARG("Short label: ") ,
01159 XmNleftAttachment , XmATTACH_FORM ,
01160 XmNleftOffset , T3D_FORM_SPACING ,
01161 XmNtopAttachment , XmATTACH_WIDGET ,
01162 XmNtopWidget , wset.dataset_name_textfield ,
01163 XmNtopOffset , T3D_FORM_SPACING ,
01164 NULL ) ;
01165
01166 wset.short_label1_textfield =
01167 XtVaCreateManagedWidget(
01168 "dialog" , xmTextFieldWidgetClass , wset.topform ,
01169 XmNcolumns , T3D_NAME_WIDTH ,
01170 XmNeditable , True ,
01171 XmNmaxLength , THD_MAX_LABEL-1 ,
01172 XmNresizeWidth , False ,
01173 XmNcursorPositionVisible , True ,
01174 XmNblinkRate , 0 ,
01175 /*
01176 XmNmarginHeight , 1 ,
01177 XmNmarginWidth , 1 ,
01178 */
01179 XmNvalue , user_inputs.short_label1 ,
01180
01181 XmNleftAttachment , XmATTACH_WIDGET ,
01182 XmNleftWidget , wset.short_label1_label ,
01183 XmNleftOffset , T3D_FORM_SPACING ,
01184 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
01185 XmNtopWidget , wset.short_label1_label ,
01186 XmNtopOffset , 0 ,
01187 NULL ) ;
01188
01189 MCW_register_help( wset.short_label1_label ,
01190 "The short label is used\n"
01191 "for a compact reminder of\n"
01192 "the dataset contents;\n"
01193 "type your choice in" ) ;
01194
01195 MCW_register_help( wset.short_label1_textfield ,
01196 "The short label is used\n"
01197 "for a compact reminder of\n"
01198 "the dataset contents;\n"
01199 "type your choice in" ) ;
01200 #endif /* NO_NAMES */
01201
01202 wset.geometry_parent_label =
01203 XtVaCreateManagedWidget(
01204 "dialog" , xmLabelWidgetClass , wset.topform ,
01205 LABEL_ARG("Copy geometry \nof this dataset") ,
01206 XmNleftAttachment , XmATTACH_FORM ,
01207 XmNleftOffset , T3D_FORM_SPACING ,
01208 XmNtopAttachment , XmATTACH_WIDGET ,
01209 #ifdef NO_NAMES
01210 XmNtopWidget , wset.region_separator ,
01211 #else
01212 XmNtopWidget , wset.short_label1_textfield ,
01213 #endif
01214 XmNtopOffset , T3D_FORM_SPACING ,
01215 NULL ) ;
01216
01217 wset.geometry_parent_textfield =
01218 XtVaCreateManagedWidget(
01219 "dialog" , xmTextFieldWidgetClass , wset.topform ,
01220 XmNcolumns , T3D_NAME_WIDTH ,
01221 XmNeditable , True ,
01222 XmNmaxLength , THD_MAX_NAME-1 ,
01223 XmNresizeWidth , False ,
01224 XmNcursorPositionVisible , True ,
01225 XmNblinkRate , 0 ,
01226 /*
01227 XmNmarginHeight , 1 ,
01228 XmNmarginWidth , 1 ,
01229 */
01230 XmNvalue , user_inputs.geometry_parent_filename ,
01231
01232 XmNleftAttachment , XmATTACH_WIDGET ,
01233 XmNleftWidget , wset.geometry_parent_label ,
01234 XmNleftOffset , T3D_FORM_SPACING ,
01235 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
01236 XmNtopWidget , wset.geometry_parent_label ,
01237 XmNtopOffset , 0 ,
01238 NULL ) ;
01239
01240 XtAddCallback( wset.geometry_parent_textfield ,
01241 XmNactivateCallback ,
01242 T3D_geometry_parent_CB , NULL ) ; /* return key */
01243
01244 XtAddCallback( wset.geometry_parent_textfield ,
01245 XmNlosingFocusCallback ,
01246 T3D_geometry_parent_CB , NULL ) ; /* Tab key */
01247
01248 XtInsertEventHandler( wset.geometry_parent_textfield ,
01249 LeaveWindowMask , /* pointer leaves */
01250 FALSE ,
01251 T3D_pointer_leave_EV , NULL ,
01252 XtListTail ) ; /* last in queue */
01253
01254 MCW_register_help( wset.geometry_parent_label ,
01255 "If a previously created 3D dataset\n"
01256 "has the same geometry (voxel sizes,\n"
01257 "etc.), enter its header filename\n"
01258 "and press the Enter key" ) ;
01259 MCW_register_hint( wset.geometry_parent_label ,
01260 "Use the geometry of another dataset" ) ;
01261
01262 MCW_register_help( wset.geometry_parent_textfield ,
01263 "If a previously created 3D dataset\n"
01264 "has the same geometry (voxel sizes,\n"
01265 "etc.), enter its header filename name\n"
01266 "here and press the Enter key" ) ;
01267 MCW_register_hint( wset.geometry_parent_textfield ,
01268 "Use the geometry of another dataset" ) ;
01269
01270 wset.anatomy_parent_label =
01271 XtVaCreateManagedWidget(
01272 "dialog" , xmLabelWidgetClass , wset.topform ,
01273 LABEL_ARG("Anatomy parent \nis this dataset") ,
01274 XmNleftAttachment , XmATTACH_WIDGET ,
01275 XmNleftWidget , wset.geometry_parent_textfield ,
01276 XmNleftOffset , T3D_FORM_SPACING ,
01277 XmNtopAttachment , XmATTACH_WIDGET ,
01278 #ifdef NO_NAMES
01279 XmNtopWidget , wset.region_separator ,
01280 #else
01281 XmNtopWidget , wset.short_label1_textfield ,
01282 #endif
01283 XmNtopOffset , T3D_FORM_SPACING ,
01284 NULL ) ;
01285
01286 wset.anatomy_parent_textfield =
01287 XtVaCreateManagedWidget(
01288 "dialog" , xmTextFieldWidgetClass , wset.topform ,
01289 XmNcolumns , T3D_NAME_WIDTH ,
01290 XmNeditable , True ,
01291 XmNmaxLength , THD_MAX_NAME-1 ,
01292 XmNresizeWidth , False ,
01293 XmNcursorPositionVisible , True ,
01294 XmNblinkRate , 0 ,
01295 /*
01296 XmNmarginHeight , 1 ,
01297 XmNmarginWidth , 1 ,
01298 */
01299 XmNvalue , user_inputs.anatomy_parent_filename ,
01300
01301 XmNleftAttachment , XmATTACH_WIDGET ,
01302 XmNleftOffset , T3D_FORM_SPACING ,
01303 XmNleftWidget , wset.anatomy_parent_label ,
01304 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
01305 XmNtopWidget , wset.anatomy_parent_label ,
01306 XmNtopOffset , 0 ,
01307 NULL ) ;
01308
01309 XtAddCallback( wset.anatomy_parent_textfield ,
01310 XmNactivateCallback ,
01311 T3D_anatomy_parent_CB , NULL ) ; /* return key */
01312
01313 XtAddCallback( wset.anatomy_parent_textfield ,
01314 XmNlosingFocusCallback ,
01315 T3D_anatomy_parent_CB , NULL ) ; /* Tab key */
01316
01317 XtInsertEventHandler( wset.anatomy_parent_textfield ,
01318 LeaveWindowMask , /* pointer leaves */
01319 FALSE ,
01320 T3D_pointer_leave_EV , NULL ,
01321 XtListTail ) ; /* last in queue */
01322
01323 MCW_register_help( wset.anatomy_parent_label ,
01324 "A dataset may optionally be attached\n"
01325 "to an 'anatomy parent' -- that is, an\n"
01326 "anatomical dataset which is aligned\n"
01327 "with the current dataset; usually, the\n"
01328 "anatomy parent should have been acquired\n"
01329 "during the same imaging session as the\n"
01330 "current dataset, so that this requisite\n"
01331 "alignment is assured. If no anatomy parent\n"
01332 "is given, then at the time one is needed,\n"
01333 "an appropriate dataset will be chosen from\n"
01334 "the same session directory.\n"
01335 "\n"
01336 #ifdef REQUIRE_ANAT_PARENT
01337 "N.B.: Functional datasets require anatomy parents;\n"
01338 " for anatomical datasets, anatomy parents are\n"
01339 " optional."
01340 #else
01341 "N.B.: You only need specify an anatomy parent\n"
01342 " here if a specific dataset is required."
01343 #endif
01344 ) ;
01345
01346 MCW_register_help( wset.anatomy_parent_textfield ,
01347 "A dataset may optionally be attached\n"
01348 "to an 'anatomy parent' -- that is, an\n"
01349 "anatomical dataset which is aligned\n"
01350 "with the current dataset; usually, the\n"
01351 "anatomy parent should have been acquired\n"
01352 "during the same imaging session as the\n"
01353 "current dataset, so that this requisite\n"
01354 "alignment is assured. If no anatomy parent\n"
01355 "is given, then at the time one is needed,\n"
01356 "an appropriate dataset will be chosen from\n"
01357 "the same session directory.\n"
01358 "\n"
01359 #ifdef REQUIRE_ANAT_PARENT
01360 "N.B.: functional datasets require anatomy parents;\n"
01361 " for anatomical datasets, anatomy parents are\n"
01362 " optional."
01363 #else
01364 "N.B.: You only need specify an anatomy parent\n"
01365 " here if a specific dataset is required."
01366 #endif
01367 ) ;
01368
01369 #ifndef NO_NAMES
01370 wset.geometry_dataname_label =
01371 XtVaCreateManagedWidget(
01372 "dialog" , xmLabelWidgetClass , wset.topform ,
01373 LABEL_ARG("Geometry parent\nDataset name ") ,
01374 XmNleftAttachment , XmATTACH_FORM ,
01375 XmNleftOffset , T3D_FORM_SPACING ,
01376 XmNtopAttachment , XmATTACH_WIDGET ,
01377 XmNtopWidget , wset.geometry_parent_textfield ,
01378 XmNtopOffset , T3D_FORM_SPACING ,
01379 XmNsensitive , False ,
01380 NULL ) ;
01381
01382 wset.geometry_dataname_textfield =
01383 XtVaCreateManagedWidget(
01384 "dialog" , xmTextFieldWidgetClass , wset.topform ,
01385 XmNcolumns , T3D_NAME_WIDTH ,
01386 XmNeditable , False ,
01387 XmNmaxLength , THD_MAX_NAME-1 ,
01388 XmNresizeWidth , False ,
01389
01390 XmNcursorPositionVisible , False ,
01391 XmNsensitive , False ,
01392 /*
01393 XmNmarginHeight , 1 ,
01394 XmNmarginWidth , 1 ,
01395 */
01396 XmNvalue , " " ,
01397
01398 XmNleftAttachment , XmATTACH_WIDGET ,
01399 XmNleftWidget , wset.geometry_dataname_label ,
01400 XmNleftOffset , T3D_FORM_SPACING ,
01401 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
01402 XmNtopWidget , wset.geometry_dataname_label ,
01403 XmNtopOffset , 0 ,
01404 NULL ) ;
01405
01406 MCW_register_help( wset.geometry_dataname_label ,
01407 "This item just shows the\n"
01408 "dataset name of the 'geometry\n"
01409 "parent' you selected (e.g., to\n"
01410 "let you decide if you've got\n"
01411 "the right one)." ) ;
01412
01413 MCW_register_help( wset.geometry_dataname_textfield ,
01414 "This item just shows the\n"
01415 "dataset name of the 'geometry\n"
01416 "parent' you selected (e.g., to\n"
01417 "let you decide if you've got\n"
01418 "the right one)." ) ;
01419
01420 wset.anatomy_dataname_label =
01421 XtVaCreateManagedWidget(
01422 "dialog" , xmLabelWidgetClass , wset.topform ,
01423 LABEL_ARG("Anatomy parent \nDataset name ") ,
01424 XmNleftAttachment , XmATTACH_WIDGET ,
01425 XmNleftWidget , wset.geometry_dataname_textfield ,
01426 XmNleftOffset , T3D_FORM_SPACING ,
01427 XmNtopAttachment , XmATTACH_WIDGET ,
01428 XmNtopWidget , wset.geometry_parent_textfield ,
01429 XmNtopOffset , T3D_FORM_SPACING ,
01430 XmNsensitive , False ,
01431 NULL ) ;
01432
01433 wset.anatomy_dataname_textfield =
01434 XtVaCreateManagedWidget(
01435 "dialog" , xmTextFieldWidgetClass , wset.topform ,
01436 XmNcolumns , T3D_NAME_WIDTH ,
01437 XmNeditable , False ,
01438 XmNmaxLength , THD_MAX_NAME-1 ,
01439 XmNresizeWidth , False ,
01440
01441 XmNcursorPositionVisible , False ,
01442 XmNsensitive , False ,
01443 /*
01444 XmNmarginHeight , 1 ,
01445 XmNmarginWidth , 1 ,
01446 */
01447 XmNvalue , " " ,
01448
01449 XmNleftAttachment , XmATTACH_WIDGET ,
01450 XmNleftWidget , wset.anatomy_dataname_label ,
01451 XmNleftOffset , T3D_FORM_SPACING ,
01452 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
01453 XmNtopWidget , wset.anatomy_dataname_label ,
01454 XmNtopOffset , 0 ,
01455 NULL ) ;
01456
01457 MCW_register_help( wset.anatomy_dataname_label ,
01458 "This item just shows the\n"
01459 "dataset name of the 'anatomy\n"
01460 "parent' you selected" ) ;
01461
01462 MCW_register_help( wset.anatomy_dataname_textfield ,
01463 "This item just shows the\n"
01464 "dataset name of the 'anatomy\n"
01465 "parent' you selected" ) ;
01466
01467 printf(".");fflush(stdout);
01468 #endif /* NO_NAMES */
01469
01470 /*----- arrowvals for dataset and function types -----*/
01471
01472 wset.dataset_type_av =
01473 new_MCW_arrowval(
01474 wset.topform , /* parent */
01475 "Type of data\nin the images ", /* label */
01476 MCW_AV_downup , /* arrows */
01477 FIRST_3DIM_TYPE , /* min */
01478 LAST_3DIM_TYPE , /* max */
01479 user_inputs.dataset_type , /* init */
01480 MCW_AV_readtext , /* text type */
01481 0 , /* decimals */
01482 T3D_type_av_CB , NULL , /* callback */
01483 T3D_text_display , /* text maker */
01484 DATASET_typestr /* and data */
01485 ) ;
01486
01487 wset.dataset_type_av->allow_wrap = 1 ;
01488
01489 XtVaSetValues( wset.dataset_type_av->wtext ,
01490 XmNcolumns , LONGEST_3DIM_TYPESTR ,
01491 XmNmaxLength , LONGEST_3DIM_TYPESTR ,
01492 NULL ) ;
01493
01494 XtVaSetValues( wset.dataset_type_av->wrowcol ,
01495 XmNleftAttachment , XmATTACH_FORM ,
01496 XmNleftOffset , T3D_FORM_SPACING ,
01497 XmNtopAttachment , XmATTACH_WIDGET ,
01498 #ifndef NO_NAMES
01499 XmNtopWidget , wset.geometry_dataname_label ,
01500 #else
01501 XmNtopWidget , wset.geometry_parent_label ,
01502 #endif
01503 XmNtopOffset , T3D_FORM_SPACING ,
01504 NULL ) ;
01505
01506 MCW_reghelp_children( wset.dataset_type_av->wrowcol ,
01507 "Use the arrows to specify\n"
01508 "the type of data stored\n"
01509 "in the image files.\n"
01510 "N.B.: 3D+time datasets\n"
01511 " must be anatomical." ) ;
01512 MCW_reghint_children( wset.dataset_type_av->wrowcol ,
01513 "Type of data you acquired" ) ;
01514
01515 if( user_inputs.ntt > 0 )
01516 AV_SENSITIZE( wset.dataset_type_av , False ) ;
01517
01518 wset.function_type_av =
01519 new_MCW_arrowval(
01520 wset.topform , /* parent */
01521 "Type of function \nin the images", /* label */
01522 MCW_AV_downup , /* arrows */
01523 FIRST_FUNC_TYPE , /* min */
01524 LAST_FUNC_TYPE , /* max */
01525 user_inputs.function_type , /* init */
01526 MCW_AV_readtext , /* text type */
01527 0 , /* decimals */
01528 T3D_type_av_CB , NULL , /* callback */
01529 T3D_text_display , /* text maker */
01530 FUNC_typestr /* and data */
01531 ) ;
01532
01533 wset.function_type_av->allow_wrap = 1 ;
01534
01535 XtVaSetValues( wset.function_type_av->wtext ,
01536 XmNcolumns , LONGEST_FUNC_TYPESTR ,
01537 XmNmaxLength , LONGEST_FUNC_TYPESTR ,
01538 NULL ) ;
01539
01540 XtVaSetValues( wset.function_type_av->wrowcol ,
01541 XmNleftAttachment , XmATTACH_WIDGET ,
01542 XmNleftOffset , T3D_FORM_SPACING ,
01543 XmNtopAttachment , XmATTACH_WIDGET ,
01544 XmNtopOffset , T3D_FORM_SPACING ,
01545 XmNleftWidget , wset.geometry_parent_textfield ,
01546 #ifndef NO_NAMES
01547 XmNtopWidget , wset.geometry_dataname_textfield ,
01548 #else
01549 XmNtopWidget , wset.geometry_parent_textfield ,
01550 #endif
01551 XtNmappedWhenManaged , False ,
01552 NULL ) ;
01553
01554 MCW_reghelp_children( wset.function_type_av->wrowcol ,
01555 "Use the arrows to specify\n"
01556 "the type of functional data\n"
01557 "stored in the image files" ) ;
01558 MCW_reghint_children( wset.function_type_av->wrowcol ,
01559 "Type of functional data" ) ;
01560
01561 wset.anatomy_type_av =
01562 new_MCW_arrowval(
01563 wset.topform , /* parent */
01564 "Type of anatomy \nin the images", /* label */
01565 MCW_AV_downup , /* arrows */
01566 FIRST_ANAT_TYPE , /* min */
01567 LAST_ANAT_TYPE , /* max */
01568 user_inputs.anatomy_type , /* init */
01569 MCW_AV_readtext , /* text type */
01570 0 , /* decimals */
01571 T3D_type_av_CB , NULL , /* callback */
01572 T3D_text_display , /* text maker */
01573 ANAT_typestr /* and data */
01574 ) ;
01575
01576 wset.anatomy_type_av->allow_wrap = 1 ;
01577
01578 XtVaSetValues( wset.anatomy_type_av->wtext ,
01579 XmNcolumns , LONGEST_ANAT_TYPESTR ,
01580 XmNmaxLength , LONGEST_ANAT_TYPESTR ,
01581 NULL ) ;
01582
01583 XtVaSetValues( wset.anatomy_type_av->wrowcol ,
01584 XmNleftAttachment , XmATTACH_WIDGET ,
01585 XmNleftWidget , wset.geometry_parent_textfield ,
01586 #ifndef NO_NAMES
01587 XmNtopWidget , wset.geometry_dataname_textfield ,
01588 #else
01589 XmNtopWidget , wset.geometry_parent_textfield ,
01590 #endif
01591 XmNleftOffset , T3D_FORM_SPACING ,
01592 XmNtopAttachment , XmATTACH_WIDGET ,
01593 XmNtopOffset , T3D_FORM_SPACING ,
01594 XtNmappedWhenManaged , False ,
01595 NULL ) ;
01596
01597 MCW_reghelp_children( wset.anatomy_type_av->wrowcol ,
01598 "Use the arrows to specify\n"
01599 "the type of anatomical data\n"
01600 "stored in the image files" ) ;
01601 MCW_reghint_children( wset.anatomy_type_av->wrowcol ,
01602 "Type of anatomical data" ) ;
01603
01604 /*----- stat_aux data fields -----*/
01605
01606 wset.stat_aux_label =
01607 XtVaCreateManagedWidget(
01608 "dialog" , xmLabelWidgetClass , wset.topform ,
01609 XmNleftAttachment , XmATTACH_FORM ,
01610 XmNleftOffset , T3D_FORM_SPACING ,
01611 XmNtopAttachment , XmATTACH_WIDGET ,
01612 XmNtopWidget , wset.dataset_type_av->wrowcol ,
01613 XmNtopOffset , T3D_FORM_SPACING ,
01614 NULL ) ;
01615
01616 wset.stat_aux_textfield =
01617 XtVaCreateManagedWidget(
01618 "dialog" , xmTextFieldWidgetClass , wset.topform ,
01619 XmNcolumns , 80 ,
01620 XmNeditable , True ,
01621 XmNmaxLength , THD_MAX_NAME-1 ,
01622 XmNresizeWidth , False ,
01623 XmNcursorPositionVisible , True ,
01624 XmNblinkRate , 0 ,
01625 XmNleftAttachment , XmATTACH_FORM ,
01626 XmNleftOffset , T3D_FORM_SPACING ,
01627 XmNtopAttachment , XmATTACH_WIDGET ,
01628 XmNtopWidget , wset.stat_aux_label ,
01629 XmNtopOffset , 1 ,
01630 NULL ) ;
01631
01632 MCW_register_help( wset.stat_aux_label ,
01633 "Some types of functional data require input\n"
01634 "of extra statistical parameters. These\n"
01635 "values should be entered in the text field\n"
01636 "below, separated by spaces and/or commas.\n"
01637 "\n"
01638 " Inten+Cor requires the number of\n"
01639 " samples (images) used, the number of\n"
01640 " fitting parameters, and the number of\n"
01641 " orthogonalization parameters.\n"
01642 "\n"
01643 " Inten+Ttest requires the number of\n"
01644 " degrees-of-freedom in the t-test."
01645 ) ;
01646
01647 MCW_register_help( wset.stat_aux_textfield ,
01648 "Some types of functional data require input\n"
01649 "of extra statistical parameters. These\n"
01650 "values should be entered in this text field,\n"
01651 "separated by spaces and/or commas.\n"
01652 "\n"
01653 " Inten+Cor requires the number of\n"
01654 " samples (images) used, the number of\n"
01655 " fitting parameters, and the number of\n"
01656 " orthogonalization parameters.\n"
01657 "\n"
01658 " Inten+Ttest requires the number of\n"
01659 " degrees-of-freedom in the t-test."
01660 ) ;
01661
01662 MCW_register_hint( wset.stat_aux_label , "Extra statistical parameters" ) ;
01663 MCW_register_hint( wset.stat_aux_textfield , "Extra statistical parameters" ) ;
01664
01665 /** The stuff below is commented out,
01666 since the textfield is scanned only at the write-out time **/
01667
01668 #if 0
01669 XtAddCallback( wset.stat_aux_textfield ,
01670 XmNactivateCallback ,
01671 T3D_stat_aux_CB , NULL ) ; /* return key */
01672
01673 XtAddCallback( wset.stat_aux_textfield ,
01674 XmNlosingFocusCallback ,
01675 T3D_stat_aux_CB , NULL ) ; /* Tab key */
01676
01677 XtInsertEventHandler( wset.stat_aux_textfield ,
01678 LeaveWindowMask , /* pointer leaves */
01679 FALSE ,
01680 T3D_pointer_leave_EV , NULL ,
01681 XtListTail ) ; /* last in queue */
01682 #endif
01683
01684 /*--- output locations ---*/
01685
01686 wset.output_file_label =
01687 XtVaCreateManagedWidget(
01688 "dialog" , xmLabelWidgetClass , wset.topform ,
01689 LABEL_ARG("Prefix for 3D \nDataset file ") ,
01690
01691 XmNleftAttachment , XmATTACH_WIDGET ,
01692 XmNleftWidget , wset.geometry_parent_textfield ,
01693 XmNleftOffset , T3D_FORM_SPACING ,
01694 XmNtopAttachment , XmATTACH_WIDGET ,
01695 XmNtopWidget , wset.stat_aux_textfield ,
01696 XmNtopOffset , T3D_FORM_SPACING ,
01697 XmNbottomAttachment , XmATTACH_FORM ,
01698 XmNbottomOffset , T3D_FORM_SPACING ,
01699 NULL ) ;
01700
01701 wset.output_file_textfield =
01702 XtVaCreateManagedWidget(
01703 "dialog" , xmTextFieldWidgetClass , wset.topform ,
01704 XmNcolumns , T3D_NAME_WIDTH ,
01705 XmNeditable , True ,
01706 XmNmaxLength , THD_MAX_PREFIX-1 ,
01707 XmNresizeWidth , False ,
01708 XmNcursorPositionVisible , True ,
01709 XmNblinkRate , 0 ,
01710 /*
01711 XmNmarginHeight , 1 ,
01712 XmNmarginWidth , 1 ,
01713 */
01714 XmNvalue , user_inputs.output_filename ,
01715
01716 XmNleftAttachment , XmATTACH_WIDGET ,
01717 XmNleftOffset , T3D_FORM_SPACING ,
01718 XmNleftWidget , wset.output_file_label ,
01719 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
01720 XmNtopWidget , wset.output_file_label ,
01721 XmNtopOffset , 0 ,
01722
01723 NULL ) ;
01724
01725 MCW_register_help( wset.output_file_label ,
01726 "Type in the 'prefix' for the filenames\n"
01727 "that the 3D dataset will be saved in.\n"
01728 "[The actual filenames will be of the\n"
01729 " form prefix+orig.suff, where suff =\n"
01730 " " DATASET_HEADER_SUFFIX " and " DATASET_BRICK_SUFFIX "]" ) ;
01731
01732 MCW_register_help( wset.output_file_textfield ,
01733 "Type in the 'prefix' for the filenames\n"
01734 "that the 3D dataset will be saved in.\n"
01735 "[The actual filenames will be of the\n"
01736 " form prefix+orig.suff, where suff =\n"
01737 " " DATASET_HEADER_SUFFIX " and " DATASET_BRICK_SUFFIX "]" ) ;
01738
01739 MCW_register_hint( wset.output_file_label ,
01740 "New dataset's 'prefix' for filenames" ) ;
01741 MCW_register_hint( wset.output_file_textfield ,
01742 "New dataset's 'prefix' for filenames" ) ;
01743
01744 wset.session_file_label =
01745 XtVaCreateManagedWidget(
01746 "dialog" , xmLabelWidgetClass , wset.topform ,
01747 LABEL_ARG("Session direct.\nfor 3D Datasets") ,
01748
01749 XmNleftAttachment , XmATTACH_FORM ,
01750 XmNleftOffset , T3D_FORM_SPACING ,
01751 XmNtopAttachment , XmATTACH_WIDGET ,
01752 XmNtopWidget , wset.stat_aux_textfield ,
01753 XmNtopOffset , T3D_FORM_SPACING ,
01754 NULL ) ;
01755
01756 wset.session_file_textfield =
01757 XtVaCreateManagedWidget(
01758 "dialog" , xmTextFieldWidgetClass , wset.topform ,
01759 XmNcolumns , T3D_NAME_WIDTH ,
01760 XmNeditable , True ,
01761 XmNmaxLength , THD_MAX_NAME-1 ,
01762 XmNresizeWidth , False ,
01763 XmNcursorPositionVisible , True ,
01764 XmNblinkRate , 0 ,
01765 /*
01766 XmNmarginHeight , 1 ,
01767 XmNmarginWidth , 1 ,
01768 */
01769 XmNvalue , user_inputs.session_filename ,
01770
01771 XmNleftAttachment , XmATTACH_WIDGET ,
01772 XmNleftOffset , T3D_FORM_SPACING ,
01773 XmNleftWidget , wset.session_file_label ,
01774 XmNtopAttachment , XmATTACH_OPPOSITE_WIDGET ,
01775 XmNtopWidget , wset.session_file_label ,
01776 XmNtopOffset , 0 ,
01777
01778 NULL ) ;
01779
01780 MCW_register_help( wset.session_file_label ,
01781 "Type in the name of the session\n"
01782 "directory in which to save this\n"
01783 "3D dataset, and in which to look\n"
01784 "for the 'parent' datasets" ) ;
01785
01786 MCW_register_help( wset.session_file_textfield ,
01787 "Type in the name of the session\n"
01788 "directory in which to save this\n"
01789 "3D dataset, and in which to look\n"
01790 "for the 'parent' datasets" ) ;
01791
01792 MCW_register_hint( wset.session_file_label , "New dataset's directory" ) ;
01793 MCW_register_hint( wset.session_file_textfield , "New dataset's directory" ) ;
01794
01795 printf(".");fflush(stdout);
01796
01797 /*----- action controls at lower right corner -----*/
01798
01799 wset.action_frame =
01800 XtVaCreateManagedWidget(
01801 "dialog" , xmFrameWidgetClass , wset.topform ,
01802 XmNshadowType , XmSHADOW_ETCHED_IN ,
01803 XmNleftAttachment , XmATTACH_WIDGET ,
01804 XmNleftWidget , wset.anatomy_parent_textfield ,
01805 XmNleftOffset , T3D_FORM_SPACING ,
01806 XmNbottomAttachment , XmATTACH_FORM ,
01807 XmNbottomOffset , T3D_FORM_SPACING ,
01808 NULL ) ;
01809
01810 wset.action_rowcol =
01811 XtVaCreateWidget(
01812 "dialog" , xmRowColumnWidgetClass , wset.action_frame ,
01813 XmNorientation , XmVERTICAL ,
01814 XmNpacking , XmPACK_TIGHT ,
01815 NULL ) ;
01816
01817 /* 14 Sep 1998: add a button to swap bytes in the image data */
01818
01819 { int dd = mri_datum_size((MRI_TYPE)argopt.datum_all) ;
01820 char * tt = "Byte Swap[2]" ;
01821 char * ff = "Byte Swap[4]" ;
01822 if( dd == 2 || dd == 4 ){
01823 if( dd == 2 )
01824 wset.swap_pb =
01825 XtVaCreateManagedWidget(
01826 "dialog" , xmPushButtonWidgetClass , wset.action_rowcol ,
01827 LABEL_ARG(tt) , NULL ) ;
01828 else
01829 wset.swap_pb =
01830 XtVaCreateManagedWidget(
01831 "dialog" , xmPushButtonWidgetClass , wset.action_rowcol ,
01832 LABEL_ARG(ff) , NULL ) ;
01833
01834 XtAddCallback( wset.swap_pb , XmNactivateCallback ,
01835 T3D_swap_CB , NULL ) ;
01836 MCW_register_hint( wset.swap_pb , "Use if images need this" ) ;
01837 } else {
01838 wset.swap_pb = NULL ;
01839 }
01840 }
01841
01842 wset.button_help_pb =
01843 XtVaCreateManagedWidget(
01844 "dialog" , xmPushButtonWidgetClass , wset.action_rowcol ,
01845 LABEL_ARG("button help") ,
01846 NULL ) ;
01847 XtAddCallback( wset.button_help_pb , XmNactivateCallback ,
01848 MCW_click_help_CB , NULL ) ;
01849 MCW_register_help( wset.button_help_pb ,
01850 "Click the hand\non any button to get\na little help" ) ;
01851 MCW_register_hint( wset.button_help_pb , "Get more help" ) ;
01852
01853 wset.open_view_pb =
01854 XtVaCreateManagedWidget(
01855 "dialog" , xmPushButtonWidgetClass , wset.action_rowcol ,
01856 LABEL_ARG("View Images") ,
01857 NULL ) ;
01858 XtAddCallback( wset.open_view_pb , XmNactivateCallback ,
01859 T3D_open_view_CB , NULL ) ;
01860 MCW_register_help( wset.open_view_pb ,
01861 "Use this to open a window to see the images;\n"
01862 "N.B.: If you use the viewing controls to change the\n"
01863 " orientation of the images, then you must be\n"
01864 " aware that 'x' and 'y' in the geometry controls\n"
01865 " above refer to the images in their ORIGINAL\n"
01866 " orientation on the screen, NOT in the rotated\n"
01867 " and/or mirrored orientation you will be viewing." ) ;
01868 MCW_register_hint( wset.open_view_pb , "See the input images" ) ;
01869
01870 wset.save_file_pb =
01871 XtVaCreateManagedWidget(
01872 "dialog" , xmPushButtonWidgetClass , wset.action_rowcol ,
01873 LABEL_ARG("Save Dataset") ,
01874 NULL ) ;
01875 XtAddCallback( wset.save_file_pb , XmNactivateCallback ,
01876 T3D_save_file_CB , NULL ) ;
01877 MCW_register_help( wset.save_file_pb ,
01878 "Use this to save the volume data\n"
01879 "into 3D dataset files when you\n"
01880 "have set all the control data." ) ;
01881 MCW_register_hint( wset.save_file_pb , "Write new dataset to disk" ) ;
01882
01883 wset.quit_pb =
01884 XtVaCreateManagedWidget(
01885 "dialog" , xmPushButtonWidgetClass , wset.action_rowcol ,
01886 XmNrecomputeSize , False ,
01887 LABEL_ARG("quit") ,
01888 NULL ) ;
01889 XtAddCallback( wset.quit_pb , XmNactivateCallback ,
01890 T3D_quit_CB , NULL ) ;
01891 MCW_register_help( wset.quit_pb ,
01892 "Press this button TWICE\nto exit the program" ) ;
01893 MCW_register_hint( wset.quit_pb , "Press twice to exit program" ) ;
01894
01895 MCW_set_widget_bg( wset.quit_pb , MCW_hotcolor(wset.quit_pb) , 0 ) ;
01896
01897 XtManageChild( wset.action_rowcol ) ;
01898
01899 printf(".");fflush(stdout);
01900
01901 /*----- all done -----*/
01902
01903 XtManageChild( wset.topform ) ;
01904
01905 XtRealizeWidget( wset.topshell ) ;
01906
01907 WAIT_for_window( wset.topshell ) ; /* 10 Sep 2002 */
01908 wset.good = 1 ;
01909
01910 T3D_data_to_widgets() ;
01911 T3D_set_dependent_geometries() ;
01912
01913 EXRETURN ;
01914 }
|
|
|
|
||||||||||||
|
Definition at line 3674 of file to3d.c. References to3d_data::fov, to3d_widget_set::fov_av, MCW_arrowval::fval, RESET_QUIT, and T3D_set_dependent_geometries(). Referenced by T3D_create_widgets().
03675 {
03676 user_inputs.fov = wset.fov_av->fval ;
03677 T3D_set_dependent_geometries() ;
03678 RESET_QUIT ;
03679 }
|
|
||||||||||||||||
|
Definition at line 5343 of file to3d.c. References THD_3dim_dataset::anat_parent_idcode, THD_3dim_dataset::anat_parent_name, to3d_data::anatomy_dataname, to3d_data::anatomy_parent_idcode, client_data, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, DEBLANK, ENTRY, FILENAME_TO_PREFIX, to3d_data::fov, to3d_data::geometry_dataname, geometry_loaded, to3d_data::geometry_parent_filename, geomparent_loaded, ATR_int::in, INERR, MCW_strncpy, myXtFree, ATR_int::nin, to3d_data::nx, THD_dataxes::nxx, to3d_data::ny, THD_dataxes::nyy, to3d_data::nz, THD_dataxes::nzz, PATH_CONCAT, THD_3dim_dataset::self_name, to3d_widget_set::session_file_textfield, to3d_data::session_filename, T3D_data_to_widgets(), T3D_poperr(), T3D_widgets_to_data(), THD_delete_3dim_dataset(), THD_find_int_atr(), THD_MAX_NAME, THD_open_one_dataset(), to3d_data::voxcontig, VOXCONTIG_UNIF, VOXCONTIG_YES, to3d_data::voxshape, VOXSHAPE_CUBICAL, VOXSHAPE_IRREGULAR, VOXSHAPE_SQUARE, XCENTERED, to3d_data::xorient, to3d_data::xorigin, to3d_data::xsize, THD_dataxes::xxdel, THD_dataxes::xxorg, THD_dataxes::xxorient, to3d_data::xyz_centered, YCENTERED, to3d_data::yorient, to3d_data::yorigin, to3d_data::ysize, THD_dataxes::yydel, THD_dataxes::yyorg, THD_dataxes::yyorient, ZCENTERED, to3d_data::zorient, to3d_data::zorigin, zpad, to3d_data::zsize, to3d_data::zspacing, THD_dataxes::zzdel, THD_dataxes::zzorg, and THD_dataxes::zzorient. Referenced by main(), and T3D_create_widgets().
05345 {
05346 static char * old_name = NULL ;
05347 char * new_name ;
05348 float size ;
05349 char new_path[THD_MAX_NAME] , new_pref[THD_MAX_NAME] ;
05350 THD_3dim_dataset * geom_dset ;
05351 THD_dataxes * geom_daxes ;
05352
05353 int xpad=0,ypad=0,zpad=0 ; /* 05 Feb 2001 */
05354
05355 ENTRY("T3D_geometry_parent_CB") ;
05356
05357 if( old_name == NULL ) old_name = XtNewString("Elvis Lives!!!") ;
05358
05359 if( w != NULL ){
05360 new_name = XmTextFieldGetString( w ) ; /* get the new text */
05361 } else {
05362 new_name = XtNewString( user_inputs.geometry_parent_filename ) ;
05363 }
05364 DEBLANK(new_name) ;
05365
05366 if( strlen(new_name) == 0 ) { old_name = new_name ; geomparent_loaded = 0 ; EXRETURN ; }
05367 if( strcmp(new_name,old_name) == 0 ){ myXtFree(new_name) ; geomparent_loaded = 0 ; EXRETURN ; }
05368
05369 /* have a new filename --> try to read dataset from it */
05370
05371 myXtFree(old_name) ; old_name = new_name ;
05372
05373 /* make a pathname to the geometry dataset */
05374
05375 if( strstr(new_name,"/") == NULL ){
05376 char * sess ;
05377 if( w != NULL ) sess = XmTextFieldGetString(wset.session_file_textfield);
05378 else sess = XtNewString( user_inputs.session_filename ) ;
05379 DEBLANK(sess) ;
05380 if( strlen(sess) > 0 ){
05381 PATH_CONCAT( new_path , sess , new_name ) ;
05382 } else {
05383 strcpy( new_path , new_name ) ;
05384 }
05385 myXtFree(sess) ;
05386 } else {
05387 strcpy( new_path , new_name ) ;
05388 }
05389
05390 FILENAME_TO_PREFIX(new_path,new_pref) ;
05391 if( strlen(new_pref) == 0 ) strcat(new_path,"+orig") ;
05392
05393 /* read dataset from this path */
05394
05395 geom_dset = THD_open_one_dataset( new_path ) ;
05396 if( geom_dset == NULL ){
05397 T3D_poperr( INERR ,
05398 "Cannot read 3D dataset\nin geometry parent file" ) ;
05399 geomparent_loaded = 0 ; EXRETURN ;
05400 }
05401
05402 /* 05 Feb 2001: set if this was a 'padded' dataset from an earlier to3d */
05403
05404 { ATR_int * atr ;
05405 atr = THD_find_int_atr( geom_dset->dblk , "TO3D_ZPAD" ) ;
05406 if( atr != NULL && atr->nin >= 3 ){
05407 xpad = atr->in[0] ;
05408 ypad = atr->in[1] ;
05409 zpad = atr->in[2] ;
05410 }
05411 }
05412
05413 geom_daxes = geom_dset->daxes ;
05414
05415 if( geom_daxes->nxx - 2*xpad != user_inputs.nx ||
05416 geom_daxes->nyy - 2*ypad != user_inputs.ny ||
05417 geom_daxes->nzz - 2*zpad != user_inputs.nz ){
05418
05419 char msg[256] ;
05420
05421 sprintf(msg,
05422 "*** Shape mismatch!! ***\n"
05423 "file nx=%d ny=%d nz=%d (zpad=%d)\n"
05424 "images nx=%d ny=%d nz=%d",
05425 geom_daxes->nxx,geom_daxes->nyy,geom_daxes->nzz,zpad,
05426 user_inputs.nx ,user_inputs.ny ,user_inputs.nz ) ;
05427
05428 T3D_poperr( INERR , msg ) ;
05429 THD_delete_3dim_dataset( geom_dset , False ) ;
05430 geomparent_loaded = 0 ; EXRETURN ;
05431 }
05432
05433 #ifdef ALLOW_NONCONTIG
05434 if( geom_daxes->xxskip != 0.0 || geom_daxes->yyskip != 0.0 ){
05435 T3D_poperr( INERR , "Nonzero skip factors for x and y!" ) ;
05436 THD_delete_3dim_dataset( geom_dset , False ) ;
05437 geomparent_loaded = 0 ; EXRETURN ;
05438 }
05439 #endif
05440
05441 /* at this point, the geom dataset seems OK, so copy its axes data */
05442
05443 /* but first, load all data from the widgets into the user_inputs
05444 (this will mean that the T3D_data_to_widgets call later won't
05445 clobber any un-altered but currently un-saved data fields */
05446
05447 T3D_widgets_to_data() ;
05448
05449 #ifdef REQUIRE_ANAT_PARENT
05450 if( strlen(geom_dset->anat_parent_name) > 0 ){
05451 MCW_strncpy( user_inputs.anatomy_dataname ,
05452 geom_dset->anat_parent_name, THD_MAX_NAME ) ;
05453 user_inputs.anatomy_parent_idcode = geom_dset->anat_parent_idcode ;
05454 }
05455 #endif
05456
05457 MCW_strncpy( user_inputs.geometry_dataname ,
05458 geom_dset->self_name , THD_MAX_NAME ) ;
05459
05460 MCW_strncpy( user_inputs.geometry_parent_filename ,
05461 new_name , THD_MAX_NAME ) ;
05462
05463 user_inputs.xorient = geom_daxes->xxorient ;
05464 user_inputs.yorient = geom_daxes->yyorient ;
05465 user_inputs.zorient = geom_daxes->zzorient ;
05466
05467 #if 0 /* Bad stuff, replaced June 20, 1995 */
05468
05469 user_inputs.xorigin = fabs(geom_daxes->xxorg) ;
05470 user_inputs.yorigin = fabs(geom_daxes->yyorg) ;
05471 user_inputs.zorigin = fabs(geom_daxes->zzorg) ;
05472
05473 #else /* newer stuff [05 Feb 2001] - allow for padding in to3d before */
05474
05475 { float xorg = geom_daxes->xxorg + xpad * geom_daxes->xxdel ;
05476 float yorg = geom_daxes->yyorg + ypad * geom_daxes->yydel ;
05477 float zorg = geom_daxes->zzorg + zpad * geom_daxes->zzdel ;
05478
05479 user_inputs.xorigin = (ORIENT_sign[user_inputs.xorient] == '+')
05480 ? (-xorg) : (xorg) ;
05481 user_inputs.yorigin = (ORIENT_sign[user_inputs.yorient] == '+')
05482 ? (-yorg) : (yorg) ;
05483 user_inputs.zorigin = (ORIENT_sign[user_inputs.zorient] == '+')
05484 ? (-zorg) : (zorg) ;
05485 }
05486 #endif
05487
05488 user_inputs.xsize = fabs(geom_daxes->xxdel) ;
05489 user_inputs.ysize = fabs(geom_daxes->yydel) ;
05490 #ifdef ALLOW_NONCONTIG
05491 user_inputs.zspacing = fabs(geom_daxes->zzdel) ;
05492 user_inputs.zsize = user_inputs.zspacing - geom_daxes->zzskip ;
05493 #else
05494 user_inputs.zsize = fabs(geom_daxes->zzdel) ;
05495 #endif
05496
05497 /*-- set the vox*_bbox values depending on initial sizes --*/
05498
05499 if( user_inputs.xsize != user_inputs.ysize ){
05500 user_inputs.voxshape = VOXSHAPE_IRREGULAR ;
05501 } else {
05502 if( user_inputs.xsize != user_inputs.zsize ){
05503 user_inputs.voxshape = VOXSHAPE_SQUARE ;
05504 } else {
05505 user_inputs.voxshape = VOXSHAPE_CUBICAL ;
05506 }
05507 }
05508 user_inputs.fov = user_inputs.xsize * user_inputs.nx ;
05509
05510 #ifdef ALLOW_NONCONTIG
05511 if( geom_daxes->zzskip == 0 ) user_inputs.voxcontig = VOXCONTIG_YES ;
05512 else user_inputs.voxcontig = VOXCONTIG_UNIF ;
05513 #endif
05514
05515 user_inputs.xyz_centered = 0 ;
05516
05517 size = 0.5 * (user_inputs.nx-1) * user_inputs.xsize ;
05518 if( fabs(size - user_inputs.xorigin) < 0.01 )
05519 user_inputs.xyz_centered |= XCENTERED ;
05520
05521 size = 0.5 * (user_inputs.ny-1) * user_inputs.ysize ;
05522 if( fabs(size - user_inputs.yorigin) < 0.01 )
05523 user_inputs.xyz_centered |= YCENTERED ;
05524
05525 size = 0.5 * (user_inputs.nz-1) * user_inputs.zsize ;
05526 if( fabs(size - user_inputs.zorigin) < 0.01 )
05527 user_inputs.xyz_centered |= ZCENTERED ;
05528
05529 T3D_data_to_widgets() ;
05530
05531 THD_delete_3dim_dataset( geom_dset , False ) ;
05532
05533 geometry_loaded = 1 ;
05534 geomparent_loaded = 1 ; /* flag that load was OK */
05535
05536 EXRETURN ;
05537 }
|
|
||||||||||||||||
|
Definition at line 4601 of file to3d.c. References MCW_imseq_status::aux, FD_brick_to_mri(), isqCR_getimage, isqCR_getoverlay, isqCR_getqimage, isqCR_getstatus, myXtNew, FD_brick::n3, MCW_imseq_status::num_series, MCW_imseq_status::num_total, MCW_imseq_status::parent, MCW_imseq_status::send_CB, MCW_imseq_status::slice_proj, T3D_imseq_CB(), MCW_imseq_status::transforms0D, and MCW_imseq_status::transforms2D. Referenced by T3D_open_view_CB().
04602 {
04603 MCW_imseq_status * stat ;
04604
04605 if( n < 0 || n >= br->n3 || type == isqCR_getoverlay ) return NULL ;
04606
04607 if( type == isqCR_getstatus ){
04608 stat = myXtNew( MCW_imseq_status ) ;
04609
04610 stat->num_total = br->n3 ;
04611 stat->num_series = br->n3 ;
04612 stat->send_CB = T3D_imseq_CB ;
04613 stat->parent = (XtPointer) br ;
04614 stat->aux = NULL ;
04615
04616 stat->transforms0D = NULL ;
04617 stat->transforms2D = NULL ;
04618 stat->slice_proj = NULL ;
04619
04620 return (XtPointer) stat ;
04621 }
04622
04623 if( type == isqCR_getimage || type == isqCR_getqimage ){
04624 return (XtPointer) FD_brick_to_mri( n , 0 , br ) ;
04625 }
04626
04627 return NULL ; /* should never be reached */
04628 }
|
|
||||||||||||||||
|
Definition at line 4632 of file to3d.c. References THD_string_array::ar, drive_MCW_imseq(), MCW_imseq::im_nr, isqCR_destroy, isqCR_force_redisplay, isqCR_newimage, isqDR_display, isqDR_rebar, isqDR_title, MCW_invert_widget(), myXtFree, ISQ_cbs::nim, to3d_widget_set::open_view_pb, ISQ_cbs::reason, and to3d_widget_set::seq. Referenced by T3D_getim().
04633 {
04634 switch( cbs->reason ){
04635
04636 case isqCR_destroy:
04637 myXtFree( seq ) ; wset.seq = NULL ;
04638 myXtFree( br ) ;
04639 MCW_invert_widget( wset.open_view_pb ) ;
04640 break ;
04641
04642 case isqCR_newimage:
04643 drive_MCW_imseq( seq, isqDR_title, (XtPointer) imnames->ar[cbs->nim] ) ;
04644 break ;
04645
04646 case isqCR_force_redisplay:{ /* 22 Aug 1998 */
04647 drive_MCW_imseq( seq , isqDR_display , (XtPointer) seq->im_nr ) ;
04648 drive_MCW_imseq( seq , isqDR_rebar , (XtPointer) seq->im_nr ) ;
04649 }
04650
04651 }
04652 return ;
04653 }
|
|
|
Definition at line 1942 of file to3d.c. References af_type_set, AFNI_log_string, ANAT_EPI_TYPE, to3d_data::anatomy_dataname, to3d_data::anatomy_parent_filename, to3d_data::anatomy_parent_idcode, to3d_data::anatomy_type, to3d_data::anatomy_type_string, Argc, argopt, Argv, commandline, to3d_data::dataset_name, to3d_data::dataset_type, to3d_data::dataset_type_string, decode_location(), EMPTY_STRING, ENTRY, FatalError, FIRST_ANAT_TYPE, FIRST_FUNC_TYPE, First_Image_Arg, FIRST_VIEW_TYPE, free, to3d_data::function_type, to3d_data::function_type_string, to3d_data::geometry_dataname, to3d_data::geometry_parent_filename, HEAD_ANAT_TYPE, HEAD_FUNC_TYPE, INCODE_FOV, INCODE_NONE, INCODE_SLAB, LAST_ANAT_TYPE, LAST_FUNC_TYPE, LAST_VIEW_TYPE, malloc, MAX_STAT_AUX, MCW_strncpy, my_getenv(), to3d_data::nosave, to3d_data::ntt, NZBOT, to3d_data::nzz, ORCODE, ORIENT_OPPOSITE, outliers_fname, to3d_data::output_filename, to3d_data::session_filename, to3d_data::short_label1, to3d_data::short_label2, to3d_data::stat_aux, strtod(), Syntax(), to3d_data::t_then_z, THD_filename_ok(), THD_MAX_LABEL, THD_MAX_NAME, THD_MAX_PREFIX, to3d_data::Torg, to3d_data::tpattern, TR, to3d_data::TR, tross_commandline(), to3d_data::tunits, UNITS_HZ_TYPE, UNITS_MSEC_TYPE, UNITS_SEC_TYPE, use_zoff, VIEW_ORIGINAL_TYPE, to3d_data::view_type, WarningError, to3d_data::xin_bot, to3d_data::xin_top, to3d_data::xincode, to3d_data::xorient, to3d_data::yin_bot, to3d_data::yin_top, to3d_data::yincode, to3d_data::yorient, ZERO_IDCODE, to3d_data::zin_bot, to3d_data::zin_top, to3d_data::zincode, zoff, to3d_data::zorient, zpad, and zpad_mm. Referenced by main().
01943 {
01944 int nopt , ii ;
01945
01946 ENTRY("T3D_initialize_user_data") ;
01947
01948 user_inputs = default_user_inputs ; /* copy defaults */
01949 user_inputs.nosave = 0 ;
01950
01951 /*-- initialize strings --*/
01952
01953 EMPTY_STRING( user_inputs.dataset_name ) ;
01954 EMPTY_STRING( user_inputs.short_label1 ) ;
01955 EMPTY_STRING( user_inputs.short_label2 ) ;
01956 EMPTY_STRING( user_inputs.geometry_parent_filename ) ;
01957 EMPTY_STRING( user_inputs.anatomy_parent_filename ) ;
01958 EMPTY_STRING( user_inputs.anatomy_dataname ) ;
01959 EMPTY_STRING( user_inputs.geometry_dataname ) ;
01960 EMPTY_STRING( user_inputs.output_filename ) ;
01961 ZERO_IDCODE( user_inputs.anatomy_parent_idcode ) ;
01962
01963 strcpy( user_inputs.session_filename , "./" ) ;
01964
01965 strcpy( user_inputs.dataset_type_string ,
01966 DATASET_typestr[user_inputs.dataset_type] ) ;
01967
01968 strcpy( user_inputs.function_type_string ,
01969 FUNC_typestr[user_inputs.function_type] ) ;
01970
01971 user_inputs.view_type = VIEW_ORIGINAL_TYPE ;
01972
01973 for( ii=0 ; ii < MAX_STAT_AUX ; ii++ )
01974 user_inputs.stat_aux[ii] = 0.0 ;
01975
01976 user_inputs.xincode = user_inputs.yincode = user_inputs.zincode = INCODE_NONE ;
01977
01978 user_inputs.ntt = 0 ;
01979 user_inputs.TR = 1.0 ;
01980 user_inputs.Torg = 0.0 ; /* 23 Feb 2005 */
01981 user_inputs.nzz = 0 ;
01982 user_inputs.t_then_z = 0 ;
01983 user_inputs.tpattern = NULL ;
01984 user_inputs.tunits = UNITS_MSEC_TYPE ;
01985
01986 /*-- 05 Feb 2000: zpad environment --*/
01987
01988 { char *eee=my_getenv("AFNI_TO3D_ZPAD") , *fff ;
01989 if( eee != NULL ){
01990 zpad = strtod( eee , &fff ) ;
01991 if( zpad < 0.0 ) FatalError("AFNI_TO3D_ZPAD is negative") ;
01992 zpad_mm = (*fff == 'm') ;
01993 }
01994 }
01995
01996 /*-- scan options --*/
01997
01998 nopt = 1 ;
01999 while( nopt < Argc && Argv[nopt][0] == '-' ){
02000
02001 if( strncmp(Argv[nopt],"-help",4) == 0 ){
02002 Syntax() ;
02003 }
02004
02005 /* -type from the anatomy prefixes */
02006
02007 for( ii=FIRST_ANAT_TYPE ; ii <= LAST_ANAT_TYPE ; ii++ )
02008 if( strncmp( &(Argv[nopt][1]) ,
02009 ANAT_prefixstr[ii] , THD_MAX_PREFIX ) == 0 ) break ;
02010
02011 if( ii <= LAST_ANAT_TYPE ){
02012 user_inputs.anatomy_type = ii ;
02013 user_inputs.dataset_type = HEAD_ANAT_TYPE ;
02014 strcpy( user_inputs.dataset_type_string ,
02015 DATASET_typestr[user_inputs.dataset_type] ) ;
02016 strcpy( user_inputs.anatomy_type_string ,
02017 ANAT_typestr[user_inputs.anatomy_type] ) ;
02018
02019 af_type_set = 1 ; nopt++ ; continue ;
02020 }
02021
02022 /* -type from the function prefixes */
02023
02024 for( ii=FIRST_FUNC_TYPE ; ii <= LAST_FUNC_TYPE ; ii++ )
02025 if( strncmp( &(Argv[nopt][1]) ,
02026 FUNC_prefixstr[ii] , THD_MAX_PREFIX ) == 0 ) break ;
02027
02028 if( ii <= LAST_FUNC_TYPE ){
02029 user_inputs.function_type = ii ;
02030 user_inputs.dataset_type = HEAD_FUNC_TYPE ;
02031 strcpy( user_inputs.dataset_type_string ,
02032 DATASET_typestr[user_inputs.dataset_type] ) ;
02033 strcpy( user_inputs.function_type_string ,
02034 FUNC_typestr[user_inputs.function_type] ) ;
02035
02036 af_type_set = 1 ; nopt++ ; continue ;
02037 }
02038
02039 #ifdef USE_MRI_DELAY
02040 /*--- -in:1 ---*/
02041
02042 if( strncmp(Argv[nopt],"-in:1",5) == 0 ){
02043 argopt.delay_input = TRUE ;
02044 nopt++ ; continue ;
02045 }
02046 #endif
02047
02048 /*--- -view type ---*/
02049
02050 if( strncmp(Argv[nopt],"-view",4) == 0 ){
02051 char * str ;
02052
02053 if( ++nopt >= Argc ) FatalError("-view needs a type") ;
02054
02055 str = Argv[nopt] ; if( str[0] == '+' ) str++ ;
02056
02057 for( ii=FIRST_VIEW_TYPE ; ii <= LAST_VIEW_TYPE ; ii++ )
02058 if( strcmp(str,VIEW_codestr[ii]) == 0 ) break ;
02059
02060 if( ii <= LAST_VIEW_TYPE ){
02061 user_inputs.view_type = ii ;
02062 } else {
02063 WarningError("Unknown view type after -view!") ;
02064 }
02065 nopt++ ; continue ;
02066 }
02067
02068 /* 05 Feb 2001: -zpad option */
02069
02070 if( strncmp(Argv[nopt],"-zpad",5) == 0 ){
02071 char * eee ;
02072 if( ++nopt >= Argc ) FatalError("-zpad needs a count") ;
02073 if( zpad > 0.0 ) fprintf(stderr,"+++ WARNING: second -zpad option found!\n") ;
02074 zpad = strtod( Argv[nopt] , &eee ) ;
02075 if( zpad < 0.0 ) FatalError("-zpad is negative") ;
02076 zpad_mm = (*eee == 'm') ;
02077 nopt++ ; continue ;
02078 }
02079
02080 /*--- -session name ---*/
02081
02082 if( strncmp(Argv[nopt],"-session",4) == 0 ){
02083 if( ++nopt >= Argc ) FatalError("-session needs a name") ;
02084 MCW_strncpy( user_inputs.session_filename, Argv[nopt], THD_MAX_NAME ) ;
02085 nopt++ ; continue ;
02086 }
02087
02088 /*--- -prefix name ---*/
02089
02090 if( strncmp(Argv[nopt],"-prefix",4) == 0 ){
02091 if( ++nopt >= Argc ) FatalError("-prefix needs a name") ;
02092 MCW_strncpy( user_inputs.output_filename , Argv[nopt] , THD_MAX_NAME ) ;
02093 nopt++ ; continue ;
02094 }
02095
02096 #ifndef NO_NAMES
02097 /*--- -dname name ---*/
02098
02099 if( strncmp(Argv[nopt],"-dname",4) == 0 ){
02100 if( ++nopt >= Argc ) FatalError("-dname needs a name") ;
02101 MCW_strncpy( user_inputs.dataset_name , Argv[nopt] , THD_MAX_NAME ) ;
02102 nopt++ ; continue ;
02103 }
02104
02105 /*--- -dlabel name ---*/
02106
02107 if( strncmp(Argv[nopt],"-dlabel",4) == 0 ){
02108 if( ++nopt >= Argc ) FatalError("-dlabel needs a name") ;
02109 MCW_strncpy( user_inputs.short_label1 , Argv[nopt] , THD_MAX_LABEL ) ;
02110 nopt++ ; continue ;
02111 }
02112 #endif
02113
02114 /*--- -geomparent headerfile ---*/
02115
02116 if( strncmp(Argv[nopt],"-geomparent",6) == 0 ){
02117 if( ++nopt >= Argc ) FatalError("-geomparent needs a headerfile" ) ;
02118 MCW_strncpy( user_inputs.geometry_parent_filename ,
02119 Argv[nopt] , THD_MAX_NAME ) ;
02120 nopt++ ; continue ;
02121 }
02122
02123 /*--- -anatparent headerfile ---*/
02124
02125 if( strncmp(Argv[nopt],"-anatparent",6) == 0 ){
02126 if( ++nopt >= Argc ) FatalError("-anatparent needs a headerfile" ) ;
02127 MCW_strncpy( user_inputs.anatomy_parent_filename ,
02128 Argv[nopt] , THD_MAX_NAME ) ;
02129 nopt++ ; continue ;
02130 }
02131
02132 /*--- -nosave ---*/
02133
02134 if( strncmp(Argv[nopt],"-nosave",4) == 0 ){
02135 user_inputs.nosave = 1 ;
02136 nopt++ ; continue ;
02137 }
02138
02139 /*--- 25 Sep 2001: -sinter option ---*/
02140
02141 if( strcmp(Argv[nopt],"-sinter") == 0 ){
02142 putenv("AFNI_SIEMENS_INTERLEAVE=Yes") ; nopt++ ; continue ;
02143 }
02144
02145 /*--- 15 Aug 2001: -skip_outliers ---*/
02146
02147 if( strcmp(Argv[nopt],"-skip_outliers") == 0 ){
02148 putenv("AFNI_TO3D_OUTLIERS=No") ; nopt++ ; continue ;
02149 }
02150
02151 if( strcmp(Argv[nopt],"-text_outliers") == 0 ){
02152 putenv("AFNI_TO3D_OUTLIERS=Text") ; nopt++ ; continue ;
02153 }
02154
02155 /*--- 26 Aug 2001: -save_outliers ---*/
02156
02157 if( strcmp(Argv[nopt],"-save_outliers") == 0 ){
02158 if(++nopt > Argc) FatalError("-save_outliers needs a filename") ;
02159 outliers_fname = Argv[nopt] ;
02160 if( !THD_filename_ok(outliers_fname) )
02161 FatalError("-save_outliers filename is illegal") ;
02162 nopt++ ; continue ;
02163 }
02164
02165 /*--- July 1997: -orient code ---*/
02166
02167 if( strncmp(Argv[nopt],"-orient",4) == 0 ){
02168 char acod ;
02169
02170 if( ++nopt >= Argc ) FatalError("-orient needs a code") ;
02171 if( strlen(Argv[nopt]) != 3 ) FatalError("Illegal -orient code") ;
02172 acod = toupper(Argv[nopt][0]) ; user_inputs.xorient = ORCODE(acod) ;
02173 acod = toupper(Argv[nopt][1]) ; user_inputs.yorient = ORCODE(acod) ;
02174 acod = toupper(Argv[nopt][2]) ; user_inputs.zorient = ORCODE(acod) ;
02175 nopt++ ; continue ;
02176 }
02177
02178 if( strncmp(Argv[nopt],"-zorigin",7) == 0 ){
02179 if( ++nopt >= Argc ) FatalError("-zorigin needs a value") ;
02180 zoff = strtod( Argv[nopt] , NULL ) ;
02181 use_zoff = 1 ;
02182 nopt++ ; continue ;
02183 }
02184
02185 /********** April 1996: new options for setting dimensions **********/
02186
02187 /** 21 Nov 1997: alter the way dimensions are decoded **/
02188 #undef USE_OLD_DCODE
02189
02190 /*--- -xFOV or -xSLAB ---*/
02191
02192 if( strncmp(Argv[nopt],"-xFOV",5)==0 || strncmp(Argv[nopt],"-xSLAB",5)==0 ||
02193 strncmp(Argv[nopt],"-xfov",5)==0 || strncmp(Argv[nopt],"-xslab",5)==0 ){
02194 float val , xin_bot , xin_top ;
02195 char * ptr , * ptr2 , acod ;
02196 int dcod1 , dcod2 , xincode ;
02197
02198 xincode = ( strncmp(Argv[nopt],"-xFOV",5)==0 ||
02199 strncmp(Argv[nopt],"-xfov",5)==0 ) ? INCODE_FOV : INCODE_SLAB ;
02200
02201 if( ++nopt >= Argc ) WarningError("need an argument after -xFOV/-xSLAB!") ;
02202
02203 /* should now have something of one of the forms
02204 <number> <dircode> : <number> <dircode>
02205 <number> <dircode> - <number> <dircode>
02206 <number> <dircode> : <dircode>
02207 <number> <dircode> - <dircode>
02208
02209 Step 1: get the first <number> */
02210
02211 #ifdef USE_OLD_DCODE
02212 val = strtod( Argv[nopt] , &ptr ) ;
02213 if( val < 0.0 || (val == 0.0 && ptr == Argv[nopt]) )
02214 WarningError("a nonegative number should follow -xFOV/-xSLAB!") ;
02215
02216 xin_bot = val ;
02217
02218 /* Step 2: get the first <dircode> */
02219
02220 acod = toupper( *ptr ) ; dcod1 = ORCODE(acod) ; ptr++ ;
02221 if( dcod1 < 0 )
02222 WarningError("orientation code should follow first dimension in -xFOV/-xSLAB!") ;
02223 #else
02224 { int nused ;
02225 nused = decode_location( Argv[nopt] , &xin_bot , &dcod1 ) ;
02226 if( xin_bot < 0.0 || xin_bot == WAY_BIG )
02227 WarningError("a nonegative number should follow -xFOV/-xSLAB!") ;
02228 if( dcod1 < 0 )
02229 WarningError("1st orientation code illegal after -xFOV/-xSLAB!") ;
02230 ptr = Argv[nopt] + nused ;
02231 }
02232 #endif
02233
02234
02235 /* Step 3: get the separator */
02236
02237 if( *ptr != ':' && *ptr != '-' )
02238 #ifdef USE_OLD_DCODE
02239 WarningError(": or - should follow orientation code in -xFOV/-xSLAB!") ;
02240 #else
02241 WarningError(": or - should follow 1st dimension in -xFOV/-xSLAB!") ;
02242 #endif
02243 ptr++ ;
02244 if( *ptr == '\0' )
02245 WarningError("orientation code or dimension should follow : or - in -xFOV/-xSLAB!") ;
02246
02247 /* Step 4: try to get the second <dircode>. If that fails, then get
02248 the second <number> first, then the second <dircode>.
02249 If the second <dircode> works, however, then the second
02250 <number> is defined to be equal to the first <number>. */
02251
02252 #ifdef USE_OLD_DCODE
02253 acod = toupper( *ptr ) ; dcod2 = ORCODE(acod) ;
02254 if( dcod2 < 0 ){
02255 val = strtod( ptr , &ptr2 ) ;
02256 if( val < 0.0 || (val == 0.0 && ptr2 == ptr) )
02257 WarningError("orientation code or dimension should follow : or - in -xFOV/-xSLAB!") ;
02258 xin_top = val ;
02259 ptr = ptr2 ;
02260 acod = toupper( *ptr ) ; dcod2 = ORCODE(acod) ;
02261 if( dcod2 < 0 )
02262 WarningError("orientation code should follow second dimension in -xFOV/-xSLAB!") ;
02263 } else {
02264 xin_top = xin_bot ;
02265 }
02266 #else
02267 { int nused ;
02268 nused = decode_location( ptr , &xin_top , &dcod2 ) ;
02269 if( dcod2 < 0 )
02270 WarningError("need 2nd orientation code in -xFOV/-xSLAB!") ;
02271 if( xin_top < 0.0 )
02272 WarningError("need nonegative 2nd dimension in -xFOV/-xSLAB!") ;
02273 if( xin_top == WAY_BIG ) xin_top = xin_bot ;
02274 }
02275 #endif
02276
02277 /* Now, check for consistency:
02278 Direction codes should be in the same or opposite directions;
02279 however, must be opposite if the two <number>s are identical.
02280 For example 120A-120A makes no sense,
02281 but 120A-120P is reasonable, and 10A-30A is also reasonable. */
02282
02283 if( xin_top == xin_bot && dcod1 != ORIENT_OPPOSITE(dcod2) )
02284 WarningError("zero thickness slab specified in -xFOV/-xSLAB!") ;
02285
02286 if( dcod1 != dcod2 && dcod1 != ORIENT_OPPOSITE(dcod2) )
02287 WarningError("inconsistent directions given in -xFOV/-xSLAB!") ;
02288
02289 /* If the direction codes are the same, then if the first <number>
02290 is smaller, reverse the first direction code and negate the
02291 first number. For example, 10A:30A becomes -10P:30A, which is
02292 equivalent. If the first number is larger, then reverse the
02293 second code and number. For example, 30A:10A becomes 30A:-10P.
02294 Why do this? Then the first direction code correctly expresses
02295 the sense of the input direction. The sum of numbers becomes
02296 the cross-slab thickness, needed to compute various stuff later. */
02297
02298 if( dcod1 == dcod2 ){
02299 if( xin_bot < xin_top ){
02300 dcod1 = ORIENT_OPPOSITE(dcod1) ;
02301 xin_bot = -xin_bot ;
02302 } else {
02303 dcod2 = ORIENT_OPPOSITE(dcod2) ;
02304 xin_top = -xin_top ;
02305 }
02306 }
02307
02308 /* All is OK, so store the results */
02309
02310 user_inputs.xincode = xincode + dcod1 ;
02311 user_inputs.xin_bot = xin_bot ;
02312 user_inputs.xin_top = xin_top ;
02313
02314 #if 0
02315 printf("decoded %s to give xincode=%d bot=%f top=%f\n",Argv[nopt],
02316 user_inputs.xincode, user_inputs.xin_bot, user_inputs.xin_top ) ;
02317 #endif
02318
02319 nopt++ ; continue ;
02320 }
02321
02322 /*--- -yFOV or -ySLAB ---*/
02323
02324 if( strncmp(Argv[nopt],"-yFOV",5)==0 || strncmp(Argv[nopt],"-ySLAB",5)==0 ||
02325 strncmp(Argv[nopt],"-yfov",5)==0 || strncmp(Argv[nopt],"-yslab",5)==0 ){
02326
02327 float val , yin_bot , yin_top ;
02328 char * ptr , * ptr2 , acod ;
02329 int dcod1 , dcod2 , yincode ;
02330
02331 yincode = ( strncmp(Argv[nopt],"-yFOV",5)==0 ||
02332 strncmp(Argv[nopt],"-yfov",5)==0 ) ? INCODE_FOV : INCODE_SLAB ;
02333
02334 if( ++nopt >= Argc ) WarningError("need an argument after -yFOV/-ySLAB!") ;
02335
02336 /* should now have something of one of the forms
02337 <number> <dircode> : <number> <dircode>
02338 <number> <dircode> - <number> <dircode>
02339 <number> <dircode> : <dircode>
02340 <number> <dircode> - <dircode>
02341
02342 Step 1: get the first <number> */
02343
02344 #ifdef USE_OLD_DCODE
02345 val = strtod( Argv[nopt] , &ptr ) ;
02346 if( val < 0.0 || (val == 0.0 && ptr == Argv[nopt]) )
02347 WarningError("a nonegative number should follow -yFOV/-ySLAB!") ;
02348
02349 yin_bot = val ;
02350
02351 /* Step 2: get the first <dircode> */
02352
02353 acod = toupper( *ptr ) ; dcod1 = ORCODE(acod) ; ptr++ ;
02354 if( dcod1 < 0 )
02355 WarningError("orientation code should follow first dimension in -yFOV/-ySLAB!") ;
02356 #else
02357 { int nused ;
02358 nused = decode_location( Argv[nopt] , &yin_bot , &dcod1 ) ;
02359 if( yin_bot < 0.0 || yin_bot == WAY_BIG )
02360 WarningError("a nonegative number should follow -yFOV/-ySLAB!") ;
02361 if( dcod1 < 0 )
02362 WarningError("1st orientation code illegal after -yFOV/-ySLAB!") ;
02363 ptr = Argv[nopt] + nused ;
02364 }
02365 #endif
02366
02367 /* Step 3: get the separator */
02368
02369 if( *ptr != ':' && *ptr != '-' )
02370 #ifdef USE_OLD_DCODE
02371 WarningError(": or - should follow orientation code in -yFOV/-ySLAB!") ;
02372 #else
02373 WarningError(": or - should follow 1st dimension in -yFOV/-ySLAB!") ;
02374 #endif
02375
02376 ptr++ ;
02377 if( *ptr == '\0' )
02378 WarningError("orientation code or dimension should follow : or - in -yFOV/-ySLAB!") ;
02379
02380 /* Step 4: try to get the second <dircode>. If that fails, then get
02381 the second <number> first, then the second <dircode>.
02382 If the second <dircode> works, however, then the second
02383 <number> is defined to be equal to the first <number>. */
02384
02385 #ifdef USE_OLD_DCODE
02386 acod = toupper( *ptr ) ; dcod2 = ORCODE(acod) ;
02387 if( dcod2 < 0 ){
02388 val = strtod( ptr , &ptr2 ) ;
02389 if( val < 0.0 || (val == 0.0 && ptr2 == ptr) )
02390 WarningError("orientation code or dimension should follow : or - in -yFOV/-ySLAB!") ;
02391 yin_top = val ;
02392 ptr = ptr2 ;
02393 acod = toupper( *ptr ) ; dcod2 = ORCODE(acod) ;
02394 if( dcod2 < 0 )
02395 WarningError("orientation code should follow second dimension in -yFOV/-ySLAB!") ;
02396 } else {
02397 yin_top = yin_bot ;
02398 }
02399 #else
02400 { int nused ;
02401 nused = decode_location( ptr , &yin_top , &dcod2 ) ;
02402 if( dcod2 < 0 )
02403 WarningError("need 2nd orientation code in -yFOV/-ySLAB!") ;
02404 if( yin_top < 0.0 )
02405 WarningError("need nonegative 2nd dimension in -yFOV/-ySLAB!") ;
02406 if( yin_top == WAY_BIG ) yin_top = yin_bot ;
02407 }
02408 #endif
02409
02410 /* Now, check for consistency:
02411 Direction codes should be in the same or opposite directions;
02412 however, must be opposite if the two <number>s are identical.
02413 For example 120A-120A makes no sense,
02414 but 120A-120P is reasonable, and 10A-30A is also reasonable. */
02415
02416 if( yin_top == yin_bot && dcod1 != ORIENT_OPPOSITE(dcod2) )
02417 WarningError("zero thickness slab specified in -yFOV/-ySLAB!") ;
02418
02419 if( dcod1 != dcod2 && dcod1 != ORIENT_OPPOSITE(dcod2) )
02420 WarningError("inconsistent directions given in -yFOV/-ySLAB!") ;
02421
02422 /* If the direction codes are the same, then if the first <number>
02423 is smaller, reverse the first direction code and negate the
02424 first number. For example, 10A:30A becomes -10P:30A, which is
02425 equivalent. If the first number is larger, then reverse the
02426 second code and number. For example, 30A:10A becomes 30A:-10P.
02427 Why do this? Then the first direction code correctly expresses
02428 the sense of the input direction. The sum of numbers becomes
02429 the cross-slab thickness, needed to compute various stuff later. */
02430
02431 if( dcod1 == dcod2 ){
02432 if( yin_bot < yin_top ){
02433 dcod1 = ORIENT_OPPOSITE(dcod1) ;
02434 yin_bot = -yin_bot ;
02435 } else {
02436 dcod2 = ORIENT_OPPOSITE(dcod2) ;
02437 yin_top = -yin_top ;
02438 }
02439 }
02440
02441 /* All is OK, so store the results */
02442
02443 user_inputs.yincode = yincode + dcod1 ;
02444 user_inputs.yin_bot = yin_bot ;
02445 user_inputs.yin_top = yin_top ;
02446
02447 #if 0
02448 printf("decoded %s to give yincode=%d bot=%f top=%f\n",Argv[nopt],
02449 user_inputs.yincode, user_inputs.yin_bot, user_inputs.yin_top ) ;
02450 #endif
02451
02452 nopt++ ; continue ;
02453 }
02454
02455 /*--- -zFOV or -zSLAB ---*/
02456
02457 if( strncmp(Argv[nopt],"-zFOV",5)==0 || strncmp(Argv[nopt],"-zSLAB",5)==0 ||
02458 strncmp(Argv[nopt],"-zfov",5)==0 || strncmp(Argv[nopt],"-zslab",5)==0 ){
02459
02460 float val , zin_bot , zin_top ;
02461 char * ptr , * ptr2 , acod ;
02462 int dcod1 , dcod2 , zincode ;
02463
02464 zincode = ( strncmp(Argv[nopt],"-zFOV",5)==0 ||
02465 strncmp(Argv[nopt],"-zfov",5)==0 ) ? INCODE_FOV : INCODE_SLAB ;
02466
02467 if( ++nopt >= Argc ) WarningError("need an argument after -zFOV/-zSLAB!") ;
02468
02469 /* should now have something of one of the forms
02470 <number> <dircode> : <number> <dircode>
02471 <number> <dircode> - <number> <dircode>
02472 <number> <dircode> : <dircode>
02473 <number> <dircode> - <dircode>
02474
02475 Step 1: get the first <number> */
02476
02477 #ifdef USE_OLD_DCODE
02478 val = strtod( Argv[nopt] , &ptr ) ;
02479 if( val < 0.0 || (val == 0.0 && ptr == Argv[nopt]) )
02480 WarningError("a nonegative number should follow -zFOV/-zSLAB!") ;
02481
02482 zin_bot = val ;
02483
02484 /* Step 2: get the first <dircode> */
02485
02486 acod = toupper( *ptr ) ; dcod1 = ORCODE(acod) ; ptr++ ;
02487 if( dcod1 < 0 )
02488 WarningError("orientation code should follow first dimension in -zFOV/-zSLAB!") ;
02489 #else
02490 { int nused ;
02491 nused = decode_location( Argv[nopt] , &zin_bot , &dcod1 ) ;
02492 if( zin_bot < 0.0 || zin_bot == WAY_BIG )
02493 WarningError("a nonegative number should follow -yFOV/-ySLAB!") ;
02494 if( dcod1 < 0 )
02495 WarningError("1st orientation code illegal after -yFOV/-ySLAB!") ;
02496 ptr = Argv[nopt] + nused ;
02497 }
02498 #endif
02499
02500 /* Step 3: get the separator */
02501
02502 if( *ptr != ':' && *ptr != '-' )
02503 #ifdef USE_OLD_DCODE
02504 WarningError(": or - should follow orientation code in -zFOV/-zSLAB!") ;
02505 #else
02506 WarningError(": or - should follow 1st dimension in -zFOV/-zSLAB!") ;
02507 #endif
02508
02509 ptr++ ;
02510 if( *ptr == '\0' )
02511 WarningError("orientation code or dimension should follow : or - in -zFOV/-zSLAB!") ;
02512
02513 /* Step 4: try to get the second <dircode>. If that fails, then get
02514 the second <number> first, then the second <dircode>.
02515 If the second <dircode> works, however, then the second
02516 <number> is defined to be equal to the first <number>. */
02517
02518 #ifdef USE_OLD_DCODE
02519 acod = toupper( *ptr ) ; dcod2 = ORCODE(acod) ;
02520 if( dcod2 < 0 ){
02521 val = strtod( ptr , &ptr2 ) ;
02522 if( val < 0.0 || (val == 0.0 && ptr2 == ptr) )
02523 WarningError("orientation code or dimension should follow : or - in -zFOV/-zSLAB!") ;
02524 zin_top = val ;
02525 ptr = ptr2 ;
02526 acod = toupper( *ptr ) ; dcod2 = ORCODE(acod) ;
02527 if( dcod2 < 0 )
02528 WarningError("orientation code should follow second dimension in -zFOV/-zSLAB!") ;
02529 } else {
02530 zin_top = zin_bot ;
02531 }
02532 #else
02533 { int nused ;
02534 nused = decode_location( ptr , &zin_top , &dcod2 ) ;
02535 if( dcod2 < 0 )
02536 WarningError("need 2nd orientation code in -zFOV/-zSLAB!") ;
02537 if( zin_top < 0.0 )
02538 WarningError("need nonegative 2nd dimension in -zFOV/-zSLAB!") ;
02539 if( zin_top == WAY_BIG ) zin_top = zin_bot ;
02540 }
02541 #endif
02542
02543 /* Now, check for consistency:
02544 Direction codes should be in the same or opposite directions;
02545 however, must be opposite if the two <number>s are identical.
02546 For example 120A-120A makes no sense,
02547 but 120A-120P is reasonable, and 10A-30A is also reasonable. */
02548
02549 if( zin_top == zin_bot && dcod1 != ORIENT_OPPOSITE(dcod2) )
02550 WarningError("zero thickness slab specified in -zFOV/-zSLAB!") ;
02551
02552 if( dcod1 != dcod2 && dcod1 != ORIENT_OPPOSITE(dcod2) )
02553 WarningError("inconsistent directions given in -zFOV/-zSLAB!") ;
02554
02555 /* If the direction codes are the same, then if the first <number>
02556 is smaller, reverse the first direction code and negate the
02557 first number. For example, 10A:30A becomes -10P:30A, which is
02558 equivalent. If the first number is larger, then reverse the
02559 second code and number. For example, 30A:10A becomes 30A:-10P.
02560 Why do this? Then the first direction code correctly expresses
02561 the sense of the input direction. The sum of numbers becomes
02562 the cross-slab thickness, needed to compute various stuff later. */
02563
02564 if( dcod1 == dcod2 ){
02565 if( zin_bot < zin_top ){
02566 dcod1 = ORIENT_OPPOSITE(dcod1) ;
02567 zin_bot = -zin_bot ;
02568 } else {
02569 dcod2 = ORIENT_OPPOSITE(dcod2) ;
02570 zin_top = -zin_top ;
02571 }
02572 }
02573
02574 /* All is OK, so store the results */
02575
02576 user_inputs.zincode = zincode + dcod1 ;
02577 user_inputs.zin_bot = zin_bot ;
02578 user_inputs.zin_top = zin_top ;
02579
02580 #if 0
02581 printf("decoded %s to give zincode=%d bot=%f top=%f\n",Argv[nopt],
02582 user_inputs.zincode, user_inputs.zin_bot, user_inputs.zin_top ) ;
02583 #endif
02584
02585 nopt++ ; continue ;
02586 }
02587
02588 /*---- -statpar x x x ----*/
02589
02590 if( strncmp(Argv[nopt],"-statpar",5) == 0 ){
02591 float val ;
02592 char * ptr ;
02593
02594 if( ++nopt >= Argc ) FatalError("need an argument after -statpar!") ;
02595
02596 ii = 0 ;
02597 do{
02598 val = strtod( Argv[nopt] , &ptr ) ;
02599 if( *ptr != '\0' ) break ;
02600 user_inputs.stat_aux[ii++] = val ;
02601 nopt++ ;
02602 } while( nopt < Argc ) ;
02603
02604 if( ii == 0 )
02605 WarningError("No numbers given after -statpar?") ;
02606 continue ;
02607 }
02608
02609 /***** 21 Oct 1996: options for time units *****/
02610
02611 if( strcmp(Argv[nopt],"-t=ms")==0 || strcmp(Argv[nopt],"-t=msec")==0 ){
02612 user_inputs.tunits = UNITS_MSEC_TYPE ;
02613 nopt++ ; continue ;
02614 }
02615
02616 if( strcmp(Argv[nopt],"-t=s")==0 || strcmp(Argv[nopt],"-t=sec")==0 ){
02617 user_inputs.tunits = UNITS_SEC_TYPE ;
02618 nopt++ ; continue ;
02619 }
02620
02621 if( strcmp(Argv[nopt],"-t=Hz")==0 || strcmp(Argv[nopt],"-t=Hertz")==0 ){
02622 user_inputs.tunits = UNITS_HZ_TYPE ;
02623 nopt++ ; continue ;
02624 }
02625
02626 /**** 23 Feb 2005: -Torg option ****/
02627
02628 if( strncmp(Argv[nopt],"-Torg",5) == 0 ){
02629 if( nopt+1 >= Argc ) FatalError("need 1 argument after -Torg") ;
02630 user_inputs.Torg = strtod( Argv[++nopt] , NULL ) ;
02631 nopt++ ; continue ;
02632 }
02633
02634 /************* Aprille 1996: New options for specifying time ***********/
02635
02636 if( strncmp(Argv[nopt],"-time:zt",8)==0 || strncmp(Argv[nopt],"-time:tz",8)==0 ){
02637 int t_then_z , ntt , nzz , nerr ;
02638 float TR , tframe , tsl ;
02639 char *tpattern , *eptr ;
02640
02641 if( nopt+4 >= Argc ) FatalError("need 4 arguments after -time: options") ;
02642
02643 t_then_z = ( strncmp(Argv[nopt],"-time:tz",8)==0 ) ;
02644
02645 ntt = strtol( Argv[++nopt] , NULL , 10 ) ;
02646 nzz = strtol( Argv[++nopt] , NULL , 10 ) ;
02647 if( ! t_then_z ){ ii = ntt ; ntt = nzz ; nzz = ii ; }
02648
02649 TR = strtod( Argv[++nopt] , &eptr ) ;
02650 tpattern = Argv[++nopt] ;
02651
02652 /** 03 Nov 1996: allow units to be written after TR **/
02653
02654 if( strcmp(eptr,"ms")==0 || strcmp(eptr,"msec")==0 ){
02655 user_inputs.tunits = UNITS_MSEC_TYPE ;
02656 } else if( strcmp(eptr,"s")==0 || strcmp(eptr,"sec")==0 ){
02657 user_inputs.tunits = UNITS_SEC_TYPE ;
02658 } else if( strcmp(eptr,"Hz")==0 || strcmp(eptr,"Hertz")==0 ){
02659 user_inputs.tunits = UNITS_HZ_TYPE ;
02660 }
02661
02662 /** 31 July 1996: be more specific about errors **/
02663
02664 nerr = 0 ;
02665 if( ntt < 2 ){
02666 fprintf(stderr,"Illegal value of nt after -time: option\n") ; nerr++ ;
02667 }
02668 if( nzz < NZBOT ){
02669 fprintf(stderr,"Illegal value of nz after -time: option\n") ; nerr++ ;
02670 }
02671 if( TR < 0.0 ){
02672 fprintf(stderr,"Illegal value of TR after -time: option\n") ; nerr++ ;
02673 }
02674 if( nerr > 0 ){
02675 nopt++ ; continue ; /* skip on to next option, this one is bad! */
02676 }
02677
02678 user_inputs.tpattern = (float *) malloc( sizeof(float) * nzz ) ;
02679 for( ii=0 ; ii < nzz ; ii++ ) user_inputs.tpattern[ii] = 0.0 ;
02680
02681 user_inputs.ntt = ntt ;
02682 user_inputs.nzz = nzz ;
02683 user_inputs.t_then_z = t_then_z ;
02684 user_inputs.TR = TR ;
02685
02686 if( TR == 0.0 ){ TR = 1.0; user_inputs.tunits = UNITS_SEC_TYPE; }
02687
02688 tframe = TR / nzz ; /* time per slice */
02689
02690 if( nzz > 1 && tpattern[0] == '@' ){
02691 FILE * fp ;
02692
02693 /*--- read pattern file (ignore EOFs!) ---*/
02694
02695 fp = fopen( tpattern+1 , "r" ) ;
02696 if( fp == NULL ){
02697 fprintf(stderr,"Cannot open tpattern file %s\n",tpattern+1) ;
02698 } else {
02699 for( ii=0 ; ii < nzz ; ii++ )
02700 fscanf( fp , "%f" , user_inputs.tpattern + ii ) ;
02701 fclose( fp ) ;
02702 }
02703 } else if( nzz > 1 &&
02704 (strcmp(tpattern,"alt+z")==0 || strcmp(tpattern,"altplus")==0) ){
02705
02706 /*--- set up alternating in the +z direction ---*/
02707
02708 tsl = 0.0 ;
02709 for( ii=0 ; ii < nzz ; ii+=2 ){
02710 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02711 }
02712 for( ii=1 ; ii < nzz ; ii+=2 ){
02713 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02714 }
02715 } else if( nzz > 1 && strcmp(tpattern,"alt+z2")==0 ){ /* 22 Feb 2005 */
02716
02717 /*--- set up alternating in the +z direction ---*/
02718
02719 tsl = 0.0 ;
02720 for( ii=1 ; ii < nzz ; ii+=2 ){
02721 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02722 }
02723 for( ii=0 ; ii < nzz ; ii+=2 ){
02724 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02725 }
02726 } else if( nzz > 1 &&
02727 (strcmp(tpattern,"alt-z")==0 || strcmp(tpattern,"altminus")==0) ){
02728
02729 /*--- set up alternating in the -z direction ---*/
02730
02731 tsl = 0.0 ;
02732 for( ii=nzz-1 ; ii >=0 ; ii-=2 ){
02733 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02734 }
02735 for( ii=nzz-2 ; ii >=0 ; ii-=2 ){
02736 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02737 }
02738 } else if( nzz > 1 && strcmp(tpattern,"alt-z2")==0 ){ /* 22 Feb 2005 */
02739
02740 /*--- set up alternating in the -z direction ---*/
02741
02742 tsl = 0.0 ;
02743 for( ii=nzz-2 ; ii >=0 ; ii-=2 ){
02744 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02745 }
02746 for( ii=nzz-1 ; ii >=0 ; ii-=2 ){
02747 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02748 }
02749 } else if( nzz > 1 &&
02750 (strcmp(tpattern,"seq+z")==0 || strcmp(tpattern,"seqplus")==0) ){
02751
02752 /*--- set up sequential in the +z direction ---*/
02753
02754 tsl = 0.0 ;
02755 for( ii=0 ; ii < nzz ; ii++ ){
02756 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02757 }
02758 } else if( nzz > 1 &&
02759 (strcmp(tpattern,"seq-z")==0 || strcmp(tpattern,"seqminus")==0) ){
02760
02761 /*--- set up sequential in the -z direction ---*/
02762
02763 tsl = 0.0 ;
02764 for( ii=nzz-1 ; ii >=0 ; ii-- ){
02765 user_inputs.tpattern[ii] = tsl ; tsl += tframe ;
02766 }
02767 } else if( nzz == 1 ||
02768 (strcmp(tpattern,"zero")==0 || strcmp(tpattern,"simult")==0) ){
02769
02770 /*--- delete the tpattern ---*/
02771
02772 free(user_inputs.tpattern) ;
02773 user_inputs.tpattern = NULL ;
02774
02775 } else {
02776 fprintf(stderr,"Unknown tpattern = %s\n",tpattern) ;
02777 }
02778
02779 nopt++ ; continue ;
02780 }
02781
02782 /********** non-dataset arguments ************/
02783
02784 /*----- -gamma # option -----*/
02785
02786 if( strncmp(Argv[nopt],"-gamma",4) == 0 ){
02787 float val ;
02788 if( nopt+1 >= Argc ) FatalError("need an argument after -gamma!");
02789
02790 val = strtod( Argv[++nopt] , NULL ) ;
02791 if( val > 0 ) argopt.gamma = val ;
02792 else fprintf(stderr,
02793 "\n*** warning: -gamma value %s illegal\n", Argv[nopt]);
02794
02795 nopt++ ; continue ; /* go to next arg */
02796 }
02797
02798 /*----- -gsfac value option -----*/
02799
02800 if( strncmp(Argv[nopt],"-gsfac",4) == 0 ){
02801 float val ;
02802 if( nopt+1 >= Argc ) FatalError("need an argument after -gsfac!");
02803
02804 val = strtod( Argv[++nopt] , NULL ) ;
02805 if( val != 0.0 ) argopt.gsfac = val ;
02806 else fprintf(stderr,
02807 "\n*** warning: -gsfac value %s illegal\n", Argv[nopt]);
02808
02809 nopt++ ; continue ; /* go to next arg */
02810 }
02811
02812 /*----- -datum type option -----*/
02813
02814 if( strncmp(Argv[nopt],"-datum",6) == 0 ){
02815 if( ++nopt >= Argc ) FatalError("need an argument after -datum!") ;
02816
02817 if( strcmp(Argv[nopt],"short") == 0 ){
02818 argopt.datum_all = MRI_short ;
02819 } else if( strcmp(Argv[nopt],"float") == 0 ){
02820 argopt.datum_all = MRI_float ;
02821 } else if( strcmp(Argv[nopt],"complex") == 0 ){
02822 argopt.datum_all = MRI_complex ;
02823 } else if( strcmp(Argv[nopt],"byte") == 0 ){
02824 argopt.datum_all = MRI_byte ;
02825 } else if( strcmp(Argv[nopt],"rgb") == 0 ){
02826 argopt.datum_all = MRI_rgb ;
02827 } else {
02828 char buf[256] ;
02829 sprintf(buf,"-datum of type '%s' is not supported in AFNI!",
02830 Argv[nopt] ) ;
02831 FatalError(buf) ;
02832 }
02833
02834 nopt++ ; continue ; /* go to next arg */
02835 }
02836
02837 /*----- -ncolor # option -----*/
02838
02839 if( strncmp(Argv[nopt],"-ncolor",4) == 0 ){
02840 float val ;
02841 if( nopt+1 >= Argc ) FatalError("need an argument after -ncolor!");
02842
02843 val = strtod( Argv[++nopt] , NULL ) ;
02844 if( val > 4 ) argopt.ncolor = val ;
02845 else fprintf(stderr,
02846 "\n*** warning: -ncolor value %s illegal\n", Argv[nopt]);
02847
02848 nopt++ ; continue ; /* go to next arg */
02849 }
02850
02851 /*----- -xtwarns option -----*/
02852
02853 if( strncmp(Argv[nopt],"-xtwarns",6) == 0 ){
02854 argopt.xtwarns = True ;
02855 nopt++ ; continue ; /* go to next arg */
02856 }
02857
02858 /*----- -2swap and -4swap options -----*/
02859
02860 if( strncmp(Argv[nopt],"-2swap",4) == 0 ){
02861 argopt.swap_two = 1 ;
02862 nopt++ ; continue ; /* go to next arg */
02863 }
02864
02865 if( strncmp(Argv[nopt],"-4swap",4) == 0 ){
02866 argopt.swap_four = 1 ;
02867 nopt++ ; continue ; /* go to next arg */
02868 }
02869
02870 if( strncmp(Argv[nopt],"-8swap",4) == 0 ){ /* 06 Feb 2003 */
02871 argopt.swap_eight = 1 ;
02872 nopt++ ; continue ; /* go to next arg */
02873 }
02874
02875 /*----- -nofloatscan -----*/
02876
02877 if( strncmp(Argv[nopt],"-nofloatscan",6) == 0 ){
02878 argopt.nofloatscan = 1 ;
02879 nopt++ ; continue ; /* go to next arg */
02880 }
02881
02882 /*--- illegal option ---*/
02883
02884 printf("*** ILLEGAL OPTION: %s\n\n",Argv[nopt]) ;
02885 FatalError("cannot continue") ;
02886
02887 }
02888
02889 if( user_inputs.ntt > 1 && !af_type_set ){
02890 user_inputs.anatomy_type = ANAT_EPI_TYPE ; /* 20 Dec 2001 */
02891 }
02892
02893 First_Image_Arg = nopt ;
02894
02895 /* 14 Sep 1999: manufacture a command line for History,
02896 but with (possibly) fewer image inputs */
02897
02898 { int nim=Argc-First_Image_Arg , ii ;
02899 char ** qargv ;
02900
02901 if( nim < 9 ){ /* 8 or fewer images ==> copy them all */
02902
02903 qargv = Argv ;
02904
02905 } else { /* im0 im1 im2 ... im<last-1> im<last> */
02906
02907 qargv = (char **) malloc( sizeof(char *) * Argc ) ; /* copy all */
02908 for( ii=0 ; ii < Argc ; ii++ ) qargv[ii] = Argv[ii] ; /* argv's */
02909
02910 qargv[First_Image_Arg+3] = "..." ; /* notice of omission */
02911
02912 for( ii=First_Image_Arg+4 ; ii < Argc-2 ; ii++ ) /* these will */
02913 qargv[ii] = NULL ; /* be omitted */
02914 }
02915
02916 commandline = tross_commandline( "to3d" , Argc , qargv ) ;
02917 AFNI_log_string(commandline) ; /* 14 Aug 2001 */
02918
02919 if( qargv != Argv ) free(qargv) ;
02920 }
02921
02922 EXRETURN ;
02923 }
|
|
||||||||||||||||
|
--- fix dimensions if user input axes stuff ---* Definition at line 4543 of file to3d.c. References THD_string_array::ar, client_data, to3d_widget_set::dc, drive_MCW_imseq(), ISQ_REALZ, isqDR_display, isqDR_getimnr, isqDR_opacitybut, isqDR_penbbox, isqDR_realize, isqDR_record_disable, isqDR_title, isqDR_winfosides, isqDR_zoombut, MCW_invert_widget(), NORMAL_cursorize, open_MCW_imseq(), to3d_widget_set::open_view_pb, RESET_QUIT, to3d_widget_set::seq, T3D_getim(), THD_3dim_dataset_to_brick(), to3d_widget_set::topshell, MCW_imseq::wimage, MCW_imseq::wtop, to3d_data::xsize, THD_dataxes::xxdel, to3d_data::ysize, THD_dataxes::yydel, to3d_data::zsize, to3d_data::zspacing, and THD_dataxes::zzdel. Referenced by T3D_create_widgets().
04545 {
04546 FD_brick * br ;
04547 char * title = "to3d" ;
04548 int nim ;
04549
04550 if( wset.seq != NULL ){
04551 if( ISQ_REALZ(wset.seq) )
04552 XMapRaised( XtDisplay(wset.topshell) , XtWindow(wset.seq->wtop) ) ;
04553 else
04554 XBell( XtDisplay(wset.topshell) , 100 ) ; /* should never happen */
04555 return ;
04556 }
04557
04558 daxes->xxdel = user_inputs.xsize ; /* these are here to make */
04559 daxes->yydel = user_inputs.ysize ; /* the aspect ratio work */
04560 #ifdef ALLOW_NONCONTIG
04561 daxes->zzdel = user_inputs.zspacing ;
04562 #else
04563 daxes->zzdel = user_inputs.zsize ;
04564 #endif
04565
04566 br = THD_3dim_dataset_to_brick( dset , 1,2,3 ) ;
04567
04568 if( br == NULL ){
04569 XBell( XtDisplay(wset.topshell) , 100 ) ;
04570 fprintf(stderr,"\n*** bad data in THD_3dim_dataset_to_brick!\n");
04571 return ;
04572 }
04573
04574 wset.seq = open_MCW_imseq( wset.dc , T3D_getim , br ) ;
04575 drive_MCW_imseq( wset.seq,isqDR_realize , NULL ) ;
04576 NORMAL_cursorize( wset.seq->wimage ) ; /* 07 Dec 2001 */
04577
04578 drive_MCW_imseq(wset.seq,isqDR_getimnr, (XtPointer) &nim ) ;
04579 drive_MCW_imseq(wset.seq,isqDR_title , (XtPointer) imnames->ar[nim] ) ;
04580
04581 drive_MCW_imseq(wset.seq,isqDR_opacitybut ,(XtPointer)0); /* 07 Mar 2001 */
04582 drive_MCW_imseq(wset.seq,isqDR_record_disable,(XtPointer)0); /* 24 Apr 2001 */
04583 drive_MCW_imseq(wset.seq,isqDR_zoombut ,(XtPointer)0); /* 12 Mar 2002 */
04584 drive_MCW_imseq(wset.seq,isqDR_penbbox ,(XtPointer)0); /* 12 Mar 2002 */
04585
04586 /* 01 Dec 1999: add "sides" markers for image viewer */
04587
04588 { static char * ws[4] = { "-x" , "-y" , "+x" , "+y" } ;
04589 drive_MCW_imseq( wset.seq, isqDR_winfosides, (XtPointer)ws ) ;
04590 }
04591
04592 drive_MCW_imseq( wset.seq , isqDR_display , (XtPointer)-1 ) ;
04593
04594 MCW_invert_widget( wset.open_view_pb ) ;
04595
04596 RESET_QUIT ;
04597 }
|
|
||||||||||||
|
||||||||||||
|
Definition at line 3707 of file to3d.c. References MCW_arrowval::fval, RESET_QUIT, to3d_widget_set::topshell, to3d_data::xorigin, to3d_widget_set::xorigin_av, to3d_data::yorigin, to3d_widget_set::yorigin_av, to3d_data::zorigin, and to3d_widget_set::zorigin_av. Referenced by T3D_create_widgets().
03708 {
03709 float size = av->fval ;
03710
03711 if( av == wset.xorigin_av ){
03712 user_inputs.xorigin = size ;
03713 } else if( av == wset.yorigin_av ){
03714 user_inputs.yorigin = size ;
03715 } else if( av == wset.zorigin_av ){
03716 user_inputs.zorigin = size ;
03717 } else {
03718 XBell( XtDisplay(wset.topshell) , 100 ) ;
03719 fprintf(stderr,"\n*** illegal call to T3D_origin_av_CB!\n") ;
03720 }
03721 RESET_QUIT ;
03722 }
|
|
||||||||||||||||||||
|
Definition at line 5319 of file to3d.c. References client_data, and ev. Referenced by T3D_create_widgets().
05321 {
05322 XLeaveWindowEvent * lev = (XLeaveWindowEvent *) ev ;
05323 XmAnyCallbackStruct cbs ;
05324
05325 if( lev->type != LeaveNotify || w == NULL ) return ;
05326
05327 cbs.reason = XmCR_ACTIVATE ; /* simulate a return press */
05328 cbs.event = ev ;
05329 XtCallCallbacks( w , XmNactivateCallback , &cbs ) ;
05330 }
|
|
||||||||||||
|
Definition at line 5288 of file to3d.c. References to3d_widget_set::action_frame, ENTRY, to3d_widget_set::good, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, to3d_widget_set::topshell, and XtRealloc. Referenced by T3D_anatomy_parent_CB(), T3D_check_data(), T3D_geometry_parent_CB(), T3D_save_file_CB(), and T3D_type_av_CB().
05289 {
05290 static char * total_msg = NULL ;
05291 static int len_total = 0 ;
05292 int len_needed ;
05293
05294 ENTRY("T3D_poperr") ;
05295
05296 len_needed = strlen(prefix_msg) + strlen(msg) + 2 ;
05297 if( len_needed > len_total ){
05298 total_msg = (char*)XtRealloc( total_msg , len_needed ) ;
05299 len_total = len_needed ;
05300 }
05301 strcpy( total_msg , prefix_msg ) ;
05302 strcat( total_msg , msg ) ;
05303
05304 if( wset.topshell != NULL && wset.good ){
05305 (void) MCW_popup_message( wset.action_frame,
05306 total_msg, MCW_USER_KILL | MCW_TIMER_KILL ) ;
05307 XFlush( XtDisplay(wset.topshell) ) ;
05308 sleep(1) ;
05309 } else {
05310 fprintf(stderr,"%s\n",total_msg) ;
05311 }
05312 EXRETURN ;
05313 }
|
|
||||||||||||||||
|
Definition at line 3592 of file to3d.c. References AFNI_speak(), client_data, ENTRY, MCW_set_widget_label(), and T3D_quit_timeout_CB(). Referenced by T3D_create_widgets().
03594 {
03595 static Boolean first = True ;
03596 static Widget wquit = NULL ;
03597
03598 ENTRY("T3D_quit_CB") ;
03599
03600 if( wcall == NULL ){
03601 if( wquit == NULL ) return ;
03602 MCW_set_widget_label( wquit , "quit" ) ;
03603 first = True ;
03604 EXRETURN ;
03605 }
03606
03607 if( first ){
03608 if( wquit == NULL ) wquit = wcall ;
03609 first = False ;
03610 MCW_set_widget_label( wquit , "QUIT" ) ;
03611
03612 (void) XtAppAddTimeOut( XtWidgetToApplicationContext(wcall) ,
03613 5000 , T3D_quit_timeout_CB , NULL ) ;
03614
03615 EXRETURN ;
03616 }
03617 AFNI_speak("Done",0) ;
03618 exit(0) ;
03619 }
|
|
|
Definition at line 3859 of file to3d.c. References ADDTO_SARR, to3d_data::anatomy_type, Argc, argopt, Argv, THD_datablock::atr, THD_datablock::brick, THD_datablock::brick_bytes, THD_datablock::brick_fac, THD_diskptr::brick_name, THD_diskptr::byte_order, CLEAR_MRILIB_globals, commandline, DATABLOCK_MEM_MALLOC, DATABLOCK_TYPE, to3d_data::dataset_type, DATAXES_TYPE, THD_3dim_dataset::daxes, THD_3dim_dataset::dblk, DBLK_BRICK, dbrick, THD_3dim_dataset::death_mark, THD_diskptr::dimsizes, THD_diskptr::directory_name, THD_datablock::diskptr, DISKPTR_TYPE, MRI_IMAGE::dw, MRI_IMAGE::dx, MRI_IMAGE::dy, MRI_IMAGE::dz, EMPTY_STRING, ENTRY, FatalError, THD_diskptr::filecode, First_Image_Arg, MRI_IMAGE::fname, to3d_data::fov, FREE_IMARR, THD_3dim_dataset::func_type, to3d_data::function_type, geometry_loaded, THD_diskptr::header_name, complex::i, MRI_IMARR::imarr, imdx, imdy, imdz, INCODE_FOV, INCODE_SLAB, INIT_KILL, INIT_SARR, ISANAT, ISFUNCTYPE, KILL_1MRI, MRI_IMAGE::kind, THD_datablock::kl, THD_3dim_dataset::kl, LAST_ORIENT_TYPE, THD_datablock::malloc_type, THD_3dim_dataset::markers, THD_datablock::master_bytes, THD_datablock::master_ival, THD_datablock::master_nvals, MAX, MCW_file_expand(), MCW_free_expand(), MCW_warn_expand(), MIN, MRI_COMPLEX_PTR, mri_data_pointer(), mri_datum_size(), mri_fix_data_pointer(), MRI_FLOAT_PTR, mri_imcount(), mri_max(), mri_min(), mri_read_file(), mri_read_file_delay(), MRI_SHORT_PTR, mri_to_byte_scl(), mri_to_complex(), mri_to_float(), mri_to_rgb(), mri_to_short(), mri_to_short_scl(), myXtNew, THD_datablock::natr, THD_datablock::natr_alloc, negative_shorts, nfloat_err, to3d_data::nimage, to3d_data::ntt, MRI_IMARR::num, to3d_data::nvals, THD_datablock::nvals, THD_diskptr::nvals, MRI_IMAGE::nvox, nvox_total, to3d_data::nx, MRI_IMAGE::nx, THD_dataxes::nxx, to3d_data::ny, MRI_IMAGE::ny, THD_dataxes::nyy, to3d_data::nz, nz, NZBOT, THD_dataxes::nzz, to3d_data::nzz, MRI_IMAGE::pixel_size, THD_diskptr::prefix, complex::r, THD_diskptr::rank, THD_3dim_dataset::stats, STORAGE_BY_BRICK, THD_diskptr::storage_mode, swap_eightbytes(), swap_fourbytes(), swap_twobytes(), to3d_data::t_then_z, THD_3dim_dataset::tagset, THD_3dim_dataset::taxis, THD_3dim_dataset::tcat_len, THD_3dim_dataset::tcat_list, THD_3dim_dataset::tcat_num, thd_complexscan(), thd_floatscan(), THD_get_write_order(), THD_init_datablock_brick(), THD_MAX_NAME, THD_null_datablock_auxdata, tross_Append_History(), THD_3dim_dataset::type, THD_dataxes::type, THD_datablock::type, THD_diskptr::type, to3d_data::view_type, THD_3dim_dataset::view_type, THD_diskptr::viewcode, MRI_IMAGE::was_swapped, THD_3dim_dataset::wod_daxes, THD_3dim_dataset::wod_flag, XCENTERED, to3d_data::xin_bot, to3d_data::xin_top, to3d_data::xincode, to3d_data::xorient, to3d_data::xorigin, to3d_data::xsize, XtMalloc, THD_dataxes::xxdel, THD_dataxes::xxorg, THD_dataxes::xxorient, to3d_data::xyz_centered, YCENTERED, to3d_data::yin_bot, to3d_data::yin_top, to3d_data::yincode, to3d_data::yorient, to3d_data::yorigin, to3d_data::ysize, THD_dataxes::yydel, THD_dataxes::yyorg, THD_dataxes::yyorient, ZCENTERED, ZERO_STAT_AUX, to3d_data::zin_bot, to3d_data::zin_top, to3d_data::zincode, to3d_data::zorient, to3d_data::zorigin, to3d_data::zsize, to3d_data::zspacing, THD_dataxes::zzdel, THD_dataxes::zzorg, and THD_dataxes::zzorient. Referenced by main().
03860 {
03861 MRI_IMAGE * im , * shim ;
03862 char * bar ;
03863 int npix , ii , bb , dsize ;
03864 int nx , ny , nz , nim , lf , isfunc , nvals , kz,kim , bsize,ibr ;
03865 MRI_IMARR * arr ;
03866 char iname[THD_MAX_NAME] ;
03867 float nonshort_min=1.E38 , nonshort_max=-1.E38 ;
03868 float nonbyte_min =1.E38 , nonbyte_max =-1.E38 ;
03869 int nonshort_num=0 , nonfloat_num=0 , noncomplex_num=0 , nonbyte_num=0 ;
03870 int gnim ;
03871 char ** gname ;
03872 int time_dep , ltt,kzz , ntt,nzz , nvoxt ;
03873 int kzmod ; /* 06 Nov 2002 */
03874
03875 ENTRY("T3D_read_images") ;
03876
03877 nim = Argc - First_Image_Arg ; /* = number of files, not images! */
03878
03879 INIT_SARR( imnames ) ; /* image name for each slice */
03880
03881 MCW_warn_expand(1) ;
03882 MCW_file_expand( nim , Argv+First_Image_Arg , &gnim , &gname ) ;
03883 MCW_warn_expand(0) ;
03884 #ifdef AFNI_DEBUG
03885 printf("T3D_read_images: input file count = %d; expanded = %d\n",nim,gnim) ;
03886 #endif
03887
03888 if( gnim < 1 ){ FatalError("NO INPUT IMAGE FILES?") ; }
03889
03890 /**--- count up the actual number of images into nz ---**/
03891
03892 #ifndef AFNI_DEBUG
03893 printf("Counting images: ");fflush(stdout);
03894 #endif
03895
03896 nz = 0 ;
03897 for( lf=0 ; lf < gnim ; lf++ ){
03898 ii = mri_imcount( gname[lf] ) ;
03899 if( ii == 0 ){
03900 fprintf(stderr,"*** bad file specifier %s\n",gname[lf]) ;
03901 exit(1) ;
03902 }
03903 nz += ii ;
03904 }
03905 #ifdef AFNI_DEBUG
03906 printf("T3D_read_images: mri_imcount totals nz=%d\n",nz) ;
03907 #else
03908 printf(" total=%d 2D slices\n",nz) ;
03909 #endif
03910
03911 if( nz < NZBOT ){
03912 fprintf(stderr,"*** Must have at least %d input images! ***\n",NZBOT) ;
03913 exit(1) ;
03914 }
03915
03916 /**------ Perform various sanity checks if the user is
03917 trying to create a time dependent dataset. ------**/
03918
03919 time_dep = (user_inputs.ntt > 0) ;
03920 if( time_dep ){ ntt = user_inputs.ntt ; nzz = user_inputs.nzz ; }
03921
03922 if( time_dep && nz != ntt * nzz ){
03923 fprintf(stderr,"*** Number of slices on command line = %d\n"
03924 "*** Number of slices needed for -time: = %d\n"
03925 "*** Something is wrong with your command line!\n" ,
03926 nz , ntt * nzz ) ;
03927 exit(1) ;
03928 }
03929
03930 if( time_dep ){
03931 isfunc = ISFUNCTYPE(user_inputs.dataset_type) ;
03932 nvals = (isfunc) ? FUNC_nvals[user_inputs.function_type]
03933 : ANAT_nvals[user_inputs.anatomy_type] ;
03934
03935 if( nvals != 1 ){
03936 fprintf(stderr,"*** Sorry: time dependent datasets with more than one\n"
03937 "*** value per time point are not yet supported!\n" ) ;
03938 exit(1) ;
03939 }
03940
03941 #if 0
03942 if( isfunc ){
03943 fprintf(stderr,"*** Sorry: time dependent functional\n"
03944 "*** datasets are not yet supported!\n" ) ;
03945 exit(1) ;
03946 }
03947 #endif
03948 }
03949
03950 /*--- read 1st file to get sizes ---*/
03951
03952 CLEAR_MRILIB_globals ; /* 12 Mar 2001 */
03953
03954 #ifdef USE_MRI_DELAY
03955 if( argopt.delay_input )
03956 arr = mri_read_file_delay( gname[0] ) ;
03957 else
03958 #endif
03959 arr = mri_read_file( gname[0] ) ;
03960
03961 if( arr == NULL || arr->num == 0 ){
03962 fprintf(stderr,"*** cannot read first file! ***\n") ; exit(1) ;
03963 }
03964 im = arr->imarr[0] ;
03965
03966 nx = im->nx ;
03967 ny = im->ny ; npix = nx * ny ;
03968
03969 /* 05 Feb 2001: set voxel sizes, if available */
03970
03971 if( im->dw > 0.0 ){
03972 imdx = im->dx ; imdy = im->dy ; imdz = im->dz ; /* globals */
03973 }
03974
03975 /**--- use 1st file to set default datum type, if not set already ---**/
03976
03977 if( argopt.datum_all < 0 ){
03978 switch( im->kind ){
03979 case MRI_byte: argopt.datum_all = MRI_byte ; break ;
03980
03981 default:
03982 case MRI_short: argopt.datum_all = MRI_short ; break ;
03983
03984 case MRI_int:
03985 case MRI_double:
03986 case MRI_float: argopt.datum_all = MRI_float ; break ;
03987
03988 case MRI_complex: argopt.datum_all = MRI_complex ; break ;
03989
03990 case MRI_rgb: argopt.datum_all = MRI_rgb ; break ;
03991 }
03992 }
03993
03994 /**--- allocate storage for all slices to be input ---**/
03995
03996 dsize = mri_datum_size( (MRI_TYPE) argopt.datum_all ) ;
03997 dbrick = bar = (char*)XtMalloc( dsize * nx * ny * nz ) ;
03998 nvoxt = nx * ny * nz ;
03999
04000 #if 0
04001 printf("T3D_read_images: first file (%s) has nx=%d ny=%d #im=%d\n",
04002 gname[0],nx,ny,arr->num) ;
04003 #endif
04004
04005 /*--- read all files, convert to desired type if needed, put in the brick ---*/
04006
04007 #ifndef AFNI_DEBUG
04008 printf("Reading images: ");fflush(stdout);
04009 kzmod = (int)(0.0234567*nz)+1 ; /* 06 Nov 2002 */
04010 #endif
04011
04012 kz = 0 ; if( time_dep ){ ltt = kzz = 0 ; }
04013
04014 for( lf=0 ; lf < gnim ; lf++ ){ /** loop over files **/
04015
04016 /*--- open this file, if not the first (which we read in a minute ago) ---*/
04017
04018 if( lf != 0 ){
04019 #ifdef USE_MRI_DELAY
04020 if( argopt.delay_input )
04021 arr = mri_read_file_delay( gname[0] ) ;
04022 else
04023 #endif
04024 arr = mri_read_file( gname[lf] ) ;
04025
04026 if( arr == NULL || arr->num == 0 ){
04027 fprintf(stderr,"*** cannot read file %s\n",gname[lf]) ;
04028 exit(1) ;
04029 }
04030 #ifdef AFNI_DEBUG
04031 printf("T3D_read_images: file %d (%s) has #im=%d\n",lf,gname[lf],arr->num) ;
04032 #endif
04033 }
04034
04035 for( kim=0 ; kim < arr->num ; kim++ ){ /** loop over 2D images in file **/
04036
04037 /*--- set string for this slice for display in image viewing window ---*/
04038
04039 if( arr->num == 1 ){
04040 strcpy( iname , gname[lf] ) ;
04041 } else {
04042 sprintf( iname , "%s#%d" , gname[lf],kim) ;
04043 }
04044 ADDTO_SARR(imnames,iname) ;
04045
04046 /*--- get the image and check if it fits the first image dimensions ---*/
04047
04048 im = arr->imarr[kim] ;
04049 if( im->nx != nx || im->ny != ny ){
04050 fprintf(stderr,"*** file %s has nonconforming images: first=%dx%d this=%dx%d\n",
04051 gname[lf] , nx,ny , im->nx,im->ny) ;
04052 exit(1) ;
04053 }
04054
04055 #ifdef USE_MRI_DELAY
04056 if( argopt.delay_input )
04057 (void) mri_data_pointer( im ) ; /* force load of image from disk */
04058 #endif
04059
04060 /* 14 Sep 1998: swap bytes if ordered */
04061 /* 07 Mar 2002: but only if it wasn't already swapped */
04062
04063 if( im->pixel_size == 2 && argopt.swap_two ){
04064 if( im->was_swapped ){ /* don't swap me */
04065 static int first=1 ;
04066 if( first ){ /* but print a message */
04067 fprintf(stderr,"++ Ignoring -2swap on input image [%s...]\n",
04068 (im->fname == NULL) ? "." : im->fname ) ;
04069 first = 0 ;
04070 }
04071 } else { /* swap me */
04072 static int first=1 ;
04073 if( first ){ /* and print a message */
04074 fprintf(stderr,"++ Executing -2swap on input image [%s...]\n",
04075 (im->fname == NULL) ? "." : im->fname ) ;
04076 first = 0 ;
04077 }
04078 swap_twobytes( im->nvox , mri_data_pointer(im) ) ;
04079 }
04080 } else if( im->pixel_size == 4 && argopt.swap_four ){
04081 if( im->was_swapped ){ /* don't swap me again */
04082 static int first=1 ;
04083 if( first ){ /* but print a missive */
04084 fprintf(stderr,"++ Ignoring -4swap on input image [%s...]\n",
04085 (im->fname == NULL) ? "" : im->fname ) ;
04086 first = 0 ;
04087 }
04088 } else { /* swap me, swap me */
04089 static int first=1 ;
04090 if( first ){ /* and print a message */
04091 fprintf(stderr,"++ Executing -4swap on input image [%s...]\n",
04092 (im->fname == NULL) ? "." : im->fname ) ;
04093 first = 0 ;
04094 }
04095 swap_fourbytes( im->nvox , mri_data_pointer(im) ) ;
04096 }
04097 } else if( im->pixel_size == 8 && argopt.swap_eight ){ /* 06 Feb 2003 */
04098 if( im->was_swapped ){ /* don't swap me again */
04099 static int first=1 ;
04100 if( first ){ /* but print a missive */
04101 fprintf(stderr,"++ Ignoring -8swap on input image [%s...]\n",
04102 (im->fname == NULL) ? "" : im->fname ) ;
04103 first = 0 ;
04104 }
04105 } else { /* swap me, swap me */
04106 static int first=1 ;
04107 if( first ){ /* and print a message */
04108 fprintf(stderr,"++ Executing -8swap on input image [%s...]\n",
04109 (im->fname == NULL) ? "." : im->fname ) ;
04110 first = 0 ;
04111 }
04112 swap_eightbytes( im->nvox , mri_data_pointer(im) ) ;
04113 }
04114 }
04115
04116 /* 14 Sep 1999: check float inputs for errors */
04117
04118 if( !argopt.nofloatscan && im->kind == MRI_float )
04119 nfloat_err += thd_floatscan( im->nvox , MRI_FLOAT_PTR(im) ) ;
04120 else if( !argopt.nofloatscan && im->kind == MRI_complex )
04121 nfloat_err += thd_complexscan( im->nvox , MRI_COMPLEX_PTR(im) ) ;
04122
04123 /*--- convert input image to desired type: im --> shim ---*/
04124
04125 if( im->kind == argopt.datum_all ){ /* data is desired type */
04126 shim = im ;
04127
04128 } else { /* must convert data */
04129 switch( argopt.datum_all ){
04130
04131 default: FatalError("Illegal argopt.datum_all!") ;
04132
04133 case MRI_short:{ /** convert to shorts **/
04134 short * shar ;
04135
04136 if( argopt.gsfac == 0.0 ){ /* scale each slice by itself */
04137 float immin , immax ;
04138 immin = mri_min( im ) ; immax = mri_max( im ) ;
04139 if( immin >= -32767.0 && immax <= 32767.0 )
04140 shim = mri_to_short( 1.0 , im ) ; /* no need to scale */
04141 else
04142 shim = mri_to_short_scl( 0.0 , 10000.0 , im ) ; /* scale */
04143
04144 nonshort_min = MIN(immin,nonshort_min) ;
04145 nonshort_max = MAX(immax,nonshort_max) ; nonshort_num++ ;
04146 KILL_1MRI(im) ;
04147 } else { /* use global scaling factor */
04148 float immin , immax ;
04149 shim = mri_to_short( argopt.gsfac , im ) ;
04150 immin = mri_min( im ) ; immax = mri_max( im ) ;
04151 nonshort_min = MIN(immin,nonshort_min) ;
04152 nonshort_max = MAX(immax,nonshort_max) ; nonshort_num++ ;
04153 KILL_1MRI(im) ;
04154 }
04155
04156 /* correct for oddities of FIM */
04157
04158 shar = MRI_SHORT_PTR( shim ) ; /* image of shorts */
04159 if( shar[1] == -10000 && shar[2] == 10000 ) shar[1] = shar[2] = 0 ;
04160 }
04161 break ; /* end of conversion to shorts */
04162
04163 case MRI_byte:{ /** convert to bytes **/
04164
04165 if( argopt.gsfac == 0.0 ){ /* scale each slice by itself */
04166 float immin , immax ;
04167 immin = mri_min( im ) ; immax = mri_max( im ) ;
04168 if( immin >= 0 && immax <= 255.0 )
04169 shim = mri_to_byte_scl( 1.0 , 0.0 , im ) ; /* no scale */
04170 else
04171 shim = mri_to_byte_scl( 0.0 , 255.0 , im ) ; /* scale */
04172
04173 nonbyte_min = MIN(immin,nonbyte_min) ;
04174 nonbyte_max = MAX(immax,nonbyte_max) ; nonbyte_num++ ;
04175 KILL_1MRI(im) ;
04176 } else { /* use global scaling factor */
04177 float immin , immax ;
04178 shim = mri_to_byte_scl( argopt.gsfac , 0.0 , im ) ;
04179 immin = mri_min( im ) ; immax = mri_max( im ) ;
04180 nonbyte_min = MIN(immin,nonbyte_min) ;
04181 nonbyte_max = MAX(immax,nonbyte_max) ; nonbyte_num++ ;
04182 KILL_1MRI(im) ;
04183 }
04184
04185 }
04186 break ; /* end of conversion to bytes */
04187
04188 case MRI_float:{ /** convert to floats **/
04189 float * shar ;
04190
04191 shim = mri_to_float( im ) ; nonfloat_num++ ;
04192 KILL_1MRI(im) ;
04193
04194 shar = MRI_FLOAT_PTR( shim ) ; /* image of floats */
04195 if( shar[1]==-10000.0 && shar[2]==10000.0 ) shar[1]=shar[2]=0.0 ;
04196 }
04197 break ; /* end of conversion to floats */
04198
04199 case MRI_complex:{ /** convert to complexes **/
04200 complex * shar ;
04201
04202 shim = mri_to_complex( im ) ; noncomplex_num++ ;
04203 KILL_1MRI(im) ;
04204
04205 shar = MRI_COMPLEX_PTR( shim ) ; /* image of complexes */
04206 if( shar[1].r == -10000.0 && shar[2].r == 10000.0 &&
04207 shar[1].i == 0.0 && shar[2].i == 0.0 ){
04208
04209 shar[1].r=shar[2].r=0.0 ;
04210 }
04211 }
04212 break ; /* end of conversion to complexes */
04213
04214 case MRI_rgb:{ /** convert to RGB **/
04215 shim = mri_to_rgb( im ) ;
04216 KILL_1MRI(im) ;
04217 }
04218 break ;
04219
04220 }
04221 } /**-- end of conversion: desired image is in shim --**/
04222
04223 #ifdef AFNI_DEBUG
04224 printf("T3D_read_images: putting data into slice %d\n",kz) ;
04225 #endif
04226
04227 if( ! time_dep ){
04228
04229 /**-- copy data from shim into the kz-th slice in bar --**/
04230
04231 bb = npix * dsize * kz ;
04232 memcpy( bar+bb , mri_data_pointer(shim) , npix*dsize ) ;
04233 } else {
04234
04235 /**-- copy data from shim into the (kzz,ltt)-th slice in bar --**/
04236
04237 bb = npix * dsize * ( kzz + ltt * nzz ) ;
04238 memcpy( bar+bb , mri_data_pointer(shim) , npix*dsize ) ;
04239
04240 /*-- step the kzz,ltt indices forward, depending on the
04241 order in which the slices are coming in (-time:zt or :tz) --*/
04242
04243 if( user_inputs.t_then_z ){
04244 ltt++ ; if( ltt == ntt ){ ltt = 0 ; kzz++ ; }
04245 } else {
04246 kzz++ ; if( kzz == nzz ){ kzz = 0 ; ltt++ ; }
04247 }
04248 }
04249 kz++ ;
04250
04251 KILL_1MRI(shim) ;
04252 #ifndef AFNI_DEBUG
04253 if( kz%kzmod == 0 ){ printf(".") ; fflush(stdout); }
04254 #endif
04255 } /** end of loop over images from 1 file **/
04256
04257 FREE_IMARR(arr) ;
04258 } /** end of loop over files **/
04259 #ifndef AFNI_DEBUG
04260 printf("\n");fflush(stdout);
04261 #endif
04262
04263 if( nfloat_err > 0 ) /* 14 Sep 1999 */
04264 printf("*** Found %d float errors in inputs - see program float_scan!\n",
04265 nfloat_err) ;
04266
04267 MCW_free_expand( gnim , gname ) ;
04268
04269 /**-- 10 Jan 2004: set slice thickness to slice spacing, if given --**/
04270
04271 if( use_MRILIB_slicespacing && fabs(MRILIB_slicespacing-imdz) > 0.01l ){
04272 fprintf(stderr,"Using slice spacing=%g",MRILIB_slicespacing) ;
04273 if( imdz > 0.0 ) fprintf(stderr," instead of slice thickness=%g",imdz) ;
04274 fprintf(stderr,"\n") ;
04275 imdz = MRILIB_slicespacing ;
04276 }
04277
04278 /**-- 19 Jan 2000: check inputs shorts for negativity --**/
04279
04280 if( argopt.datum_all == MRI_short ){
04281 short * sar = (short *) dbrick ;
04282 for( ii=0 ; ii < nvoxt ; ii++ )
04283 if( sar[ii] < 0 ) negative_shorts++ ;
04284 }
04285 nvox_total = nvoxt ; /* 24 Aug 2001 */
04286
04287 /**--- print conversion information ---**/
04288
04289 if( nonshort_num > 0 )
04290 printf( "Number of non-short slices converted to shorts = %d\n"
04291 "Smallest value in them = %f\n"
04292 "Largest value in them = %f\n" ,
04293 nonshort_num , nonshort_min , nonshort_max ) ;
04294
04295 if( nonbyte_num > 0 )
04296 printf( "Number of non-byte slices converted to bytes = %d\n"
04297 "Smallest value in them = %f\n"
04298 "Largest value in them = %f\n" ,
04299 nonbyte_num , nonbyte_min , nonbyte_max ) ;
04300
04301 if( nonfloat_num > 0 )
04302 printf( "Number of non-float slices converted to floats = %d\n",
04303 nonfloat_num ) ;
04304
04305 if( noncomplex_num > 0 )
04306 printf( "Number of non-complex slices converted to complexes = %d\n",
04307 noncomplex_num ) ;
04308
04309 /*--- now create the rest of the data structures, as far as we can ---*/
04310
04311 isfunc = ISFUNCTYPE(user_inputs.dataset_type) ;
04312 nvals = (isfunc) ? FUNC_nvals[user_inputs.function_type]
04313 : ANAT_nvals[user_inputs.anatomy_type] ;
04314
04315 nim = kz ; /* number of images actually processed above */
04316
04317 if( time_dep ){
04318 nvals = ntt ;
04319 if( nim != ntt * nzz ){
04320 fprintf(stderr,
04321 "\n"
04322 "***** TIME-DEPENDENCE ERROR *****\n"
04323 " Number of images input does not\n"
04324 " match number specified in -time:\n"
04325 " option on command line!\n" ) ;
04326 exit(1) ;
04327 }
04328 }
04329
04330 #ifdef AFNI_DEBUG
04331 printf("T3D_read_images: nvals set to %d\n",nvals) ;
04332 #endif
04333
04334 nz = nim / nvals ; /* number of slices */
04335 if( nz * nvals != nim ){
04336 fprintf(stderr,
04337 "\n"
04338 "***** DATA TYPE ERROR *****\n"
04339 " Number of images not an even\n"
04340 " multiple of number of values\n"
04341 " required for chosen data type\n" ) ;
04342 exit(1) ;
04343 }
04344
04345 dset = myXtNew( THD_3dim_dataset ) ; /* these are */
04346 dblk = dset->dblk = myXtNew( THD_datablock ) ; /* globals */
04347 daxes = dset->daxes = myXtNew( THD_dataxes ) ;
04348 markers = dset->markers = NULL ; /* later, dude */
04349 dkptr = dblk->diskptr = myXtNew( THD_diskptr ) ;
04350
04351 dset->tagset = NULL ; /* Oct 1998 */
04352
04353 INIT_KILL(dset->kl) ; INIT_KILL(dblk->kl) ;
04354
04355 dkptr->type = DISKPTR_TYPE ;
04356 dkptr->rank = 3 ;
04357 dkptr->nvals = nvals ;
04358 dkptr->dimsizes[0] = nx ;
04359 dkptr->dimsizes[1] = ny ;
04360 dkptr->dimsizes[2] = nz ;
04361 dkptr->storage_mode = STORAGE_BY_BRICK ;
04362 dkptr->byte_order = THD_get_write_order() ; /* 25 April 1998 */
04363 EMPTY_STRING(dkptr->prefix) ;
04364 EMPTY_STRING(dkptr->viewcode) ;
04365 EMPTY_STRING(dkptr->filecode) ;
04366 EMPTY_STRING(dkptr->directory_name) ;
04367 EMPTY_STRING(dkptr->header_name) ;
04368 EMPTY_STRING(dkptr->brick_name) ;
04369
04370 dblk->type = DATABLOCK_TYPE ;
04371 dblk->nvals = dkptr->nvals ;
04372 dblk->malloc_type = DATABLOCK_MEM_MALLOC ;
04373 dblk->natr = 0 ;
04374 dblk->natr_alloc = 0 ;
04375 dblk->atr = NULL ;
04376 dblk->brick = NULL ;
04377 dblk->brick_fac = NULL ;
04378 dblk->brick_bytes = NULL ;
04379
04380 THD_init_datablock_brick( dblk , argopt.datum_all , NULL ) ;
04381 THD_null_datablock_auxdata( dblk ) ;
04382
04383 dblk->master_nvals = 0 ; /* 11 Jan 1999 */
04384 dblk->master_ival = NULL ;
04385 dblk->master_bytes = NULL ;
04386
04387 bsize = nx*ny*nz * mri_datum_size( argopt.datum_all ) ;
04388 for( ibr=0 ; ibr < nvals ; ibr++ ){
04389 mri_fix_data_pointer( dbrick + ibr*bsize , DBLK_BRICK(dblk,ibr) ) ;
04390 }
04391
04392 daxes->type = DATAXES_TYPE ;
04393 daxes->nxx = nx ;
04394 daxes->nyy = ny ;
04395 daxes->nzz = nz ;
04396 daxes->xxorg = - user_inputs.xorigin ;
04397 daxes->yyorg = - user_inputs.yorigin ;
04398 daxes->zzorg = - user_inputs.zorigin ;
04399 daxes->xxdel = user_inputs.xsize ;
04400 daxes->yydel = user_inputs.ysize ;
04401 #ifdef ALLOW_NONCONTIG
04402 daxes->zzdel = user_inputs.zspacing ;
04403 #else
04404 daxes->zzdel = user_inputs.zsize ;
04405 #endif
04406 daxes->xxorient = user_inputs.xorient ;
04407 daxes->yyorient = user_inputs.yorient ;
04408 daxes->zzorient = user_inputs.zorient ;
04409
04410 dset->type = user_inputs.dataset_type ;
04411 dset->view_type = user_inputs.view_type ;
04412 dset->func_type = ISANAT(dset) ? (user_inputs.anatomy_type)
04413 : (user_inputs.function_type) ;
04414
04415 dset->wod_daxes = NULL ;
04416 dset->wod_flag = 0 ;
04417 dset->stats = NULL ;
04418 #ifdef ALLOW_DATASET_VLIST
04419 dset->pts = NULL ;
04420 #endif
04421 dset->death_mark = 0 ;
04422 dset->tcat_list = NULL ;
04423 dset->tcat_num = 0 ;
04424 dset->tcat_len = NULL ;
04425
04426 ZERO_STAT_AUX( dset ) ;
04427
04428 user_inputs.nx = nx ;
04429 user_inputs.ny = ny ;
04430 user_inputs.nz = nz ;
04431 user_inputs.nimage = nim ;
04432 user_inputs.nvals = nvals ;
04433
04434 /**--- fix dimensions if user input axes stuff ---**/
04435
04436 if( user_inputs.xincode > 0 ){
04437 int dcode , fov ;
04438 float dx , xorg , size ;
04439
04440 fov = 1 ;
04441 dcode = user_inputs.xincode - INCODE_FOV ;
04442
04443 if( dcode < FIRST_ORIENT_TYPE || dcode > LAST_ORIENT_TYPE ){
04444 dcode = user_inputs.xincode - INCODE_SLAB ;
04445 fov = 0 ;
04446 }
04447
04448 if( fov ){
04449 dx = (user_inputs.xin_bot + user_inputs.xin_top) / nx ;
04450 xorg = user_inputs.xin_bot - 0.5*dx ;
04451 } else {
04452 dx = (user_inputs.xin_bot + user_inputs.xin_top) / (nx-1) ;
04453 xorg = user_inputs.xin_bot ;
04454 }
04455 user_inputs.xorient = dcode ;
04456 user_inputs.xsize = dx ;
04457 user_inputs.xorigin = xorg ;
04458 user_inputs.fov = nx * dx ; geometry_loaded = 1 ;
04459
04460 size = 0.5 * (nx-1) * dx ;
04461 if( fabs(size-xorg) < 0.01 )
04462 user_inputs.xyz_centered |= XCENTERED ;
04463 else
04464 user_inputs.xyz_centered &= ~XCENTERED ;
04465 }
04466
04467 if( user_inputs.yincode > 0 ){
04468 int dcode , fov ;
04469 float dy , yorg , size ;
04470
04471 fov = 1 ;
04472 dcode = user_inputs.yincode - INCODE_FOV ;
04473
04474 if( dcode < FIRST_ORIENT_TYPE || dcode > LAST_ORIENT_TYPE ){
04475 dcode = user_inputs.yincode - INCODE_SLAB ;
04476 fov = 0 ;
04477 }
04478
04479 if( fov ){
04480 dy = (user_inputs.yin_bot + user_inputs.yin_top) / ny ;
04481 yorg = user_inputs.yin_bot - 0.5*dy ;
04482 } else {
04483 dy = (user_inputs.yin_bot + user_inputs.yin_top) / (ny-1) ;
04484 yorg = user_inputs.yin_bot ;
04485 }
04486 user_inputs.yorient = dcode ;
04487 user_inputs.ysize = dy ;
04488 user_inputs.yorigin = yorg ;
04489 user_inputs.fov = ny * dy ; geometry_loaded = 1 ;
04490
04491 size = 0.5 * (ny-1) * dy ;
04492 if( fabs(size-yorg) < 0.01 )
04493 user_inputs.xyz_centered |= YCENTERED ;
04494 else
04495 user_inputs.xyz_centered &= ~YCENTERED ;
04496 }
04497
04498 if( user_inputs.zincode > 0 ){
04499 int dcode , fov ;
04500 float dz , zorg , size ;
04501
04502 fov = 1 ;
04503 dcode = user_inputs.zincode - INCODE_FOV ;
04504
04505 if( dcode < FIRST_ORIENT_TYPE || dcode > LAST_ORIENT_TYPE ){
04506 dcode = user_inputs.zincode - INCODE_SLAB ;
04507 fov = 0 ;
04508 }
04509
04510 if( fov ){
04511 dz = (user_inputs.zin_bot + user_inputs.zin_top) / nz ;
04512 zorg = user_inputs.zin_bot - 0.5*dz ;
04513 } else {
04514 if( nz == 1 ){
04515 fprintf(stderr,"*** -zSLAB illegal with only 1 slice! ***\n") ;
04516 exit(1) ;
04517 }
04518 dz = (user_inputs.zin_bot + user_inputs.zin_top) / (nz-1) ;
04519 zorg = user_inputs.zin_bot ;
04520 }
04521 user_inputs.zorient = dcode ;
04522 user_inputs.zsize = dz ;
04523 user_inputs.zorigin = zorg ;
04524
04525 size = 0.5 * (nz-1) * dz ;
04526 if( fabs(size-zorg) < 0.01 )
04527 user_inputs.xyz_centered |= ZCENTERED ;
04528 else
04529 user_inputs.xyz_centered &= ~ZCENTERED ;
04530 }
04531
04532 dset->taxis = NULL ; /* will be patched later, if necessary */
04533
04534 if( commandline != NULL ) tross_Append_History( dset , commandline ) ;
04535
04536 /*********** DONE **********/
04537
04538 EXRETURN ;
04539 }
|
|
||||||||||||||||
|
Definition at line 4659 of file to3d.c. References THD_marker_set::aflags, AFNI_speak(), THD_3dim_dataset::anat_parent_idcode, THD_3dim_dataset::anat_parent_name, to3d_data::anatomy_dataname, to3d_data::anatomy_parent_idcode, to3d_data::anatomy_type, THD_datablock::brick_fac, client_data, commandline, to3d_data::dataset_name, to3d_data::dataset_type, THD_3dim_dataset::dblk, DBLK_BRICK_TYPE, DSET_delete, DSET_NUM_TIMES, THD_timeaxis::dz_sl, EMPTY_STRING, FUNC_HAVE_THR, THD_3dim_dataset::func_type, to3d_data::function_type, to3d_widget_set::good, HEAD_ANAT_TYPE, THD_marker_set::help, THD_3dim_dataset::idcode, INIT_STAT_AUX, ISFUNC, THD_3dim_dataset::keywords, THD_marker_set::label, THD_3dim_dataset::label1, THD_3dim_dataset::label2, THD_3dim_dataset::markers, MARKS_MAXFLAG, MARKS_MAXHELP, MARKS_MAXLAB, MARKS_MAXNUM, MCW_CALLER_KILL, MCW_new_idcode, MCW_popup_message(), MCW_strncpy, MCW_TIMER_KILL, MCW_USER_KILL, myXtNew, to3d_data::need_stat_aux, NMARK_ALIGN, THD_timeaxis::nsl, THD_timeaxis::ntt, to3d_data::ntt, THD_marker_set::numdef, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, ORI_A2P_TYPE, ORI_I2S_TYPE, ORI_L2R_TYPE, ORI_P2A_TYPE, ORI_R2L_TYPE, ORI_S2I_TYPE, outliers_checked, to3d_data::output_filename, to3d_widget_set::save_file_pb, THD_3dim_dataset::self_name, to3d_data::session_filename, to3d_data::short_label1, to3d_data::short_label2, to3d_data::stat_aux, T3D_check_data(), T3D_check_outliers(), T3D_poperr(), T3D_widgets_to_data(), THD_3dim_dataset::taxis, THD_load_statistics(), THD_MAX_LABEL, THD_MAX_NAME, THD_set_int_atr(), THD_write_3dim_dataset(), THD_zeropad(), TIMEAXIS_TYPE, THD_timeaxis::toff_sl, to3d_widget_set::topshell, to3d_data::Torg, to3d_data::tpattern, to3d_data::TR, tross_Append_History(), THD_timeaxis::ttdel, THD_timeaxis::ttdur, THD_timeaxis::ttorg, to3d_data::tunits, THD_timeaxis::type, THD_3dim_dataset::type, THD_timeaxis::units_type, THD_marker_set::valid, VIEW_ORIGINAL_TYPE, to3d_data::view_type, THD_3dim_dataset::view_type, THD_3dim_dataset::warp, THD_3dim_dataset::warp_parent_idcode, THD_3dim_dataset::warp_parent_name, WATCH_cursorize, to3d_data::xorient, to3d_data::xorigin, to3d_data::xsize, THD_dataxes::xxdel, THD_dataxes::xxorg, THD_dataxes::xxorient, to3d_data::yorient, to3d_data::yorigin, to3d_data::ysize, THD_dataxes::yydel, THD_dataxes::yyorg, THD_dataxes::yyorient, ZERO_IDCODE, THD_timeaxis::zorg_sl, to3d_data::zorient, to3d_data::zorigin, zpad, ZPAD_MM, to3d_data::zsize, to3d_data::zspacing, THD_dataxes::zzdel, THD_dataxes::zzorg, and THD_dataxes::zzorient. Referenced by main(), and T3D_create_widgets().
04661 {
04662 Boolean good , isfunc ;
04663 int ii , jj , bigfile ;
04664 Widget wmsg = NULL ;
04665 int npad ;
04666
04667 /*-- store all control data in the user_inputs data struct --*/
04668
04669 if( wset.topshell != NULL && wset.good ) T3D_widgets_to_data() ;
04670
04671 /*-- check for legal values --*/
04672
04673 good = T3D_check_data( True ) ;
04674 if( !good ) return ;
04675
04676 AFNI_speak("Saving",0) ;
04677
04678 /*-- store values in dataset --*/
04679
04680 dset->type = user_inputs.dataset_type ;
04681 dset->view_type = user_inputs.view_type ;
04682
04683 isfunc = ISFUNC(dset) ;
04684
04685 dset->func_type = (isfunc) ? (user_inputs.function_type)
04686 : (user_inputs.anatomy_type) ;
04687
04688 if( isfunc && FUNC_HAVE_THR(dset->func_type) ){
04689 int iv = FUNC_ival_thr[dset->func_type] ;
04690 switch( DBLK_BRICK_TYPE(dblk,iv) ){
04691 default:
04692 dblk->brick_fac[iv] = 0.0 ;
04693 break ;
04694
04695 case MRI_short:
04696 dblk->brick_fac[iv] = 1.0 / FUNC_scale_short[dset->func_type] ;
04697 break ;
04698
04699 case MRI_byte:
04700 dblk->brick_fac[iv] = 1.0 / FUNC_scale_byte[dset->func_type] ;
04701 break ;
04702 }
04703 }
04704
04705 if( user_inputs.need_stat_aux ){
04706 INIT_STAT_AUX( dset ,
04707 FUNC_need_stat_aux[user_inputs.function_type] ,
04708 user_inputs.stat_aux ) ;
04709 }
04710
04711 dset->warp = NULL ;
04712
04713 MCW_strncpy( dset->label1 , user_inputs.short_label1 , THD_MAX_LABEL ) ;
04714 MCW_strncpy( dset->label2 , user_inputs.short_label2 , THD_MAX_LABEL ) ;
04715 dset->keywords = NULL ;
04716
04717 if( strlen(dset->label1) == 0 ){
04718 MCW_strncpy( dset->label1 , user_inputs.output_filename , THD_MAX_LABEL ) ;
04719 }
04720
04721 EMPTY_STRING( dset->warp_parent_name ) ;
04722 ZERO_IDCODE(dset->warp_parent_idcode) ;
04723
04724 if( strlen(user_inputs.anatomy_dataname) > 0 ){
04725 MCW_strncpy( dset->anat_parent_name ,
04726 user_inputs.anatomy_dataname , THD_MAX_NAME ) ;
04727 dset->anat_parent_idcode = user_inputs.anatomy_parent_idcode ;
04728 } else {
04729 EMPTY_STRING( dset->anat_parent_name ) ;
04730 ZERO_IDCODE(dset->anat_parent_idcode) ;
04731 }
04732
04733 MCW_strncpy( dset->self_name, user_inputs.dataset_name, THD_MAX_NAME ) ;
04734
04735 daxes->xxorient = user_inputs.xorient ;
04736 daxes->yyorient = user_inputs.yorient ;
04737 daxes->zzorient = user_inputs.zorient ;
04738
04739 daxes->xxorg = (ORIENT_sign[user_inputs.xorient] == '+')
04740 ? (-user_inputs.xorigin) : ( user_inputs.xorigin) ;
04741
04742 daxes->yyorg = (ORIENT_sign[user_inputs.yorient] == '+')
04743 ? (-user_inputs.yorigin) : ( user_inputs.yorigin) ;
04744
04745 daxes->zzorg = (ORIENT_sign[user_inputs.zorient] == '+')
04746 ? (-user_inputs.zorigin) : ( user_inputs.zorigin) ;
04747
04748 daxes->xxdel = (ORIENT_sign[user_inputs.xorient] == '+')
04749 ? ( user_inputs.xsize) : (-user_inputs.xsize) ;
04750
04751 daxes->yydel = (ORIENT_sign[user_inputs.yorient] == '+')
04752 ? ( user_inputs.ysize) : (-user_inputs.ysize) ;
04753
04754 #ifdef ALLOW_NONCONTIG
04755 daxes->zzdel = (ORIENT_sign[user_inputs.zorient] == '+')
04756 ? ( user_inputs.zspacing) : (-user_inputs.zspacing) ;
04757 #else
04758 daxes->zzdel = (ORIENT_sign[user_inputs.zorient] == '+')
04759 ? ( user_inputs.zsize) : (-user_inputs.zsize) ;
04760 #endif
04761
04762 /*-- this stuff is no longer used --*/
04763
04764 #ifdef ALLOW_NONCONTIG
04765 daxes->xxskip = 0.0 ;
04766 daxes->yyskip = 0.0 ;
04767 daxes->zzskip = user_inputs.zspacing - user_inputs.zsize ;
04768 #endif
04769
04770 dset->taxis = NULL ;
04771
04772 if( user_inputs.ntt > 0 ){
04773 dset->taxis = myXtNew( THD_timeaxis ) ;
04774
04775 dset->taxis->type = TIMEAXIS_TYPE ;
04776 dset->taxis->ntt = user_inputs.ntt ;
04777 dset->taxis->ttdel = user_inputs.TR ;
04778 dset->taxis->ttdur = 0.0 ;
04779 dset->taxis->units_type = user_inputs.tunits ; /* 21 Oct 1996 */
04780 dset->taxis->ttorg = user_inputs.Torg ; /* 23 Feb 2005 */
04781
04782 if( user_inputs.tpattern != NULL ){
04783 dset->taxis->nsl = daxes->nzz ;
04784 dset->taxis->zorg_sl = daxes->zzorg ;
04785 dset->taxis->dz_sl = daxes->zzdel ;
04786 dset->taxis->toff_sl = user_inputs.tpattern ;
04787 } else {
04788 dset->taxis->nsl = 0 ;
04789 dset->taxis->zorg_sl = 0.0 ;
04790 dset->taxis->dz_sl = 0.0 ;
04791 dset->taxis->toff_sl = NULL ;
04792 }
04793 }
04794
04795 /*-- get the dataset statistics --*/
04796
04797 if( dset->taxis == NULL )
04798 bigfile = (daxes->nxx * daxes->nyy * daxes->nzz > 9999999) ;
04799 else
04800 bigfile = (daxes->nxx * daxes->nyy * daxes->nzz * dset->taxis->ntt > 9999999) ;
04801
04802 if( wset.topshell != NULL && bigfile && wset.good ){
04803 wmsg = MCW_popup_message( wset.save_file_pb ,
04804 "***************\n"
04805 "* Computing *\n"
04806 "* dataset *\n"
04807 "* statistics *\n"
04808 "***************" ,
04809 MCW_CALLER_KILL ) ;
04810 WATCH_cursorize( wmsg ) ;
04811 XFlush( XtDisplay(wmsg) ) ;
04812 } else {
04813 wmsg = NULL ;
04814 }
04815
04816 THD_load_statistics( dset ) ;
04817
04818 if( !outliers_checked ){ /* 15 Aug 2001 */
04819 T3D_check_outliers(0) ; outliers_checked = 1 ;
04820 }
04821
04822 if( wmsg != NULL ) XtDestroyWidget( wmsg ) ;
04823
04824 /*-- maybe some Talairach markers, too --*/
04825
04826 if( dset->type == HEAD_ANAT_TYPE &&
04827 dset->view_type == VIEW_ORIGINAL_TYPE &&
04828 DSET_NUM_TIMES(dset) == 1 ){ /* no markers on 3D+t datasets! */
04829
04830 markers = dset->markers = myXtNew( THD_marker_set ) ;
04831 markers->numdef = 0 ;
04832
04833 for( ii=0 ; ii < MARKS_MAXNUM ; ii++ ){ /* null all data out */
04834 markers->valid[ii] = 0 ;
04835 for( jj=0 ; jj < MARKS_MAXLAB ; jj++ )
04836 markers->label[ii][jj] = '\0';
04837 for( jj=0 ; jj < MARKS_MAXHELP ; jj++ )
04838 markers->help[ii][jj] = '\0';
04839 }
04840
04841 for( ii=0 ; ii < NMARK_ALIGN ; ii++ ){ /* copy strings in */
04842 MCW_strncpy( &(markers->label[ii][0]) ,
04843 THD_align_label[ii] , MARKS_MAXLAB ) ;
04844 MCW_strncpy( &(markers->help[ii][0]) ,
04845 THD_align_help[ii] , MARKS_MAXHELP ) ;
04846 }
04847
04848 for( ii=0 ; ii < MARKS_MAXFLAG ; ii++ ) /* copy flags in */
04849 markers->aflags[ii] = THD_align_aflags[ii] ;
04850
04851 } /* end of markers (for HEAD_ANAT_TYPE) */
04852
04853 /*----- actually write the dataset out! -----*/
04854
04855 if( wset.topshell != NULL && bigfile && wset.good ){
04856 wmsg = MCW_popup_message( wset.save_file_pb ,
04857 "********************\n"
04858 "* Please wait for *\n"
04859 "* disk operation *\n"
04860 "********************" ,
04861 MCW_CALLER_KILL ) ;
04862 WATCH_cursorize( wmsg ) ;
04863 XFlush( XtDisplay(wmsg) ) ;
04864 } else {
04865 wmsg = NULL ;
04866 }
04867
04868 /** make up a new idcode for this new output dataset **/
04869
04870 dset->idcode = MCW_new_idcode() ;
04871
04872 npad = (int) zpad ;
04873 if( npad == 0 ){ /* the old code */
04874
04875 good = THD_write_3dim_dataset( user_inputs.session_filename ,
04876 user_inputs.output_filename , dset , True ) ;
04877
04878 } else { /* 05 Feb 2001: allow for zero-padding in z-direction */
04879 THD_3dim_dataset * qset=NULL ;
04880 int flag=0 ;
04881
04882 if( zpad_mm ) flag = ZPAD_MM ;
04883
04884 switch( daxes->zzorient ){
04885 case ORI_R2L_TYPE:
04886 case ORI_L2R_TYPE:
04887 qset = THD_zeropad( dset, 0,0,0,0,npad,npad, user_inputs.output_filename,flag ) ;
04888 break ;
04889
04890 case ORI_P2A_TYPE:
04891 case ORI_A2P_TYPE:
04892 qset = THD_zeropad( dset, 0,0,npad,npad,0,0, user_inputs.output_filename,flag ) ;
04893 break ;
04894
04895 case ORI_I2S_TYPE:
04896 case ORI_S2I_TYPE:
04897 qset = THD_zeropad( dset, npad,npad,0,0,0,0, user_inputs.output_filename,flag ) ;
04898 break ;
04899
04900 default:
04901 fprintf(stderr,"*** Can't zpad: zzorient=%d\n",daxes->zzorient) ;
04902 break ;
04903 }
04904
04905 if( commandline != NULL ) tross_Append_History( qset , commandline ) ;
04906
04907 { int ppad[3] ;
04908 ppad[0] = ppad[1] = 0 ; ppad[2] = npad ;
04909 THD_set_int_atr( qset->dblk , "TO3D_ZPAD" , 3 , ppad ) ;
04910 }
04911
04912 THD_load_statistics( qset ) ;
04913 good = THD_write_3dim_dataset( user_inputs.session_filename ,
04914 user_inputs.output_filename , qset , True ) ;
04915 DSET_delete(qset) ;
04916 }
04917
04918 if( wmsg != NULL ) XtDestroyWidget( wmsg ) ;
04919
04920 if( !good ) T3D_poperr("*******************\n\n" ,
04921 "Some error occurred\n"
04922 "while trying to write file") ;
04923
04924 else if( wset.topshell != NULL && wset.good )
04925 wmsg = MCW_popup_message( wset.save_file_pb ,
04926 "*********************\n"
04927 "* Dataset written *\n"
04928 "* out to disk. *\n"
04929 "*********************" ,
04930 MCW_USER_KILL | MCW_TIMER_KILL ) ;
04931
04932 return ;
04933 }
|
|
|
|
Definition at line 5698 of file to3d.c. References to3d_data::dataset_type, ENTRY, to3d_data::function_type, to3d_widget_set::good, ISFUNCTYPE, MCW_set_widget_label(), to3d_data::need_stat_aux, to3d_widget_set::stat_aux_label, to3d_widget_set::stat_aux_textfield, THD_MAX_NAME, and to3d_widget_set::topshell. Referenced by T3D_check_data(), T3D_data_to_widgets(), and T3D_type_av_CB().
05699 {
05700 char lbuf[THD_MAX_NAME] ;
05701 Boolean needit ;
05702
05703 ENTRY("T3D_setup_stat_aux") ;
05704
05705 user_inputs.need_stat_aux =
05706 ( ISFUNCTYPE(user_inputs.dataset_type) &&
05707 FUNC_need_stat_aux[user_inputs.function_type] > 0 ) ;
05708
05709 if( wset.topshell != NULL && wset.good ){
05710 needit = (Boolean) user_inputs.need_stat_aux ;
05711
05712 if( needit ){
05713 sprintf( lbuf , "%s: statistical parameters for %s" ,
05714 FUNC_label_stat_aux[user_inputs.function_type] ,
05715 FUNC_typestr[user_inputs.function_type] ) ;
05716 } else {
05717 sprintf( lbuf , "Field below not applicable" ) ;
05718 }
05719 XtSetSensitive( wset.stat_aux_label , needit ) ;
05720 XtSetSensitive( wset.stat_aux_textfield , needit ) ;
05721 MCW_set_widget_label( wset.stat_aux_label , lbuf ) ;
05722 }
05723
05724 EXRETURN ;
05725 }
|
|
||||||||||||
|
Definition at line 3726 of file to3d.c. References MCW_arrowval::fval, RESET_QUIT, T3D_set_dependent_geometries(), to3d_widget_set::topshell, to3d_data::xsize, to3d_widget_set::xsize_av, to3d_data::ysize, to3d_widget_set::ysize_av, to3d_data::zsize, to3d_widget_set::zsize_av, to3d_data::zspacing, and to3d_widget_set::zspacing_av. Referenced by T3D_create_widgets().
03727 {
03728 float size = av->fval ;
03729
03730 if( av == wset.xsize_av ){
03731 user_inputs.xsize = size ;
03732 } else if( av == wset.ysize_av ){
03733 user_inputs.ysize = size ;
03734 } else if( av == wset.zsize_av ){
03735 user_inputs.zsize = size ;
03736 #ifdef ALLOW_NONCONTIG
03737 } else if( av == wset.zspacing_av ){
03738 user_inputs.zspacing = size ;
03739 #endif
03740 } else {
03741 XBell( XtDisplay(wset.topshell) , 100 ) ;
03742 fprintf(stderr,"\n*** illegal call to T3D_size_av_CB!\n") ;
03743 }
03744 T3D_set_dependent_geometries() ;
03745 RESET_QUIT ;
03746 }
|
|
||||||||||||||||
|
initialize display and overlay colors * Definition at line 5692 of file to3d.c. References client_data. Referenced by T3D_create_widgets().
05694 {
05695 return ;
05696 }
|
|
||||||||||||||||
|
Definition at line 3623 of file to3d.c. References AFNI_yesenv(), to3d_widget_set::anatomy_parent_label, argopt, THD_3dim_dataset::daxes, dbrick, drive_MCW_imseq(), ENTRY, ISQ_REALZ, isqDR_clearstat, isqDR_display, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, mri_datum_size(), myXtFree, myXtNew, negative_shorts, THD_timeaxis::ntt, to3d_data::ntt, THD_datablock::nvals, nvox_total, THD_dataxes::nxx, THD_dataxes::nyy, nz, THD_dataxes::nzz, outliers_checked, to3d_widget_set::seq, swap_eightbytes(), swap_fourbytes(), swap_twobytes(), T3D_check_outliers(), and THD_3dim_dataset::taxis. Referenced by T3D_create_widgets().
03624 {
03625 int dd = mri_datum_size((MRI_TYPE)argopt.datum_all) ;
03626 int nx , ny , nz , nv , nvox ;
03627
03628 ENTRY("T3D_swap_CB") ;
03629
03630 nx = dset->daxes->nxx ; ny = dset->daxes->nyy ;
03631 nz = dset->daxes->nzz ; nv = dblk->nvals ; nvox = nx*ny*nz*nv ;
03632
03633 switch( dd ){
03634 case 2: swap_twobytes ( nvox , dbrick ) ; break ;
03635 case 4: swap_fourbytes ( nvox , dbrick ) ; break ;
03636 case 8: swap_eightbytes( nvox , dbrick ) ; break ;
03637 }
03638
03639 if( argopt.datum_all == MRI_short && !AFNI_yesenv("AFNI_NO_NEGATIVES_WARNING") ){ /* 24 Aug 2001 */
03640 short * sar = (short *) dbrick ; int ii ;
03641 negative_shorts = 0 ;
03642 for( ii=0 ; ii < nvox_total ; ii++ )
03643 if( sar[ii] < 0 ) negative_shorts++ ;
03644
03645 if( negative_shorts ){
03646 float perc = (100.0*negative_shorts)/nvox_total ; char msg[512] ;
03647 sprintf(msg , " \n"
03648 " to3d WARNING: %d negative voxels (%g%%)\n"
03649 " after byte-swapping.\n" ,
03650 negative_shorts , perc ) ;
03651
03652 (void) MCW_popup_message( wset.anatomy_parent_label , msg ,
03653 MCW_USER_KILL | MCW_TIMER_KILL ) ;
03654 }
03655 }
03656
03657 if( ISQ_REALZ(wset.seq) ){
03658 drive_MCW_imseq( wset.seq , isqDR_clearstat , NULL ) ;
03659 drive_MCW_imseq( wset.seq , isqDR_display , (XtPointer)-1 ) ;
03660 }
03661
03662 if( user_inputs.ntt > 5 ){ /* 15 Aug 2001 */
03663 dset->taxis = myXtNew( THD_timeaxis ) ;
03664 dset->taxis->ntt = user_inputs.ntt ;
03665 T3D_check_outliers(0) ; outliers_checked = 1 ;
03666 myXtFree(dset->taxis) ;
03667 }
03668
03669 EXRETURN ;
03670 }
|
|
||||||||||||
|
Definition at line 3573 of file to3d.c. References ENTRY, MCW_arrowval::ival, and RETURN. Referenced by T3D_create_widgets().
|
|
||||||||||||
|
Definition at line 3750 of file to3d.c. References to3d_widget_set::anatomy_parent_label, to3d_widget_set::anatomy_parent_textfield, to3d_data::anatomy_type, to3d_widget_set::anatomy_type_av, to3d_data::dataset_type, to3d_widget_set::dataset_type_av, to3d_data::function_type, to3d_widget_set::function_type_av, ISFUNCTYPE, MCW_arrowval::ival, to3d_data::nimage, to3d_data::ntt, to3d_data::nvals, to3d_data::nz, nz, RESET_QUIT, SENSITIZE, T3D_fix_dataset_dimen(), T3D_poperr(), T3D_set_dependent_geometries(), T3D_setup_stat_aux(), to3d_widget_set::topshell, and MCW_arrowval::wrowcol. Referenced by T3D_create_widgets(), and T3D_data_to_widgets().
03751 {
03752 int itype = av->ival ;
03753 Boolean isfunc ;
03754 int nvals_old , nvals_new ;
03755
03756 isfunc = ISFUNCTYPE(user_inputs.dataset_type) ;
03757 nvals_old = (isfunc) ? FUNC_nvals[user_inputs.function_type]
03758 : ANAT_nvals[user_inputs.anatomy_type] ;
03759
03760 if( av == wset.dataset_type_av ){
03761 user_inputs.dataset_type = itype ;
03762
03763 isfunc = ISFUNCTYPE(itype) ;
03764
03765 #ifdef FUNCTION_ONLY_ANAT_PARENT
03766 SENSITIZE( wset.anatomy_parent_label , isfunc ) ;
03767 SENSITIZE( wset.anatomy_parent_textfield , isfunc ) ;
03768 #endif
03769
03770 if( isfunc ){
03771 XtUnmapWidget( wset.anatomy_type_av->wrowcol ) ;
03772 XtMapWidget ( wset.function_type_av->wrowcol ) ;
03773 } else {
03774 XtUnmapWidget( wset.function_type_av->wrowcol ) ;
03775 XtMapWidget ( wset.anatomy_type_av->wrowcol ) ;
03776 }
03777
03778 } else if( av == wset.function_type_av ){
03779 user_inputs.function_type = itype ;
03780 } else if( av == wset.anatomy_type_av ){
03781 user_inputs.anatomy_type = itype ;
03782 } else {
03783 XBell( XtDisplay(wset.topshell) , 100 ) ;
03784 fprintf(stderr,"\n*** illegal call to T3D_type_av_CB!\n") ;
03785 }
03786
03787 /*--- check if # of values/pixel has altered ---*/
03788
03789 isfunc = ISFUNCTYPE(user_inputs.dataset_type) ;
03790 nvals_new = (isfunc) ? FUNC_nvals[user_inputs.function_type]
03791 : ANAT_nvals[user_inputs.anatomy_type] ;
03792
03793 /*-- time-dependent data can have only 1 value per time point! --*/
03794
03795 if( user_inputs.ntt > 0 && nvals_new != 1 ){
03796 T3D_poperr("***** DATA TYPE WARNING *****\n",
03797 "New data type is not allowed\n"
03798 "with time-dependent datatset!" ) ;
03799 return ;
03800 }
03801
03802 if( nvals_new != nvals_old ){
03803 int nz = user_inputs.nimage / nvals_new ;
03804 if( nz * nvals_new != user_inputs.nimage ){
03805 T3D_poperr("**** DATA TYPE WARNING *****\n",
03806 "Number of images not an even\n"
03807 "multiple of # of data values" ) ;
03808 }
03809
03810 user_inputs.nz = nz ;
03811 user_inputs.nvals = nvals_new ;
03812 T3D_set_dependent_geometries() ;
03813 T3D_fix_dataset_dimen() ;
03814 }
03815
03816 T3D_setup_stat_aux() ;
03817
03818 RESET_QUIT ;
03819 }
|
|
||||||||||||||||
|
Referenced by T3D_create_widgets(), and T3D_data_to_widgets(). |
|
||||||||||||||||
|
Definition at line 3528 of file to3d.c. References AV_SENSITIZE, client_data, ENTRY, to3d_widget_set::fov_av, MCW_val_bbox(), RESET_QUIT, T3D_set_dependent_geometries(), to3d_widget_set::topshell, to3d_data::voxshape, to3d_widget_set::voxshape_bbox, VOXSHAPE_CUBICAL, VOXSHAPE_IRREGULAR, VOXSHAPE_SQUARE, to3d_widget_set::xsize_av, to3d_widget_set::ysize_av, and to3d_widget_set::zsize_av. Referenced by T3D_create_widgets(), and T3D_data_to_widgets().
03530 {
03531 int val ;
03532 Boolean fov_sens , xsize_sens , ysize_sens , zsize_sens ;
03533
03534 ENTRY("T3D_voxshape_CB") ;
03535
03536 user_inputs.voxshape = val = MCW_val_bbox( wset.voxshape_bbox ) ;
03537
03538 switch( val ){
03539
03540 default: XBell( XtDisplay(wset.topshell) , 100 ) ; return ;
03541
03542 case VOXSHAPE_CUBICAL:
03543 fov_sens = True ;
03544 xsize_sens = ysize_sens = zsize_sens = False ;
03545 break ;
03546
03547 case VOXSHAPE_SQUARE:
03548 fov_sens = True ;
03549 xsize_sens = ysize_sens = False ;
03550 zsize_sens = True ;
03551 break ;
03552
03553 case VOXSHAPE_IRREGULAR:
03554 fov_sens = False ;
03555 xsize_sens = ysize_sens = zsize_sens = True ;
03556 break ;
03557
03558 }
03559 AV_SENSITIZE( wset.fov_av , fov_sens ) ;
03560 AV_SENSITIZE( wset.xsize_av , xsize_sens ) ;
03561 AV_SENSITIZE( wset.ysize_av , ysize_sens ) ;
03562 AV_SENSITIZE( wset.zsize_av , zsize_sens ) ;
03563
03564 T3D_set_dependent_geometries() ;
03565 RESET_QUIT ;
03566 EXRETURN ;
03567 }
|
|
Variable Documentation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Initial value: {
"x axis centered" , "y axis centered" , "z axis centered" } |
|
|
Initial value: {
"contiguous" , "unif.noncontig" , "irreg.noncontig" } |
|
|
Initial value: {
"cubical" , "square" , "irregular"
} |