1 #ifndef SUMA_SURFACE_IO_INCLUDED
2 #define SUMA_SURFACE_IO_INCLUDED
3 
4 #define SUMA_FS_ANNOT_TAG_COLORTABLE   1
5 #define SUMA_FS_STRLEN 50
6 typedef struct {
7    int i;
8    int r;
9    int g;
10    int b;
11    int flag;
12    char name[SUMA_FS_STRLEN];
13 } SUMA_FS_COLORTABLE_ENTRY;
14 
15 typedef struct {
16    char *fname;
17    int nbins;
18    SUMA_FS_COLORTABLE_ENTRY *bins;
19    SUMA_COLOR_MAP_HASH_DATUM *chd;
20 } SUMA_FS_COLORTABLE;
21 
22 typedef struct {
23    int N_Vert;
24    int N_Vert_alloc;
25    float *Vert;
26 
27    int N_Face;
28    int N_Face_alloc;
29    int *Face;
30 
31    int N_Point;
32    int N_Point_alloc;
33    int *Point;
34 } SUMA_OBJ_STRUCT;
35 void SUMA_Show_OBJ(SUMA_OBJ_STRUCT *obj, char *Header, int level, FILE *out);
36 char *SUMA_OBJ_Info(SUMA_OBJ_STRUCT *obj, char *Header, int level);
37 SUMA_Boolean SUMA_OBJ_Read_SO(char *fname, SUMA_SurfaceObject *SO,
38                               SUMA_SphereDO **sphdo);
39 SUMA_SurfaceObject *SUMA_OBJ_2_SO(SUMA_OBJ_STRUCT *obj);
40 SUMA_OBJ_STRUCT *SUMA_OBJ_Read(char *fname);
41 SUMA_OBJ_STRUCT *SUMA_Free_OBJ(SUMA_OBJ_STRUCT *obj);
42 
43 SUMA_SurfaceObject *SUMA_Load_Surface_Object_Wrapper (
44                         char *if_name, char *if_name2, char *vp_name,
45                         SUMA_SO_File_Type SO_FT, SUMA_SO_File_Format SO_FF,
46                         char *sv_name, int debug);
47 char *SUMA_RemoveSurfNameExtension (char*Name, SUMA_SO_File_Type oType);
48 void *SUMA_Prefix2SurfaceName (char *prefix, char *path, char *vp_name, SUMA_SO_File_Type oType, SUMA_Boolean *exists);
49 void * SUMA_2Prefix2SurfaceName (char *namecoord, char *nametopo, char *path, char *vp_name, SUMA_SO_File_Type oType, SUMA_Boolean *exists);
50 SUMA_Boolean SUMA_SureFit_Read_Coord (char * f_name, SUMA_SureFit_struct *SF);
51 SUMA_Boolean SUMA_SureFit_Read_Topo (char * f_name, SUMA_SureFit_struct *SF);
52 void SUMA_Show_SureFit (SUMA_SureFit_struct *SF, FILE *Out);
53 SUMA_Boolean SUMA_Free_SureFit (SUMA_SureFit_struct *SF);
54 SUMA_Boolean SUMA_FreeSurfer_Read (char * f_name, SUMA_FreeSurfer_struct *FS);
55 SUMA_Boolean SUMA_FreeSurfer_Read_eng (char * f_name, SUMA_FreeSurfer_struct *FS, int debug);
56 SUMA_Boolean SUMA_FreeSurfer_ReadBin_eng (char * f_name, SUMA_FreeSurfer_struct *FS, int debug);
57 SUMA_Boolean SUMA_Free_FreeSurfer (SUMA_FreeSurfer_struct *FS);
58 void SUMA_Show_FreeSurfer (SUMA_FreeSurfer_struct *FS, FILE *Out);
59 SUMA_Boolean SUMA_Ply_Read (char * f_name, SUMA_SurfaceObject *SO);
60 SUMA_Boolean SUMA_Ply_Write (char * f_name, SUMA_SurfaceObject *SO);
61 SUMA_Boolean SUMA_STL_Read (char * f_name, SUMA_SurfaceObject *SO);
62 SUMA_Boolean SUMA_STL_Write (char * f_name, SUMA_SurfaceObject *SO);
63 SUMA_Boolean SUMA_Mnc_Read (char * f_name, SUMA_SurfaceObject *SO);
64 SUMA_Boolean SUMA_Mnc_Write (char * f_name, SUMA_SurfaceObject *SO);
65 SUMA_Boolean SUMA_VEC_Write (SUMA_SFname *Fname, SUMA_SurfaceObject *SO);
66 SUMA_Boolean SUMA_VEC_Read(SUMA_SFname *Fname, SUMA_SurfaceObject *SO);
67 SUMA_Boolean SUMA_FS_Write (char *fileNm, SUMA_SurfaceObject *SO, char *firstLine);
68 SUMA_Boolean SUMA_SureFit_Write (SUMA_SFname *Fname, SUMA_SurfaceObject *SO);
69 SUMA_Boolean SUMA_GIFTI_Write (char *fileNm, SUMA_SurfaceObject *SO,
70                                SUMA_SO_File_Format forceencode);
71 SUMA_Boolean SUMA_BYU_Write (char *fileNm, SUMA_SurfaceObject *SO, int base1);
72 void SUMA_SaveDrawnROI (char *filename, void *data);
73 void SUMA_SaveXformOpts (char *filename, void *data);
74 SUMA_Boolean SUMA_SaveDrawnROI_1D (char *filename, SUMA_SurfaceObject *SO, SUMA_DRAWN_ROI *DrawnROI, int SaveWhat);
75 SUMA_Boolean SUMA_SaveDrawnROINIML (char *filename, SUMA_SurfaceObject *SO, SUMA_DRAWN_ROI *DrawnROI, int SaveWhat, int Format);
76 SUMA_1D_DRAWN_ROI * SUMA_Free_1DDrawROI (SUMA_1D_DRAWN_ROI *ROI1D);
77 SUMA_Boolean SUMA_Write_DrawnROI_1D (SUMA_DRAWN_ROI **ROIv, int N_ROI, char *filename);
78 SUMA_1D_DRAWN_ROI * SUMA_DrawnROI_to_1DDrawROI (SUMA_DRAWN_ROI *ROI);
79 SUMA_DRAWN_ROI ** SUMA_OpenDrawnROI_NIML (char *filename, int *N_ROI,
80                               SUMA_Boolean ForDisplay, SUMA_SurfaceViewer *sv);
81 SUMA_DRAWN_ROI ** SUMA_OpenDrawnROI_1D(char *filename, char *Parent_idcode_str,
82                                        int *N_ROI, SUMA_Boolean ForDisplay);
83 SUMA_DRAWN_ROI **SUMA_MultiColumnsToDrawnROI(
84          int N_Nodes,
85          void *ind, SUMA_VARTYPE ind_type,
86          void *col0, SUMA_VARTYPE col0_type,
87          void *col1, SUMA_VARTYPE col1_type,
88          void *col2, SUMA_VARTYPE col2_type,
89          void *col3, SUMA_VARTYPE col3_type,
90          SUMA_COLOR_MAP *cmap,
91          int edges_only,
92          char *name, char *Parent_idcode_str,
93          int *N_ROI, SUMA_Boolean ForDisplay,
94          SUMA_Boolean kkk);
95 void SUMA_OpenDrawnROI (char *filename, void *data);
96 SUMA_DSET *SUMA_ROIv2Grpdataset (SUMA_DRAWN_ROI** ROIv, int N_ROIv,
97                                  char *Parent_idcode_str, int Pad_to,
98                                  int Pad_val, SUMA_COLOR_MAP **cm) ;
99 SUMA_DSET *SUMA_ROIv2MultiDset (SUMA_DRAWN_ROI** ROIv, int N_ROIv,
100                                  char *Parent_idcode_str, int Pad_to,
101                                  int Pad_val, SUMA_COLOR_MAP **cm) ;
102 NI_element *SUMA_ROIv2dataset (SUMA_DRAWN_ROI** ROIv, int N_ROIv, char *Parent_idcode_str, int pad_to, int pad_val);
103 DList *SUMA_ROIv2NodeLists (SUMA_DRAWN_ROI** ROIv, int N_ROIv, int purgedups) ;
104 void SUMA_SaveSOascii (char *filename, void *data);
105 float * SUMA_readFScurv (char *f_name, int *nrows, int *ncols, SUMA_Boolean rowmajor, SUMA_Boolean SkipCoords);
106 SUMA_Boolean SUMA_BYU_Read(char *f_name, SUMA_SurfaceObject *SO, int debug, byte hide_negcols);
107 SUMA_Boolean SUMA_BrainVoyager_Read(char *f_name, SUMA_SurfaceObject *SO, int debug, byte hide_negcols);
108 SUMA_Boolean SUMA_FreeSurfer_WritePatch (char *fileNm, SUMA_SurfaceObject *SO, char *firstLine, SUMA_SurfaceObject *SOparent);
109 SUMA_FORM_AFNI_DSET_STRUCT *SUMA_New_FormAfniDset_Opt(void);
110 SUMA_FORM_AFNI_DSET_STRUCT *SUMA_Free_FormAfniDset_Opt(SUMA_FORM_AFNI_DSET_STRUCT *Opt);
111 THD_3dim_dataset *SUMA_FormAfnidset (float *NodeList, float *vals, int N_vals, SUMA_FORM_AFNI_DSET_STRUCT *Opt);
112 NI_group *SUMA_SO2nimlSO(SUMA_SurfaceObject *SO, char *optlist, int nlee) ;
113 SUMA_SurfaceObject *SUMA_nimlSO2SO(NI_group *ngr);
114 SUMA_OPEN_DX_STRUCT ** SUMA_Free_OpenDX_StructVec(SUMA_OPEN_DX_STRUCT **dxv, int nobj);
115 SUMA_Boolean SUMA_OpenDX_Write(char *fname, SUMA_SurfaceObject *SO);
116 SUMA_Boolean SUMA_OpenDx_Object_Attr(char *op, int nchar, SUMA_OPEN_DX_STRUCT *dx);
117 SUMA_Boolean SUMA_OpenDx_Object_Components(char *op, int nchar, SUMA_OPEN_DX_STRUCT *dx);
118 SUMA_OPEN_DX_STRUCT *SUMA_Find_OpenDX_Object_Name(SUMA_OPEN_DX_STRUCT **dxv, int iop, char *nm, int *nf);
119 SUMA_OPEN_DX_STRUCT *SUMA_Find_OpenDX_Object_Class(SUMA_OPEN_DX_STRUCT **dxv, int iop, char *nm, int *nf);
120 SUMA_Boolean SUMA_OpenDX_Read_SO(char *fname, SUMA_SurfaceObject *SO);
121 char * SUMA_OpenDX_Read_CruiseVolHead(char *fname, THD_3dim_dataset *dset, int loaddata);
122 SUMA_Boolean SUMA_readFSannot (char *f_name,
123                                char *f_ROI, char *f_cmap, char *f_col,
124                                int Showct, char *ctfile,
125                                int lbl1, int lbl2,
126                                SUMA_DSET **dset);
127 SUMA_COLOR_MAP *SUMA_FScolutToColorMap(char *fscolutname,
128                                        int lbl1, int lbl2, int show,int idISi);
129 SUMA_COLOR_MAP *SUMA_FScolutToColorMap_eng(SUMA_FS_COLORTABLE *ct,
130                                        int lbl1, int lbl2, int show,int idISi);
131 SUMA_Boolean SUMA_isnimlSO(NI_group *ngr);
132 void SUMA_free_ROI_Extract(void *dd);
133 SUMA_Boolean SUMA_MNI_OBJ_Write(char * f_name_in, SUMA_SurfaceObject *SO);
134 SUMA_Boolean SUMA_MNI_OBJ_Read(char * f_name, SUMA_SurfaceObject *SO);
135 SUMA_Boolean SUMA_GIFTI_Read(char *f_name, SUMA_SurfaceObject *SO,
136                              int debug);
137 void set_GIFTI_RAI_warn(int v);
138 SUMA_Boolean SUMA_GetSOCoordXform(SUMA_SurfaceObject *SO, double xform[4][4]);
139 
140 
141 typedef struct {
142    int label;
143    char *name;
144    int N_vals;
145    int N_alloc;
146    int *vals;
147 } SUMA_ROI_EXTRACT;
148 
149 #endif
150