1 #ifndef THD_SEGTOOLS_INCLUDED
2 #define THD_SEGTOOLS_INCLUDED
3 
4 #define C(i) (gsl_vector_get(c,(i)))
5 #define THD_SEG_IRAN(t) (lrand48() % (t))
6 
7 extern int *z_idoubleqsort (double *x , int nx );
8 
9 THD_3dim_dataset *thd_polyfit(THD_3dim_dataset *in_set,
10                               byte *mask, int polorder,
11                               char *prefix, int verb);
12 
13 typedef enum { NONE = 0, COUNT, iCOUNT, MAG, iMAG } REMAPS;
14 
15 /**********************************************************************
16    BEGIN: functions based on command.c code from The C clustering library.
17 **********************************************************************/
18 void segtools_verb(int ii);
19 void example_kmeans( int nrows, int ncols,
20                      float** data,
21                      int nclusters, int npass,
22                      char dist, char* jobname,
23                      int *clusterid, float **vcdata,
24                      REMAPS remap);
25 void clusterlib_display_version(void);
26 char* clusterlib_setjobname(const char* basename, int strip);
27 int clusterlib_readnumber(const char word[]);
28 char clusterlib_getmetric(int i);
29 float** example_distance_gene(int nrows, int ncols, float** data);
30 void example_hierarchical( int nrows, int ncols,
31                            float** data,
32                            char* jobname,
33                            int k, float** distmatrix,
34                            int *clusterid);
35 void getvoxlclusterdist(int* count, float** cdata,
36 			int* clusterid, float** data, char* jobname,
37 			int nclusters, int nrows, int ncols, float **vcdata,
38          char dist);
39 void getvoxlclustersdist(int* count, float** cdata,
40 			int* clusterid, float** data, char* jobname,
41 			int nclusters, int nrows, int ncols, float **vcdata,
42          char dist);
43 void color_palette(int nclusters, char* jobname);
44 
45 /**********************************************************************
46    END: functions based on command.c code from The C clustering library.
47 **********************************************************************/
48 
49 typedef struct {
50    int k;
51    int kh;
52    int r;
53    char *jobname;
54    char distmetric;
55    int voxdebug[4];
56    int verb;
57    int writedists;
58    unsigned int rand_seed;
59    int remap;
60    char *user_labeltable;
61    char *clabels[500]; /* overkill */
62    int nclabels;
63 } OPT_KMEANS;
64 
65 OPT_KMEANS new_kmeans_oc(void);
66 int thd_Adist (  THD_3dim_dataset *in_set,
67                  byte *mask,
68                  float *sigs, int nsigs,
69                  THD_3dim_dataset **dist_set,
70                  OPT_KMEANS oc);
71 int thd_Acluster1 (   THD_3dim_dataset *in_set,
72                   byte *mask, int nmask,
73                   THD_3dim_dataset **clust_set,
74                   THD_3dim_dataset **dist_set,
75                   THD_3dim_dataset *clust_init,
76                   OPT_KMEANS oc);
77 int thd_Acluster (  THD_3dim_dataset *in_set,
78                   byte *mask, int nmask,
79                   THD_3dim_dataset **clust_set,
80                   THD_3dim_dataset **dist_set,
81                   THD_3dim_dataset *clust_init,
82                   OPT_KMEANS oc ,
83                   float **Dp, int Dp_ncol);
84 
85 #endif
86