imagery.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #ifndef GRASS_IMAGERY_H
  2. #define GRASS_IMAGERY_H
  3. #include <grass/gis.h>
  4. #include <grass/raster.h>
  5. //#include <grass/vector.h>
  6. /* File/directory name lengths */
  7. #define INAME_LEN GNAME_MAX /* coupled to raster map name length */
  8. struct Ref_Color
  9. {
  10. unsigned char *table; /* color table for min-max values */
  11. unsigned char *index; /* data translation index */
  12. unsigned char *buf; /* data buffer for reading color file */
  13. int fd; /* for image i/o */
  14. CELL min, max; /* min,max CELL values */
  15. int n; /* index into Ref_Files */
  16. };
  17. struct Ref_Files
  18. {
  19. char name[INAME_LEN]; /* length is not in sync with other definitions */
  20. char mapset[INAME_LEN];
  21. };
  22. struct Ref
  23. {
  24. int nfiles;
  25. struct Ref_Files *file;
  26. struct Ref_Color red, grn, blu;
  27. };
  28. struct Tape_Info
  29. {
  30. char title[75];
  31. char id[2][75];
  32. char desc[5][75];
  33. };
  34. struct Control_Points
  35. {
  36. int count;
  37. double *e1;
  38. double *n1;
  39. double *e2;
  40. double *n2;
  41. int *status;
  42. };
  43. struct One_Sig
  44. {
  45. char desc[100];
  46. int npoints;
  47. double *mean; /* one mean for each band */
  48. double **var; /* covariance band-band */
  49. int status; /* may be used to 'delete' a signature */
  50. float r, g, b; /* color */
  51. int have_color;
  52. };
  53. struct Signature
  54. {
  55. int nbands;
  56. int nsigs;
  57. char title[100];
  58. struct One_Sig *sig;
  59. };
  60. struct SubSig
  61. {
  62. double N;
  63. double pi;
  64. double *means;
  65. double **R;
  66. double **Rinv;
  67. double cnst;
  68. int used;
  69. };
  70. struct ClassData
  71. {
  72. int npixels;
  73. int count;
  74. double **x; /* pixel list: x[npixels][nbands] */
  75. double **p; /* prob p[npixels][subclasses] */
  76. };
  77. struct ClassSig
  78. {
  79. long classnum;
  80. char *title;
  81. int used;
  82. int type;
  83. int nsubclasses;
  84. struct SubSig *SubSig;
  85. struct ClassData ClassData;
  86. };
  87. struct SigSet
  88. {
  89. int nbands;
  90. int nclasses;
  91. char *title;
  92. struct ClassSig *ClassSig;
  93. };
  94. /* IClass */
  95. /*! Holds statistical values for creating histograms and raster maps for one class.
  96. One class is represented by one category (cat).
  97. */
  98. typedef struct
  99. {
  100. int cat; /*!< class */
  101. const char *name; /*!< signature description (class name) */
  102. const char *color; /*!< class color (RRR:GGG:BBB)*/
  103. int nbands; /*!< number of bands */
  104. int ncells; /*!< number of cells in training areas */
  105. int *band_min; /*!< minimum value for each band */
  106. int *band_max; /*!< maximum value for each band */
  107. float *band_sum; /*!< sum of values for each band */
  108. float *band_mean; /*!< mean of values for each band */
  109. float *band_stddev; /*!< standard deviation for each band */
  110. float **band_product; /*!< sum of products of cell category values of 2 bands */
  111. int **band_histo; /*!< number of cells for cell category value (0-256) for each band */
  112. int *band_range_min; /*!< min range of values to create raster map */
  113. int *band_range_max; /*!< max range of values to create raster map */
  114. float nstd; /*!< multiplier of standard deviation */
  115. } IClass_statistics;
  116. #define SIGNATURE_TYPE_MIXED 1
  117. #define GROUPFILE "CURGROUP"
  118. #define SUBGROUPFILE "CURSUBGROUP"
  119. #include <grass/defs/imagery.h>
  120. #endif