cluster.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef GRASS_CLUSTER_H
  2. #define GRASS_CLUSTER_H
  3. #include <grass/gis.h>
  4. #include <grass/imagery.h>
  5. struct Cluster
  6. {
  7. int nbands; /* number of bands */
  8. int npoints; /* number of points */
  9. DCELL **points; /* array of points */
  10. int np;
  11. double *band_sum; /* sum over each band */
  12. double *band_sum2; /* sum of squares over each band */
  13. int *class; /* class of each point */
  14. int *reclass; /* for removing empty classes */
  15. int *count; /* number of points in each class */
  16. int *countdiff; /* change in count */
  17. double **sum; /* sum over band per class */
  18. double **sumdiff; /* change in sum */
  19. double **sum2; /* sum of squares per band per class */
  20. double **mean; /* initial class means */
  21. struct Signature S; /* final signature(s) */
  22. int nclasses; /* number of classes */
  23. int merge1, merge2;
  24. int iteration; /* number of iterations */
  25. double percent_stable; /* percentage stable */
  26. };
  27. /* c_assign.c */
  28. int I_cluster_assign(struct Cluster *, int *);
  29. /* c_begin.c */
  30. int I_cluster_begin(struct Cluster *, int);
  31. /* c_clear.c */
  32. int I_cluster_clear(struct Cluster *);
  33. /* c_distinct.c */
  34. int I_cluster_distinct(struct Cluster *, double);
  35. /* c_exec.c */
  36. int I_cluster_exec(struct Cluster *, int, int, double, double, int, int (*)(),
  37. int *);
  38. /* c_execmem.c */
  39. int I_cluster_exec_allocate(struct Cluster *);
  40. int I_cluster_exec_free(struct Cluster *);
  41. /* c_means.c */
  42. int I_cluster_means(struct Cluster *);
  43. /* c_merge.c */
  44. int I_cluster_merge(struct Cluster *);
  45. /* c_nclasses.c */
  46. int I_cluster_nclasses(struct Cluster *, int);
  47. /* c_point.c */
  48. int I_cluster_point(struct Cluster *, DCELL *);
  49. int I_cluster_begin_point_set(struct Cluster *, int);
  50. int I_cluster_point_part(struct Cluster *, DCELL, int, int);
  51. int I_cluster_end_point_set(struct Cluster *, int);
  52. /* c_reassign.c */
  53. int I_cluster_reassign(struct Cluster *, int *);
  54. /* c_reclass.c */
  55. int I_cluster_reclass(struct Cluster *, int);
  56. /* c_sep.c */
  57. double I_cluster_separation(struct Cluster *, int, int);
  58. /* c_sig.c */
  59. int I_cluster_signatures(struct Cluster *);
  60. /* c_sum2.c */
  61. int I_cluster_sum2(struct Cluster *);
  62. #endif