imagery.h 3.2 KB

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