1 #ifndef SUMA_AFNI_SURFACE_INCLUDE
2 #define SUMA_AFNI_SURFACE_INCLUDE
3 
4 #define NI_SETA_INT(ngr, name, val)  {\
5    char m_stmp[100]; sprintf(m_stmp,"%d", (val));   \
6    NI_set_attribute(ngr, name, m_stmp);  \
7 }
8 #define NI_GETA_INT(ngr, name, val)  {\
9    char *m_s = NI_get_attribute(ngr, name);  \
10    if (m_s) { (val) = atoi(m_s); } else { (val) = 0; }\
11 }
12 #define NI_GETA_INT_chk(ngr, name, val, ok)  {\
13    char *m_s = NI_get_attribute(ngr, name); ok = 1; \
14    if (m_s) { (val) = atoi(m_s); } else { (val) = 0; ok = 0}\
15 }
16 #define NI_SETA_FLOAT(ngr, name, val)  {\
17    char m_stmp[100]; sprintf(m_stmp,"%f", (val));   \
18    NI_set_attribute(ngr, name, m_stmp);  \
19 }
20 #define NI_GETA_FLOAT_chk(ngr, name, val, ok)  {\
21    char *m_s = NI_get_attribute(ngr, name); ok = 1;  \
22    if (m_s) { (val) = atof(m_s); } else { (val) = 0.0; ok = 0;}\
23 }
24 
25 
26 NI_group *SUMA_NewAfniSurfaceObject(void);
27 NI_group *SUMA_NewAfniSurfaceObjectTriangle(void);
28 NI_group *SUMA_NewAfniSurfaceObjectPointset(void);
29 NI_group *SUMA_NewAfniSurfaceObjectNormals(void);
30 NI_group *SUMA_FreeAfniSurfaceObject(NI_group *aSO);
31 NI_element *SUMA_FindNgrNamedElement(NI_group *ngr, char *elname);
32 void *SUMA_FindNgrNamedAny(NI_group *ngr, char *elname);
33 int SUMA_NI_get_int(NI_element *nel, char *attrname);
34 double SUMA_NI_get_double(NI_element *nel, char *attrname);
35 void SUMA_NI_set_int(NI_element *nel, char *attrname, int n);
36 void SUMA_NI_set_double(NI_element *nel, char *attrname, double n);
37 char *SUMA_NI_AttrOfNamedElement(NI_group *ngr, char *elname, char *attrname);
38 int SUMA_NI_intAttrOfNamedElement(NI_group *ngr, char *elname, char *attrname);
39 double SUMA_NI_doubleAttrOfNamedElement(NI_group *ngr, char *elname,
40                                        char *attrname);
41 
42 /*! 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
43 the previous to the current */
44 #define LARGE_NUM 1e38
45 typedef struct {
46    int node; /*!< Index of current node*/
47    float le;   /*!< Length of edge between current node
48                      and previous one. 0 for starting node. */
49    int order; /*!< Path order to node. A path order of i means i segments
50                    are needed to reach node from the starting node.
51                    0 for starting node*/
52    void *Previous; /*!< pointer to path leading up to the previous node.
53                         NULL for starting node. This pointer is to be typecast
54                         to SUMA_DIJKSTRA_PATH_CHAIN **/
55 } SUMA_DIJKSTRA_PATH_CHAIN;
56 int * SUMA_Dijkstra_generic (int N_Node,
57                      float *NodeList, int NodeDim, int dist_metric,
58                      int *N_Neighbv, int **FirstNeighb, float **FirstNeighbDist,
59                      int Nx, int Ny,
60                      byte *isNodeInMeshp,
61                      int *N_isNodeInMesh, int Method_Number,
62                      float *Lfinal, int *N_Path,
63                      int verb);
64 
65 
66 #endif
67