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_3dCRUISEtoAFNI.c File Reference

#include "SUMA_suma.h"

Go to the source code of this file.


Functions

void usage_3dCRUISEtoAFNI (SUMA_GENERIC_ARGV_PARSE *ps)
SUMA_GENERIC_PROG_OPTIONS_STRUCTSUMA_3dCRUISEtoAFNI_ParseInput (char *argv[], int argc, SUMA_GENERIC_ARGV_PARSE *ps)
int main (int argc, char *argv[])

Variables

SUMA_SurfaceViewerSUMAg_cSV = NULL
SUMA_SurfaceViewerSUMAg_SVv = NULL
int SUMAg_N_SVv = 0
SUMA_DOSUMAg_DOv = NULL
int SUMAg_N_DOv = 0
SUMA_CommonFieldsSUMAg_CF = NULL

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 86 of file SUMA_3dCRUISEtoAFNI.c.

References argc, SUMA_GENERIC_PROG_OPTIONS_STRUCT::debug, DSET_delete, DSET_write, EDIT_empty_copy(), SUMA_GENERIC_PROG_OPTIONS_STRUCT::in_name, LocalHead, SUMA_3dCRUISEtoAFNI_ParseInput(), SUMA_Alloc_DisplayObject_Struct(), SUMA_Boolean, SUMA_error_message(), SUMA_free, SUMA_Free_CommonFields(), SUMA_Free_Generic_Prog_Options_Struct(), SUMA_LH, SUMA_mainENTRY, SUMA_MAX_DISPLAYABLE_OBJECTS, SUMA_OpenDX_Read_CruiseVolHead(), SUMA_Parse_IO_Args(), SUMA_SL_Err, SUMA_STANDALONE_INIT, tross_Make_History(), and usage_3dCRUISEtoAFNI().

00087 {/* Main */    
00088    static char FuncName[]={"3dCRUISEtoAFNI"}; 
00089    SUMA_GENERIC_PROG_OPTIONS_STRUCT *Opt;  
00090    SUMA_GENERIC_ARGV_PARSE *ps=NULL;
00091    SUMA_OPEN_DX_STRUCT **dx = NULL;
00092    THD_3dim_dataset *dset=NULL;
00093    char *sto3d = NULL;
00094    SUMA_Boolean LocalHead = NOPE;
00095 
00096         SUMA_mainENTRY;
00097    SUMA_STANDALONE_INIT;
00098 
00099    /* Allocate space for DO structure */
00100         SUMAg_DOv = SUMA_Alloc_DisplayObject_Struct (SUMA_MAX_DISPLAYABLE_OBJECTS);
00101    ps = SUMA_Parse_IO_Args(argc, argv, "");
00102    
00103    if (argc < 2) {
00104       usage_3dCRUISEtoAFNI(ps);
00105       exit (1);
00106    }
00107    
00108    Opt = SUMA_3dCRUISEtoAFNI_ParseInput (argv, argc, ps);
00109 
00110    if (Opt->debug > 2) LocalHead = YUP;
00111    
00112    dset = EDIT_empty_copy( NULL ) ;
00113    tross_Make_History( "3dCRUISEtoAFNI" , argc,argv , dset) ;
00114    if (!(sto3d = SUMA_OpenDX_Read_CruiseVolHead(Opt->in_name, dset, 1))) {
00115       if (Opt->debug) SUMA_SL_Err("Failed in SUMA_OpenDX_Read_CruiseVolHead");
00116       exit(1);   
00117    }
00118    if (dset) {
00119       SUMA_LH("Writing Dset");
00120       DSET_write(dset) ;
00121       if (LocalHead) { 
00122          fprintf(SUMA_STDERR,"%s: Can use the following command to create dset with to3d:\n%s\n", FuncName,sto3d); 
00123       } 
00124    } else {
00125       /* the olde way */
00126       if (system(sto3d)) {
00127          fprintf(SUMA_STDERR, "Error %s: Failed while executing shell command:\n%s\n"
00128                               "Check to3d's error messages, and disk writing permissions.\n", FuncName, sto3d);
00129       }
00130    }
00131    
00132    
00133       
00134    if (sto3d) SUMA_free(sto3d); sto3d = NULL;
00135    if (dset) { DSET_delete(dset); dset = NULL; }
00136    if (Opt) Opt = SUMA_Free_Generic_Prog_Options_Struct(Opt);
00137    if (!SUMA_Free_CommonFields(SUMAg_CF)) SUMA_error_message(FuncName,"SUMAg_CF Cleanup Failed!",1);
00138    exit(0);
00139    
00140 } 

SUMA_GENERIC_PROG_OPTIONS_STRUCT* SUMA_3dCRUISEtoAFNI_ParseInput char *    argv[],
int    argc,
SUMA_GENERIC_ARGV_PARSE   ps
 

Definition at line 32 of file SUMA_3dCRUISEtoAFNI.c.

References SUMA_GENERIC_ARGV_PARSE::arg_checked, argc, SUMA_GENERIC_PROG_OPTIONS_STRUCT::debug, SUMA_GENERIC_PROG_OPTIONS_STRUCT::in_name, LocalHead, SUMA_Alloc_Generic_Prog_Options_Struct(), SUMA_Boolean, SUMA_ENTRY, SUMA_RETURN, SUMA_SKIP_COMMON_OPTIONS, and usage_3dCRUISEtoAFNI().

Referenced by main().

00033 {
00034    static char FuncName[]={"SUMA_BrainWrap_ParseInput"}; 
00035    SUMA_GENERIC_PROG_OPTIONS_STRUCT *Opt=NULL;
00036    int kar;
00037    SUMA_Boolean brk;
00038    SUMA_Boolean LocalHead = NOPE;
00039 
00040    SUMA_ENTRY;
00041    
00042    Opt = SUMA_Alloc_Generic_Prog_Options_Struct();
00043    kar = 1;
00044    brk = NOPE;
00045         while (kar < argc) { /* loop accross command ine options */
00046                 /*fprintf(stdout, "%s verbose: Parsing command line...\n", FuncName);*/
00047                 if (strcmp(argv[kar], "-h") == 0 || strcmp(argv[kar], "-help") == 0) {
00048                          usage_3dCRUISEtoAFNI(ps);
00049           exit (0);
00050                 }
00051                 
00052                 SUMA_SKIP_COMMON_OPTIONS(brk, kar);
00053       
00054       if (!brk && (strcmp(argv[kar], "-input") == 0)) {
00055          kar ++;
00056                         if (kar >= argc)  {
00057                                 fprintf (SUMA_STDERR, "need argument after -input\n");
00058                                 exit (1);
00059                         }
00060          Opt->in_name = argv[kar];
00061                         brk = YUP;
00062                 }
00063       if (!brk && (strcmp(argv[kar], "-debug") == 0)) {
00064          kar ++;
00065                         if (kar >= argc)  {
00066                                 fprintf (SUMA_STDERR, "need integer argument after -debug\n");
00067                                 exit (1);
00068                         }
00069          Opt->debug = atoi(argv[kar]);
00070                         brk = YUP;
00071                 }
00072       
00073       if (!brk && !ps->arg_checked[kar]) {
00074                         fprintf (SUMA_STDERR,"Error %s:\nOption %s not understood. Try -help for usage\n", FuncName, argv[kar]);
00075                         exit (1);
00076                 } else {        
00077                         brk = NOPE;
00078                         kar ++;
00079                 }
00080    }
00081    
00082    SUMA_RETURN(Opt);
00083 }

void usage_3dCRUISEtoAFNI SUMA_GENERIC_ARGV_PARSE   ps
 

Definition at line 11 of file SUMA_3dCRUISEtoAFNI.c.

References i, SUMA_free, SUMA_help_basics(), SUMA_help_IO_Args(), and SUMA_New_Additions().

Referenced by main(), and SUMA_3dCRUISEtoAFNI_ParseInput().

00012 {
00013       static char FuncName[]={"usage_3dCRUISEtoAFNI"};
00014       char * s = NULL, *sio=NULL, *st = NULL, *sts = NULL;
00015       int i;
00016       s = SUMA_help_basics();
00017       sio  = SUMA_help_IO_Args(ps);
00018       printf ( "\n"
00019                "Usage: 3dCRUISEtoAFNI -input CRUISE_HEADER.dx\n"
00020                " Converts a CRUISE dataset defined by a heder in OpenDX format\n"
00021                " The conversion is based on sample data and information\n"
00022                " provided by Aaron Carass from JHU's IACL iacl.ece.jhu.edu\n" 
00023                "%s"
00024                "%s"
00025                "\n", sio,  s);
00026       SUMA_free(s); s = NULL; SUMA_free(st); st = NULL; SUMA_free(sio); sio = NULL;       
00027       s = SUMA_New_Additions(0, 1); printf("%s\n", s);SUMA_free(s); s = NULL;
00028       printf("       Ziad S. Saad SSCC/NIMH/NIH ziad@nih.gov     \n");
00029       exit(0);
00030 }

Variable Documentation

SUMA_CommonFields* SUMAg_CF = NULL
 

Global pointer to structure containing info common to all viewers

Definition at line 9 of file SUMA_3dCRUISEtoAFNI.c.

SUMA_SurfaceViewer* SUMAg_cSV = NULL
 

Global pointer to current Surface Viewer structure

Definition at line 3 of file SUMA_3dCRUISEtoAFNI.c.

SUMA_DO* SUMAg_DOv = NULL
 

Global pointer to Displayable Object structure vector

Definition at line 7 of file SUMA_3dCRUISEtoAFNI.c.

int SUMAg_N_DOv = 0
 

Number of DOs stored in DOv

Definition at line 8 of file SUMA_3dCRUISEtoAFNI.c.

int SUMAg_N_SVv = 0
 

Number of SVs realized by X

Definition at line 6 of file SUMA_3dCRUISEtoAFNI.c.

SUMA_SurfaceViewer* SUMAg_SVv = NULL
 

Global pointer to the vector containing the various Surface Viewer Structures SUMAg_SVv contains SUMA_MAX_SURF_VIEWERS structures

Definition at line 4 of file SUMA_3dCRUISEtoAFNI.c.

 

Powered by Plone

This site conforms to the following standards: