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_suma.h

Go to the documentation of this file.
00001 /*! includes various include files, no muss no fuss */
00002 #include <stddef.h>
00003 #include <stdlib.h>
00004 #include <stdio.h>
00005 #include <stdarg.h>
00006 #include <assert.h>
00007 #include <string.h>
00008 #include <sys/time.h>
00009 #include <X11/X.h>
00010 #include <X11/Intrinsic.h>
00011 #include <X11/IntrinsicP.h>
00012 #include <X11/keysym.h>
00013 #include <X11/Xutil.h>
00014 #include <X11/StringDefs.h>
00015 #include <X11/Xatom.h>  /* For XA_RGB_DEFAULT_MAP. */
00016 #include <X11/Xmu/StdCmap.h>  /* For XmuLookupStandardColormap. */
00017 #include <Xm/MainW.h>
00018 #include <Xm/RowColumn.h>
00019 #include <Xm/PushB.h>
00020 #include <Xm/ToggleB.h>
00021 #include <Xm/CascadeB.h>
00022 #include <Xm/Frame.h>
00023 #include <math.h>
00024 #include <signal.h>
00025 #include <GL/gl.h>
00026 #include <GL/glu.h>
00027 #include <GL/glx.h>
00028 #include <GLUT/GL/glut.h>
00029 
00030 /* from Fri Aug  9 17:54:03 EDT 2002 and on SUMA will need motif headers */
00031 
00032 #include <Xm/XmAll.h>
00033 
00034 
00035 
00036 #ifdef SOLARIS
00037         #include <GLw/GLwDrawA.h>  /* OpenGL drawing area. */
00038 #else
00039    #ifdef SUMA_MOTIF_GLXAREA
00040       #include <GL/GLwMDrawA.h> 
00041    #else
00042            #include <GL/GLwDrawA.h>  /* OpenGL drawing area. */
00043    #endif
00044 #endif
00045 
00046 #include "imseq.h"
00047 #include "mrilib.h"
00048 #include "niml.h"
00049 #include "xutil.h"
00050 #include "display.h"
00051 #include "xim.h"
00052 
00053 
00054 
00055 /* SUMA's generic includes */
00056    #include "SUMA_label.h"
00057    #include "SUMA_Algorithms.h"
00058    #include "SUMA_DataSets.h"
00059    #include "SUMA_Macros.h"  
00060    #define SUMA_ENTRY ENTRY(FuncName)
00061    #define SUMA_RETURN RETURN
00062    #define SUMA_RETURNe EXRETURN
00063    #define SUMA_mainENTRY mainENTRY(FuncName)
00064    
00065    #include "../mcw_malloc.h"
00066    
00067    /* post March 3 04, using AFNI's allocation and tracing routines
00068    instead of SUMA's 
00069    If you do not want to use AFNI's allocation functions, then use
00070    -DDONT_USE_MCW_MALLOC in your compile command
00071    
00072    Relevant afni files:
00073    mcw_malloc.c/h
00074    debugtrace.c/h
00075    */
00076    
00077    #define SUMA_free mcw_free
00078    
00079    /* memory allocation section */
00080    #ifndef DONT_USE_MCW_MALLOC
00081       #define SUMA_malloc(a) mcw_malloc((a),__FILE__,__LINE__)
00082       #define SUMA_calloc(a,b) mcw_calloc((a),(b),__FILE__,__LINE__)
00083       #define SUMA_realloc(a,b) mcw_realloc((a),(b),__FILE__,__LINE__)
00084       #define SUMA_MEMTRACE_OFF {   /* No such thing */ }
00085       #ifdef SUMA_COMPILED
00086          #define SUMA_MEMTRACE_ON {\
00087             enable_mcw_malloc() ;   \
00088             SUMAg_CF->MemTrace = YUP;  \
00089          }
00090          #define SUMA_MEMTRACE_TOGGLE {   \
00091             if (!SUMAg_CF->MemTrace) { \
00092                SUMAg_CF->MemTrace = YUP; \
00093                enable_mcw_malloc() ;   \
00094             }  \
00095          }
00096       #else
00097          #define SUMA_MEMTRACE_ON {\
00098             enable_mcw_malloc() ;   \
00099          }
00100          #define SUMA_MEMTRACE_TOGGLE {   \
00101             if (!SUMAg_CF->MemTrace) { \
00102                enable_mcw_malloc() ;   \
00103             }  \
00104          }
00105       #endif
00106    #else
00107       #define SUMA_malloc(a) mcw_malloc((a))
00108       #define SUMA_calloc(a,b) mcw_calloc((a),(b))
00109       #define SUMA_realloc(a,b) mcw_realloc((a),(b))
00110       #define SUMA_MEMTRACE_ON {}
00111       #define SUMA_MEMTRACE_OFF {}
00112       #define SUMA_MEMTRACE_TOGGLE {}
00113    #endif
00114    
00115    /* debug tracing section */
00116    #ifdef SUMA_COMPILED
00117       #ifdef USE_TRACING
00118          #define SUMA_INOUT_NOTIFY_ON {\
00119             SUMAg_CF->InOut_Notify = YUP; \
00120             DBG_trace = 1;\
00121          }
00122          #define SUMA_INOUT_NOTIFY_OFF {\
00123             SUMAg_CF->InOut_Notify = NOPE; \
00124             DBG_trace = 0; \
00125          }
00126          #define SUMA_INOUT_NOTIFY_TOGGLE {\
00127             SUMAg_CF->InOut_Notify = !SUMAg_CF->InOut_Notify; \
00128             if (!DBG_trace) DBG_trace = 1;  \
00129             else DBG_trace = 0;  \
00130          }
00131       #else
00132          #define SUMA_INOUT_NOTIFY_ON {\
00133             SUMAg_CF->InOut_Notify = YUP; \
00134          }
00135          #define SUMA_INOUT_NOTIFY_OFF {\
00136             SUMAg_CF->InOut_Notify = NOPE; \
00137          }
00138          #define SUMA_INOUT_NOTIFY_TOGGLE {\
00139             SUMAg_CF->InOut_Notify = !SUMAg_CF->InOut_Notify; \
00140          }
00141       #endif
00142    #else
00143       #ifdef USE_TRACING
00144          #define SUMA_INOUT_NOTIFY_ON { DBG_trace = 1; }
00145          #define SUMA_INOUT_NOTIFY_OFF { DBG_trace = 0; }
00146          #define SUMA_INOUT_NOTIFY_TOGGLE {\
00147             if (!DBG_trace) DBG_trace = 1;  \
00148             else DBG_trace = 0;  \
00149          }
00150       #else
00151          #define SUMA_INOUT_NOTIFY_ON { }
00152          #define SUMA_INOUT_NOTIFY_OFF { }
00153          #define SUMA_INOUT_NOTIFY_TOGGLE { }
00154       #endif
00155    #endif
00156 
00157 /* The include files */
00158 #if defined SUMA_COMPILED
00159    /* SUMA specific includes*/
00160    #include "SUMA_define.h"   
00161    #include "SUMA_prototype.h"
00162    #include "SUMA_ParseCommands.h"  
00163    #include "SUMA_niml.h"
00164    #include "SUMA_Engine.h"
00165    #include "SUMA_display.h"
00166    #include "SUMA_input.h"   
00167    #include "SUMA_SVmanip.h"
00168    #include "SUMA_DOmanip.h"  
00169    #include "SUMA_MiscFunc.h"   
00170    #include "SUMA_trackball.h"
00171    #include "SUMA_Color.h"
00172    #include "SUMA_GeomComp.h"
00173    #include "SUMA_CreateDO.h"
00174    #include "SUMA_Load_Surface_Object.h"
00175    #include "SUMA_Surface_IO.h"
00176    #include "SUMA_SphericalMapping.h"
00177    #include "SUMA_xColBar.h"
00178    #include "SUMA_SurfClust.h"
00179    #include "SUMA_IsoSurface.h"
00180    #include "SUMA_BrainWrap.h"
00181    #include "SUMA_SurfaceToSurface.h"
00182    #define SUMA_IGNORE_VOLREG {  \
00183       SUMAg_CF->IgnoreVolreg = 1;   \
00184    }
00185 #else
00186    /* define the necessary macros */   
00187    #define SUMA_STDERR stderr
00188    #define SUMA_STDOUT stdout
00189    
00190    #define SUMA_SLP_Err SUMA_S_Err
00191    #define SUMA_SL_Err SUMA_S_Err
00192    #define SUMA_L_Err SUMA_S_Err
00193    
00194    #define SUMA_SLP_Note SUMA_S_Note
00195    #define SUMA_SL_Note SUMA_S_Note
00196    #define SUMA_L_Note SUMA_S_Note
00197    
00198    #define SUMA_SLP_Warn SUMA_S_Warn
00199    #define SUMA_SL_Warn SUMA_S_Warn
00200    #define SUMA_L_Warn SUMA_S_Warn
00201    
00202    #define SUMA_SLP_Crit SUMA_S_Crit
00203    #define SUMA_SL_Crit SUMA_S_Crit
00204    #define SUMA_L_Crit SUMA_S_Crit
00205    #define SUMA_IGNORE_VOLREG { }
00206    
00207    #define SUMA_LH(msg) {\
00208       if (LocalHead) fprintf (SUMA_STDERR, "%s:\n %s\n", FuncName, msg);  \
00209    }
00210    
00211    #define SUMA_S_Warn(msg) {\
00212       fprintf (SUMA_STDERR, "Warning %s:\n %s\n", FuncName, msg);  \
00213    }
00214    
00215    #define SUMA_S_Note(msg) {\
00216       fprintf (SUMA_STDERR, "Notice %s:\n %s\n", FuncName, msg);  \
00217    }
00218    
00219    #define SUMA_S_Err(msg) {\
00220       fprintf (SUMA_STDERR, "Error %s:\n %s\n", FuncName, msg);  \
00221    }
00222    
00223    #define SUMA_S_Crit(msg) {\
00224       fprintf (SUMA_STDERR, "Critical error %s:\n %s\n", FuncName, msg);  \
00225    }
00226     
00227 #endif
00228 
00229 
00230 
00231 /******************************* BEGIN IGNORE THIS CHUNK ********************************/
00232 #ifdef USE_SUMA_MALLOC
00233    /* NO LONGER SUPPORTED Apr. 09 04 */
00234 
00235    /* The pre-March 3/04 way, SUMA uses its own version of memory allocation
00236    and tracing. Those tools did not allow for memory corruption checking and
00237    used linear pointer storage methods making for inefficient searching 
00238       Use -DUSE_SUMA_MALLOC in the compile line if you wish to use the old stuff
00239    */
00240    #define SUMA_free( p ) \
00241            SUMA_free_fn( FuncName, p )
00242    #define SUMA_calloc( nmemb,  size) \
00243            SUMA_calloc_fn( FuncName, nmemb, size)
00244    #define SUMA_malloc(size) \
00245            SUMA_malloc_fn( FuncName, size)
00246    #define SUMA_realloc( ptr, size) \
00247            SUMA_realloc_fn( FuncName, ptr, size)
00248    #define SUMA_ENTRY  { \
00249       if (SUMAg_CF->InOut_Notify) SUMA_DBG_IN_NOTIFY(FuncName);   \
00250    }
00251    #define SUMA_RETURN(m_rvar) {\
00252       if (SUMAg_CF->InOut_Notify) { SUMA_DBG_OUT_NOTIFY(FuncName); }\
00253       return(m_rvar);\
00254    }
00255    #define SUMA_RETURNe  {\
00256       if (SUMAg_CF->InOut_Notify) { SUMA_DBG_OUT_NOTIFY(FuncName); }\
00257       return ;\
00258    }
00259    #define SUMA_mainENTRY {}
00260 
00261    #define SUMA_INOUT_NOTIFY_ON {\
00262       SUMAg_CF->InOut_Notify = YUP; \
00263    }
00264    #define SUMA_INOUT_NOTIFY_OFF {\
00265       SUMAg_CF->InOut_Notify = NOPE; \
00266    }
00267 
00268    #define SUMA_INOUT_NOTIFY_TOGGLE {\
00269       SUMAg_CF->InOut_Notify = !SUMAg_CF->InOut_Notify; \
00270    }
00271    #define SUMA_MEMTRACE_ON {\
00272       SUMAg_CF->MemTrace = YUP;  \
00273    }
00274    #define SUMA_MEMTRACE_OFF {   \
00275       SUMAg_CF->MemTrace = OFF;  \
00276    }
00277    #define SUMA_MEMTRACE_TOGGLE {   \
00278       SUMAg_CF->MemTrace = !SUMAg_CF->MemTrace; \
00279    }
00280 #endif
00281 /******************************* END IGNORE THIS CHUNK ********************************/
 

Powered by Plone

This site conforms to the following standards: