Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
plug_coorder.c
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006    
00007 #include "afni.h"
00008 
00009 #ifndef ALLOW_PLUGINS
00010 #  error "Plugins not properly set up -- see machdep.h"
00011 #endif
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 static char helpstring[] =
00020   "Purpose: control the AFNI display of coordinates.\n"
00021   "\n"
00022   "The input 'Order' specifies which anatomical directions are to\n"
00023   "be displayed in the AFNI control window as the -x, -y, and -z\n"
00024   "axes, respectively.\n"
00025   "\n"
00026   "For example, the 'Dicom' order is equivalent to 'RAI', which\n"
00027   "means that\n"
00028   "  -x = Right      [and so +x = Left     ]\n"
00029   "  -y = Anterior   [    so +y = Posterior]\n"
00030   "  -z = Inferior   [    so +z = Superior ]\n"
00031   "\n"
00032   "The 'flipped' order is 'LPI', which is used in many journals.\n"
00033   "See the output of 'afni -help' for more information.\n"
00034   "\n"
00035   "After you make your choice, you must press one of the\n"
00036   "'Set' buttons for the plugin to send its data to AFNI.\n"
00037   "Author -- RW Cox"
00038 ;
00039 
00040 
00041 
00042 static char * cord_strings[] = {
00043  "Dicom" , "Flipped" ,
00044   "RAI" , "RAS" , "RPI" , "RPS" , "RIA" , "RIP" , "RSA" , "RSP" ,
00045   "LAI" , "LAS" , "LPI" , "LPS" , "LIA" , "LIP" , "LSA" , "LSP" ,
00046   "AIR" , "ASR" , "PIR" , "PSR" , "IAR" , "IPR" , "SAR" , "SPR" ,
00047   "AIL" , "ASL" , "PIL" , "PSL" , "IAL" , "IPL" , "SAL" , "SPL" ,
00048   "IRA" , "SRA" , "IRP" , "SRP" , "ARI" , "PRI" , "ARS" , "PRS" ,
00049   "ILA" , "SLA" , "ILP" , "SLP" , "ALI" , "PLI" , "ALS" , "PLS"
00050 } ;
00051 
00052 #define NUM_CORD_STRINGS (sizeof(cord_strings)/sizeof(char *))
00053 
00054 
00055 
00056 static char * CORD_main( PLUGIN_interface * ) ;  
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 DEFINE_PLUGIN_PROTOTYPE
00073 
00074 PLUGIN_interface * PLUGIN_init( int ncall )
00075 {
00076    PLUGIN_interface * plint ;     
00077    int meth ;
00078 
00079    if( ncall > 0 ) return NULL ;  
00080 
00081    
00082 
00083    plint = PLUTO_new_interface( "Coord Order" ,
00084                                 "Coordinate Order Display" ,
00085                                 helpstring ,
00086                                 PLUGIN_CALL_VIA_MENU , CORD_main  ) ;
00087 
00088    PLUTO_add_hint( plint , "Coordinate Order Display" ) ;
00089 
00090    PLUTO_set_sequence( plint , "A:afnicontrol:display" ) ;
00091 
00092    PLUTO_set_runlabels( plint , "Set+Keep" , "Set+Close" ) ;  
00093 
00094    
00095 
00096    PLUTO_add_option( plint ,
00097                      "Input" ,  
00098                      "Input" ,  
00099                      TRUE       
00100                    ) ;
00101 
00102    meth = PLUTO_string_index( GLOBAL_library.cord.orcode ,
00103                               NUM_CORD_STRINGS ,
00104                               cord_strings ) ;
00105    if( meth < 0 || meth >= NUM_CORD_STRINGS ) meth = 0 ;
00106 
00107    PLUTO_add_string( plint ,
00108                      "Order" ,          
00109                      NUM_CORD_STRINGS , 
00110                      cord_strings ,     
00111                      meth               
00112                    ) ;
00113 
00114    
00115 
00116    return plint ;
00117 }
00118 
00119 
00120 
00121 
00122 
00123 
00124 
00125 static char * CORD_main( PLUGIN_interface * plint )
00126 {
00127    char * str ;                 
00128 
00129    
00130 
00131    PLUTO_next_option(plint) ;
00132 
00133    str = PLUTO_get_string(plint) ;      
00134 
00135    MCW_strncpy(GLOBAL_argopt.orient_code,str,4) ;
00136    THD_coorder_fill( GLOBAL_argopt.orient_code , &GLOBAL_library.cord ) ;
00137    PLUTO_force_redisplay() ;
00138    return NULL ;
00139 }