Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

SUMA_define.h

Go to the documentation of this file.
00001 #ifndef SUMA_DEFINE_INCLUDED
00002 #define SUMA_DEFINE_INCLUDED
00003 
00004 #define ARRAY 1
00005 #define STRAIGHT 2
00006 #define TRIANGLES 1
00007 #define POINTS 2
00008 
00009 #define DRAW_METHOD ARRAY
00010 #define RENDER_METHOD TRIANGLES
00011 #define DO_MESH
00012 #define DO_MESH_AXIS
00013 /*#define ZERO_CENTER*/
00014 
00015 #define SUMA_SWAP_BUTTONS_1_3 0 /*!< 1/0 flag for swapping functions of buttons 1 and 3, also controlled by alt+s */ 
00016 #define SUMA_DOUBLE_CLICK_MAX_DELAY 250 /*!< Maximum delay in ms to consider a double click */
00017 
00018 #define NODE_COLOR_R 0.35
00019 #define NODE_COLOR_G 0.35
00020 #define NODE_COLOR_B 0.35
00021 #define SUMA_GRAY_NODE_COLOR 0.30
00022 #define SUMA_DIM_AFNI_COLOR_FACTOR 0.5 /*!< 0.4 works well, use higher factors for flashiness scaling factor (0..1) applied to afni's rgb colors, lower values help retain surface shape info */
00023 #define SUMA_AFNI_COLORPLANE_OPACITY 1
00024 #define SUMA_DIM_CONVEXITY_COLOR_FACTOR 0.5
00025 #define SUMA_CONVEXITY_COLORPLANE_OPACITY 1
00026 #define SUMA_BACKGROUND_MODULATION_FACTOR 3   /*!< 0 background does not modulate foreground, 
00027                                                    Color = Fore * avg_Bright * AttenFactor (0 <= avg_Bright <=1)
00028                                                    a good setting is such that SUMA_BACKGROUND_ATTENUATION_FACTOR * SUMA_DIM_AFNI_COLOR_FACTOR = 1
00029                                                     Watch for saturation effects!*/
00030 
00031 #define SUMA_MAT_SHININESS_INIT 0 /*!< Surface object shininess, 0 20, 50 .. 128*/
00032 #define SUMA_MAT_SPECULAR_INIT    0.0, 0.0, 0.0, 1.0 /*!< The specular color of the material, keep this and the exponent (that's MAT_SHININESS) 0 to keep shininess down*/
00033 #define SUMA_MAT_AMBIENT_INIT    0.2, 0.2, 0.2, 1.0 /*!< Fraction of Ambient light reflected.Ambient light has an undetermined direction and is scattered equally in all directions */
00034 #define SUMA_MAT_DIFFUSE_INIT    0.8, 0.8, 0.8, 1.0 /*!<  Fraction of Diffuse light reflected.Diffuse light comes from one direction, but is scattered equally in all directions and appears equally bright no matter where the eye is located*/
00035 #define SUMA_MAT_EMISSION_INIT    0.0, 0.0, 0.0, 1.0 /*!< Emissive color/light emanated from object.
00036                                                            and unaffected by light sources. 
00037                                                            It adds no light to other objects in the scene */
00038 #define SUMA_LMODEL_AMBIENT       1.0, 1.0, 1.0, 1.0 /*!< keep the ambient light high */
00039 
00040 #define SUMA_CLEAR_COLOR_R         0.0 /*!< clear color (viewer background) Red */
00041 #define SUMA_CLEAR_COLOR_G         0.0 /*!< clear color (viewer background) Green */
00042 #define SUMA_CLEAR_COLOR_B         0.0 /*!< clear color (viewer background) Blue */
00043 #define SUMA_CLEAR_COLOR_A         0.0 /*!< clear color (viewer background) Alpha */
00044 
00045 
00046 #define SUMA_BACKFACE_CULL 0 /*!< 1/0 flag for culling backface facesets */
00047 #define SUMA_CHECK_WINDING 0 /*!< 1/0 flag for checking triangle winding */
00048 
00049 #define SUMA_LIGHT0_COLOR_INIT    1.0, 1.0, 1.0,  1.0 
00050 #define SUMA_INTITIAL_LIGHT0_SWITCH 1 /*!< -1 works well for SureFit Surfaces, 1 works well for iv and FreeSurfer surfaces */
00051 #define SUMA_STDERR stderr
00052 #define SUMA_STDOUT stdout
00053 
00054 #define SUMA_CROSS_HAIR_LINE_WIDTH 1.5
00055 #define SUMA_CROSS_HAIR_RADIUS 6
00056 #define SUMA_CROSS_HAIR_GAP 2
00057 #define SUMA_CROSS_HAIR_SPHERE_RADIUS 0.5
00058 #define SUMA_SELECTED_NODE_SPHERE_RADIUS 0.25
00059 
00060 #define SUMA_BEEP_LENGTH_MS 50 /*!< beep time in ms */
00061 #define SUMA_XYZ_XFORM_BOXDIM_MM 5 /*!< search box width (in mm) used to change XYZ to the closest node index. Keep this one small, 5 mm works for me. Otherwise you may get thrown way off of where you should be. It is no guarantee that the closest node is part of the faceset you are looking at*/
00062 #define SUMA_SELECTED_FACESET_LINE_WIDTH 2 /*!< Line Width of highlighting triangles */
00063 #define SUMA_SELECTED_FACESET_OFFSET_FACTOR 0.01 /*!< highlighting is done by drawing two triangles at a fractional distance of the normal vector */
00064 #define SUMA_SELECTED_FACESET_LINE_INTENSITY 0.75 /*!< line gray color intensity */
00065 #define SUMA_NODE_ALPHA 1 /*!< Node Color Intensity 1, max intensity 0 min intensity*/
00066 #define FOV_INITIAL 30
00067 #define FOV_MIN 0.01
00068 #define FOV_MAX 140
00069 #define FOV_IN_FACT 1.05
00070 #define FOV_OUT_FACT 0.95
00071 #define MOUSE_ZOOM_FACT 30 /*!< The larger, the slower the gain on mouse movement */
00072 #define TRANSLATE_GAIN 50 /*!< between 40 and 80 */
00073 #define ARROW_TRANSLATE_DELTAX 30
00074 #define ARROW_TRANSLATE_DELTAY 30
00075 #define SUMA_MAX_MESSAGES 100 /*!< Maximum number of messages stored in list */
00076 #define SUMA_MAX_MEMBER_FACE_SETS 110 /*!< Maximum number of facesets a node can be part of. 
00077                                           Used to be 60 but that was not enough for a few
00078                                           funky FS surfaces. ZSS Mon Mar 24 16:14:12 EST 2003*/
00079 #define SUMA_MAX_FACESET_EDGE_NEIGHB 3 /*!< Maximum number of adjoining FaceSets a triangular faceset can have.*/
00080 #define SUMA_MAX_DISPLAYABLE_OBJECTS 1000 /*!< Maximum number of displayable Objects */
00081 #define SUMA_MAX_SURF_VIEWERS 6 /*!< Maximum number of surface viewers allowed */
00082 #define SUMA_N_STANDARD_VIEWS 2/*!< Maximum number of standard views, see SUMA_STANDARD_VIEWS*/
00083 #define SUMA_DEFAULT_VIEW_FROM 300 /*!< default view from location on Z axis */
00084 #define SUMA_MAX_NAME_LENGTH 500   /*!< Maximum number of characters in a filename */
00085 #define SUMA_MAX_DIR_LENGTH 2000    /*!< Maximum number of characters in a directory name */
00086 #define SUMA_MAX_COMMAND_LENGTH      2000/*!< Maximum number of characters in a command string */
00087 #define SUMA_MAX_LABEL_LENGTH 100 /*!< Maximum number of characters for labeling and naming suma fields and objects */
00088 #define SUMA_IDCODE_LENGTH 50   /*!< Max. length of idcode_str of all suma objects */
00089 #define SUMA_MAX_STRING_LENGTH 1000 /*!< Maximum number of characters in a string */ 
00090 #define SUMA_MAX_NUMBER_NODE_NEIGHB   100 /*!< Maximum number of neighbors any one node can have.
00091                                           Used to be 50 but that was not enough for a few
00092                                           funky FS surfaces. ZSS Mon Mar 24 16:14:12 EST 2003*/
00093 #define SUMA_MAX_OVERLAYS 50 /*!< Maximum number of color overlay planes allowed */
00094 #define SUMA_COMMAND_DELIMITER '|'
00095 #define SUMA_COMMAND_TERMINATOR '~'
00096 #define SUMA_PERSPECTIVE_NEAR   1.0   /*!< Z Near, distance from the viewer to the near clipping plane (for gluPerspective)*/
00097 #define SUMA_PERSPECTIVE_FAR      900 /*!< Z Far, distance from the viewer to the far clipping plane (for gluPerspective)*/
00098 #define SUMA_TESSCON_TO_MM       319.7 /*!< The mysterious Tesscon units */
00099 #define SUMA_TESSCON_DIFF_FLAG    1000   /*!< If aMaxDim - aMinDim > SUMA_TESSCON_DIFF_FLAG in a .iv file, scaling by SUMA_TESSCON_TO_MM is applied */
00100 
00101 #define SUMA_WriteCheckWait 400 /*!< Milliseconds to wait for each stream_writecheck call */ 
00102 #define SUMA_WriteCheckWaitMax 2000 /*!< Milliseconds to try and establish a good WriteCheck */
00103 
00104 #define SUMA_MAX_N_SURFACE_SPEC 20/*!< Maximum number of surfaces allowed in a spec file */
00105 
00106 #define SUMA_MEMTRACE_BLOCK 10000 /*!< Number of elements to allocate for when keeping track of allocated memory. If needed more space is reallocated with SUMA_MEMTRACE_BLOCK increments. */
00107 #define SUMA_MEMTRACE_FLAG 1    /*!< Flag to turn on(1) or off (0) the memory tracing capability */
00108 #define SUMA_PI 3.14159 
00109 #define SUMA_EPSILON 0.000001
00110 /*!
00111    Debugging flags
00112 */
00113 #define SUMA_NIML_WORKPROC_IO_NOTIFY 0  /*!< If set to 1 then SUMA_niml_workprocess will send a notification when InOut_Notify is ON
00114                                           You should keep it off unless you suspect a problem in that function. Otherwise
00115                                          you'll get many reports from the function making it difficult to see other messages. */
00116 #define SUMA_WORKPROC_IO_NOTIFY 0  /*!< Same as above but for SUMA_workprocess */
00117                                     
00118 typedef enum  { SUMA_NO_ANSWER, SUMA_YES, SUMA_NO, SUMA_HELP, SUMA_CANCEL, SUMA_YES_ALL, SUMA_NO_ALL, SUMA_WHAT_THE_HELL } SUMA_QUESTION_DIALOG_ANSWER; /* DO NOT CHANGE THE ORDER OF THE FIRST 4 */
00119 
00120 typedef enum  { SUMA_FT_NOT_SPECIFIED, SUMA_FREE_SURFER, SUMA_SUREFIT, SUMA_INVENTOR_GENERIC, SUMA_PLY, SUMA_VEC } SUMA_SO_File_Type;
00121 typedef enum { SUMA_FF_NOT_SPECIFIED, SUMA_ASCII, SUMA_BINARY, SUMA_BINARY_BE, SUMA_BINARY_LE } SUMA_SO_File_Format;
00122 typedef enum { NOPE, YUP} SUMA_Boolean;
00123 typedef enum {SO_type, AO_type, ROIdO_type, ROIO_type, GO_type, LS_type} SUMA_DO_Types;   /*!< Displayable Object Types 
00124                                                                                     S: surface, A: axis, G: grid, 
00125                                                                                     ROId: Region of interest drawn type,
00126                                                                                     LS_type: segment*/
00127 typedef enum {SUMA_SCREEN, SUMA_LOCAL} SUMA_DO_CoordType; /*!< Coordinate system that Displayable object is attached to
00128                                                                   SCREEN is for a fixed system, LOCAL is for a mobile system,
00129                                                                   ie one that is rotated by the mouse movements */
00130 typedef enum {SUMA_SOLID_LINE, SUMA_DASHED_LINE} SUMA_STIPPLE;
00131 
00132 typedef enum {SUMA_Button_12_Motion, SUMA_Button_2_Shift_Motion, SUMA_Button_1_Motion, SUMA_Button_2_Motion, SUMA_Button_3_Motion} SUMA_MOTION_TYPES; /*!< Types of mouse motion */
00133 
00134 typedef enum { SE_Empty, 
00135                SE_SetLookAt, SE_SetLookFrom, SE_Redisplay, SE_Home, SE_SetNodeColor, 
00136                SE_FlipLight0Pos, SE_GetNearestNode, SE_SetLookAtNode, SE_HighlightNodes, SE_SetRotMatrix, 
00137                SE_SetCrossHair, SE_ToggleCrossHair, SE_SetSelectedNode, SE_ToggleShowSelectedNode, SE_SetSelectedFaceSet,
00138                SE_ToggleShowSelectedFaceSet, SE_ToggleConnected, SE_SetAfniCrossHair, SE_SetAfniSurf, SE_SetForceAfniSurf, 
00139                SE_BindCrossHair, SE_ToggleForeground, SE_ToggleBackground, SE_FOVreset, SE_CloseStream4All, 
00140                SE_Redisplay_AllVisible, SE_RedisplayNow, SE_ResetOpenGLState, SE_LockCrossHair,
00141                SE_ToggleLockAllCrossHair, SE_SetLockAllCrossHair, SE_ToggleLockView, SE_ToggleLockAllViews, 
00142                SE_Load_Group, SE_Home_AllVisible, SE_Help, SE_Log, SE_UpdateLog, SE_SetRenderMode, SE_OpenDrawROI,
00143                SE_RedisplayNow_AllVisible, SE_RedisplayNow_AllOtherVisible,  SE_SetLight0Pos, SE_OpenColFileSelection,
00144                SE_SaveDrawnROIFileSelection, SE_OpenDrawnROIFileSelection,
00145                SE_BadCode} SUMA_ENGINE_CODE; /* DO not forget to modify SUMA_CommandCode */
00146                
00147 typedef enum { SEF_Empty, 
00148                SEF_fm, SEF_im, SEF_fv3, SEF_iv3, SEF_fv15, 
00149                SEF_iv15, SEF_i, SEF_f, SEF_s, SEF_vp, 
00150                SEF_cp, SEF_fp, SEF_ip, 
00151                SEF_BadCode} SUMA_ENGINE_FIELD_CODE; 
00152                
00153 typedef enum { SES_Empty,
00154                SES_Afni,  /*!< command from Afni directly which practically means that Srcp in EngineData is not SUMA_SurfaceViewer * . In the future, some Afni related pointer might get passed here. */
00155                SES_Suma,  /*!< command from Suma, which means that Srcp is a SUMA_SurfaceViewer * to the viewer making the command. */
00156                SES_SumaWidget,  /*!< command from a widget in Suma. Usually means, do not try to update widget ... */
00157                SES_SumaFromAfni,   /*!< command from Suma in response to a request from Afni. Srcp is still a SUMA_SurfaceViewer * but Afni, havin initiated the command should not receive the command back from Suma. Think cyclical cross hair setting... */
00158                SES_SumaFromAny,  /*!< Same concept as SES_SumaFromAfni but from generic program. */
00159                SES_Unknown} SUMA_ENGINE_SOURCE;
00160 
00161 typedef enum { SEI_WTSDS,  
00162                SEI_Head, SEI_Tail, SEI_Before, SEI_After, SEI_In,
00163                SEI_BadLoc } SUMA_ENGINE_INSERT_LOCATION;
00164                
00165 typedef enum { SUMA_byte, SUMA_int, SUMA_float, SUMA_double, SUMA_string} SUMA_VARTYPE;
00166 typedef enum {    SOPT_ibbb,  /*!< int, byte, byte, byte, null */
00167                   SOPT_ifff   /*!< int, float, float, float, null */
00168             } SUMA_OVERLAY_PLANE_TYPE; /*!< type of color plane data, letters code for 
00169                                             index red green blue and alpha values */
00170 
00171 
00172 
00173 typedef enum { SW_File, 
00174                SW_FileOpen, SW_FileOpenSpec, SW_FileOpenSurf, SW_FileClose, 
00175                SW_N_File } SUMA_WIDGET_INDEX_FILE; /*!< Indices to widgets under File menu. 
00176                                                       Make sure you begin with SW_File and end
00177                                                       with SW_N_File */
00178 typedef enum { SW_Tools,
00179                SW_ToolsDrawROI,
00180                SW_N_Tools } SUMA_WIDGET_INDEX_TOOLS; /*!< Indices to widgets under Tools menu. 
00181                                                       Make sure you begin with SW_Tools and end
00182                                                       with  SW_N_Tools*/
00183 typedef enum { SW_View, 
00184                SW_ViewSumaCont, SW_ViewSurfCont, SW_ViewViewCont, 
00185                SW_ViewSep1,
00186                SW_ViewCrossHair, SW_ViewNodeInFocus, SW_ViewSelectedFaceset,
00187                SW_N_View } SUMA_WIDGET_INDEX_VIEW; /*!< Indices to widgets under View menu. 
00188                                                       Make sure you begin with SW_View and end
00189                                                       with SW_N_View */
00190 typedef enum { SW_Help, 
00191                SW_HelpViewer,  SW_HelpMessageLog, SW_HelpSep1, SW_HelpIONotify,
00192                SW_HelpMemTrace,  
00193                SW_N_Help } SUMA_WIDGET_INDEX_HELP; /*!< Indices to widgets under Help menu.
00194                                                          Make sure you begin with SW_View and end
00195                                                          with SW_N_View */                                                   
00196 typedef enum { SW_SurfCont_Render,
00197                SW_SurfCont_RenderViewerDefault, SW_SurfCont_RenderFill, SW_SurfCont_RenderLine, SW_SurfCont_RenderPoints, 
00198                SW_N_SurfCont_Render } SUMA_WIDGET_INDEX_SURFCONT_RENDER; /*!< Indices to widgets in SurfaceController under
00199                                                                            RenderMode */
00200 typedef enum { SW_DrawROI_SaveMode,
00201                SW_DrawROI_SaveMode1D, SW_DrawROI_SaveModeNIML, 
00202                SW_N_DrawROI_SaveMode } SUMA_WIDGET_INDEX_DRAWROI_SAVEMODE; /*!< Indices to widgets in DrawROI under
00203                                                                            SavingMode */
00204 typedef enum { SW_DrawROI_SaveWhat,
00205                SW_DrawROI_SaveWhatThis, SW_DrawROI_SaveWhatRelated, 
00206                SW_N_DrawROI_SaveWhat } SUMA_WIDGET_INDEX_DRAWROI_SAVEWHAT; /*!< Indices to widgets in DrawROI under
00207                                                                            SavingWhat */
00208                                                                            
00209 
00210 typedef struct {
00211    int *i;  /*!< node index */
00212    float *r; /*!< node red */
00213    float *g; /*!< node green */
00214    float *b;/*!< node blue */
00215    int N; /*!< number of elements */
00216 }SUMA_IRGB; /*!< structure containing node colors */
00217 
00218 typedef struct {
00219    SUMA_OVERLAY_PLANE_TYPE Type; /*!< This variable determines the types of the variables below */
00220    SUMA_ENGINE_SOURCE Source; /*!< provenance of plane */
00221    void *i; /*!< Node index */
00222    void *r; /*!< Node red */
00223    void *g; /*!< Node green */
00224    void *b; /*!< Node blue */
00225    void *a; /*!< Node alpha */
00226    int N; /*!< number of elements in each vector above */
00227    float DimFact; /*!< global factor applied to each color */
00228    SUMA_Boolean Show; /*!< show plane ?*/
00229    float GlobalOpacity; /*!< Global opacity factor */
00230    SUMA_Boolean BrightMod; /*!< Brightness modulation */
00231 }  SUMA_OVERLAY_PLANE_DATA; /*!< This is a conveninence structure meant to carry data required to fill a color plane. 
00232                                  \sa SUMA_OVERLAYS*/
00233 
00234 typedef enum { SUMA_CMAP_UNDEFINED, SUMA_CMAP_RGYBR20,  SUMA_CMAP_nGRAY20,
00235                SUMA_CMAP_GRAY20, SUMA_CMAP_BW20, SUMA_CMAP_BGYR19, 
00236                SUMA_CMAP_MATLAB_DEF_BGYR64} SUMA_STANDARD_CMAP; /*!< Names of standard colormaps. RGYBR20 reads Red, Green, Yellow, Blue, Red, 20 colors total */
00237 
00238 typedef enum { SUMA_ROI_InCreation, SUMA_ROI_Finished, SUMA_ROI_InEdit} SUMA_ROI_DRAWING_STATUS;
00239 
00240 typedef enum { SUMA_ROI_OpenPath,   /*!< A collection of nodes that are topologically connected */
00241                SUMA_ROI_ClosedPath, /*!< A closed OpenPath */
00242                SUMA_ROI_FilledArea, /*!< A filled ClosePath */
00243                                     /* Preserve the order of the above three */
00244                SUMA_ROI_Collection  /*!< A collection of nodes */
00245             } SUMA_ROI_DRAWING_TYPE;  /*!< an ROI created by drawing (or other means)*/
00246 
00247 typedef enum { SUMA_BSA_Undefined, SUMA_BSA_AppendStroke, SUMA_BSA_AppendStrokeOrFill, SUMA_BSA_JoinEnds, SUMA_BSA_FillArea } SUMA_BRUSH_STROKE_ACTION; 
00248 
00249 typedef enum { SUMA_ROI_Undefined,
00250                SUMA_ROI_NodeGroup, /*!< A collection of nodes */
00251                SUMA_ROI_EdgeGroup, /*!< A collection of edges */
00252                SUMA_ROI_FaceGroup, /*!< A collection of Faces */
00253                SUMA_ROI_NodeSegment /*!< A series of connected nodes */
00254              } SUMA_ROI_TYPE; /* a generic types of ROI datums*/
00255 
00256 typedef enum { SXR_default, SXR_NP, SXR_Afni , SXR_Bonaire} SUMA_XRESOURCES;   /* flags for different X resources */
00257 
00258 typedef enum { SRM_ViewerDefault, SRM_Fill, SRM_Line, SRM_Points , SRM_N_RenderModes} SUMA_RENDER_MODES; /*!< flags for various rendering modes */
00259 
00260 #define SUMA_N_STANDARD_VIEWS  2 /*!< number of useful views enumerated in SUMA_STANDARD_VIEWS */
00261 typedef enum {   SUMA_2D_Z0, SUMA_3D, SUMA_Dunno} SUMA_STANDARD_VIEWS; /*!< Standard viewing modes. These are used to decide what viewing parameters to carry on when switching states 
00262                                                                   SUMA_2D_Z0 2D views, with Z = 0 good for flat surfaces
00263                                                                   SUMA_3D standard 3D view
00264                                                                   SUMA_Dunno used to flag errors leave this at the end 
00265                                                                   Keep in sync with SUMA_N_STANDARD_VIEWS*/
00266 typedef enum {   SUMA_No_Lock, SUMA_I_Lock, SUMA_XYZ_Lock, SUMA_N_Lock_Types}  SUMA_LINK_TYPES; /*!< types of viewer linking. Keep SUMA_N_Lock_Types at the end, it is used to keep track of the number of types*/
00267                                                                  
00268 typedef enum {  SWP_TOP_RIGHT, /*!< Position to the top right of reference */
00269                 SWP_BOTTOM_RIGHT_CORNER, 
00270                 SWP_TOP_LEFT,
00271                 SWP_POINTER /*!< Position centered to the pointer */
00272              } SUMA_WINDOW_POSITION; /*!< Types of relative window positions */
00273 
00274 typedef enum {    SAR_Undefined,
00275                   SAR_Fail, /*!< Failed action */
00276                   SAR_Succeed,
00277                }  SUMA_ACTION_RESULT;  
00278 
00279 typedef enum { SAP_Do,
00280                SAP_Undo,
00281                SAP_Redo,
00282             } SUMA_ACTION_POLARITY;               
00283 
00284 typedef struct {
00285    SUMA_ACTION_RESULT (*ActionFunction)(void *ActionData, SUMA_ACTION_POLARITY Pol); /*!< The function to call for performing the action */
00286    void *ActionData; /*!< The data to be passed to the function performing the action */
00287    void (*ActionDataDestructor)(void *Actiondata); /*!< The function to call that destroys ActionData */
00288 } SUMA_ACTION_STACK_DATA; /*!< a structure containing the data to form the element of the Action Stack element*/
00289 
00290 /*! structure to keep track of allocate memory */
00291 typedef struct {
00292    void **Pointers; /*!< vector of pointers for which memory was allocated */
00293    int *Size; /*!< vector of sizes of allocated memory blocks. Pointers[i] has Size[i] bytes allocated for it */
00294    int N_alloc; /*!< number of meaningful entries in Pointers and Size */
00295    int N_MaxPointers; /*!< Maximum number of elements allocated for in Pointers and Size */
00296 } SUMA_MEMTRACE_STRUCT;
00297 
00298 /*! structure containing a data block information */
00299 typedef struct {
00300    void *data;   /*!< pointer to data location */
00301    int N_link; /*!< number of links to data location */
00302    char ParentIDcode[SUMA_IDCODE_LENGTH]; /* IDcode of the creator of data */
00303 } SUMA_INODE;
00304 
00305 /*! Structure containing a color map */
00306 typedef struct {
00307    float ** M; /*!< N_Col x 3 matrix of R G B values (0..1) */
00308    int N_Col; /*!< number of colors in the color map */
00309    char *Name; /*!< Name of colormap */
00310 } SUMA_COLOR_MAP;
00311 
00312 /*! structure containing an ROI Plane's infor */ 
00313 typedef struct {
00314    char *name; /*!< name of plane and the indices of the ROIs that belong to it */
00315    DList *ROI_index_lst;   /*!< list of indices (into SUMA_DO * SUMAg_DOv) of 
00316                                SUMA_DRAWN_ROI * objects that belong to a certain 
00317                                plane. That sounds confusing now, I'm sure it'll 
00318                                sound clear a year from now */  
00319 } SUMA_ROI_PLANE;
00320 
00321 
00322 /*! Structure containing one color overlay */
00323 typedef struct {
00324    SUMA_Boolean Show; /*!< if YUP then this overlay enters the composite color map */
00325    char *Name; /*!< name of ovelay, CONVEXITY or Functional or areal boundaries perhaps. The Name can be a filename with path*/
00326    char *Label; /*!< Usually the same as Name without any existing path */
00327    int *NodeDef; /*!< nodes overwhich the colors are defined*/
00328    int N_NodeDef; /*!< total number of nodes specified in NodeDef*/
00329    int N_Alloc; /*!< You'd think this should be equal to NodeDef, but in instances where you may be receiving
00330              varying numbers of colors to the same plane, it's a pane to have to free and realloc space.
00331              So, while the juice is only up to N_NodeDef, the allocation is for N_Alloc */
00332    float **ColMat; /*!< N_NodeDef x 3 matrix containing colors of nodes specified in NodeDef */
00333    float GlobalOpacity; /*!< Opacity factor between 0 and 1 to apply to all values in ColMat */
00334    float *LocalOpacity; /*!< Opacity factor vector between 0 and 1 to apply to each individual node color */
00335    int PlaneOrder; /*!< Order of the overlay plane, 1st plane is 0 and is farthest away from the top */  
00336    SUMA_Boolean BrightMod; /*!< if YUP then colors overlaid on top of this plane have their 
00337                               brightness modulated by the average intensity of the colors in that 
00338                               plane see the function SUMA_Overlays_2_GLCOLAR4 for details. 
00339                               In other obscure words, if YUP then plane is part of background.*/  
00340 } SUMA_OVERLAYS;
00341 
00342 /*! a structure holding the options for the function SUMA_ScaleToMap 
00343 \sa SUMA_ScaleToMapOptInit to allocate and initialize such a structure 
00344 to free this structure use the free function
00345 */
00346 typedef struct {
00347    SUMA_Boolean ApplyMask; /*!< if YUP then values that fall in MaskRange are assigned the color in MaskColor */
00348    float MaskRange[2]; /*!< values between MaskRange[0] and MaskRange[1] (inclusive) are assigned MaskColor */
00349    float MaskColor[3]; /*!< color to assign to masked nodes */
00350    SUMA_Boolean ApplyClip; /*!< if YUP then values that range clipping using Range is applied */
00351    float ClipRange[2]; /*!< nodes with values <= Range[0] are given the first color in the color map, values >= Range[1] get the last color in the map */
00352    float BrightFact; /*!< a brightness factor to apply to the color map. This factor is applied to the colors in the colormap and the mask colors*/
00353 } SUMA_SCALE_TO_MAP_OPT;
00354 
00355 /*! structure containing the color mapping of a vector */
00356 typedef struct {
00357    float **cM; /*!< N_Node x 3 matrix containing the colors at each node*/
00358    int N_Node; /*!< obvious */
00359    SUMA_Boolean *isMasked; /*!< if isMasked[i] then node i has a mask color associated with it */ 
00360 } SUMA_COLOR_SCALED_VECT;
00361 
00362 
00363 
00364 
00365 /*! TRY TO MAKE DO WITHOUT THIS THING, IF POSSIBLE. 
00366 It is a pain to work with two types of ROI structues 
00367 structure to hold an ROI */
00368 typedef struct { 
00369    SUMA_ROI_TYPE Type;   /*!< The type of ROI */
00370    
00371    char *idcode_str;    /*!< unique idcode for ROI */
00372    char *Parent_idcode_str; /*!< idcode of parent surface */
00373    char *Label; /*!< ascii label for ROI */
00374 
00375    int *ElInd; /*!< pointer to vector containing indices into the parent surface (SO has Parent_idcode_str) of ROI elements.
00376                            If Type is SUMA_ROI_NodeGroup then ElementIndex contains indices to SO->NodeList .
00377                            If Type is SUMA_ROI_FaceGroup then ElementIndex contains indices to SO->FaceList.
00378                            If Type is SUMA_ROI_EdgeGroup then ElementIndex contains indices to SO->EL->EL. */
00379    int N_ElInd; /*!< Number of elements in ElementIndex */ 
00380 } SUMA_ROI; 
00381 
00382 
00383 
00384 typedef struct {
00385    SUMA_ROI_TYPE Type; /*!< Type of ROI in datum */
00386    int N_n; /*!< Number of elements in nPath */
00387    int N_t; /*!< Number of elements in tPath */
00388    int *nPath; /*!< Vector of N node indices. These nodes must be immediate (linked) neighbours of each other */
00389    int *tPath; /*!< Vector of N triangle indices. These triangles must be connected to each other */
00390    float tDistance; /*!< distance from the first node to the last taken along the surface (geodesic)*/
00391    float nDistance; /*!< distance from the first node to the last by summing the length of segments between nodes */
00392    SUMA_BRUSH_STROKE_ACTION action; /*!< a record of the action that went with this datum. 
00393                                        This field is used to recreate the ROI drawing history from a saved
00394                                        niml file */
00395 } SUMA_ROI_DATUM; /*!< elementary datum of a drawn ROI */
00396 
00397 /*! 
00398 I do not think we can have both nodes and triangles in this struct.
00399 I guess I can make this be a Node Datum then create a similar struct
00400 for triangle Datum and add them to SUMA_NIML_DRAWN_ROI.
00401 If you do something like this rename:
00402 SUMA_NIML_ROI_DATUM to SUMA_NIML_NODE_ROI_DATUM
00403 Will the file niml.h no longer be in afni_src directory ?
00404 */
00405 typedef struct {
00406    int action; /*!< action taken with this datum, see same field in SUMA_ROI_DATUM */
00407    int Type; /*!< describes the type of the DrawnROI datum (see SUMA_ROI_TYPE) */
00408    int N_n; 
00409    int *nPath;
00410 /* int Type;
00411    int N_t;
00412    int *tPath; */
00413 } SUMA_NIML_ROI_DATUM; /*!< a version of SUMA_ROI_DATUM struct that can be used by niml. */
00414 
00415 #define SUMA_MAX_ROI_CTRL_NODES 100 /*!< Maximum number of control nodes in an ROI */
00416 #define SUMA_MAX_ROI_CTRL_NODES3 300 
00417 #define SUMA_MAX_ROI_ON_SURFACE 100 /*!< Maximum number of ROIs Drawn on a surface */
00418 
00419 typedef struct {   
00420    int n1;  /*!<index of edge's first node */
00421    int n2; /*!<index of edge's second node */
00422 } SUMA_CONTOUR_EDGES; /*<! structure defining an edge by the nodes forming it*/
00423 
00424 /*! structure to hold the drawing of an ROI */
00425 typedef struct {   
00426    SUMA_ROI_DRAWING_TYPE Type;   /*!< The type of ROI drawn, that would be closed path, etc, etc, */
00427 
00428    char *idcode_str;    /*!< unique idcode for ROI */
00429    char *Parent_idcode_str; /*!< idcode of parent surface */
00430    char *Label; /*!< ascii label for ROI */ 
00431    char *ColPlaneName;  /*!< Name of color plane that the ROI is painted in.
00432                      If this field is set to NULL then the ROI will be painted
00433                      in the generic ROI_Plane plane. For the moment, NULL is the only
00434                      option */
00435    float FillColor[3];  /*!< RGB fill color */
00436    float EdgeColor[3];  /*!< RGB edge color */
00437    int EdgeThickness;   /*!< thickness of edge */
00438    int iLabel; /*!< An integer value, another way to represent a Label */
00439    SUMA_ROI_DRAWING_STATUS DrawStatus; /*!< Status of the ROI being drawn, finished, being drawn, being edited, etc. */
00440 
00441    DList *ROIstrokelist;   /*!< a doubly linked list with the data element being a (void *)SUMA_ROI_DATUM * */
00442 
00443    DList *ActionStack; /*!< a stack containing the various actions performed*/
00444    DListElmt *StackPos; /*!< The element of ActionStack that represents the current position */
00445    
00446    int N_CE; /*!< number of contour edges */
00447    SUMA_CONTOUR_EDGES *CE; /*!< a vector of edges that form the contour of the ROI */
00448 } SUMA_DRAWN_ROI;
00449 
00450 typedef struct {
00451    int Type;         /*!< The final type of the DrawnROI, see SUMA_ROI_DRAWING_TYPE*/
00452    char *idcode_str;
00453    char *Parent_idcode_str;
00454    char *Label;
00455    char *ColPlaneName;
00456    float FillColor[3];  /*!< RGB fill color */
00457    float EdgeColor[3];  /*!< RGB edge color */
00458    int EdgeThickness;   /*!< thickness of edge */
00459    int iLabel;
00460    SUMA_NIML_ROI_DATUM *ROI_datum; /*!< a vector of ROI data (a multitude of ROI datum) */
00461    int N_ROI_datum;
00462 } SUMA_NIML_DRAWN_ROI; /*!< a version of SUMA_DRAWN_ROI struct that can be used by niml.
00463                            Fields are a reflection of those in SUMA_DRAWN_ROI*/
00464 typedef struct {
00465    int Type;         /*!< The final type of the DrawnROI, see SUMA_ROI_DRAWING_TYPE*/
00466    char *idcode_str;
00467    char *Parent_idcode_str;
00468    char *Label;
00469    int *iNode; /*!< A node's index */
00470    int *iLabel; /*!< A node's value */
00471    int N; /*!< NUmber of elements in iNode and iLabel */
00472 } SUMA_1D_DRAWN_ROI; /*!< a version of SUMA_DRAWN_ROI struct that can be used by 1D functions.
00473                      Fields are a reflection of those in SUMA_DRAWN_ROI*/
00474 
00475 typedef struct {
00476    SUMA_ROI_DATUM *ROId;
00477    SUMA_DRAWN_ROI *DrawnROI;
00478 } SUMA_ROI_ACTION_STRUCT;  /*!< a structure packaging data for the routines acting on drawn ROIs */
00479 
00480 
00481 
00482 
00483 /*! 
00484 Stucture to hold the contents of the specs file 
00485 */
00486 typedef struct {
00487    char SurfaceType[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_LABEL_LENGTH];
00488    char SurfaceFormat[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_LABEL_LENGTH]; 
00489    char SureFitTopo[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_NAME_LENGTH];
00490    char SureFitCoord[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_NAME_LENGTH];
00491    char MappingRef[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_NAME_LENGTH];
00492    char SureFitVolParam[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_NAME_LENGTH];
00493    char FreeSurferSurface[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_NAME_LENGTH];
00494    char InventorSurface[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_NAME_LENGTH];
00495    char VolParName[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_NAME_LENGTH]; 
00496    char *IDcode[SUMA_MAX_N_SURFACE_SPEC];
00497    char State[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_LABEL_LENGTH];
00498    char Group[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_NAME_LENGTH];
00499    char SurfaceLabel[SUMA_MAX_N_SURFACE_SPEC][SUMA_MAX_NAME_LENGTH];
00500    int EmbedDim[SUMA_MAX_N_SURFACE_SPEC];
00501    int N_Surfs;
00502    int N_States;
00503    int N_Groups;
00504    char StateList[SUMA_MAX_N_SURFACE_SPEC*100];
00505    char SpecFilePath[SUMA_MAX_DIR_LENGTH];
00506 } SUMA_SurfSpecFile;
00507 
00508 /*! structure that containing node's first order neighbors */
00509 typedef struct {
00510    int N_Node; /*!< Number of nodes whose neighbors are listed in this structure */
00511    int *NodeId; /*!< Id of each node whose neighbors are listed in this structure */
00512    int **FirstNeighb; /*!< N_Node x N_Neighb_max matrix with each row specifying the indices of neighboring nodes.
00513                         After Tue Jan  7 18:13:44 EST 2003: The nodes are now ordered to form a path on the surface.
00514                         Note: There is no guarantee that the path is closed. */
00515    int *N_Neighb; /*!< maximum number of neighbors for a particular node */
00516    int N_Neighb_max; /*!< maximum number of neighbors of all nodes */
00517 } SUMA_NODE_FIRST_NEIGHB;
00518 
00519 /*! structure that contains faceset's first order neighbors */
00520 typedef struct {
00521    int N_FaceSet; /*!< Number of nodes whos neighbors are listed in this structure */
00522    int **FirstNeighb; /*!< N_Node x N_Neighb_max matrix with each row specifying the indices of neighboring facesets */
00523    int *N_Neighb; /*!< maximum number of neighbors for a particular faceset */
00524    int N_Neighb_max; /*!< maximum number of neighbors of all facesets */
00525    int N_Neighb_min; /*!< minimum number of neighbors of all facesets */
00526 } SUMA_FACESET_FIRST_EDGE_NEIGHB;
00527 
00528 /*!
00529    structure containing surface curvature parameters
00530 */
00531 typedef struct {
00532    int N_Node; /*!< Number of nodes in the surface */
00533    float **T1; /*!< N_Node x 3 matrix with each row specifying the 1st principal direction of the surface */
00534    float **T2; /*!< N_Node x 3 matrix with each row specifying the 2nd principal direction of the surface */
00535    float *Kp1; /*!< N_Node x 1 vector with each row specifying the curvature along the 1st principal direction */
00536    float *Kp2; /*!< N_Node x 1 vector with each row specifying the curvature along the 2nd principal direction */
00537    int N_SkipNode; /*!< number of nodes for which the curvature could not be computed */
00538 } SUMA_SURFACE_CURVATURE;
00539 
00540 
00541 /*! 
00542    structure containing the edges that make up a triangular faceset list
00543 
00544 */
00545 typedef struct {
00546    int ** EL; /*!< pointer to where the Edge List ( N_EL x 2 ) will be placed
00547                         each row is an edge, i1 i2 where i1 is always <= i2
00548                         EL is sorted by row */
00549    int ** ELps; /*!< pointer to where the Edge List Property matrix ( N_EL x 2 )will be placed 
00550                         1st column, row i = 1 means edge i: i1,i2 was encountered as i2->i1 in the triangle J (so it was flipped when stored in EL)
00551                                           = -1 means edge i: i1,i2 was encountered as i1->i2 in the triangle J (so no flipping was done to store it in EL)
00552                         2nd column, row i = J is the triangle ( FL[J] ) that the segment belongs to. 
00553                         3rd column, row i = Numer of triangles that contain this edge. This number is positive for the first occurence
00554                         of the edge in EL, it is -1 afterwards. A decent edge has 2 hosting triangles, an edge edge
00555                         has 1 hosting triangle. Bad edges come in all other colors*/
00556                         
00557    int *ELloc; /*!< k x 1 vector that stores where each node's listing begins. 
00558                      ELloc is used to quickly find a certain edge in EL
00559                      to find the edge formed by nodes na-nb
00560                      find the minimum of na and nb (say it's nb)
00561                      the first reference of an edge containing nb starts at EL(ELloc(nb),:)
00562                      NOTE: ELloc contains an entry for each node in FaceSetList, except the 
00563                      largest node index since that's never in the 
00564                      first column of EL */
00565                      
00566    int N_EL; /*!< Number of segments = 3 * N_Facesets */
00567    int max_N_Hosts; /*!< Maximum number of triangle hosts any one edge has (max ( ELps(:,2) != -1 ) )*/
00568    int  min_N_Hosts; /*!< Minimum version of max_N_Hosts */
00569    
00570    int **Tri_limb; /*!< each row j of Tri_limb contains the indices into EL (and ELps) of the edges that make it up */
00571    float *Le; /*!< Vector N_EL elements long containing the length of each edge in EL */
00572    
00573 } SUMA_EDGE_LIST;
00574 
00575 /*! structure that contains array pointers from function SUMA_isinbox */
00576 #define SUMA_isinbox_struct
00577 typedef struct {
00578    int *IsIn; /*!< Indices of nodes inside the box */
00579    int nIsIn; /*!< Number of nodes inside the box */
00580    float *d; /*!< Distance of each node to the center of the box */
00581    float **dXYZ; /*!< Not implemented */
00582 } SUMA_ISINBOX;
00583 
00584 /*! structure that contains array pointers from function isinsphere */
00585 #define SUMA_isinsphere_struct
00586 typedef struct {
00587    int *IsIn;  /*!< Indices of nodes inside the sphere */
00588    int nIsIn; /*!< Number of nodes inside the sphere */
00589    float *d;  /*!< Not implemented Distance of each node to the center of the shpere */
00590    float **dXYZ; /*!< Not implemented */
00591 } SUMA_ISINSPHERE;
00592 
00593 /*! Displayable Object Type */
00594 typedef struct {
00595    void *OP;   /*!< Object Pointer */
00596    SUMA_DO_Types ObjectType; /*!< Type of displayable object */
00597    SUMA_DO_CoordType CoordType; /*!< Type of coordinate system that the object is attached to
00598                                     This is used to determine whether the object is drawn before or 
00599                                     or after the shift and rotation matrices are applied */
00600 } SUMA_DO;
00601 
00602 /*! string stucture 
00603 */
00604 typedef struct {
00605    int N_alloc;  /*!< space allocated for s */
00606    char *s; /*!< string s */
00607 } SUMA_STRING;
00608 
00609 /*! structure containing widgets for surface viewer controllers ViewCont */
00610 typedef struct {
00611    Widget TopLevelShell;/*!< Top level shell for a viewer's controller */
00612 }SUMA_X_ViewCont;
00613 
00614 typedef struct {
00615    Widget toplevel;  /*!< toplevel widget of the text display window */
00616    Widget text_w; /*!<  text widget containing string to be displayed */
00617    Widget search_w;  /*!< widget of string search field */
00618    Widget text_output;  /*!< widget of search result field */
00619    SUMA_Boolean case_sensitive;  /*!< Case sensitive widget search */
00620    SUMA_Boolean allow_edit; /*!< allow editing of text displayed*/
00621    void (*OpenCallBack)(void *data); /*!< call back performed when SUMA_CreateTextShell is entered */
00622    void * OpenData;  /*!< data sent along with OpenCallBack */
00623    void (*DestroyCallBack)(void *data);   /*!< call back performed when SUMA_DestroyTextShell is entered */
00624    void * DestroyData; /*!< data sent along with DestroyCallBack */
00625    SUMA_Boolean CursorAtBottom; /*!< If YUP then cursor is positioned at end of text field */
00626 } SUMA_CREATE_TEXT_SHELL_STRUCT; /*!< structure containing options and widgets for the text shell window */
00627 
00628 typedef enum {SUMA_OK_BUTTON, SUMA_APPLY_BUTTON, 
00629                SUMA_CLEAR_BUTTON, SUMA_CANCEL_BUTTON, 
00630                SUMA_HELP_BUTTON, SUMA_N_PROMPT_BUTTONS }SUMA_PROMPT_BUTTONS;
00631 
00632 typedef enum { SUMA_OK, SUMA_OK_HELP, 
00633                SUMA_OK_CANCEL, SUMA_OK_CANCEL_HELP,
00634                SUMA_OK_CLEAR_CANCEL, SUMA_OK_CLEAR_CANCEL_HELP,
00635                SUMA_OK_APPLY_CANCEL, SUMA_OK_APPLY_CANCEL_HELP,
00636                SUMA_OK_APPLY_CLEAR_CANCEL, SUMA_OK_APPLY_CLEAR_CANCEL_HELP} SUMA_PROMPT_MODE;
00637                
00638 typedef struct {
00639    SUMA_PROMPT_MODE Mode;
00640    SUMA_PROMPT_BUTTONS default_button; /*!< button to call when return key is hit in the text field.*/
00641    void (*SelectCallback)(char *selection, void *data); /*!< function called when a selection is made 
00642                                             See note for Preserve field*/
00643    void *SelectData; /*!< data sent along to SelectCallback */
00644    void (*CancelCallback)(void *data); /*!< function called when cancel or kill is called */
00645    void *CancelData; /*!< data sent along to CancelCallback */
00646    void (*HelpCallback)(void *data);
00647    void (*HelpData);
00648    SUMA_Boolean (*VerifyFunction)(char *word, void *data);
00649    void (*VerifyData); 
00650    Widget actionarea;
00651    Widget pane;
00652    Widget dialog; /*!< widget of dialog */
00653    Widget daddy; /*!< widget of parent */ 
00654    Widget text_w; /*!< Text entry widget */
00655    char *selection; /*!< What the lame user wrote */
00656    char *label; /*!< Label for the text field */
00657    SUMA_Boolean preserve; 
00658 } SUMA_PROMPT_DIALOG_STRUCT; /*!< \sa similar fields in SUMA_SELECTION_DIALOG_STRUCT */
00659 
00660 typedef enum { SUMA_FILE_OPEN, SUMA_FILE_SAVE } SUMA_FILE_SELECT_MODE; /*!< mode of file selection dialog */
00661 
00662 typedef struct {
00663    SUMA_FILE_SELECT_MODE Mode; 
00664    void (*SelectCallback)(char *filename, void *data); /*!< function called when a selection is made 
00665                                             See note for Preserve field*/
00666    void *SelectData; /*!< data sent along to SelectCallback */
00667    void (*CancelCallback)(void *data); /*!< function called when cancel or kill is called */
00668    void *CancelData; /*!< data sent along to CancelCallback */
00669    Widget dlg_w; /*!< widget of dialog */
00670    Widget daddy; /*!< widget of parent */
00671    char *filename; /*!< selected filename. 
00672                NOTE: This is only valid when a selection has been made */
00673    char *FilePattern; /*!< Pattern for filename filtering
00674                            Only relevant when window is opened */
00675    SUMA_Boolean preserve; /*!< If YUP, then widget is only unmanaged when 
00676                               selection is made or cancel is pressed. In 
00677                               this case, you should take care of dlg's safekeeping
00678                               and eventual destruction.
00679                               If Nope, then the widget is destroyed after selection
00680                               and/or cancel and the dlg structure is destroyed.
00681                               Be careful, if Preserve is NOPE, that your callbacks
00682                               do not return before being done with this structure*/ 
00683 } SUMA_SELECTION_DIALOG_STRUCT;
00684 
00685 /*!
00686    Structure containing widgets and settings of an arrow and or a text field
00687 */ 
00688 typedef struct {
00689    Widget rc;  /*!< rowcolumn containing all the widgets of the arrow field */
00690    Widget textfield;  /*! text label */
00691    Widget up;     /*!< up arrow */
00692    Widget down;   /*!< down arrow */
00693    Widget label;  /*!< label widget */
00694    
00695    float step; /*!< increment */
00696    float min;  /*!< minimum value */
00697    float max;  /*!< maximum value */
00698    SUMA_Boolean wrap; /*!< YUP: wrap value in min-max range, else clip it*/
00699    float value;   /*!< current value */
00700    int cwidth; /*!< charcter spaces to save for widget */
00701    SUMA_VARTYPE type; /*!< SUMA_int or SUMA_float or SUMA_string */
00702    int direction; /*!< +1 up, -1 down */
00703    
00704    XtIntervalId arrow_timer_id; /*!< time out process id */
00705    
00706    void (*NewValueCallback)(void *data); /*!< callback to make when a new value is set */
00707    void *NewValueCallbackData; 
00708    SUMA_Boolean modified; /*!< set to YUP when user edits the value field */
00709    SUMA_Boolean arrow_action; /*!< set to YUP when user clicks one of the arrows */
00710 } SUMA_ARROW_TEXT_FIELD;
00711 
00712 typedef enum {
00713    SUMA_LSP_SINGLE, SUMA_LSP_BROWSE, SUMA_LSP_MULTIPLE, SUMA_LSP_EXTENDED
00714 }  SUMA_ListSelectPolicy; /*!< Flags for motif list selection policy */
00715 
00716 typedef struct {
00717    char ** clist; /*!< strings displayed in the Scrolled list window */
00718    int N_clist; /*!< Number of strings in clist */
00719    void **oplist; /*!< list of pointers to objects in the scrolled list */
00720 } SUMA_ASSEMBLE_LIST_STRUCT;
00721 
00722 /*!
00723    Structure containing widgets and settings for a list widget 
00724 */
00725 typedef struct {
00726    Widget toplevel; /*!< top level shell for list */
00727    Widget rc;  /*!< rowcolumn containing all the widgets of the scrolled list */
00728    Widget list; /*!< list widget */
00729    
00730    Widget PosRef; /*!< Widget relative to which list is positioned */
00731    SUMA_WINDOW_POSITION Pos; /*! Position of list relative to PosRef*/
00732    SUMA_ListSelectPolicy SelectPolicy; /*!< Sets the XmNselectionPolicy resource:
00733                           SUMA_LSP_SINGLE: XmSINGLE_SELECT, 
00734                           SUMA_LSP_BROWSE: XmBROWSE_SELECT, 
00735                           SUMA_LSP_MULTIPLE: XmMULTIPLE_SELECT, 
00736                           SUMA_LSP_EXTENDED: XmEXTENDED_SELECT */
00737    SUMA_Boolean ShowSorted; /*!< Sort the list in alphabetical order */
00738    SUMA_Boolean RemoveDups; /*!< Remove duplicates in list */                        
00739    void (*Default_cb)(Widget w, XtPointer data, XtPointer calldata); /*!< callback to make when a default selection mode is made */ 
00740    void *Default_Data; /*!< pointer to data to go with Default_cb. If you pass NULL, the pointer to the List Widget is sent */
00741    void (*Select_cb)(Widget w, XtPointer data, XtPointer calldata); /*!< callback to make when a selection is made */ 
00742    void *Select_Data; /*!< pointer to data to go with Select_cb. If you pass NULL, the pointer to the List Widget is sent */
00743    void (*CloseList_cb)(Widget w, XtPointer data, XtPointer calldata); /*!< callbak to make when a selection is made */
00744    void *CloseList_Data; /*!< pointer to data to go with CloseList_cb. If you pass NULL, the pointer to the List Widget is sent */
00745    char *Label;
00746    SUMA_Boolean isShaded; /*!< YUP if the window is minimized or shaded, NOPE if you can see its contents */
00747    
00748    SUMA_ASSEMBLE_LIST_STRUCT *ALS; /*!< structure containing the list of strings shown in the widget and the pointers 
00749                                        of the objects the list refers to*/  
00750 } SUMA_LIST_WIDGET;
00751 
00752 /*! structure containing widgets for surface  controllers SurfCont */
00753 typedef struct {
00754    Widget TopLevelShell;/*!< Top level shell for a Surface's controller */
00755    Widget PosRef; /*!< reference position widget */
00756    Widget Mainform; /*!< main form, child of TopLevelShell */
00757    Widget SurfInfo_pb; /*!< More info push button */
00758    SUMA_CREATE_TEXT_SHELL_STRUCT * SurfInfo_TextShell; /*!< structure containing widgets and options of the surface info text shell */
00759    Widget RenderModeMenu[SW_N_SurfCont_Render]; /*!< vector of widgets controlling the rendering mode menu */
00760    Widget ColPlane_fr; /*!< the frame controlling the colorplanes */
00761    SUMA_ARROW_TEXT_FIELD *ColPlaneOrder; /*!< structure for arrow/text field widget controlling color plane order */
00762    SUMA_ARROW_TEXT_FIELD *ColPlaneOpacity; /*!< structure for arrow/text field widget controlling color plane opacity */
00763    Widget ColPlaneShow_tb; /*!< show/hide color plane */
00764    SUMA_LIST_WIDGET *SwitchColPlanelst; /*!< a structure containing widgets and options for the switch color plane list */
00765    Widget ColPlaneLabel_Parent_lb;
00766    SUMA_OVERLAYS *curColPlane; /*!< a copy of the pointer to the selected color plane */
00767 }SUMA_X_SurfCont;
00768 
00769 typedef struct {
00770    int N_rb_group; /*!< number of radio buttons in group */
00771    int N_but; /*!< number of buttons per radio button group */
00772    Widget *tb; /*!< vector of N_rb_group * N_but toggle button widgets */
00773    Widget *rb; /*!< vetor of N_rb_group radio box widget */
00774    Widget arb; /*!< widget of radiobox for all lock buttons */
00775    Widget *atb; /*!< widget of toggle buttons in arb */
00776 }SUMA_rb_group;
00777 
00778 /*! structure containing widgets for Suma's controller SumaCont */
00779 typedef struct {
00780    Widget AppShell; /*!< AppShell widget for Suma's controller */
00781    Widget quit_pb; /*!< quit push button */
00782    SUMA_Boolean quit_first;   /*!< flag indicating first press of done button */
00783    SUMA_rb_group *Lock_rbg; /*!< pointer to structure contining N radio button groups */
00784    Widget *LockView_tbg;   /*!< vector of toggleview buttons */
00785    Widget LockAllView_tb;  /*!< widget of toggleAllview button */
00786 }SUMA_X_SumaCont;
00787 
00788 
00789 /*! structure containing widgets and data for the DrawROI window*/
00790 typedef struct {
00791    Widget AppShell; /*!< AppShell widget for the DrawROI window*/ 
00792    Widget DrawROImode_tb; /*!< widget for toggling draw ROI mode */
00793    Widget ParentLabel_lb; /*!< widget for specifying a label for the parent surface */ 
00794    Widget Redo_pb;
00795    Widget Undo_pb;
00796    Widget Save_pb;
00797    Widget Load_pb;
00798    Widget Close_pb;
00799    Widget Finish_pb;
00800    Widget Join_pb;
00801    Widget Delete_pb;
00802    SUMA_Boolean Delete_first; /*! Flag indicating putton has been pressed for the first time */
00803    SUMA_ARROW_TEXT_FIELD *ROIval; /*!< pointer to arrow field */
00804    SUMA_ARROW_TEXT_FIELD *ROIlbl; /*!< pointer to text field */
00805    SUMA_DRAWN_ROI *curDrawnROI; /*!< A pointer to the DrawnROI structure currently in use by window.
00806                                     This is a copy of another pointer, NEVER FREE IT*/
00807    SUMA_LIST_WIDGET *SwitchROIlst; /*!< a structure containing widgets and options for the switch ROI list */
00808    int SaveWhat;  /*!< option for determining what ROI to save, acceptable values are in SUMA_WIDGET_INDEX_DRAWROI_SAVEWHAT */
00809    int SaveMode;  /*!< option for determining format of ROI to save, acceptable values are in SUMA_WIDGET_INDEX_DRAWROI_SAVEMODE */ 
00810    Widget SaveModeMenu[SW_N_DrawROI_SaveMode]; /*!< set of widgets for SaveMode menu */
00811    Widget SaveWhatMenu[SW_N_DrawROI_SaveWhat]; /*!< set of widgets for SaveWhat menu */
00812 } SUMA_X_DrawROI;
00813 
00814                
00815                
00816 /*! structure containg X vars for surface viewers*/
00817 typedef struct {
00818    Display *DPY; /*!< display of toplevel widget */
00819    Widget TOPLEVEL, FORM, FRAME, GLXAREA;
00820    XVisualInfo *VISINFO;
00821    GLXContext GLXCONTEXT;
00822    Colormap CMAP;
00823    Bool DOUBLEBUFFER;
00824    char *Title; 
00825    int REDISPLAYPENDING;
00826    int WIDTH, HEIGHT;
00827    XtWorkProcId REDISPLAYID;
00828    XtIntervalId MOMENTUMID;
00829    GC gc;
00830    SUMA_X_ViewCont *ViewCont; /*!< pointer to structure containing viewer controller widget structure */
00831    Widget ToggleCrossHair_View_tglbtn; /*!< OBSOLETE Toggle button in View-> menu */
00832    Widget FileMenu[SW_N_File]; /*!< Vector of widgets under File Menu */       
00833    Widget ToolsMenu[SW_N_Tools]; /*!< Vector of widgets under File Menu */       
00834    Widget ViewMenu[SW_N_View]; /*!< Vector of widgets under View Menu */
00835    Widget HelpMenu[SW_N_Help]; /*!< Vector of widgets under Help Menu */
00836    SUMA_PROMPT_DIALOG_STRUCT *LookAt_prmpt; /*!< structure for the LookAt dialog */
00837    SUMA_PROMPT_DIALOG_STRUCT *JumpIndex_prmpt; /*!< structure for the Jump To Index dialog */
00838    SUMA_PROMPT_DIALOG_STRUCT *JumpXYZ_prmpt; /*!< structure for the Jump To XYZ dialog */
00839    SUMA_PROMPT_DIALOG_STRUCT *JumpFocusNode_prmpt; /*!< structure for setting the Focus Node dialog */
00840    SUMA_PROMPT_DIALOG_STRUCT *JumpFocusFace_prmpt; /*!< structure for setting the Focus FaceSet dialog */
00841    SUMA_PROMPT_DIALOG_STRUCT *HighlightBox_prmpt; /*!<  structure for highlighting nodes in Box dialog */ 
00842 }SUMA_X;
00843 
00844 /*! structure containg X vars common to all viewers */
00845 typedef struct {
00846    SUMA_X_SumaCont *SumaCont; /*!< structure containing widgets for Suma's controller */
00847    SUMA_X_DrawROI *DrawROI; /*!< structure containing widgets for DrawROI window */
00848    XtAppContext App; /*!< Application Context for SUMA */
00849    Display *DPY_controller1; /*!< Display of 1st controller's top level shell */
00850    SUMA_XRESOURCES X_Resources; /*!< flag specifying the types of resources to use */
00851    SUMA_CREATE_TEXT_SHELL_STRUCT *Help_TextShell; /*!< structure containing widgets and options of SUMA_help window */
00852    SUMA_CREATE_TEXT_SHELL_STRUCT *Log_TextShell; /*!<  structure containing widgets and options of SUMA_log window */
00853    SUMA_SELECTION_DIALOG_STRUCT *FileSelectDlg; /*!< structure containing widgets and options of a generic file selection dialog */
00854 }SUMA_X_AllView;
00855 
00856 /*! filename and path */
00857 typedef struct {
00858    char *Path;
00859    char *FileName;
00860 }SUMA_FileName;
00861 
00862 /*! filename, extension and path */
00863 typedef struct {
00864    char *Path;
00865    char *FileName;
00866    char *FileName_NoExt;
00867    char *Ext;
00868 }SUMA_PARSED_NAME;
00869 
00870 
00871 /*! structure defining a cross hair */
00872 typedef struct {   
00873    GLfloat XaxisColor[4] ;
00874    GLfloat YaxisColor[4] ;
00875    GLfloat ZaxisColor[4] ;
00876    
00877    GLfloat LineWidth;
00878    SUMA_STIPPLE Stipple; /*!< dashed or solid line */
00879 
00880    GLfloat c[3]; /*!< Cross Hair center */
00881    GLfloat r; /*!< Cross Hair radius */
00882    GLfloat g; /*!< 1/2 of gap between center and ray (should be less than radius/2) */
00883    
00884    SUMA_Boolean ShowSphere; /*!< YUP/NOPE, starting to regret this. */
00885    GLUquadricObj *sphobj; /*!< quadric object, representing central sphere */
00886    GLfloat sphcol[4]; /*!< Sphere color */
00887    GLdouble sphrad; /*!< Sphere radius */
00888    GLint slices; /*!< think pizza */
00889    GLint stacks; /*!< think lattitudes */
00890    
00891    int SurfaceID; /*!< If the cross hair is tied to a surface, SurfaceID contains the index into SUMAg_DOv of that surface. -1 if that cross hair is wild and loose */
00892    int NodeID; /*!< a node from SurfaceID can be associated with the cross hair (-1 for nothing) */
00893 }SUMA_CrossHair;   
00894 
00895 typedef struct {      
00896    GLUquadricObj *sphobj; /*!< quadric object, representing central sphere */
00897    GLfloat sphcol[4]; /*!< Sphere color */
00898    GLdouble sphrad; /*!< Sphere radius */
00899    GLint slices; /*!< think pizza */
00900    GLint stacks; /*!< think lattitudes */
00901    GLfloat c[3]; /*!< center of Sphere Marker */
00902 }SUMA_SphereMarker;   
00903 
00904 typedef struct {
00905    GLfloat n0[3]; /*!< Node 1 XYZ*/
00906    GLfloat n1[3]; /*!< Node 2 XYZ*/
00907    GLfloat n2[3]; /*!< Node 3 XYZ*/
00908    GLfloat LineWidth; /*!< LineWidth of Edge*/
00909    GLfloat LineCol[4]; /*!< LineColor of Edge*/
00910    GLfloat NormVect[3]; /*!< normal vector of faceset, two triangles are drawn at a small distance from the selected FaceSet */
00911 }SUMA_FaceSetMarker;
00912 
00913 /*!
00914    Structure containg a bunch of segments defined between n0 and n1
00915 */
00916 typedef struct {
00917    char *idcode_str;    /*!< unique idcode for DO */
00918    char *Label; /*!< ascii label for DO */ 
00919 
00920    GLfloat *n0; /*!< vector containing XYZ of nodes 1 (3*N_n elements long)*/
00921    GLfloat *n1; /*!< vector containing XYZ of nodes 2 (3*N_n elements long)*/
00922    int N_n; /*!< Number of elements in n0 and n1 */
00923    GLfloat LineWidth; /*!< LineWidth of all segment*/
00924    GLfloat LineCol[4]; /*!< LineColor of all segments*/
00925    SUMA_STIPPLE Stipple; /*!< dashed or solid line */
00926 }SUMA_SegmentDO;
00927 
00928 /*! Structure containing the communication info and status with AFNI */
00929 typedef struct {
00930    SUMA_Boolean Connected;   /*!< flag indicating connection state */
00931    int ConSock;
00932    
00933 } SUMA_AfniCom;
00934 
00935 /* structure defining the former state of a surface viewer window */
00936 typedef struct {
00937    int N_DO;      /*!< Total number of surface objects registered with the viewer */
00938    int *ShowDO;    /*!< ShowSO[i] (i=0..N_DO) contains Object indices into DOv for DOs visible in the surface viewer*/
00939    float ViewFrom[3]; /*!< Location of observer's eyes */
00940    float ViewFromOrig[3]; /*!< Original Location of observer's eyes */
00941    float ViewCenter[3];   /*!< Center of observer's gaze */
00942    float ViewCenterOrig[3];   /*!< Original Center of observer's gaze */
00943    float ViewCamUp[3];   /*!< Camera Up direction vector */
00944    float ViewDistance; /*!< Viewing distance */
00945    float FOV; /*!< Field of View (affects zoom level)*/
00946    float Aspect;   /*!< Aspect ratio of the viewer*/
00947 } SUMA_ViewState_Hist;
00948 
00949 
00950 /*! structure defining the viewing state of the viewer window */
00951 typedef struct {
00952    char *Name; /*!< The name of the viewing state, fiducial, inflated, etc .. */
00953    int *MembSOs; /*!< Indices into DOv of SOs that are members of the viewing state */
00954    int N_MembSOs; /*!< Number of members in MembSOs. Only SOs that are in MembSOs can
00955                      be placed into ShowDO of the viewer in a particular viewing state.*/                  
00956    SUMA_ViewState_Hist *Hist; /*!< Pointer to structure containing various parameter settings for that viewing state */            
00957 } SUMA_ViewState;
00958 
00959 /*! structure containing the geometric settings for viewing the surface */
00960 typedef struct {
00961    float ViewFrom[3]; /*!< Location of observer's eyes */
00962    float ViewFromOrig[3]; /*!< Original Location of observer's eyes */
00963    float ViewCenter[3];   /*!< Center of observer's gaze */
00964    float ViewCenterOrig[3];   /*!< Original Center of observer's gaze */
00965    float ViewCamUp[3];   /*!< Camera Up direction vector */
00966    float ViewDistance; /*!< Viewing distance */
00967    
00968    int translateBeginX; /*!< User Input (mouse) X axis current position for translation */
00969    int translateBeginY; /*!< User Input (mouse) Y axis current position for translation */
00970    float translateDeltaX;   /*!< User Input (mouse) X axis position increment for translation */
00971    float translateDeltaY;   /*!< User Input (mouse) Y axis position increment for translation */
00972    float TranslateGain;   /*!< gain applied to mouse movement */
00973    float ArrowtranslateDeltaX;   /*!< User Input (Keyboard) X axis position increment for translation */
00974    float ArrowtranslateDeltaY;   /*!< User Input (Keyboard) X axis position increment for translation */
00975    GLfloat translateVec[2];      /*!< translation vector, in screen coordinates, equal to [translateDeltaX translateDeltaY]. The third translation (Z dimension) is 0.0*/
00976    GLfloat RotaCenter[3];   /*!<Center of Rotation */
00977    float zoomDelta;       /*!< Zoom increment */
00978    float zoomBegin;    /*!< Current zoom level*/
00979    int spinDeltaX;            /*!< User Input (mouse) X axis position increment for spinning*/
00980    int spinDeltaY;            /*!< User Input (mouse) Y axis position increment for spinning*/
00981    int spinBeginX;            /*!< User Input (mouse) X axis current position for spinning */
00982    int spinBeginY;            /*!< User Input (mouse) Y axis current position for spinning */
00983    int MinIdleDelta;       /*!< minimum spinDeltaX or spinDeltaY to initiate momentum rotation */
00984    float deltaQuat[4];   /*!< Quaternion increment */
00985    float currentQuat[4]; /*!< Current quaternion */
00986    Boolean ApplyMomentum;   /*!< Turn momentum ON/OFF */
00987 } SUMA_GEOMVIEW_STRUCT;
00988 
00989 /*! structure holding the pointer the node color assignment and a bit more */
00990 typedef struct {
00991    GLfloat *glar_ColorList; /*!< pointer to the 1D ColorList array */
00992    int N_glar_ColorList; /*!< Number of elements in glar_ColorList 4xNumber of nodes in the surface */
00993    char *idcode_str; /*!< string containing the idcode of the surface to which glar_ColorList belongs*/
00994    SUMA_Boolean Remix; /*!< flag indicating that colors need to be remixed */ 
00995 } SUMA_COLORLIST_STRUCT;
00996 
00997 typedef struct {
00998    int N;   /*!< Number of points in vectors x and y */
00999    int Nalloc; /*!< Number of elements allocated for in x and y */
01000    int *x;  /*!< vector containing x coordinates */
01001    int *y;  /*!< vector containing y coordinates */
01002    float *NPv; /*!< vector containing x y z triplets of near plane selection points */
01003    float *FPv; /*!< vector containing x y z triplets of far plane selection points */   
01004    int *SurfNodes; /*!< vector containing indices of nodes corresponding to the 
01005                         intersection between line [ NPv[j] FPv[j] ] and surface object */   
01006    int *SurfTri; /*!< vector containing indices of triangles corresponding to the 
01007                         intersection between line [ NPv[j] FPv[j] ] and surface object */
01008    int *ProjectionOf; /*!< if ProjectionOf[31] = 78; it means SurfNodes[31] 
01009                            is the intersection between line [ NPv[78] FPv[78] ] and the surface object. */
01010    int N_SurfNodes;  /*!< NUmber of SurfNodes in SurfNodes (always <= N) */
01011    
01012 } SUMA_OLD_BRUSH_STROKE; /*!< Structure containing the path of the mouse in the viewer window. 
01013                         See functions SUMA_CreateBrushStroke(), SUMA_AddToBrushStroke(), 
01014                         SUMA_ClearBrushStroke(), SUMA_ShowBrushStroke()*/
01015 
01016 
01017 typedef struct {
01018    float x; /*!< x screen coordinate. This is typically an integer value except in places of interpolation*/
01019    float y; /*!< y screen coordinate. This is typically an integer value except in places of interpolation*/
01020    
01021    float NP[3];   /*!< x y z triplet of near plane selection point */
01022    float FP[3];   /*!< x y z triplet of far plane selection point */
01023    
01024    int SurfNode;  /*!< index of node corresponding to the 
01025                         intersection between line [NP FP] and surface object.
01026                         initialized to -1 */
01027    int SurfTri;   /*!< index of triangle corresponding to the 
01028                         intersection between line [NP FP] and surface object.
01029                         initialized to -1 */  
01030    SUMA_Boolean Decimated; /*!< Flag to indicate if datum was obtained by a mouse trace (NOPE)
01031                                or through decimation (YUP)*/                      
01032 } SUMA_BRUSH_STROKE_DATUM; /*!< Data structure for the doubly linked version of brushstroke.  */
01033 
01034 /*! structure defining the state of a viewer window */
01035 typedef struct {
01036    int N_DO;      /*!< Total number of surface objects registered with the viewer */
01037    int *ShowDO;    /*!< ShowDO[i] (i=0..N_DO) contains Object indices into DOv for DOs visible in the surface viewer*/
01038    
01039    SUMA_COLORLIST_STRUCT *ColList; /*!< pointer to structures containing NodeColorLists for surfaces listed in ShowDO */
01040    int N_ColList; /*!< Number of structures in ColList */
01041    
01042    SUMA_STANDARD_VIEWS StdView; /*!< viewing mode, for 2D or 3D */
01043    SUMA_GEOMVIEW_STRUCT *GVS; /*! pointer to structures containing geometric viewing settings */
01044    int N_GVS; /*!< Number of different geometric viewing structures */
01045 
01046    short verbose;   /*!< Verbosity of viewer */
01047 
01048    SUMA_X *X; /*!< structure containing X widget midgets */
01049 
01050    float Aspect;   /*!< Aspect ratio of the viewer*/
01051    int WindWidth;   /*!< Width of window */
01052    int WindHeight;   /*!< Height of window */
01053    float *FOV; /*!< Field of View (affects zoom level, there is a separate FOV for each ViewState)*/
01054    
01055    SUMA_Boolean BF_Cull; /*!< flag for backface culling */
01056    SUMA_RENDER_MODES PolyMode; /*!< polygon viewing mode, SRM_Fill, SRM_Line, SRM_Points
01057                                     There is a similar field for each surface object to 
01058                                     allow independent control for each surface. If the rendering mode
01059                                     is specified for a certain surface, it takes precedence over the
01060                                     one specified here*/
01061 
01062    float Back_Modfact; /*!< Factor to apply when modulating foreground color with background intensity
01063                            background does not modulate foreground, 
01064                            Color = Fore * avg_Bright * AttenFactor; (w/ 0 <= avg_Bright <=1)
01065                            a good setting is such that SUMA_BACKGROUND_ATTENUATION_FACTOR * SUMA_DIM_AFNI_COLOR_FACTOR = 1
01066                             Watch for saturation effects!  */
01067 
01068    GLfloat light0_position[4]; /*!< Light 0 position: 1st 3 vals --> direction of light . Last value is 0 -->  directional light*/
01069    GLfloat light1_position[4]; /*!< Light 1 position: 1st 3 vals --> direction of light. Last value is 0 -->  directional light*/
01070    
01071    GLfloat clear_color[4]; /*!< viewer background color */
01072       
01073    SUMA_Boolean Open; /*! Viewer visible to the human eye */
01074    int ShowEyeAxis ; /*!< ShowEyeAxis */
01075    int ShowMeshAxis; /*!< ShowEyeAxis */
01076    int ShowCrossHair; /*!< ShowCrossHair */
01077    SUMA_Boolean ShowForeground;    /*!< Flag for showing/not showing foreground colors */
01078    SUMA_Boolean ShowBackground; /*!< Flag for showing/not showing background colors */   
01079    
01080    
01081    int Focus_SO_ID; /*!< index into SUMAg_DOv of the surface currently in focus, -1 for nothing*/
01082    int Focus_DO_ID; /*!< index into SUMAg_DOv of the Displayabl Object currently in focus -1 for nothing*/
01083    
01084    GLdouble Pick0[3];   /*!< Click location in World coordinates, at z = 0 (near clip plane)*/
01085    GLdouble Pick1[3];   /*!< Click location in World coordinates, at z = 1.0 (far clip plane)*/
01086    
01087    SUMA_CrossHair *Ch; /*!< Pointer to Cross Hair structure */
01088       
01089    SUMA_ViewState *VSv; /*!< Vector of Viewing State Structures */
01090    int N_VSv; /*!< Number of Viewing State structures */
01091    char *State; /*!< The current state of the viewer. This variable should no be freed since it points to locations within VSv*/
01092    int iState; /*!< index into VSv corresponding to State */
01093    int LastNonMapStateID; /*!< Index into the state in VSv from which a toggle to the mappable state was initiated */ 
01094    
01095    SUMA_Boolean isShaded; /*!< YUP if the window is minimized or shaded, NOPE if you can see its contents */
01096 
01097    SUMA_Boolean LinkAfniCrossHair; /*!< YUP if the cross hair location is to be sent (and accepted from AFNI, when the stream is open) */
01098    SUMA_Boolean ResetGLStateVariables; /*!< YUP if you need to run the function that resets the Eye Axis before display. 
01099                                           see functions SUMA_display and SUMA_OpenGLStateReset for more info */
01100                                           
01101    DList *BS; /*!< The new version of BrushStroke, in doubly linked list form */
01102 }SUMA_SurfaceViewer;
01103 
01104 /*! structure defining an EngineData structure */
01105 typedef struct {
01106    SUMA_ENGINE_CODE CommandCode; /*!< Code of command to be executed by SUMA_Engine function, 
01107                                     this is the same as the _Dest fields for each variable type.
01108                                     However, the _Dest fields are left as a way to make sure that
01109                                     the user has correctly initialized EngineData for a certain command.*/
01110    
01111    void *Srcp; /*!< Pointer to data structure of the calling source, typically, a typecast version of SUMA_SurfaceViewer * */
01112    SUMA_ENGINE_SOURCE Src; /*!< Source of command. This replaces the _Source fields in the older version of the structure */
01113    
01114    float fv3[3]; /*!< Float vector, 3 values */
01115    SUMA_ENGINE_CODE fv3_Dest; /*!<  float3 vector destination */
01116    SUMA_ENGINE_SOURCE fv3_Source; /*!< OBSOLETE float3 vector source */
01117    
01118    int iv3[3];      /*!< Integer vector, 3 values */
01119    SUMA_ENGINE_CODE iv3_Dest;  /*!<  Integer3 vector destination */
01120    SUMA_ENGINE_SOURCE iv3_Source;  /*!<OBSOLETE  Integer3 vector source */
01121    
01122    float fv15[15]; /*!< Float vector, 15 values */
01123    SUMA_ENGINE_CODE fv15_Dest; /*!<  float15 vector destination */
01124    SUMA_ENGINE_SOURCE fv15_Source; /*!< OBSOLETE float15 vector source */
01125    
01126    int iv15[15];/*!< Integer vector, 15 values */
01127    SUMA_ENGINE_CODE iv15_Dest;/*!<  Integer15 vector destination */
01128    SUMA_ENGINE_SOURCE iv15_Source; /*!< OBSOLETE Integer15 vector source */
01129    
01130    int i;      /*!< integer */
01131    SUMA_ENGINE_CODE i_Dest;   /*!<  integer destination */
01132    SUMA_ENGINE_SOURCE i_Source; /*!< OBSOLETE integer source */
01133    
01134    float f; /*!< float, ingenious ain't it! */
01135    SUMA_ENGINE_CODE f_Dest; /*!<  float destination */
01136    SUMA_ENGINE_SOURCE f_Source; /*!< OBSOLETE float source */
01137    
01138    char s[SUMA_MAX_STRING_LENGTH]; /*!< string */
01139    SUMA_ENGINE_CODE s_Dest; /*!<  string destination */
01140    SUMA_ENGINE_SOURCE s_Source; /*!< OBSOLETE string source */
01141    
01142    int *ip; /*!< integer pointer */
01143    SUMA_ENGINE_CODE ip_Dest; /*!<  integer pointer destination */
01144    
01145    float *fp; /*!< float pointer */
01146    SUMA_ENGINE_CODE fp_Dest; /*!< float pointer destination */
01147    
01148    char *cp; /*!< char pointer */
01149    SUMA_ENGINE_CODE cp_Dest; /*!< character pointer destination */
01150    
01151    float **fm; /*!< float matrix pointer */
01152    SUMA_Boolean fm_LocalAlloc; /*!< Locally allocated matrix pointer ? (if it is then it is freed in SUMA_ReleaseEngineData ) */
01153    SUMA_ENGINE_CODE fm_Dest; /*!<  destination of fm */
01154    SUMA_ENGINE_SOURCE fm_Source; /*!< OBSOLETE source of fm*/
01155    
01156    int **im; /*!< Same dance as fm but for integers */
01157    SUMA_Boolean im_LocalAlloc;
01158    SUMA_ENGINE_CODE im_Dest; /*!<  destination of im */
01159    SUMA_ENGINE_SOURCE im_Source; /*!< OBSOLETE source of im */
01160    
01161    void *vp; /*!< pointer to void */
01162    SUMA_ENGINE_CODE vp_Dest; /*!<  destination of fm */
01163    SUMA_ENGINE_SOURCE vp_Source; /*!< OBSOLETE source of fm*/
01164    
01165    int N_rows; /*!< Number of rows in fm or im */
01166    int N_cols; /*!< Number of colums in fm or im */
01167    
01168 } SUMA_EngineData;
01169 
01170  
01171 /*! structure defining an axis object */
01172 typedef struct {
01173    GLfloat XaxisColor[4] ;
01174    GLfloat YaxisColor[4] ;
01175    GLfloat ZaxisColor[4] ;
01176    
01177    GLfloat LineWidth;
01178    SUMA_STIPPLE Stipple; /*!< dashed or solid line */
01179    
01180    GLfloat XYZspan[3]; /*!< the axis will span +/- span[i] in the three dimensions */
01181    GLfloat Center[3]; /*!< origin of axis */
01182    char *Name; /*!< name of axis */
01183    char *idcode_str; /*! idcode of axis */
01184 }SUMA_Axis;
01185 
01186 
01187 /*! structure that contains the output of SurfNorm function */
01188 #define SUMA_SurfNorm_struct
01189 typedef struct {
01190    int N_Node; /*!< Number of nodes, 1st dim of NodeNormList*/
01191    int N_Face;/*!< Number of facesets, 1st dim of FaceNormList*/
01192    float *FaceNormList ; /*!< N_Face x 3 vector (was matrix prior to SUMA 1.2) containing normalized normal vectors for each triangular faceset*/ 
01193    float *NodeNormList ; /*!< N_Node x 3 vector (was matrix prior to SUMA 1.2) containing normalized normal vectors for each node*/
01194 } SUMA_SURF_NORM; /*!< structure that contains the output of SurfNorm function */
01195 
01196 /*! structure that contains the output of SUMA_MemberFaceSets function */
01197 #define SUMA_MemberFaceSets_struct
01198 typedef struct {
01199    int N_Memb_max;/*!< Maximum number of Facesets any node belonged to*/
01200    int Nnode; /*! Total number of nodes examined (0..Nnode-1) */
01201    int **NodeMemberOfFaceSet ; /*!< Nnode x N_Memb_max matrix containing for each row i, the indices of the facesets containing node i*/ 
01202    int *N_Memb ; /*!< Nnode x 1 vetor containing for each node i, the number of facesets that contain it*/
01203 } SUMA_MEMBER_FACE_SETS; /*!< structure that contains the output of SurfNorm function */
01204 
01205 
01206 /*! structure containing results of intersection of a ray with triangles */
01207 typedef struct {
01208    int N_el; /*!< Number of elements in each vector */
01209    SUMA_Boolean *isHit;   /*!< Is the triangle hit ? */
01210    float *t;   /*!< SIGNED Distance from ray source to triangle */
01211    float *u;   /*!< location of intersection in triangle in Barycentric coordinates, V0P = u V0V1 + vV0V2*/
01212    float *v;   /*!< location of intersection in triangle */
01213    int ifacemin; /*!< index of the faceset closest (NOT SIGNED, abs(t)) to the ray's origin */
01214    int ifacemax; /*!< index of the faceset farthest (NOT SIGNED, abs(t)) from the ray's origin */
01215    int N_hits; /*!< Number of intersections between ray and surface */
01216    float P[3]; /*!< XYZ of intersection with ifacemin */
01217    float d; /*!< Distance from the closest node in ifacemin to P */
01218    int inodemin; /*!< node index (into NodeList)that is closest to P  */
01219    int inodeminlocal; /*!< node in FaceSet[ifacemin] that is closest to P , 
01220                   inodemin = FaceSet[ifacemin][inodeminlocal]*/
01221 } SUMA_MT_INTERSECT_TRIANGLE;
01222 
01223 /*! Structure defining the surface's volume parent info */
01224 typedef struct {
01225    int isanat; /*!< 1 if parent volume is of type anat */
01226    int nx, ny, nz; /*!< number of voxels in the three dimensions */
01227    float dx, dy, dz; /*!< delta x, y, z in mm */
01228    float xorg, yorg, zorg; /*!< voxel origin in three dimensions */
01229    char *prefix; /*!< parent volume prefix */
01230    char *filecode; /*!< parent volume prefix + view */
01231    char *dirname; /*!< parent volume directory name */
01232    char *idcode_str; /*!< idcode string*/
01233    char *idcode_date; /*!< idcode date */
01234    int xxorient, yyorient, zzorient; /*!< orientation of three dimensions*/ 
01235    float *VOLREG_CENTER_OLD; /*!< pointer to the named attribute (3x1) in the .HEAD file of the experiment-aligned Parent Volume */
01236    float *VOLREG_CENTER_BASE; /*!< pointer to the named attribute (3x1) in the .HEAD file of the experiment-aligned Parent Volume */
01237    float *VOLREG_MATVEC; /*!< pointer to the named attribute (12x1) in the .HEAD file of the experiment-aligned Parent Volume */
01238 } SUMA_VOLPAR;
01239 
01240 typedef struct {
01241    SUMA_OVERLAYS *Overlay; /*!< pointer to color overlay structures */
01242    SUMA_INODE *Overlay_Inode; /*!< pointer to Inodes corresponding to each Overlay struct */
01243 } SUMA_OVERLAY_LIST_DATUM;   /*!< a structure used to create linked lists of SO->Overlays and co */ 
01244 
01245 
01246 
01247 /*! structure defining a Surface Object */
01248 typedef struct {
01249    SUMA_SO_File_Type FileType; /*!< Type of Surface file */
01250    SUMA_SO_File_Format FileFormat; /*!< Format of Surface file ascii or binary*/
01251    
01252    SUMA_FileName Name; /*!< Directory and Name of surface object file (SO) */
01253    SUMA_FileName Name_coord; /*!< Directory and Name of surface coordinate file (for SureFit files) */
01254    SUMA_FileName Name_topo; /*!< Directory and Name of surface topology file  (for SureFit files)*/
01255    char *idcode_str; /*!< string containing the idcode of the surface */
01256    char *Label; /*!< string containing a label for the surface. Used for window titles and saved image names */
01257    
01258    SUMA_Boolean SUMA_VolPar_Aligned; /*!< Surface aligned to Parent Volume data sets ?*/
01259    SUMA_Boolean VOLREG_APPLIED; /*!< YUP if VP->VOLREG_CENTER_BASE, VP->VOLREG_CENTER_OLD, VP->VOLREG_MATVEC were successfully applied*/
01260    SUMA_Boolean SentToAfni; /*!< YUP if the surface has been niml-sent to AFNI */
01261 
01262    SUMA_RENDER_MODES PolyMode; /*!< polygon viewing mode, SRM_Fill, SRM_Line, SRM_Points */
01263    
01264    int N_Node; /*!< Number of nodes in the SO */
01265    int NodeDim; /*!< Dimension of Node coordinates 3 for 3D only 3 is used for now, with flat surfaces having z = 0*/
01266    int EmbedDim; /*!< Embedding dimension of the surface, 2 for flat surfaces 3 for ones with non zero curvature other. */ 
01267    float *NodeList; /*!< N_Node x 3 vector containing the XYZ node coordinates. 
01268                         If NodeDim is 2 then the third column is all zeros
01269                         Prior to SUMA  1.2 this used to be a 2D matrix (a vector of vectors) */
01270    char *MapRef_idcode_str; /*!< if NULL, then it is not known whether surface is mappable or not
01271                                  if equal to idcode_str then surface surface is Mappable, 
01272                                  otherwise it specifies the idcode of the Mapping reference surface */
01273    
01274    int N_FaceSet; /*!< Number of polygons defining the surface  */
01275    int FaceSetDim; /*!< Number of sides on the polygon */
01276    int *FaceSetList; /*!< N_FaceSetList x FaceSetDim vector describing the polygon set that makes up the SO.
01277                      Each row contains the indices (into NodeList) of the nodes that make up a polygon 
01278                      Prior to SUMA  1.2 this used to be a 2D matrix (a vector of vectors) */
01279    
01280    float *NodeNormList ; /*!< N_Node x 3 vector (used to be matrix prior to SUMA 1.2) containing normalized normal vectors for each node*/
01281    float *FaceNormList ; /*!< N_FaceSet x 3 vector (used to be matrix prior to SUMA 1.2) containing normalized normal vectors for each polygon*/ 
01282    
01283    float Center[3];       /*!< The centroid of the surface */
01284    float MaxDims[3];      /*!< The maximum along each of the XYZ dimensions */
01285    float MinDims[3];      /*!< The minimum along each of the XYZ dimensions */
01286    float aMinDims;      /*!< The maximum across all dimensions*/
01287    float aMaxDims;      /*!< The minimum across all dimensions*/
01288    
01289    int RotationWeight; /*!< Contribution to center of rotation calculation. 
01290                            set to 0 if not contributing.
01291                             set to N_Node to have the number of nodes weigh into the center's location, center of mass effect
01292                            set to 1 to give each object equal weight */
01293    int ViewCenterWeight; /*!< Contribution to center of gaze and viewfrom location */
01294    
01295    char *Name_NodeParent; /*!< Node parent of the SO.   Node Indices of SO are into NodeList matrix of the NodeParent SO*/               
01296 
01297    GLfloat *glar_NodeList;         /*!< pointer to the 1D NodeList array - DO NOT FREE IT, it is a pointer copy of NodeList*/
01298    GLint  *glar_FaceSetList;      /*!< pointer to the 1D FaceSetList array - DO NOT FREE IT, it is a pointer copy of FaceSetList*/
01299    GLfloat *glar_FaceNormList;    /*!< pointer to the 1D FaceNormList array - DO NOT FREE IT, it is a pointer copy of NodeNormList*/
01300    #if 0
01301    /* This pointer is now a part of the surface viewer structure. Wed Nov  6 10:23:05 EST 2002
01302    Node color assignment is not a property of the surface alone, it also depends on the settings of the viewer. */
01303    GLfloat *glar_ColorList;       /*!< pointer to the 1D ColorList array*/
01304    #endif
01305    GLfloat *glar_NodeNormList;    /*!< pointer to the 1D NodeNormList array - DO NOT FREE IT, it is a pointer copy of NodeNormList*/
01306    
01307    SUMA_Boolean ShowMeshAxis; /*!< flag to show Mesh Axis if it is created */
01308    SUMA_Axis *MeshAxis;   /*!< pointer to XYZ axis centered on the surface's centroid */
01309    
01310    SUMA_MEMBER_FACE_SETS *MF; /*!< structure containing the facesets containing each node */
01311    SUMA_NODE_FIRST_NEIGHB *FN; /*!< structure containing the first order neighbors of each node */
01312    SUMA_INODE *FN_Inode; /*!< Inode structure for FN */
01313    SUMA_EDGE_LIST *EL; /*!< structure containing the edge list */
01314    SUMA_INODE *EL_Inode; /*!< Inode structure for EL */
01315    
01316    float *PolyArea; /*!< N_FaceSet x 1 vector containing the area of each polygon in FaceSetList */
01317    SUMA_SURFACE_CURVATURE *SC; /*!< Structure containing the surface curvature info */
01318    
01319    float *Cx; /*!< vector containing surface convexity at each node */
01320    SUMA_INODE *Cx_Inode; /*!< Inode structure for Cx */
01321    
01322    /* selection stuff */
01323    SUMA_Boolean ShowSelectedNode; /*!< flag for an obvious reason */
01324    int SelectedNode; /*!< index of one selected node, -1 if no node is selected */
01325    SUMA_SphereMarker *NodeMarker; /*!< Node Marker object structure*/
01326    
01327    SUMA_Boolean ShowSelectedFaceSet; /*!< you know what I mean */
01328    int SelectedFaceSet; /*!< index of one selected faceset, -1 if no faceset is selected */
01329    SUMA_FaceSetMarker *FaceSetMarker; /*!< Aha, I hear ya */
01330    
01331    SUMA_VOLPAR *VolPar; /*!< Parent Volume structure */
01332    
01333    char *Group;   /*!< Group the surface belongs to, like Simpsons H. */
01334    char *State; /*!< State of SO (like inflated, bloated, exploded) */
01335    
01336    SUMA_OVERLAYS **Overlays; /*!< vector of pointers to color overlay structures */
01337    SUMA_INODE **Overlays_Inode; /*!< vector of pointers to Inodes corresponding to each Overlays struct */
01338    int N_Overlays; /*!< number of pointers to overlay structures */
01339    
01340    SUMA_X_SurfCont *SurfCont;/*!< pointer to structure containing surface controller widget structure */
01341 
01342 }SUMA_SurfaceObject; /*!< \sa Alloc_SurfObject_Struct in SUMA_DOmanip.c
01343                      \sa SUMA_Free_Surface_Object in SUMA_Load_Surface_Object.c
01344                      \sa SUMA_Print_Surface_Object in SUMA_Load_Surface_Object.c
01345                      \sa SUMA_Load_Surface_Object in SUMA_Load_Surface_Object.c
01346                */      
01347 
01348 
01349 /*! structure containing a mapping of one surface to another*/
01350 typedef struct {
01351    float *NewNodeList; /*!< N_Node x 3 vector containing new mapping of node coordinates */
01352    int N_Node; /*!< Number of nodes in NodeList */
01353    float *NodeVal; 
01354    float *NodeCol;
01355    float *NodeDisp;
01356 } SUMA_SO_map;
01357 
01358 /*! structure containing SureFit Surface*/
01359 typedef struct {
01360    /* coord files */
01361    char name_coord[SUMA_MAX_NAME_LENGTH];
01362    int N_Node; /*!< Number of nodes */
01363    float *NodeList; /*!< N_Node x 3 vector containing node coordinates */
01364    int *NodeId; /*!< Node ID, that's normaly from 0..N_Nodes-1 but since it's in .coord file, I keep it anyway */
01365    char encoding_coord[100];
01366    char configuration_id[100];
01367    char coordframe_id[100];
01368    /* Topo files */
01369    char name_topo[SUMA_MAX_NAME_LENGTH];
01370    char encoding_topo[100];
01371    char date[100];
01372    char perimeter_id[100];
01373    int N_Node_Specs; /*!< Number of nodes with listed node specs */
01374    int **Specs_mat; /*!< Node Specs matrix. Columns appear to be arraged as such NodeId #Neighbors ? ? NodeId ? */
01375    SUMA_NODE_FIRST_NEIGHB FN; /*!< First order neighbor structure */
01376    int N_FaceSet; /*!< Number of polygons making up surface */
01377    int *FaceSetList; /*!< definition of polygons. Became a vector in SUMA 1.2*/
01378    /* Param Files */
01379    char name_param[SUMA_MAX_NAME_LENGTH];
01380    float AC_WholeVolume[3]; /*!< XYZ (from .Orient.params file) of Anterior Comissure of whole volume */
01381    float AC[3]; /*!< XYZ of Anterior Comissure of cropped volume */
01382 } SUMA_SureFit_struct;
01383 
01384 /* structure containing FreeSurfer Surface */
01385 typedef struct {
01386    char name[SUMA_MAX_NAME_LENGTH];
01387    int N_Node; /*!< Number of nodes */
01388    int *NodeId; /*!< Node ID, that's normaly from 0..N_Nodes-1 unless the surface is a patch of another surface see FaceSetIndexInParent*/
01389    float *NodeList; /*!< N_Node x 3 vector containing node coordinates */
01390    int N_FaceSet; /*!< Number of polygons making up surface */
01391    int *FaceSetList; /*!< definition of polygons. For a complete surface, these are indices into NodeList's rows
01392                            For a patch, these are indices into NodeList of the parent surface.
01393                         Became a vector in SUMA 1.2*/
01394    char comment[SUMA_MAX_STRING_LENGTH]; /*!< comment at beginning of patch or surface */
01395    SUMA_Boolean isPatch; /*!< is the surface a patch of another ? */
01396    int *FaceSetIndexInParent; /*!< for a FaceSet in patch, this represents its index in FaceSetList of the parent surface.
01397                                     This is the FaceSet equivalent of NodeId*/ 
01398 } SUMA_FreeSurfer_struct;
01399 
01400 /* structure containing SureFit name*/
01401 typedef struct {
01402    char name_coord[SUMA_MAX_DIR_LENGTH+SUMA_MAX_NAME_LENGTH];
01403    char name_topo[SUMA_MAX_DIR_LENGTH+SUMA_MAX_NAME_LENGTH]; 
01404    char name_param[SUMA_MAX_DIR_LENGTH+SUMA_MAX_NAME_LENGTH];
01405 } SUMA_SFname;
01406 
01407 typedef enum {    SMT_Nothing, 
01408                   SMT_Notice, SMT_Warning, SMT_Error, SMT_Critical,  
01409                   SMT_N }  SUMA_MESSAGE_TYPES; /*!< different types of messages */
01410 
01411 typedef enum {    SMA_Nothing, 
01412                   SMA_Log, SMA_LogAndPopup,  
01413                   SMA_N }  SUMA_MESSAGE_ACTION; /*!< different actions to perform with messages */
01414 
01415  
01416                                  
01417 /*! structure containing a SUMA Message structure */
01418 typedef struct {
01419    SUMA_MESSAGE_TYPES Type;   /*!< type of message */
01420    SUMA_MESSAGE_ACTION  Action; /*!< what to do with message*/
01421    char *Message; /*!< null terminated message string */
01422    char *Source;  /*!< source of message, usually calling function */
01423 }  SUMA_MessageData;
01424 
01425 /*! structure containing information global to all surface viewers */
01426 typedef struct {
01427    char AfniHostName[SUMA_MAX_NAME_LENGTH]; /*!< name or ipaddress of afni host maximum allowed name is 20 chars less than allocated for, see SUMA_Assign_AfniHostName*/ 
01428    char NimlAfniStream[SUMA_MAX_NAME_LENGTH]; /*!< niml stream name for communicating with afni */
01429    SUMA_Boolean Dev; /*!< Flag for developer option (allows the use of confusing or kludge options) */
01430    SUMA_Boolean InOut_Notify; /*!< prints to STDERR a notice when a function is entered or exited */ 
01431    int InOut_Level; /*!< level of nested function calls */
01432    
01433    int N_OpenSV; /*!< Number of open (visible) surface viewers.
01434                      Do not confuse this with the number of surface viewers
01435                      created (SUMAg_N_SVv)*/
01436    
01437    SUMA_MEMTRACE_STRUCT *Mem; /*!< structure used to keep track of memory usage */
01438    SUMA_Boolean MemTrace; /*!< Flag for keeping track of memory usage (must also set SUMA_MEMTRACE_FLAG ) */
01439 
01440    NI_stream ns; /*!< Stream used to communicate with AFNI. 
01441                      It is null when no communication stream is open. 
01442                      The stream can be open with Connected set to NOPE.
01443                      In that case no communication between the two programs
01444                      but resuming communication is easy since surfaces need
01445                      not be sent to AFNI again as would be the case if the stream 
01446                      was completely closed */
01447    SUMA_Boolean Connected; /*!< YUP/NOPE, if SUMA is sending (or accepting) communication from AFNI */
01448    SUMA_LINK_TYPES Locked[SUMA_MAX_SURF_VIEWERS]; /*!< All viewers i such that Locked[i] != SUMA_No_Lock have their cross hair locked together */   
01449    SUMA_Boolean ViewLocked[SUMA_MAX_SURF_VIEWERS]; /*!< All viewers i such that ViewLocked[i] = YUP have their view point locked together */    
01450    SUMA_Boolean SwapButtons_1_3; /*!< YUP/NOPE, if functions of mouse buttons 1 and 3 are swapped */
01451    SUMA_X_AllView *X; /*!< structure containing widgets and other X related variables that are common to all viewers */ 
01452    DList *MessageList; /*!< a doubly linked list with data elements containing notices, warnings and error messages*/
01453    SUMA_Boolean ROI_mode; /*!< Flag specifying that SUMA is in ROI drawing mode */
01454    int nimlROI_Datum_type; /*!< the code for nimlROI_Datum_type */
01455 } SUMA_CommonFields;
01456 
01457 /*! structure containing a surface patch */
01458 typedef struct {
01459    int N_FaceSet; /*!< Number of Facesets forming patch */
01460    int *FaceSetList; /*!< vector (was a matrix prior to SUMA 1.2) (N_FaceSet x 3) containing indices of nodes forming triangles making up the patch */
01461    int *FaceSetIndex; /*!< vector (N_FaceSet x 1) containing indices of triangles in FaceSetList in the FaceSetList of the surface that the patch was taken from */
01462    int *nHits; /*!< (N_FaceSet x 1) If patch is created from a set of nodes,
01463                   nHits[i] is the number of nodes refering to this Faceset */
01464 } SUMA_PATCH; /*!< A surface patch, typically created from a set of nodes */
01465 
01466 /*! structure containing ClientData 
01467 This remains to be used somewhere ... */
01468 typedef struct {
01469    SUMA_SurfaceViewer *sv; /*!< pointer to surface viewer from which the callback was made */
01470    int svi; /*!< index of sv into SUMAg_SVv */
01471 }SUMA_CLIENT_DATA;
01472 
01473 /*! Maximum nuber of branches that can be found in the intersection 
01474    of a plane with the surface model */
01475 #define SUMA_BRANCHMAX 500   
01476 
01477 /*! Maximum nuber of nodes that can form one branch */
01478 #define SUMA_NODEINLISTMAX 500
01479 
01480 /*!
01481 \brief Structure forming a branch 
01482 
01483 A branch is a protruded part of a tree often resulting in chainsaw accidents.
01484 It is used in determining the intersection of a plane with a surface
01485 */
01486 typedef struct {
01487    int begin, start;   /*!< first node of the branch */
01488    int last;   /*!< last node of the branch */
01489    int closed; /*!< flag. 0--> open, 1--> closed */
01490    int list[SUMA_NODEINLISTMAX]; /*!< list of nodes per branch */
01491    int listsz; /*!< Number of nodes in list*/
01492 } SUMA_BRANCH;
01493 
01494 /*!
01495 \brief Structure forming a triangle branch 
01496 
01497 A Tiangle branch represents a strip of connected triangles.
01498 
01499 */
01500 typedef struct {
01501    int begin, start;   /*!< first node of the branch */
01502    int last;   /*!< last node of the branch */
01503    int iBranch; /*!< index identifying branch */
01504    SUMA_Boolean closed; /*!< flag. 0--> open, 1--> closed */
01505    int * list; /*!< list of nodes per branch */
01506    int N_list; /*!< Number of nodes in list*/
01507 } SUMA_TRI_BRANCH;
01508 
01509 /*!
01510 \brief Structure defining the intersection of a surface with a plane 
01511 */
01512 typedef struct {
01513    int N_IntersEdges; /*!< Number of edges intersected by the plane */
01514    int *IntersEdges;  /*!< Vector containing indices of edges intersected by the plane. The indices
01515                         are into SO->EL->EL matrix. The space allocate for this vector is SO->EL->N_EL
01516                         But that is way more than ususally needed. For this vector and others in
01517                         this structure, reallocation is not done to save time. Useful values for IntersEdges
01518                         are between IntersEdges[0]  and IntersEdges[N_IntersEdges-1]*/
01519    SUMA_Boolean *isEdgeInters; /*!< Vector specifying if an edge i (index into SO->EL->EL) was intersected. */
01520    #if 0
01521    /* old way, less memory usage, slower access - pre Wed Dec  4 16:57:03 EST 2002*/
01522    float *IntersNodes;  /*!< Vector containing XYZ coordinates of the intersection point on each 
01523                            intersected segment. Allocated space is for 3*SO->EL->N_EL, useful space is 
01524                            between IntersNodes[0] and IntersNodes[3*(N_IntersEdges-1) + 2]. Intersection point 
01525                            of edge IntersEdges[k] has  X = IntersNodes[3*k], Y = IntersNodes[3*k+1] and
01526                            Z = IntersNodes[3*k+2] */
01527    #endif
01528    float *IntersNodes;  /*!< Vector containing XYZ coordinates of the intersection point on each 
01529                            intersected segment. Allocated space is for 3*SO->EL->N_EL, meaningful values are
01530                            for intersected segments only. Intersection point 
01531                            of edge SO->EL->EL[k][:] has  X = IntersNodes[3*k], Y = IntersNodes[3*k+1] and
01532                            Z = IntersNodes[3*k+2] */
01533    int *IntersTri; /*!< Vector containing indices of triangles intersected by the plane (i.e. containing
01534                         and edge that was intersected. Allocation is done for SO->N_FaceSet. 
01535                         But meaningful values are between IntersETri[0] and IntersTri[N_IntersTri-1]. */
01536    int N_IntersTri; /*!< Number of intersected triangles. */
01537    SUMA_Boolean *isNodeInMesh;   /*!< Vector of SO->N_Node elements indicating whether a certain node
01538                                     belongs to an intersected seqment or not */
01539    int N_NodesInMesh;  /*!< Total number of nodes belonging to intersected segments */
01540    
01541    SUMA_Boolean *isTriHit; /*!< Vector of SO->N_FaceSet elements indicating whether a triangle was intersected by the plane.
01542                      if isTriHit[j] then triangle SO->FaceSetList[3*j], [3*j+1], [3*j+2] was intersected. You should
01543                      have a total of N_IntersTri YUP values in this vector*/
01544                         
01545 } SUMA_SURF_PLANE_INTERSECT;
01546 
01547 
01548 
01549 
01550 /*! Structure to contain the path between one node and the next. The path is defined in terms of the previous one, plus an edge from
01551 the previous to the current */
01552 typedef struct {
01553    int node; /*!< Index of current node*/ 
01554    float le;   /*!< Length of edge between current node and previous one. 0 for starting node. */ 
01555    int order; /*!< Path order to node. A path order of i means i segments are needed to reach node from the starting node. 0 for starting node*/
01556    void *Previous; /*!< pointer to path leading up to the previous node. NULL for starting node. This pointer is to be typecast to SUMA_DIJKSTRA_PATH_CHAIN **/
01557 } SUMA_DIJKSTRA_PATH_CHAIN;
01558 
01559 
01560 #endif

Generated on Tue May 27 18:23:14 2003 for SUMA Source Code by doxygen1.2.12-20011209 written by Dimitri van Heesch, © 1997-2001