#include "SUMA_suma.h" #ifdef SUMA_SureFit_STAND_ALONE SUMA_CommonFields *SUMAg_CF; #else extern SUMA_CommonFields *SUMAg_CF; #endif /* CODE */ /*!** File : SUMA_SureFit.c \author Ziad Saad Date : Fri Feb 8 16:29:06 EST 2002 Purpose : Read SureFit data */ /*!** Function: SUMA_SureFit_Read_Coord Usage : Ret = SUMA_SureFit_Read_Coord (coordname, SureFit) Input paramters : \param coordname (char *) name of .coord file \param SureFit (SUMA_SureFit_struct *) pointer to the SureFit structure Returns : \return (SUMA_Boolean) YUP/NOPE for success/failure Support : \sa \sa Side effects : ***/ SUMA_Boolean SUMA_SureFit_Read_Coord (char * f_name, SUMA_SureFit_struct *SF) {/*SUMA_SureFit_Read_Coord*/ static char FuncName[]={"SUMA_SureFit_Read_Coord"}; FILE *sf_file; int ex, EndHead, FoundHead, evl, cnt, skp, ND, id; char stmp[100], head_strt[100], head_end[100], s[1000], delimstr[] = {' ', '\0'}, *st; if (SUMAg_CF->InOut_Notify) SUMA_DBG_IN_NOTIFY(FuncName); ND = 3; /* check for existence */ if (!SUMA_filexists(f_name)) { fprintf(SUMA_STDERR,"File %s does not exist or cannot be read.\n", f_name); SUMA_RETURN (NOPE); } sprintf(SF->name_coord, "%s", f_name); /* start reading */ sf_file = fopen (f_name,"r"); if (sf_file == NULL) { SUMA_error_message (FuncName,"Could not open input file ",0); SUMA_RETURN (NOPE); } /* read until you reach the begin header BeginHeader */ ex = 1; FoundHead = 0; sprintf(head_strt,"BeginHeader"); while (ex != EOF && !FoundHead) { ex = fscanf (sf_file,"%s",s); if (strlen (s) >= strlen(head_strt)) { evl = SUMA_iswordin (s,head_strt); if (evl == 1) FoundHead = 1; } } if (!FoundHead) { fprintf(SUMA_STDERR,"Error %s: BeginHeader not found in %s.\nPerhaps you are using old versions of Caret/SureFit files.\n", FuncName, f_name); SUMA_RETURN (NOPE); } EndHead = 0; sprintf(head_end,"EndHeader"); sprintf(delimstr," "); while (ex != EOF && !EndHead) { ex = fscanf (sf_file,"%s",s); /*fprintf(stdout,"%s\n", s);*/ if (strlen (s) >= strlen(head_end)) { evl = SUMA_iswordin (s,head_end); if (evl == 1) EndHead = 1; } /* look for some tokens */ skp = 0; if (!EndHead) { st = strtok(s, delimstr); sprintf(stmp,"encoding"); if (!skp && SUMA_iswordin (st, stmp) == 1) { /*fprintf(stdout,"Found encoding\n");*/ ex = fscanf (sf_file,"%s",(SF->encoding_coord)); skp = 1; } sprintf(stmp,"configuration_id"); if (!skp && SUMA_iswordin (st, stmp) == 1) { /*fprintf(stdout,"Found configuration_id\n");*/ ex = fscanf (sf_file,"%s",(SF->configuration_id)); skp = 1; } sprintf(stmp,"coordframe_id"); if (!skp && SUMA_iswordin (st, stmp) == 1) { /*fprintf(stdout,"Found configuration_id\n");*/ ex = fscanf (sf_file,"%s",(SF->coordframe_id)); skp = 1; } } } /* Now read the Number of Nodes */ fscanf(sf_file, "%d", &SF->N_Node); /*fprintf (stdout,"Expecting %d nodes.\n", SF->N_Node);*/ /* allocate space */ SF->NodeList = (float *)SUMA_calloc(SF->N_Node * ND, sizeof(float)); SF->NodeId = (int *)SUMA_calloc (SF->N_Node, sizeof(int)); if (SF->NodeList == NULL || SF->NodeId == NULL) { fprintf(SUMA_STDERR, "Error %s: Could not allocate space for NodeList &/| NodeId.\n", FuncName); SUMA_RETURN (NOPE); } /* Now read the nodes until the end of the file */ cnt = 0; while (ex != EOF && cnt < SF->N_Node) { id = cnt * ND; ex = fscanf (sf_file,"%d %f %f %f",&(SF->NodeId[cnt]), \ &(SF->NodeList[id]), &(SF->NodeList[id+1]), &(SF->NodeList[id+2])); ++cnt; } if (cnt != SF->N_Node) { fprintf(SUMA_STDERR, "Error %s: Expecting %d Nodes, read %d.\n", FuncName, SF->N_Node, cnt); SUMA_RETURN (NOPE); } fclose (sf_file); SUMA_RETURN (YUP); }/*SUMA_SureFit_Read_Coord*/ SUMA_Boolean SUMA_SureFit_Read_Topo (char * f_name, SUMA_SureFit_struct *SF) {/*SUMA_SureFit_Read_Topo*/ static char FuncName[]={"SUMA_SureFit_Read_Topo"}; FILE *sf_file; int ex, EndHead, FoundHead, evl, cnt, skp, jnk, i, ip, NP; char stmp[100], head_strt[100], head_end[100], s[1000], delimstr[] = {' ', '\0'}, *st; if (SUMAg_CF->InOut_Notify) SUMA_DBG_IN_NOTIFY(FuncName); /* check for existence */ if (!SUMA_filexists(f_name)) { fprintf(SUMA_STDERR,"File %s does not exist or cannot be read.\n", f_name); SUMA_RETURN (NOPE); } sprintf(SF->name_topo, "%s", f_name); /* start reading */ sf_file = fopen (f_name,"r"); if (sf_file == NULL) { SUMA_error_message (FuncName,"Could not open input file ",0); SUMA_RETURN (NOPE); } /* read until you reach the begin header BeginHeader */ ex = 1; FoundHead = 0; sprintf(head_strt,"BeginHeader"); while (ex != EOF && !FoundHead) { ex = fscanf (sf_file,"%s",s); if (strlen (s) >= strlen(head_strt)) { evl = SUMA_iswordin (s,head_strt); if (evl == 1) FoundHead = 1; } } if (!FoundHead) { fprintf(SUMA_STDERR,"Error %s: BeginHeader not found in %s.\nPerhaps you are using old versions of Caret/SureFit files.\n", FuncName, f_name); SUMA_RETURN (NOPE); } EndHead = 0; sprintf(head_end,"EndHeader"); sprintf(delimstr," "); while (ex != EOF && !EndHead) { ex = fscanf (sf_file,"%s",s); /*fprintf(stdout,"%s\n", s);*/ if (strlen (s) >= strlen(head_end)) { evl = SUMA_iswordin (s,head_end); if (evl == 1) EndHead = 1; } /* look for some tokens */ skp = 0; if (!EndHead) { st = strtok(s, delimstr); sprintf(stmp,"encoding"); if (!skp && SUMA_iswordin (st, stmp) == 1) { /*fprintf(stdout,"Found encoding\n");*/ ex = fscanf (sf_file,"%s",(SF->encoding_topo)); skp = 1; } sprintf(stmp,"perimeter_id"); if (!skp && SUMA_iswordin (st, stmp) == 1) { /*fprintf(stdout,"Found perimeter_id\n");*/ ex = fscanf (sf_file,"%s",(SF->perimeter_id)); skp = 1; } sprintf(stmp,"date"); if (!skp && SUMA_iswordin (st, stmp) == 1) { /*fprintf(stdout,"Found date\n");*/ ex = fscanf (sf_file,"%s\n",(SF->date)); skp = 1; } } } /* Now read the Number of Nodes Specs */ fscanf(sf_file, "%d", &SF->N_Node_Specs); /*fprintf (stdout,"Expecting %d Node_Specs.\n", SF->N_Node_Specs);*/ SF->FN.N_Node = SF->N_Node_Specs; SF->FN.N_Neighb_max = 0; /* allocate for Node Specs Matrix and First_Neighb structure*/ SF->Specs_mat = (int **) SUMA_allocate2D(SF->N_Node_Specs, 6, sizeof(int)); /*assume maximum number of neighbors is SUMA_MAX_NUMBER_NODE_NEIGHB */ SF->FN.FirstNeighb = (int **) SUMA_allocate2D(SF->FN.N_Node, SUMA_MAX_NUMBER_NODE_NEIGHB, sizeof (int)); SF->FN.N_Neighb = (int *) SUMA_calloc (SF->FN.N_Node, sizeof(int)); SF->FN.NodeId = (int *) SUMA_calloc (SF->FN.N_Node, sizeof(int)); if (SF->Specs_mat == NULL || SF->FN.FirstNeighb == NULL || SF->FN.N_Neighb == NULL || SF->FN.NodeId == NULL ){ fprintf(SUMA_STDERR, "Error %s: Could not allocate space for SF->Specs_mat &/| SF->FN.FirstNeighb &/| SF->FN.N_Neighb &/| SF->FN.NodeId.\n", FuncName); SUMA_RETURN (NOPE); } /* Now read the node specs */ /*fprintf (stdout,"About to read specs\n");*/ cnt = 0; while (ex != EOF && cnt < SF->N_Node_Specs) { ex = fscanf (sf_file,"%d %d %d %d %d %d",&(SF->Specs_mat[cnt][0]), &(SF->Specs_mat[cnt][1]), \ &(SF->Specs_mat[cnt][2]), &(SF->Specs_mat[cnt][3]), &(SF->Specs_mat[cnt][4]), &(SF->Specs_mat[cnt][5])); SF->FN.NodeId[cnt] = SF->Specs_mat[cnt][0]; SF->FN.N_Neighb[cnt] = SF->Specs_mat[cnt][1]; if (SF->FN.N_Neighb[cnt] > SUMA_MAX_NUMBER_NODE_NEIGHB-1) { fprintf (SUMA_STDERR,"Error %s: Node %d has more neighbors (%d) than the maximum allowed (%d)\n", \ FuncName, SF->FN.NodeId[cnt], SF->FN.N_Neighb[cnt], SUMA_MAX_NUMBER_NODE_NEIGHB-1); SUMA_RETURN (NOPE); } if (SF->FN.N_Neighb[cnt] > SF->FN.N_Neighb_max) SF->FN.N_Neighb_max = SF->FN.N_Neighb[cnt]; /* Now Read in the Neighbors info */ for (i=0; i < SF->FN.N_Neighb[cnt]; ++ i) { ex = fscanf (sf_file,"%d %d", &jnk, &(SF->FN.FirstNeighb[cnt][i])); } /* seal with -1 */ SF->FN.FirstNeighb[cnt][SF->FN.N_Neighb[cnt]] = -1; ++cnt; } if (cnt != SF->N_Node_Specs) { fprintf(SUMA_STDERR, "Error %s: Expecting %d NodeSpecs, read %d.\n", FuncName, SF->N_Node_Specs, cnt); SUMA_RETURN (NOPE); } /*fprintf (stdout, "Done with Node Specs.\n");*/ ex = fscanf (sf_file,"%d", &(SF->N_FaceSet)); /*fprintf (stdout, "Expecting to read %d facesets.\n", SF->N_FaceSet);*/ NP = 3; SF->FaceSetList = (int *) SUMA_calloc(SF->N_FaceSet * 3, sizeof(int)); if (SF->FaceSetList == NULL){ fprintf(SUMA_STDERR, "Error %s: Could not allocate space for SF->FaceSetList.\n", FuncName); SUMA_RETURN (NOPE); } /*fprintf (stdout,"About to read FaceSets\n");*/ cnt = 0; while (ex != EOF && cnt < SF->N_FaceSet) { ip = NP * cnt; ex = fscanf (sf_file,"%d %d %d ",&(SF->FaceSetList[ip]), &(SF->FaceSetList[ip+1]), \ &(SF->FaceSetList[ip+2])); ++cnt; } if (cnt != SF->N_FaceSet) { fprintf(SUMA_STDERR, "Error %s: Expecting %d FaceSets, read %d.\n", FuncName, SF->N_FaceSet, cnt); SUMA_RETURN (NOPE); } fclose (sf_file); SUMA_RETURN (YUP); }/*SUMA_SureFit_Read_Topo*/ /*! Show data structure containing SureFit surface object */ void SUMA_Show_SureFit (SUMA_SureFit_struct *SF, FILE *Out) { int cnt, id, ND, NP; static char FuncName[]={"SUMA_Show_SureFit"}; if (SUMAg_CF->InOut_Notify) SUMA_DBG_IN_NOTIFY(FuncName); ND = 3; NP = 3; if (Out == NULL) Out = SUMA_STDOUT; fprintf (Out, "\n%s: Coord Info\n", SF->name_coord); fprintf (Out, "N_Node %d\n", SF->N_Node); fprintf (Out, "encoding_coord: %s\nconfiguration id: %s, coordframe_id: %s\n", SF->encoding_coord,SF->configuration_id, SF->coordframe_id); fprintf (Out, "First 2 points [id] X Y Z:\n\t[%d] %f %f %f\n\t[%d] %f %f %f\n", \ SF->NodeId[0], SF->NodeList[0], SF->NodeList[1], SF->NodeList[2], SF->NodeId[1], SF->NodeList[3], SF->NodeList[4], SF->NodeList[5]); fprintf (Out, "Last 2 points [id] X Y Z:\n\t[%d] %f %f %f\n\t[%d] %f %f %f\n", \ SF->NodeId[SF->N_Node-2], SF->NodeList[ND*(SF->N_Node-2)], SF->NodeList[ND*(SF->N_Node-2)+1], SF->NodeList[ND*(SF->N_Node-2)+2], SF->NodeId[SF->N_Node-1], SF->NodeList[ND*(SF->N_Node-1)], SF->NodeList[ND*(SF->N_Node-1)+1], SF->NodeList[ND*(SF->N_Node-1)+2]); fprintf (Out, "\n%s: Topo Info\n", SF->name_topo); fprintf (Out, "N_Node_Specs %d\n", SF->N_Node_Specs); fprintf (Out, "ecnoding_topo: %s, date %s\n", SF->encoding_topo, SF->date); fprintf (Out, "N_FaceSet %d\n", SF->N_FaceSet); fprintf (Out, "First 2 polygons:\n\t%d %d %d\n\t%d %d %d\n", \ SF->FaceSetList[0], SF->FaceSetList[1], SF->FaceSetList[2], SF->FaceSetList[3], SF->FaceSetList[4], SF->FaceSetList[5]); fprintf (Out, "Last 2 polygons:\n\t%d %d %d\n\t%d %d %d\n", \ SF->FaceSetList[NP*(SF->N_FaceSet-2)], SF->FaceSetList[NP*(SF->N_FaceSet-2) + 1], SF->FaceSetList[NP*(SF->N_FaceSet-2) + 2], SF->FaceSetList[NP*(SF->N_FaceSet-1)], SF->FaceSetList[NP*(SF->N_FaceSet-1) + 1], SF->FaceSetList[NP*(SF->N_FaceSet-1) + 2]); fprintf (Out, "\nNode Specs (%d):\n", SF->N_Node_Specs); fprintf (Out, "First Entry: \t%d %d %d %d %d %d\n", \ SF->Specs_mat[0][0], SF->Specs_mat[0][1],SF->Specs_mat[0][2], SF->Specs_mat[0][3],SF->Specs_mat[0][4], SF->Specs_mat[0][5]); cnt = 0; while (cnt < SF->FN.N_Neighb[0]) { fprintf (Out, "\t%d %d\n", cnt, SF->FN.FirstNeighb[0][cnt]); ++cnt; } fprintf (Out, "Last Entry: \t%d %d %d %d %d %d\n", \ SF->Specs_mat[SF->N_Node_Specs-1][0], SF->Specs_mat[SF->N_Node_Specs-1][1],SF->Specs_mat[SF->N_Node_Specs-1][2],\ SF->Specs_mat[SF->N_Node_Specs-1][3],SF->Specs_mat[SF->N_Node_Specs-1][4], SF->Specs_mat[SF->N_Node_Specs-1][5]); cnt = 0; while (cnt < SF->FN.N_Neighb[SF->N_Node_Specs-1]) { fprintf (Out, "\t%d %d\n", cnt, SF->FN.FirstNeighb[SF->N_Node_Specs-1][cnt]); ++cnt; } SUMA_RETURNe; } /*! free data structure containing SureFit surface object */ SUMA_Boolean SUMA_Free_SureFit (SUMA_SureFit_struct *SF) { static char FuncName[]={"SUMA_Free_SureFit"}; if (SUMAg_CF->InOut_Notify) SUMA_DBG_IN_NOTIFY(FuncName); if (SF->NodeList != NULL) SUMA_free(SF->NodeList); if (SF->NodeId != NULL) SUMA_free(SF->NodeId); if (SF->Specs_mat != NULL) SUMA_free2D ((char **)SF->Specs_mat, SF->N_Node_Specs); if (SF->FN.FirstNeighb != NULL) SUMA_free2D((char **)SF->FN.FirstNeighb, SF->FN.N_Node); if (SF->FN.N_Neighb != NULL) SUMA_free(SF->FN.N_Neighb); if (SF->FN.NodeId != NULL) SUMA_free(SF->FN.NodeId); if (SF->FaceSetList != NULL) SUMA_free(SF->FaceSetList); if (SF!= NULL) SUMA_free(SF); SUMA_RETURN (YUP); } /*! Read in some parameters from a .param file */ SUMA_Boolean SUMA_Read_SureFit_Param (char *f_name, SUMA_SureFit_struct *SF) { static char FuncName[]={"SUMA_Read_SureFit_Param"}; int ex, evl; FILE *sf_file; SUMA_Boolean Done; char delimstr[] = {' ', '\0'}, stmp[100], s[1000], *st; if (SUMAg_CF->InOut_Notify) SUMA_DBG_IN_NOTIFY(FuncName); /* check for existence */ if (!SUMA_filexists(f_name)) { fprintf(SUMA_STDERR,"File %s does not exist or cannot be read.\n", f_name); SUMA_RETURN (NOPE); } sprintf(SF->name_param, "%s", f_name); /* start reading */ sf_file = fopen (f_name,"r"); if (sf_file == NULL) { fprintf (SUMA_STDERR,"Error %s: Could not open input file ",FuncName); SUMA_RETURN (NOPE); } /* read until you reach something you like */ ex = 1; Done = NOPE; sprintf(delimstr,"="); while (ex != EOF && !Done) { ex = fscanf (sf_file,"%s",s); sprintf(stmp,"ACx_WholeVolume"); evl = SUMA_iswordin (s,stmp); if (evl == 1) { /* found ACx_WholeVolume */ /*fprintf(SUMA_STDOUT, "Found ACx_WholeVolume:");*/ /* go past the = sign and grab the value */ st = strtok(s, delimstr); st = strtok(NULL, delimstr); SF->AC_WholeVolume[0] = atof(st); /*fprintf(SUMA_STDOUT, " %f\n", SF->AC_WholeVolume[0]);*/ continue; } sprintf(stmp,"ACy_WholeVolume"); evl = SUMA_iswordin (s,stmp); if (evl == 1) { /* found ACy_WholeVolume */ /*fprintf(SUMA_STDOUT, "Found ACy_WholeVolume:");*/ /* go past the = sign and grab the value */ st = strtok(s, delimstr); st = strtok(NULL, delimstr); SF->AC_WholeVolume[1] = atof(st); /*fprintf(SUMA_STDOUT, " %f\n", SF->AC_WholeVolume[1]);*/ continue; } sprintf(stmp,"ACz_WholeVolume"); evl = SUMA_iswordin (s,stmp); if (evl == 1) { /* found ACz_WholeVolume */ /*fprintf(SUMA_STDOUT, "Found ACz_WholeVolume:");*/ /* go past the = sign and grab the value */ st = strtok(s, delimstr); st = strtok(NULL, delimstr); SF->AC_WholeVolume[2] = atof(st); /*fprintf(SUMA_STDOUT, " %f\n", SF->AC_WholeVolume[2]);*/ continue; } sprintf(stmp,"ACx"); evl = SUMA_iswordin (s,stmp); if (evl == 1) { /* found ACx */ /*fprintf(SUMA_STDOUT, "Found ACx:");*/ /* go past the = sign and grab the value */ st = strtok(s, delimstr); st = strtok(NULL, delimstr); SF->AC[0] = atof(st); /*fprintf(SUMA_STDOUT, " %f\n", SF->AC[0]);*/ continue; } sprintf(stmp,"ACy"); evl = SUMA_iswordin (s,stmp); if (evl == 1) { /* found ACy */ /*fprintf(SUMA_STDOUT, "Found ACy:");*/ /* go past the = sign and grab the value */ st = strtok(s, delimstr); st = strtok(NULL, delimstr); SF->AC[1] = atof(st); /*fprintf(SUMA_STDOUT, " %f\n", SF->AC[1]);*/ continue; } sprintf(stmp,"ACz"); evl = SUMA_iswordin (s,stmp); if (evl == 1) { /* found ACz */ /*fprintf(SUMA_STDOUT, "Found ACz:");*/ /* go past the = sign and grab the value */ st = strtok(s, delimstr); st = strtok(NULL, delimstr); SF->AC[2] = atof(st); /*fprintf(SUMA_STDOUT, " %f\n", SF->AC[2]);*/ continue; } } fclose(sf_file); /* Sanity Checks */ if (SF->AC[0] == 0.0 && SF->AC[1] == 0.0 && SF->AC[2] == 0.0) { fprintf (SUMA_STDERR,"Error %s: All values for AC are 0.0. Check your params file.\n", FuncName); SUMA_RETURN (NOPE); } if (SF->AC_WholeVolume[0] == 0.0 && SF->AC_WholeVolume[1] == 0.0 && SF->AC_WholeVolume[2] == 0.0) { fprintf (SUMA_STDERR,"Error %s: All values for AC_WholeVolume are 0.0. Check your params file.\n", FuncName); SUMA_RETURN (NOPE); } if (SF->AC[0] == SF->AC_WholeVolume[0] && SF->AC[1] == SF->AC_WholeVolume[1] && SF->AC[2] == SF->AC_WholeVolume[2]) { fprintf (SUMA_STDERR,"Error %s: Idetincal values for AC and AC_WholeVolume. Check you params file.\n", FuncName); SUMA_RETURN (NOPE); } if (SF->AC[0] < 0 || SF->AC[1] < 0 || SF->AC[2] < 0 || SF->AC_WholeVolume[0] < 0 || SF->AC_WholeVolume[1] < 0 || SF->AC_WholeVolume[2] < 0) { fprintf (SUMA_STDERR,"Error %s: Negative values in AC or AC_WholeVolume. Check you params file.\n", FuncName); SUMA_RETURN (NOPE); } SUMA_RETURN (YUP); } #ifdef SUMA_SureFit_STAND_ALONE SUMA_CommonFields *SUMAg_CF; SUMA_SurfaceViewer *SUMAg_cSV; /*!< Global pointer to current Surface Viewer structure*/ SUMA_SurfaceViewer *SUMAg_SVv; /*!< Global pointer to the vector containing the various Surface Viewer Structures */ int SUMAg_N_SVv = 0; /*!< Number of SVs stored in SVv */ SUMA_DO *SUMAg_DOv; /*!< Global pointer to Displayable Object structure vector*/ int SUMAg_N_DOv = 0; /*!< Number of DOs stored in DOv */ void usage () {/*Usage*/ printf ("\n\33[1mUsage: \33[0m SUMA_SureFit CoordRoot TopoRoot \n"); printf ("\t ..... \n\n"); printf ("\t To Compile:\ngcc -DSUMA_SureFit_STAND_ALONE -Wall -o $1 $1.c -I./ -I//usr/X11R6/include SUMA_lib.a\n"); printf ("\t\t Ziad S. Saad SSCC/NIMH/NIH ziad@nih.gov \tFri Feb 8 16:29:06 EST 2002 \n"); exit (0); }/*Usage*/ int main (int argc,char *argv[]) {/* Main */ static char FuncName[]={"SUMA_SureFit-Main"}; char SF_name[200]; SUMA_SureFit_struct *SF; /* allocate space for CommonFields structure */ SUMAg_CF = SUMA_Create_CommonFields (); if (SUMAg_CF == NULL) { fprintf(SUMA_STDERR,"Error %s: Failed in SUMA_Create_CommonFields\n", FuncName); exit(1); } /* Allocate for SF */ SF = (SUMA_SureFit_struct *) SUMA_malloc(sizeof(SUMA_SureFit_struct)); if (SF == NULL) { fprintf(SUMA_STDERR,"Error %s: Failed to allocate for SF\n", FuncName); exit(1); } if (argc < 3) { usage (); exit (1); } sprintf(SF_name, "%s.coord", argv[1]); if (!SUMA_SureFit_Read_Coord (SF_name, SF)) { fprintf(SUMA_STDERR,"Error %s: Failed in SUMA_SureFit_Read_Coord.\n", FuncName); exit(1); } sprintf(SF_name, "%s.topo", argv[2]); if (!SUMA_SureFit_Read_Topo (SF_name, SF)) { fprintf(SUMA_STDERR,"Error %s: Failed in SUMA_SureFit_Read_Topo.\n", FuncName); exit(1); } SUMA_Show_SureFit (SF, NULL); fprintf(stdout, "freeing ..\n"); if (!SUMA_Free_SureFit (SF)) { fprintf(SUMA_STDERR,"Error %s: Failed in SUMA_Free_SureFit.\n", FuncName); exit(1); } if (!SUMA_Free_CommonFields(SUMAg_CF)) SUMA_error_message(FuncName,"SUMAg_CF Cleanup Failed!",1); SUMA_RETURN (0); }/* Main */ #endif