00001
00002
00003
00004
00005
00006
00007 #ifndef _MCW_TO3D_HEADER_
00008 #define _MCW_TO3D_HEADER_
00009
00010 #include "mrilib.h"
00011 #include "imseq.h"
00012 #include "killer.h"
00013 #include "afni_warp.h"
00014 #include "mcw_glob.h"
00015
00016 #include <Xm/SeparatoG.h>
00017
00018 #include <Xm/Display.h>
00019 #include <stdlib.h>
00020 #include <ctype.h>
00021 #include <unistd.h>
00022
00023 #define NO_NAMES
00024
00025 typedef struct {
00026 int xorient,yorient,zorient , voxshape , voxcontig ,
00027 xyz_centered , view_type ,
00028 dataset_type , anatomy_type , function_type , nx,ny,nz ;
00029
00030 float fov , xsize,ysize,zsize , zspacing ,
00031 xorigin,yorigin,zorigin ;
00032
00033 char dataset_name[THD_MAX_NAME] ,
00034 short_label1[THD_MAX_LABEL] , short_label2[THD_MAX_LABEL] ;
00035
00036 char dataset_type_string[THD_MAX_NAME] ,
00037 anatomy_type_string[THD_MAX_NAME] ,
00038 function_type_string[THD_MAX_NAME] ,
00039 geometry_parent_filename[THD_MAX_NAME] ,
00040 anatomy_parent_filename[THD_MAX_NAME] ,
00041 output_filename[THD_MAX_NAME] ,
00042 session_filename[THD_MAX_NAME] ;
00043
00044 char geometry_dataname[THD_MAX_NAME] ,
00045 anatomy_dataname[THD_MAX_NAME] ;
00046
00047 int nimage , nvals , nosave ;
00048
00049 MCW_idcode anatomy_parent_idcode ;
00050
00051 int need_stat_aux ;
00052 float stat_aux[MAX_STAT_AUX] ;
00053
00054 int xincode , yincode , zincode ;
00055 float xin_bot,xin_top , yin_bot,yin_top , zin_bot,zin_top ;
00056
00057 int ntt , nzz , t_then_z , tunits ;
00058 float TR ;
00059 float *tpattern ;
00060
00061 float Torg ;
00062 } to3d_data ;
00063
00064 #define INCODE_NONE -666
00065 #define INCODE_FOV 100
00066 #define INCODE_SLAB 200
00067
00068 #define ORCODE(aa) \
00069 ( ((aa)=='R'||(aa)=='r') ? ORI_R2L_TYPE \
00070 :((aa)=='L'||(aa)=='l') ? ORI_L2R_TYPE \
00071 :((aa)=='P'||(aa)=='p') ? ORI_P2A_TYPE \
00072 :((aa)=='A'||(aa)=='a') ? ORI_A2P_TYPE \
00073 :((aa)=='I'||(aa)=='i') ? ORI_I2S_TYPE \
00074 :((aa)=='S'||(aa)=='s') ? ORI_S2I_TYPE : ILLEGAL_TYPE )
00075
00076 typedef struct {
00077 Widget topshell , topform ;
00078
00079 MCW_arrowval * xorient_av , * yorient_av , * zorient_av ,
00080 * xsize_av , * ysize_av , * zsize_av ,
00081 * xorigin_av , * yorigin_av , * zorigin_av ,
00082 * fov_av , * zspacing_av ;
00083 MCW_bbox * voxshape_bbox , * voxcontig_bbox , * centered_bbox ;
00084
00085 Widget region_separator ;
00086
00087 Widget
00088 #ifndef NO_NAMES
00089 dataset_name_label , dataset_name_textfield ,
00090 short_label1_label , short_label1_textfield ,
00091 short_label2_label , short_label2_textfield ,
00092 #endif
00093 geometry_parent_label , geometry_parent_textfield ,
00094 anatomy_parent_label , anatomy_parent_textfield ;
00095
00096 #ifndef NO_NAMES
00097 Widget geometry_dataname_label , geometry_dataname_textfield ,
00098 anatomy_dataname_label , anatomy_dataname_textfield ;
00099 #endif
00100
00101 MCW_arrowval * dataset_type_av , * function_type_av , * anatomy_type_av ;
00102
00103 Widget output_file_label , output_file_textfield ;
00104 Widget session_file_label , session_file_textfield ;
00105
00106 Widget action_frame , action_rowcol ,
00107 button_help_pb , open_view_pb , save_file_pb , quit_pb ;
00108 Widget swap_pb ;
00109
00110
00111
00112 Widget xorigin_label , yorigin_label , zorigin_label ;
00113 MCW_arrowval * view_type_av ;
00114 Widget stat_aux_label , stat_aux_textfield , datum_label , TR_label ;
00115
00116
00117
00118 MCW_DC * dc ;
00119 MCW_imseq * seq ;
00120
00121 int good ;
00122 } to3d_widget_set ;
00123
00124 #define T3D_NAME_WIDTH 25
00125 #define T3D_FORM_SPACING 11
00126
00127 static char orbuf[2] ;
00128 #define SET_ORIGIN_LABEL(ww,cc) \
00129 ( orbuf[1] = '\0' , \
00130 orbuf[0] = ORIENT_typestr[(cc)][0] , \
00131 MCW_set_widget_label((ww),orbuf) )
00132
00133
00134
00135 static char * T3D_voxshape_label[3] = {
00136 "cubical" , "square" , "irregular"
00137 } ;
00138
00139 #define VOXSHAPE_CUBICAL 1
00140 #define VOXSHAPE_SQUARE 2
00141 #define VOXSHAPE_IRREGULAR 4
00142
00143 static char * T3D_voxcontig_label[3] = {
00144 "contiguous" , "unif.noncontig" , "irreg.noncontig" } ;
00145
00146 #define VOXCONTIG_YES 1
00147 #define VOXCONTIG_UNIF 2
00148 #define VOXCONTIG_IRREG 4
00149
00150 static char * T3D_centered_label[3] = {
00151 "x axis centered" , "y axis centered" , "z axis centered" } ;
00152
00153 #define XCENTERED 1
00154 #define YCENTERED 2
00155 #define ZCENTERED 4
00156
00157
00158
00159 #define NCOLOVR 2
00160 static char * FD_colovr[NCOLOVR] = { "yellow" , "cyan" } ;
00161
00162 #define NGRAY 80
00163 #define GAMMA 1.0
00164
00165
00166
00167 void T3D_create_widgets(void) ;
00168 void T3D_read_images(void) ;
00169 void T3D_setup_stat_aux(void) ;
00170
00171 void T3D_stat_aux_CB (Widget, XtPointer, XtPointer );
00172 void T3D_voxshape_CB (Widget, XtPointer, XtPointer );
00173 void T3D_voxcontig_CB (Widget, XtPointer, XtPointer );
00174 void T3D_centered_CB (Widget, XtPointer, XtPointer );
00175 void T3D_open_view_CB (Widget, XtPointer, XtPointer );
00176 void T3D_save_file_CB (Widget, XtPointer, XtPointer );
00177 void T3D_quit_CB (Widget, XtPointer, XtPointer );
00178 void T3D_swap_CB (Widget, XtPointer, XtPointer );
00179
00180 void T3D_geometry_parent_CB(Widget, XtPointer, XtPointer );
00181 void T3D_anatomy_parent_CB (Widget, XtPointer, XtPointer );
00182 void T3D_pointer_leave_EV (Widget, XtPointer, XEvent * , Boolean * ) ;
00183
00184 void T3D_imseq_CB( MCW_imseq * , FD_brick * , ISQ_cbs * ) ;
00185
00186 XtPointer T3D_getim( int , int , FD_brick * ) ;
00187
00188 #define RESET_QUIT T3D_quit_CB(NULL,NULL,NULL)
00189
00190 char * T3D_text_display( MCW_arrowval * , XtPointer ) ;
00191
00192 void T3D_initialize_user_data(void) ;
00193 Boolean T3D_check_data(Boolean) ;
00194
00195 void T3D_orient_av_CB ( MCW_arrowval * , XtPointer ) ;
00196 void T3D_origin_av_CB ( MCW_arrowval * , XtPointer ) ;
00197 void T3D_fov_av_CB ( MCW_arrowval * , XtPointer ) ;
00198 void T3D_size_av_CB ( MCW_arrowval * , XtPointer ) ;
00199 void T3D_type_av_CB ( MCW_arrowval * , XtPointer ) ;
00200
00201 void T3D_set_dependent_geometries(void) ;
00202 void T3D_widgets_to_data(void) ;
00203 void T3D_data_to_widgets(void) ;
00204
00205 void T3D_poperr(char *,char *) ;
00206
00207 void T3D_fix_dataset_dimen(void) ;
00208 void Syntax() ;
00209
00210 void AFNI_load_defaults( Widget ) ;
00211
00212 int decode_location( char * str , float * val , int * dcode ) ;
00213
00214 void T3D_check_outliers(int) ;
00215
00216 static int INIT_ngray ;
00217 static float INIT_gamma ;
00218 static float INIT_fov ;
00219
00220 #endif