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  

SUMA.c File Reference

#include "SUMA_suma.h"

Go to the source code of this file.


Defines

#define DEBUG_1
#define DEBUG_2
#define DEBUG_3

Functions

void SUMA_usage ()
int main (int argc, char *argv[])

Variables

SUMA_SurfaceViewerSUMAg_cSV
SUMA_SurfaceViewerSUMAg_SVv
int SUMAg_N_SVv
SUMA_DOSUMAg_DOv
int SUMAg_N_DOv = 0
SUMA_CommonFieldsSUMAg_CF

Define Documentation

#define DEBUG_1
 

Definition at line 1 of file SUMA.c.

#define DEBUG_2
 

Definition at line 3 of file SUMA.c.

#define DEBUG_3
 

Definition at line 4 of file SUMA.c.


Function Documentation

int main int    argc,
char *    argv[]
 

\** File : SUMA.c

Author:
: Ziad Saad Date : Thu Dec 27 16:21:01 EST 2001
Purpose :

Input paramters :

Parameters:
param  Usage : SUMA ( )
Returns :
Returns:
Support :
See also:
OpenGL prog. Guide 3rd edition , varray.c from book's sample code
Side effects :

Definition at line 82 of file SUMA.c.

References AO_type, argc, SUMA_CommonFields::Dev, SUMA_SurfSpecFile::N_Groups, SUMA_AddDO(), SUMA_Alloc_Axis(), SUMA_Alloc_DisplayObject_Struct(), SUMA_Alloc_SurfaceViewer_Struct(), SUMA_Assign_HostName(), SUMA_Boolean, SUMA_Create_CommonFields(), SUMA_error_message(), SUMA_Free_CommonFields(), SUMA_Free_Displayable_Object_Vect(), SUMA_Free_SurfaceViewer_Struct_Vect(), SUMA_LoadSpec(), SUMA_MAX_DISPLAYABLE_OBJECTS, SUMA_MAX_SURF_VIEWERS, SUMA_Read_SpecFile(), SUMA_SCREEN, SUMA_SetupSVforDOs(), SUMA_usage(), SUMA_X_SurfaceViewer_Create(), SUMAg_N_DOv, and SUMAg_N_SVv.

00083 {/* Main */
00084    static char FuncName[]={"SUMA"}; 
00085         int kar;
00086         SUMA_SFname *SF_name;
00087         SUMA_Boolean brk, SurfIn;
00088         char *VolParName, *NameParam, *specfilename = NULL, *AfniHostName;
00089         SUMA_SurfSpecFile Spec;   
00090         SUMA_Axis *EyeAxis;     
00091   
00092    if (argc < 3)
00093        {
00094           SUMA_usage ();
00095           exit (1);
00096        }
00097                 
00098         /* allocate space for CommonFields structure */
00099         SUMAg_CF = SUMA_Create_CommonFields ();
00100         if (SUMAg_CF == NULL) {
00101                 fprintf(SUMA_STDERR,"Error %s: Failed in SUMA_Create_CommonFields\n", FuncName);
00102                 exit(1);
00103         }
00104         
00105         /* initialize Volume Parent and AfniHostName to nothing */
00106         VolParName = NULL;
00107         AfniHostName = NULL; 
00108         
00109         /* Allocate space for DO structure */
00110         SUMAg_DOv = SUMA_Alloc_DisplayObject_Struct (SUMA_MAX_DISPLAYABLE_OBJECTS);
00111         
00112         /* read in the surfaces */
00113         kar = 1;
00114         brk = NOPE;
00115         SurfIn = NOPE;
00116         while (kar < argc) { /* loop accross command ine options */
00117                 /*fprintf(stdout, "%s verbose: Parsing command line...\n", FuncName);*/
00118                 if (strcmp(argv[kar], "-h") == 0 || strcmp(argv[kar], "-help") == 0) {
00119                         SUMA_usage ();
00120           exit (1);
00121                 }
00122                 
00123                 if (!brk && (strcmp(argv[kar], "-dev") == 0)) {
00124                         fprintf(SUMA_STDOUT,"Warning %s: SUMA running in developer mode, some options may malfunction.\n", FuncName);
00125                         SUMAg_CF->Dev = YUP;
00126                         brk = YUP;
00127                 }
00128                 
00129                 if (!brk && (strcmp(argv[kar], "-vp") == 0 || strcmp(argv[kar], "-sa") == 0 || strcmp(argv[kar], "-sv") == 0))
00130                 {
00131                         kar ++;
00132                         if (kar >= argc)  {
00133                                 fprintf (SUMA_STDERR, "need argument after -vp|-sa|-sv ");
00134                                 exit (1);
00135                         }
00136                         VolParName = argv[kar];
00137                         /*fprintf(SUMA_STDOUT, "Found: %s\n", VolParName);*/
00138 
00139                         brk = YUP;
00140                 }               
00141                 
00142                 if (!brk && strcmp(argv[kar], "-ah") == 0)
00143                 {
00144                         kar ++;
00145                         if (kar >= argc)  {
00146                                 fprintf (SUMA_STDERR, "need argument after -ah ");
00147                                 exit (1);
00148                         }
00149                         AfniHostName = argv[kar];
00150                         /*fprintf(SUMA_STDOUT, "Found: %s\n", AfniHostName);*/
00151 
00152                         brk = YUP;
00153                 }       
00154                 if (!brk && strcmp(argv[kar], "-spec") == 0)
00155                 { 
00156                         kar ++;
00157                   if (kar >= argc)  {
00158                                 fprintf (SUMA_STDERR, "need argument after -spec ");
00159                                 exit (1);
00160                         }
00161                         
00162                         specfilename = argv[kar];
00163                         /*fprintf(SUMA_STDOUT, "Found: %s\n", specfilename);*/
00164                         brk = YUP;
00165                 } 
00166                 
00167 
00168                 if (!brk) {
00169                         fprintf (SUMA_STDERR,"Error %s: Option %s not understood. Try -help for usage\n", FuncName, argv[kar]);
00170                         exit (1);
00171                 } else {        
00172                         brk = NOPE;
00173                         kar ++;
00174                 }
00175                 
00176         }/* loop accross command ine options */
00177 
00178         
00179         if (specfilename == NULL) {
00180                 fprintf (SUMA_STDERR,"Error %s: No spec filename specified.\n", FuncName);
00181                 exit(1);
00182         }
00183 
00184         if(!SUMA_Assign_HostName (SUMAg_CF, AfniHostName, -1)) {
00185                 fprintf (SUMA_STDERR, "Error %s: Failed in SUMA_Assign_HostName", FuncName);
00186                 exit (1);
00187         }
00188         
00189         /* load the specs file and the specified surfaces*/
00190                 /* Load The spec file */
00191                 if (!SUMA_Read_SpecFile (specfilename, &Spec)) {
00192                         fprintf(SUMA_STDERR,"Error %s: Error in SUMA_Read_SpecFile\n", FuncName);
00193                         exit(1);
00194                 }       
00195 
00196                 /* make sure only one group was read in */
00197                 if (Spec.N_Groups != 1) {
00198                         fprintf(SUMA_STDERR,"Error %s: One and only one group of surfaces is allowed at the moment (%d found).\n", FuncName, Spec.N_Groups);
00199                         exit(1);
00200                 }
00201                 
00202                 /* load the surfaces specified in the specs file, one by one*/                  
00203                 if (!SUMA_LoadSpec (&Spec, SUMAg_DOv, &SUMAg_N_DOv, VolParName)) {
00204                         fprintf(SUMA_STDERR,"Error %s: Failed in SUMA_LoadSpec.\n", FuncName);
00205                         exit(1);
00206                 }
00207         
00208         /* create an Eye Axis DO */
00209         EyeAxis = SUMA_Alloc_Axis ("Eye Axis");
00210         if (EyeAxis == NULL) {
00211                 SUMA_error_message (FuncName,"Error Creating Eye Axis",1);
00212                 exit(1);
00213         }
00214 
00215         /* Store it into SUMAg_DOv */
00216         if (!SUMA_AddDO(SUMAg_DOv, &SUMAg_N_DOv, (void *)EyeAxis,  AO_type, SUMA_SCREEN)) {
00217                 SUMA_error_message (FuncName,"Error Adding DO", 1);
00218                 exit(1);
00219         }
00220         /*fprintf (SUMA_STDERR, "SUMAg_N_DOv = %d created\n", SUMAg_N_DOv);*/
00221 
00222 
00223         /* Allocate space (and initialize) Surface Viewer Structure */
00224         SUMAg_SVv = SUMA_Alloc_SurfaceViewer_Struct (SUMA_MAX_SURF_VIEWERS);
00225 
00226         /* Check on initialization */
00227         /*SUMA_Show_SurfaceViewer_Struct (SUMAg_cSV, stdout);*/
00228 
00229         /* Register the surfaces in Spec file with the surface viewer and perform setups */
00230         for (kar = 0; kar < SUMA_MAX_SURF_VIEWERS; ++kar) {
00231                 if (!SUMA_SetupSVforDOs (Spec, SUMAg_DOv, SUMAg_N_DOv, &SUMAg_SVv[kar])) {
00232                         fprintf (SUMA_STDERR, "Error %s: Failed in SUMA_SetupSVforDOs function.\n", FuncName);
00233                         exit (1);
00234                 }
00235         }
00236         
00237         /* Create the Surface Viewer Window */
00238         if (!SUMA_X_SurfaceViewer_Create ()) {
00239                 fprintf(stderr,"Error in SUMA_X_SurfaceViewer_Create. Exiting\n");
00240                 return 1;
00241         }
00242         /* One Surface Viewer created and initialized */
00243         SUMAg_N_SVv += 1;
00244           
00245 
00246         /*Main loop */
00247         XtAppMainLoop(SUMAg_CF->App);
00248 
00249         
00250         /* Done, clean up time */
00251           
00252         if (!SUMA_Free_Displayable_Object_Vect (SUMAg_DOv, SUMAg_N_DOv)) SUMA_error_message(FuncName,"DO Cleanup Failed!",1);
00253         if (!SUMA_Free_SurfaceViewer_Struct_Vect (SUMAg_SVv, SUMAg_N_SVv)) SUMA_error_message(FuncName,"SUMAg_SVv Cleanup Failed!",1);
00254         if (!SUMA_Free_CommonFields(SUMAg_CF)) SUMA_error_message(FuncName,"SUMAg_CF Cleanup Failed!",1);
00255   return 0;             /* ANSI C requires main to return int. */
00256 }/* Main */ 

void SUMA_usage  
 

Definition at line 21 of file SUMA.c.

References SUMA_Version().

Referenced by main().

00023   {/*Usage*/
00024           printf ("\n\33[1mUsage: \33[0m SUMA \n\t-spec <Spec file> [-sv <SurfVol>] [-ah AfniHost]\n\n");
00025                          printf ("\n\t-spec <Spec file>: File containing surface specification. This file is typically \n");
00026                          printf ("\n\t                   generated by @SUMA_Make_Spec_FS (for FreeSurfer surfaces) or \n");
00027                          printf ("\n\t                   @SUMA_Make_Spec_SF (for SureFit surfaces). The Spec file should \n");
00028                          printf ("\n\t                   be located in the directory containing the surfaces.\n");
00029                          printf ("\n\t[-sv <SurfVol>]: Anatomical volume used in creating the surface and registerd to \n");
00030                          printf ("\n\t                 the current experiment's anatomical volume (using @SUMA_AlignToExperiment).\n");
00031                          printf ("\n\t                 This parameter is optional but linking to AFNI is impossible without it.\n");
00032                          printf ("\n\t[-ah <AfniHost>]: Name (or IP address) of the computer running AFNI. This parameter is \n");
00033                          printf ("\n\t                  optional, the default is localhost.\n");
00034                          /*
00035                          printf ("\n\t[-dev]: This option will give access to options that are not well polished for consuption.\n");
00036                          printf ("\n\t        \n");
00037                          */
00038                          /*SUMA_VolSurf_help(NULL); OBSOLETE */
00039                          printf ("\n\n\tFor help on interacting with SUMA, press 'h' with the mouse pointer inside SUMA's window.\n");
00040                          printf ("\n\n\tFor more help: http://afni.nimh.nih.gov/ssc/ziad/SUMA/SUMA_doc.htm\n");
00041                          printf ("\n\n\tIf you can't get help here, please get help somewhere.\n");
00042                          SUMA_Version(NULL);
00043                          
00044           printf ("\n\t Ziad S. Saad SSCC/NIMH/NIH ziad@nih.gov \n\n");
00045           exit (0);
00046   }/*Usage*/

Variable Documentation

SUMA_CommonFields* SUMAg_CF
 

Global pointer to structure containing info common to all viewers

Definition at line 19 of file SUMA.c.

SUMA_SurfaceViewer* SUMAg_cSV
 

Global pointer to current Surface Viewer structure

Definition at line 14 of file SUMA.c.

SUMA_DO* SUMAg_DOv
 

Global pointer to Displayable Object structure vector

Definition at line 17 of file SUMA.c.

int SUMAg_N_DOv = 0
 

Number of DOs stored in DOv

Definition at line 18 of file SUMA.c.

Referenced by main().

int SUMAg_N_SVv
 

Number of SVs stored in SVv

Definition at line 16 of file SUMA.c.

Referenced by main().

SUMA_SurfaceViewer* SUMAg_SVv
 

Global pointer to the vector containing the various Surface Viewer Structures

Definition at line 15 of file SUMA.c.

 

Powered by Plone

This site conforms to the following standards: