Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

afni_pplug_env.c File Reference

#include "afni.h"

Go to the source code of this file.


Data Structures

struct  ENV_var

Defines

#define USE_SESSTRAIL
#define NUM_env_fixed   (sizeof(env_fixed)/sizeof(char *))
#define NUM_cord_strings   50
#define NUM_yesno_list   2
#define NUM_threshlock_list   3
#define NAME_NMAX   32
#define HINT_NMAX   64
#define VAL_NMAX   (PLUGIN_STRING_SIZE+NAME_NMAX+8)
#define ENV_NUMBER_EDITABLE   1
#define ENV_NUMBER_FIXED   2
#define ENV_STRING   9

Functions

void ENV_coorder (char *)
void ENV_globalrange (char *)
void ENV_compressor (char *)
void ENV_leftisleft (char *)
void ENV_marksquality (char *)
void ENV_trusthost (char *)
void ENV_cwd (char *)
void ENV_redraw_titles (char *)
void ENV_redisplay (char *)
void ENV_sesstrail (char *)
char * ENV_main (PLUGIN_interface *)
PLUGIN_interface * ENV_init (void)
void ENV_add_numeric (char *vname, char *vhint, int vbot, int vtop, int vdecim, int vdef, generic_func *cbfunc)
void ENV_add_yesno (char *vname, char *vhint)
void ENV_add_string (char *vname, char *vhint, int vcount, char **vlist, generic_func *cbfunc)

Variables

char help_start []
char help_mid []
char help_end []
char * env_fixed []
char * cord_strings [NUM_cord_strings]
char * yesno_list [] = { "YES" , "NO" }
char * threshlock_list [] = { "NO" , "VALUE" , "P-VALUE" }
int NUM_env_var = 0
ENV_varenv_var = NULL

Define Documentation

#define ENV_NUMBER_EDITABLE   1
 

Definition at line 147 of file afni_pplug_env.c.

Referenced by ENV_add_numeric(), ENV_init(), and ENV_main().

#define ENV_NUMBER_FIXED   2
 

Definition at line 148 of file afni_pplug_env.c.

Referenced by ENV_add_numeric(), ENV_init(), and ENV_main().

#define ENV_STRING   9
 

Definition at line 149 of file afni_pplug_env.c.

Referenced by ENV_add_string(), ENV_init(), and ENV_main().

#define HINT_NMAX   64
 

Definition at line 144 of file afni_pplug_env.c.

Referenced by ENV_add_numeric(), and ENV_add_string().

#define NAME_NMAX   32
 

Definition at line 143 of file afni_pplug_env.c.

Referenced by ENV_add_numeric(), ENV_add_string(), and ENV_init().

#define NUM_cord_strings   50
 

Definition at line 100 of file afni_pplug_env.c.

Referenced by ENV_init().

#define NUM_env_fixed   (sizeof(env_fixed)/sizeof(char *))
 

Definition at line 96 of file afni_pplug_env.c.

Referenced by ENV_init().

#define NUM_threshlock_list   3
 

Definition at line 138 of file afni_pplug_env.c.

Referenced by ENV_init().

#define NUM_yesno_list   2
 

Definition at line 135 of file afni_pplug_env.c.

Referenced by ENV_add_yesno(), and ENV_init().

#define USE_SESSTRAIL
 

Definition at line 17 of file afni_pplug_env.c.

#define VAL_NMAX   (PLUGIN_STRING_SIZE+NAME_NMAX+8)
 

Definition at line 145 of file afni_pplug_env.c.

Referenced by ENV_init().


Function Documentation

void ENV_add_numeric char *    vname,
char *    vhint,
int    vbot,
int    vtop,
int    vdecim,
int    vdef,
generic_func   cbfunc
 

Definition at line 539 of file afni_pplug_env.c.

References ENV_NUMBER_EDITABLE, ENV_NUMBER_FIXED, generic_func, HINT_NMAX, malloc, MCW_strncpy, NAME_NMAX, NUM_env_var, realloc, ENV_var::vbot, ENV_var::vdecim, ENV_var::vdef, ENV_var::vfunc, ENV_var::vtop, and ENV_var::vtype.

Referenced by ENV_init().

00542 {
00543    int ii ;
00544 
00545    if( vname == NULL || vname[0] == '\0' ) return ;
00546    if( vhint == NULL || vhint[0] == '\0' ) return ;
00547    if( vbot >= vtop )                      return ;
00548 
00549    if( NUM_env_var == 0 )
00550       env_var = (ENV_var *) malloc(sizeof(ENV_var)) ;
00551    else
00552       env_var = (ENV_var *) realloc(env_var,(NUM_env_var+1)*sizeof(ENV_var)) ;
00553 
00554    ii = NUM_env_var ; NUM_env_var++ ;
00555 
00556    MCW_strncpy( env_var[ii].vname , vname , NAME_NMAX ) ;
00557    MCW_strncpy( env_var[ii].vhint , vhint , HINT_NMAX ) ;
00558 
00559    env_var[ii].vtype = (vtop-vbot < 100) ? ENV_NUMBER_FIXED
00560                                          : ENV_NUMBER_EDITABLE ;
00561 
00562    env_var[ii].vbot   = vbot ;
00563    env_var[ii].vtop   = vtop ;
00564    env_var[ii].vdecim = vdecim ;
00565    env_var[ii].vdef   = vdef ;
00566    env_var[ii].vfunc  = cbfunc ;
00567 
00568    return ;
00569 }

void ENV_add_string char *    vname,
char *    vhint,
int    vcount,
char **    vlist,
generic_func   cbfunc
 

Definition at line 577 of file afni_pplug_env.c.

References ENV_STRING, generic_func, HINT_NMAX, malloc, MCW_strncpy, NAME_NMAX, NUM_env_var, realloc, ENV_var::vcount, ENV_var::vfunc, ENV_var::vlist, and ENV_var::vtype.

Referenced by ENV_add_yesno(), and ENV_init().

00579 {
00580    int ii ;
00581 
00582    if( vname == NULL || vname[0] == '\0' ) return ;
00583    if( vhint == NULL || vhint[0] == '\0' ) return ;
00584    if( vcount < 0 )                        return ;
00585    if( vcount > 0    && vlist    == NULL ) return ;
00586 
00587    if( NUM_env_var == 0 )
00588       env_var = (ENV_var *) malloc(sizeof(ENV_var)) ;
00589    else
00590       env_var = (ENV_var *) realloc(env_var,(NUM_env_var+1)*sizeof(ENV_var)) ;
00591 
00592    ii = NUM_env_var ; NUM_env_var++ ;
00593 
00594    MCW_strncpy( env_var[ii].vname , vname , NAME_NMAX ) ;
00595    MCW_strncpy( env_var[ii].vhint , vhint , HINT_NMAX ) ;
00596 
00597    env_var[ii].vtype  = ENV_STRING ;
00598    env_var[ii].vcount = vcount ;
00599    env_var[ii].vlist  = vlist ;
00600    env_var[ii].vfunc  = cbfunc ;
00601 
00602    return ;
00603 }

void ENV_add_yesno char *    vname,
char *    vhint
 

Definition at line 571 of file afni_pplug_env.c.

References ENV_add_string(), NUM_yesno_list, and yesno_list.

Referenced by ENV_init().

00572 {
00573    ENV_add_string( vname , vhint ,
00574                    NUM_yesno_list , yesno_list , NULL  ) ;
00575 }

void ENV_compressor char *    [static]
 

Definition at line 742 of file afni_pplug_env.c.

References COMPRESS_NONE, getenv(), NUM_COMPRESS_elist, PLUTO_string_index(), and THD_set_write_compression().

Referenced by ENV_init().

00743 {
00744    char *str = getenv(vname) ;
00745    int meth ;
00746 
00747    if( str == NULL ) str = "None" ;
00748    meth = PLUTO_string_index( str , NUM_COMPRESS_elist , COMPRESS_elist ) ;
00749    if( meth < 0 ) meth = COMPRESS_NONE ;
00750    THD_set_write_compression(meth) ;
00751 }

void ENV_coorder char *    [static]
 

Definition at line 724 of file afni_pplug_env.c.

References AFNI_library_type::cord, getenv(), GLOBAL_argopt, GLOBAL_library, MCW_strncpy, AF_options::orient_code, PLUTO_force_redisplay(), and THD_coorder_fill().

Referenced by ENV_init().

00725 {
00726    char *str = getenv(vname) ;
00727    if( str == NULL ) str = "RAI" ;
00728    MCW_strncpy(GLOBAL_argopt.orient_code,str,4) ;
00729    THD_coorder_fill( GLOBAL_argopt.orient_code , &GLOBAL_library.cord ) ;
00730    PLUTO_force_redisplay() ;
00731 }

void ENV_cwd char *    [static]
 

Definition at line 821 of file afni_pplug_env.c.

References BEEPIT, and getenv().

Referenced by ENV_init().

00822 {
00823   char *str = getenv(vname) , buf[256] , *bpt ;
00824 
00825   if( str != NULL && str[0] != '\0' ){
00826      int ii = chdir(str) ;
00827      if( ii ){
00828         perror("** Setting CWD fails") ;
00829         bpt = getcwd( buf , 256 ) ;
00830         if( bpt != NULL ) fprintf(stderr,"** CWD still = %s\n",buf) ;
00831         BEEPIT ;
00832      } else {
00833         bpt = getcwd( buf , 256 ) ;
00834         if( bpt != NULL ) fprintf(stderr,"++ CWD now = %s\n",buf) ;
00835      }
00836   } else {
00837      fprintf(stderr,"** CWD not changed!\n") ;
00838   }
00839 }

void ENV_globalrange char *    [static]
 

Definition at line 701 of file afni_pplug_env.c.

References AFNI_range_setter(), AFNI_yesenv(), AFNI_library_type::controllers, drive_MCW_imseq(), GLOBAL_library, IM3D_OPEN, isqDR_setrange, MAX_CONTROLLERS, Three_D_View::s123, Three_D_View::s231, and Three_D_View::s312.

Referenced by ENV_init().

00702 {
00703    Three_D_View *im3d ;
00704    int ii , gbr=AFNI_yesenv("AFNI_IMAGE_GLOBALRANGE") ;
00705 
00706    for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ ){
00707      im3d = GLOBAL_library.controllers[ii] ;
00708      if( ! IM3D_OPEN(im3d) ) continue ;
00709      if( gbr ){
00710        AFNI_range_setter( im3d , im3d->s123 ) ;
00711        AFNI_range_setter( im3d , im3d->s231 ) ;
00712        AFNI_range_setter( im3d , im3d->s312 ) ;
00713      } else {
00714        drive_MCW_imseq( im3d->s123 , isqDR_setrange , (XtPointer)NULL ) ;
00715        drive_MCW_imseq( im3d->s231 , isqDR_setrange , (XtPointer)NULL ) ;
00716        drive_MCW_imseq( im3d->s312 , isqDR_setrange , (XtPointer)NULL ) ;
00717      }
00718    }
00719    return ;
00720 }

PLUGIN_interface* ENV_init void   
 

Definition at line 173 of file afni_pplug_env.c.

References AV_SHIFT_VAL, cord_strings, ENV_add_numeric(), ENV_add_string(), ENV_add_yesno(), ENV_compressor(), ENV_coorder(), ENV_cwd(), env_fixed, ENV_globalrange(), ENV_leftisleft(), ENV_main(), ENV_marksquality(), ENV_NUMBER_EDITABLE, ENV_NUMBER_FIXED, ENV_redisplay(), ENV_redraw_titles(), ENV_sesstrail(), ENV_STRING, ENV_trusthost(), free, getenv(), help_end, help_mid, help_start, malloc, NAME_NMAX, NUM_COMPRESS_elist, NUM_cord_strings, NUM_env_fixed, NUM_env_var, NUM_threshlock_list, NUM_yesno_list, PLUTO_add_hint(), PLUTO_set_runlabels(), PLUTO_string_index(), SESSTRAIL, strtod(), THD_zzprintf(), threshlock_list, VAL_NMAX, ENV_var::vbot, ENV_var::vcount, ENV_var::vdef, ENV_var::vlist, ENV_var::vtop, ENV_var::vtype, and yesno_list.

Referenced by AFNI_misc_CB().

00174 {
00175    PLUGIN_interface *plint ;     /* will be the output of this routine */
00176 
00177    char *helpstring=NULL , *ept , *eval ;
00178    int ii ;
00179 
00180    /*------- some environment variables for AFNI ------*/
00181 
00182    { static char buf[VAL_NMAX] = "AFNI_CWD=" ;      /* 22 Feb 2001 */
00183      ept = getcwd( buf+9 , VAL_NMAX-9 ) ;
00184      if( ept != NULL ){
00185         putenv(buf) ;
00186         ENV_add_string( "AFNI_CWD" ,
00187                         "Current working directory (gets output files)" ,
00188                         0,NULL , ENV_cwd ) ;
00189      }
00190    }
00191 
00192    ENV_add_string( "AFNI_ENFORCE_ASPECT" ,
00193                    "To make AFNI enforce image window aspect ratio?" ,
00194                    NUM_yesno_list , yesno_list , NULL  ) ;
00195 
00196    ENV_add_numeric( "AFNI_FIM_PERCENT_LIMIT" ,
00197                     "Upper limit on % Change in FIM" ,
00198                     10,1000,0,100 , NULL              ) ;
00199 
00200    ENV_add_numeric( "AFNI_IMAGE_MINFRAC" ,
00201                     "Minimum size of image window" ,
00202                     0,10,2,2 , NULL                 ) ;
00203 
00204    ENV_add_string( "AFNI_LEFT_IS_LEFT" ,
00205                    "To show subject's left on image left?" ,
00206                    NUM_yesno_list , yesno_list , ENV_leftisleft  ) ;
00207 
00208    ENV_add_string( "AFNI_NO_SIDES_LABELS" ,
00209                    "Skip showing image window left-side label?" ,
00210                    NUM_yesno_list , yesno_list , NULL  ) ;
00211 
00212    ENV_add_string( "AFNI_VIEW_ANAT_BRICK" ,
00213                    "Show OverLay brick whenever possible" ,
00214                    NUM_yesno_list , yesno_list , NULL  ) ;
00215 
00216    ENV_add_string( "AFNI_VIEW_FUNC_BRICK" ,
00217                    "Show UnderLay brick whenever possible" ,
00218                    NUM_yesno_list , yesno_list , NULL  ) ;
00219 
00220    ENV_add_string( "AFNI_ORIENT" ,
00221                    "Coordinate display orientation" ,
00222                    NUM_cord_strings,cord_strings , ENV_coorder ) ;
00223 
00224    ENV_add_string( "AFNI_MARKERS_NOQUAL" ,
00225                    "Skip markers quality checking?" ,
00226                    NUM_yesno_list , yesno_list , ENV_marksquality  ) ;
00227 
00228    ENV_add_string( "AFNI_COMPRESSOR" ,
00229                    "Output BRIK compression method" ,
00230                    NUM_COMPRESS_elist,COMPRESS_elist , ENV_compressor ) ;
00231 
00232    ENV_add_string( "AFNI_AUTOGZIP" ,
00233                    "Use gzip on output if BRIK seems highly compressible" ,
00234                    NUM_yesno_list , yesno_list , NULL  ) ;
00235 
00236 #if 0
00237    ENV_add_string( "AFNI_BYTEORDER" ,
00238                    "Byte ordering for output BRIKs" ,
00239                    NUM_byteorder_list , byteorder_list , ENV_byteorder ) ;
00240 #endif
00241 
00242 #if 0
00243    ENV_add_string( "AFNI_NOMMAP" ,
00244                    "Whether to read BRIKs using mmap()" ,
00245                    NUM_yesno_list , yesno_list , NULL    ) ;
00246 #endif
00247 
00248    ENV_add_string( "AFNI_FLOATSCAN" ,
00249                    "Scan floating BRIKs for errors on input?" ,
00250                    NUM_yesno_list , yesno_list , NULL          ) ;
00251 
00252 #ifdef USE_SESSTRAIL
00253    ENV_add_numeric( "AFNI_SESSTRAIL" ,
00254                     "# directory levels seen in Switch Session, etc." ,
00255                     0,9,0,SESSTRAIL , ENV_sesstrail ) ;
00256 #endif
00257 
00258    ENV_add_string( "AFNI_PBAR_IMXY" ,
00259                    "Sizes of 'Save to PPM' for color pbars" ,
00260                    0,NULL , NULL ) ;
00261 
00262    ENV_add_string( "AFNI_PSPRINT" ,
00263                    "Command to send stdin to PostScript printer" ,
00264                    0,NULL , NULL ) ;
00265 
00266    ENV_add_string( "AFNI_TRUSTHOST" ,
00267                    "Name of host to trust for plugouts and realtime data" ,
00268                    0,NULL , ENV_trusthost ) ;
00269 
00270    ENV_add_string( "AFNI_IMAGE_LABEL_COLOR" ,
00271                    "Name of color for image overlay labels" , /* 21 Sep 2001 */
00272                    0,NULL , NULL ) ;
00273 
00274    ENV_add_numeric( "AFNI_IMAGE_LABEL_SETBACK" ,
00275                     "Size of setback for image overlay labels" ,
00276                     0 , 40 , 3 , 3 , NULL ) ;
00277 
00278    if( SUMA_ENABLED ){
00279      ENV_add_string( "AFNI_SUMA_BOXCOLOR" ,                   /* 21 Sep 2001 */
00280                      "Color name for surface node overlays [or none]" ,
00281                      0,NULL , NULL ) ;
00282 
00283      ENV_add_numeric( "AFNI_SUMA_BOXSIZE" ,                   /* 10 Mar 2002 */
00284                       "Box size for surface node overlays" ,
00285                       1 , 10 , 1 , 2 , NULL ) ;
00286 
00287      ENV_add_string( "AFNI_SUMA_LINECOLOR" ,                  /* 10 Mar 2002 */
00288                      "Color name for surface line overlays [or none]" ,
00289                      0,NULL , NULL ) ;
00290 
00291      ENV_add_numeric( "AFNI_SUMA_LINESIZE" ,                  /* 15 Jan 2003 */
00292                       "Line thickness for surface intersection overlay" ,
00293                       0 , 30 , 3 , 0 , NULL ) ;
00294    }
00295 
00296 #ifndef NO_FRIVOLITIES
00297    ENV_add_string( "AFNI_IMAGE_PGMFILE" ,
00298                    "Image file for AFNI splash window" ,
00299                    0,NULL , NULL ) ;
00300 #endif
00301 
00302    /* 08 Aug 2001 */
00303 
00304    ENV_add_yesno( "AFNI_DONT_MOVE_MENUS" ,
00305                   "Move popup menus to enhance visibility?" ) ;
00306 
00307    /* 07 Mar 2002 */
00308 
00309    ENV_add_numeric( "AFNI_GRAPH_TEXTLIMIT" ,
00310                     "Max rows in Graph Button-3 popup" ,
00311                     1 , 99 , 0 , 40 , NULL ) ;
00312 
00313    /* 16 Mar 2002 */
00314 
00315    ENV_add_string( "AFNI_KEEP_PANNING" ,
00316                    "Keep 'pan' turned on in image viewers?" ,
00317                    NUM_yesno_list , yesno_list , NULL  ) ;
00318 
00319    /* 18 Mar 2002 */
00320 
00321    ENV_add_string( "AFNI_VALUE_LABEL" ,
00322                    "Turn on the Define Overlay dataset value label?" ,
00323                    NUM_yesno_list , yesno_list , NULL  ) ;
00324 
00325    /* 22 Mar 2002 */
00326 
00327    ENV_add_string( "AFNI_CROSSHAIR_LINES" ,
00328                    "Draw crosshairs with lines, not overlay voxels?" ,
00329                    NUM_yesno_list , yesno_list , NULL  ) ;
00330 
00331    /* 25 Mar 2002 */
00332 
00333    ENV_add_string( "AFNI_CROP_ZOOMSAVE" ,
00334                    "Crop zoomed images when saving to disk?" ,
00335                    NUM_yesno_list , yesno_list , NULL  ) ;
00336 
00337    /* 23 Aug 2003 */
00338 
00339    ENV_add_numeric( "AFNI_MAX_OPTMENU" ,
00340                     "Max buttons in an Option Menu" ,
00341                     100 , 100000 , 0 , 255 , NULL ) ;
00342 
00343    /* 23 Oct 2003 */
00344 
00345    ENV_add_numeric( "AFNI_STROKE_THRESHOLD" ,
00346                     "Coarseness of grayscale stroking" ,
00347                     8 , 99 , 0 , 32 , NULL ) ;
00348 
00349    ENV_add_string( "AFNI_STROKE_AUTOPLOT" ,
00350                    "To automatically draw grayscale-data value plot?" ,
00351                    NUM_yesno_list , yesno_list , NULL  ) ;
00352 
00353    /* 04 Nov 2003 */
00354 
00355    ENV_add_string( "AFNI_IMAGE_MINTOMAX" ,
00356                    "Set image viewers to do min-to-max grayscaling?" ,
00357                    NUM_yesno_list , yesno_list , NULL  ) ;
00358 
00359    ENV_add_string( "AFNI_IMAGE_GLOBALRANGE" ,
00360                    "Set image viewers to use 3D global data range min-to-max?" ,
00361                    NUM_yesno_list , yesno_list , ENV_globalrange  ) ;
00362 
00363    /* 19 Nov 2003 */
00364 
00365    ENV_add_numeric( "AFNI_DRAW_UNDOSIZE" ,
00366                     "Megabytes allowed for Drawing Undo" ,
00367                     1 , 999 , 0 , 6 , NULL ) ;
00368 
00369 #if !defined(NO_FRIVOLITIES) && defined(DARWIN)
00370    ENV_add_yesno( "AFNI_SPEECH" , "Allow speech synthesis?" ) ; /* 03 Dec 2003 */
00371 #endif
00372 
00373    ENV_add_numeric( "AFNI_VIDEO_DELAY" ,                        /* 04 Dec 2003 */
00374                     "Image redraw interval for 'V' or 'v' (ms)." ,
00375                     1,9000,0,1 , NULL              ) ;
00376 
00377    ENV_add_numeric( "AFNI_IMAGE_ENTROPY" ,
00378                     "Entropy threshold: below this, 2%-98% is off." ,
00379                     0,10,1,0 , NULL ) ;
00380 
00381    ENV_add_string( "AFNI_THRESH_LOCK" ,                            /* 06 Feb 2004 */
00382                    "Lock Threshold slider values together?" ,
00383                    NUM_threshlock_list , threshlock_list , NULL  ) ;
00384 
00385    ENV_add_yesno( "AFNI_PBAR_LOCK" , "Lock Color Pbars together?" ) ; /* 07 Feb 2004 */
00386    ENV_add_yesno( "AFNI_RANGE_LOCK", "Lock OLay Ranges together?" ) ; /* 23 Feb 2004 */
00387 
00388    ENV_add_yesno( "AFNI_DISP_SCROLLBARS" , "Image Disp menu get scrollbars?" ) ;
00389 
00390    /* 23 Feb 2004 [rickr] */
00391    ENV_add_yesno( "AFNI_IMAGE_ZOOM_NN" ,
00392                    "Use Nearest Neighbor interpolation for image Zoom?" ) ;
00393 
00394    /* 22 Mar 2004 [RWCox] */
00395    ENV_add_yesno( "AFNI_SLAVE_FUNCTIME" , "Time Index affects functional overlay?" ) ;
00396    ENV_add_yesno( "AFNI_SLAVE_THRTIME"  , "Time Index affects threshold overlay?" ) ;
00397 
00398    ENV_add_string( "AFNI_REALTIME_MP_HOST_PORT" ,     /* 31 Mar 2004 [rickr] */
00399                    "Supply host:port string for realtime motion parameters." ,
00400                    0,NULL , NULL ) ;
00401 
00402    /* 07 Apr 2004 [RWCox] */
00403    ENV_add_yesno( "AFNI_X11_REDECORATE" , "Try to set X11 window 'decorations'?" ) ;
00404 
00405    /* 21 Dec 2004 [RWCox] */
00406    ENV_add_string( "AFNI_TITLE_LABEL2" ,
00407                    "Use 'label2' field for window titles?" ,
00408                    NUM_yesno_list , yesno_list , ENV_redraw_titles ) ;
00409 
00410    /* 21 Mar 2005 [RWCox] */
00411    ENV_add_string( "AFNI_EDGIZE_OVERLAY" ,
00412                    "Display color overlay as edges only?" ,
00413                    NUM_yesno_list , yesno_list , ENV_redisplay ) ;
00414 
00415    /* 08 Apr 2005 [rickr] */
00416    ENV_add_numeric( "AFNI_NIFTI_DEBUG" ,
00417                     "Set nifti_io debug level (should then do Rescan:This)" ,
00418                     0,5,0,0 , NULL ) ;
00419 
00420    /* 20 Apr 2005 [RWCox] */
00421    ENV_add_string( "AFNI_OVERLAY_ZERO" ,
00422                    "Do 0 values get color in an Overlay?" ,
00423                    NUM_yesno_list , yesno_list , ENV_redisplay ) ;
00424 
00425    /*---------------- compute helpstring -----------------------*/
00426 
00427    helpstring = THD_zzprintf( helpstring , "%s\n" , help_start ) ;
00428 
00429    for( ii=0 ; ii < NUM_env_fixed ; ii++ ){
00430       ept = getenv(env_fixed[ii]) ;
00431       if( ept == NULL )
00432          eval = "(Not set)" ;
00433       else if( ept[0] == '\0' )
00434          eval = "(Set to empty string)" ;
00435       else
00436          eval = ept ;
00437       helpstring = THD_zzprintf( helpstring, " %-25.25s= %s\n",
00438                                              env_fixed[ii],eval  ) ;
00439    }
00440 
00441    helpstring = THD_zzprintf( helpstring , "%s\n" , help_mid ) ;
00442 
00443    for( ii=0 ; ii < NUM_env_var ; ii++ ){
00444       helpstring = THD_zzprintf( helpstring, " %-25.25s: %s\n" ,
00445                                  env_var[ii].vname , env_var[ii].vhint ) ;
00446    }
00447 
00448    helpstring = THD_zzprintf( helpstring , "%s\n" , help_end ) ;
00449 
00450    /*---------------- set titles and call point ----------------*/
00451 
00452    plint = PLUTO_new_interface( "Environment" ,
00453                                 "Environment variables control" ,
00454                                 helpstring ,
00455                                 PLUGIN_CALL_VIA_MENU , ENV_main  ) ;
00456    free(helpstring) ;
00457 
00458    PLUTO_add_hint( plint , "Environment variables control" ) ;
00459 
00460    PLUTO_set_runlabels( plint , "Set+Keep" , "Set+Close" ) ;  /* 04 Nov 2003 */
00461 
00462    /*--------- make interface lines: 1 for each variable -----------*/
00463 
00464    for( ii=0 ; ii < NUM_env_var ; ii++ ){
00465 
00466       PLUTO_add_option( plint ,
00467                         "" ,                 /* label at left of input line */
00468                         env_var[ii].vname ,  /* tag to return to plugin */
00469                         FALSE                /* is this mandatory? */
00470                       ) ;
00471 
00472       ept = getenv( env_var[ii].vname ) ;
00473 
00474       switch( env_var[ii].vtype ){
00475 
00476          default: break ;  /* should never happen */
00477 
00478          case ENV_NUMBER_FIXED:
00479          case ENV_NUMBER_EDITABLE:{
00480             double dval=env_var[ii].vdef ; int ival ;
00481 
00482             if( ept != NULL ){
00483                dval = strtod(ept,NULL) ;
00484                AV_SHIFT_VAL(-env_var[ii].vdecim,dval) ;
00485             }
00486             ival = rint(dval) ;
00487                  if( ival < env_var[ii].vbot ) ival = env_var[ii].vbot ;
00488             else if( ival > env_var[ii].vtop ) ival = env_var[ii].vtop ;
00489 
00490             PLUTO_add_number( plint ,
00491                               env_var[ii].vname ,
00492                               env_var[ii].vbot  ,
00493                               env_var[ii].vtop  ,
00494                               env_var[ii].vdecim,
00495                               ival,(env_var[ii].vtype==ENV_NUMBER_EDITABLE) ) ;
00496             PLUTO_add_hint( plint , env_var[ii].vhint ) ; /* 8 Apr 2005 rickr */
00497          }
00498          break ;
00499 
00500          case ENV_STRING:{
00501             if( env_var[ii].vcount <= 0 ){
00502                PLUTO_add_string( plint ,
00503                                  env_var[ii].vname ,
00504                                  0 , &ept , NAME_NMAX ) ;
00505                PLUTO_add_hint( plint , env_var[ii].vhint ) ;
00506             } else {
00507                int dval , jj ;
00508                char ** sval ;
00509 
00510                dval = 1 + PLUTO_string_index( ept , env_var[ii].vcount ,
00511                                                     env_var[ii].vlist   ) ;
00512 
00513                sval = (char **) malloc( sizeof(char *)*(1+env_var[ii].vcount) ) ;
00514                sval[0] = "(Not set)" ;
00515                for( jj=0 ; jj < env_var[ii].vcount ; jj++ )
00516                   sval[jj+1] = env_var[ii].vlist[jj] ;
00517 
00518                PLUTO_add_string( plint ,
00519                                  env_var[ii].vname  ,
00520                                  1+env_var[ii].vcount , sval , dval ) ;
00521                PLUTO_add_hint( plint , env_var[ii].vhint ) ;
00522                free(sval) ;
00523             }
00524          }
00525          break ;
00526       } /* end of switch over variable type */
00527 
00528    } /* end of loop over variables */
00529 
00530    /*--------- done with interface setup ---------*/
00531 
00532    return plint ;
00533 }

void ENV_leftisleft char *    [static]
 

Definition at line 843 of file afni_pplug_env.c.

References getenv(), GLOBAL_argopt, AF_options::left_is_left, and YESSISH.

Referenced by ENV_init().

00844 {
00845    char *str = getenv(vname) ;
00846    GLOBAL_argopt.left_is_left = YESSISH(str) ;
00847 }

char * ENV_main PLUGIN_interface *    [static]
 

Definition at line 611 of file afni_pplug_env.c.

References AFNI_CALL_VOID_1ARG, AV_format_fval(), ENV_NUMBER_EDITABLE, ENV_NUMBER_FIXED, ENV_STRING, NUM_env_var, PLUTO_string_index(), ENV_var::vcount, ENV_var::vfunc, and ENV_var::vtype.

Referenced by ENV_init().

00612 {
00613    char *tag ;
00614    int ii,kk , ndone=0 ;
00615 
00616    /*--------- loop over input lines ---------*/
00617 
00618    while(1){
00619       tag = PLUTO_get_optiontag(plint) ;
00620       if( tag == NULL ) break ;
00621 
00622       /* find which variable */
00623 
00624       for( ii=0 ; ii < NUM_env_var ; ii++ )
00625          if( strcmp(tag,env_var[ii].vname) == 0 ) break ;
00626 
00627       if( ii == NUM_env_var )
00628         return "** ENV_main: table corruption! **" ;  /* should not happen */
00629 
00630       switch( env_var[ii].vtype ){  /* set vvalue for each type */
00631 
00632          default:
00633            return "** ENV_main: table corruption! **" ;  /* should not happen */
00634 
00635          /* write a numeric value into the environment */
00636 
00637          case ENV_NUMBER_FIXED:
00638          case ENV_NUMBER_EDITABLE:{
00639             float val = PLUTO_get_number(plint) ;
00640             sprintf(env_var[ii].vvalue,"%s=%s" ,
00641                     env_var[ii].vname , AV_format_fval(val) ) ;
00642          }
00643          break ;
00644 
00645          /* write a string value into the environment */
00646 
00647          case ENV_STRING:{
00648             char *str = PLUTO_get_string(plint) ; int jj ;
00649 
00650             if( env_var[ii].vcount > 0 ){
00651                jj = PLUTO_string_index( str , env_var[ii].vcount ,
00652                                               env_var[ii].vlist   ) ;
00653                if( jj >= 0 )
00654                   sprintf(env_var[ii].vvalue,"%s=%s" ,
00655                           env_var[ii].vname , str     ) ;
00656                else
00657                   sprintf(env_var[ii].vvalue,"%s=" , env_var[ii].vname ) ;
00658             } else {
00659                sprintf(env_var[ii].vvalue,"%s=%s" ,
00660                        env_var[ii].vname , str     ) ;
00661             }
00662          }
00663          break ;
00664 
00665       } /* end of switch over environment variable types */
00666 
00667       /* actually set environment variable */
00668 
00669       putenv(env_var[ii].vvalue) ;
00670 
00671       /* call callback, if there is one */
00672 
00673 #if 0
00674       if( env_var[ii].vfunc != NULL ) env_var[ii].vfunc( env_var[ii].vname ) ;
00675 #else
00676       if( env_var[ii].vfunc != NULL )
00677         AFNI_CALL_VOID_1ARG( env_var[ii].vfunc , char *, env_var[ii].vname ) ;
00678 #endif
00679 
00680       /* turn this option off (for the user's convenience) */
00681 
00682       for( kk=0 ; kk < plint->option_count ; kk++ )            /* find widget */
00683          if( strcmp(tag,plint->option[kk]->tag) == 0 ) break ;
00684 
00685       if( kk < plint->option_count )                           /* turn off */
00686          XmToggleButtonSetState( plint->wid->opwid[kk]->toggle, False,True ) ;
00687 
00688       ndone++ ;  /* count of how many we've done */
00689 
00690    } /* end of while(1) loop over option lines */
00691 
00692    /*--------- finished -------*/
00693 
00694    if( ndone == 0 ) return " \n*** Don't you want to do anything? ***\n " ;
00695 
00696    return NULL ;
00697 }

void ENV_marksquality char *    [static]
 

Definition at line 851 of file afni_pplug_env.c.

References AF_options::elide_quality, getenv(), GLOBAL_argopt, and YESSISH.

Referenced by ENV_init().

00852 {
00853    char *str = getenv(vname) ;
00854    GLOBAL_argopt.elide_quality = YESSISH(str) ;
00855 }

void ENV_redisplay char *    vname [static]
 

21 Mar 2005

Definition at line 735 of file afni_pplug_env.c.

References PLUTO_force_redisplay().

Referenced by ENV_init().

00736 {
00737    PLUTO_force_redisplay() ;
00738 }

void ENV_redraw_titles char *    [static]
 

Definition at line 812 of file afni_pplug_env.c.

References AFNI_set_window_titles(), AFNI_library_type::controllers, GLOBAL_library, and MAX_CONTROLLERS.

Referenced by ENV_init().

00813 {
00814    int ii ;
00815    for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ )
00816      AFNI_set_window_titles( GLOBAL_library.controllers[ii] ) ;
00817 }

void ENV_sesstrail char *    [static]
 

Definition at line 756 of file afni_pplug_env.c.

References AFNI_set_window_titles(), AFNI_library_type::controllers, getenv(), GLOBAL_library, IM3D_OPEN, THD_session::lastname, MAX_CONTROLLERS, THD_sessionlist::num_sess, THD_session::sessname, SESSTRAIL, THD_sessionlist::ssar, AFNI_library_type::sslist, strtod(), THD_MAX_NAME, THD_trailname(), and tt.

Referenced by ENV_init().

00757 {
00758    int ii , tt ;
00759    THD_session *sess ;
00760    char *str = getenv(vname) ;
00761 
00762    if( str == NULL ) str = "1" ;
00763    ii = SESSTRAIL ; SESSTRAIL = (int) strtod(str,NULL) ;
00764    if( ii == SESSTRAIL ) return ;
00765 
00766    /* relabel controller windows */
00767 
00768    for( ii=0 ; ii < MAX_CONTROLLERS ; ii++ )
00769       if( IM3D_OPEN(GLOBAL_library.controllers[ii]) )
00770          AFNI_set_window_titles( GLOBAL_library.controllers[ii] ) ;
00771 
00772    /* relabel sessions (cf. thd_initsess.c) */
00773 
00774    for( ii=0 ; ii < GLOBAL_library.sslist->num_sess ; ii++ ){
00775      sess = GLOBAL_library.sslist->ssar[ii] ;
00776      str  = THD_trailname(sess->sessname,SESSTRAIL) ;
00777      tt   = 1+strlen(str) - THD_MAX_NAME ; if( tt < 0 ) tt = 0 ;
00778      strcpy( sess->lastname , str+tt ) ;
00779    }
00780 }

void ENV_trusthost char *    [static]
 

Definition at line 804 of file afni_pplug_env.c.

References getenv(), and TRUST_addhost().

Referenced by ENV_init().

00805 {
00806    char *str = getenv(vname) ;
00807    TRUST_addhost(str) ;
00808 }

Variable Documentation

char* cord_strings[NUM_cord_strings] [static]
 

Initial value:

 {
 "Dicom" , "Flipped" ,
  "RAI" , "RAS" , "RPI" , "RPS" , "RIA" , "RIP" , "RSA" , "RSP" ,
  "LAI" , "LAS" , "LPI" , "LPS" , "LIA" , "LIP" , "LSA" , "LSP" ,
  "AIR" , "ASR" , "PIR" , "PSR" , "IAR" , "IPR" , "SAR" , "SPR" ,
  "AIL" , "ASL" , "PIL" , "PSL" , "IAL" , "IPL" , "SAL" , "SPL" ,
  "IRA" , "SRA" , "IRP" , "SRP" , "ARI" , "PRI" , "ARS" , "PRS" ,
  "ILA" , "SLA" , "ILP" , "SLP" , "ALI" , "PLI" , "ALS" , "PLS"
}

Definition at line 102 of file afni_pplug_env.c.

Referenced by ENV_init().

char* env_fixed[] [static]
 

Definition at line 55 of file afni_pplug_env.c.

Referenced by ENV_init().

ENV_var* env_var = NULL [static]
 

Definition at line 163 of file afni_pplug_env.c.

char help_end[] [static]
 

Initial value:

  "\n"
  "The variables shown above may be set using the plugin interface.\n"
  "As usual, one of the 'Send' buttons must be used for any changes\n"
  "you make to be communicated to AFNI.  Depending on the variables\n"
  "that are altered, there may be no immediate effects visible in the\n"
  "AFNI interface, until you take some action that is dependent on\n"
  "the variable settings.\n"
  "\n"
  "Author -- RW Cox -- June 2000"

Definition at line 41 of file afni_pplug_env.c.

Referenced by ENV_init().

char help_mid[] [static]
 

Initial value:

  "\n"
  "The variables that CAN be set by this plugin are:\n"

Definition at line 36 of file afni_pplug_env.c.

Referenced by ENV_init().

char help_start[] [static]
 

Initial value:

  "Purpose: control the AFNI environment variables.\n"
  "\n"
  "The environment variables controlled from this plugin affect the\n"
  "operation of various AFNI components.  Full documentation is in\n"
  "the file README.environment.  These environment variables may also\n"
  "also set from the command line, your login script, or from your\n"
  ".afnirc file.\n"
  "\n"
  "Some environment variables CANNOT be set in this plugin, since the\n"
  "choices they imply are irrevocable, they only affect the startup\n"
  "operation of AFNI, or the parameters they control can be set by\n"
  "other AFNI controls.  Some of these 'fixed' variables are:\n"

Definition at line 21 of file afni_pplug_env.c.

Referenced by ENV_init().

int NUM_env_var = 0 [static]
 

Definition at line 162 of file afni_pplug_env.c.

Referenced by ENV_add_numeric(), ENV_add_string(), ENV_init(), and ENV_main().

char* threshlock_list[] = { "NO" , "VALUE" , "P-VALUE" } [static]
 

Definition at line 139 of file afni_pplug_env.c.

Referenced by ENV_init().

char* yesno_list[] = { "YES" , "NO" } [static]
 

Definition at line 136 of file afni_pplug_env.c.

Referenced by ENV_add_yesno(), and ENV_init().

 

Powered by Plone

This site conforms to the following standards: