1 #ifndef GRASS_IMAGERY_H 2 #define GRASS_IMAGERY_H 3 4 #include <grass/gis.h> 5 #include <grass/raster.h> 6 7 /* File/directory name lengths */ 8 #define INAME_LEN GNAME_MAX /* coupled to raster map name length */ 9 10 struct Ref_Color 11 { 12 unsigned char *table; /* color table for min-max values */ 13 unsigned char *index; /* data translation index */ 14 unsigned char *buf; /* data buffer for reading color file */ 15 int fd; /* for image i/o */ 16 CELL min, max; /* min,max CELL values */ 17 int n; /* index into Ref_Files */ 18 }; 19 20 struct Ref_Files 21 { 22 char name[INAME_LEN]; /* length is not in sync with other definitions */ 23 char mapset[INAME_LEN]; 24 }; 25 26 struct Ref 27 { 28 int nfiles; 29 struct Ref_Files *file; 30 struct Ref_Color red, grn, blu; 31 }; 32 33 struct Tape_Info 34 { 35 char title[75]; 36 char id[2][75]; 37 char desc[5][75]; 38 }; 39 40 struct Control_Points 41 { 42 int count; 43 double *e1; 44 double *n1; 45 double *z1; 46 double *e2; 47 double *n2; 48 double *z2; 49 int *status; 50 }; 51 52 struct One_Sig 53 { 54 char desc[100]; 55 int npoints; 56 double *mean; /* one mean for each band */ 57 double **var; /* covariance band-band */ 58 int status; /* may be used to 'delete' a signature */ 59 float r, g, b; /* color */ 60 int have_color; 61 }; 62 63 struct Signature 64 { 65 int nbands; 66 int nsigs; 67 char title[100]; 68 struct One_Sig *sig; 69 }; 70 71 struct SubSig 72 { 73 double N; 74 double pi; 75 double *means; 76 double **R; 77 double **Rinv; 78 double cnst; 79 int used; 80 }; 81 82 struct ClassData 83 { 84 int npixels; 85 int count; 86 double **x; /* pixel list: x[npixels][nbands] */ 87 double **p; /* prob p[npixels][subclasses] */ 88 }; 89 90 struct ClassSig 91 { 92 long classnum; 93 char *title; 94 int used; 95 int type; 96 int nsubclasses; 97 struct SubSig *SubSig; 98 struct ClassData ClassData; 99 }; 100 101 struct SigSet 102 { 103 int nbands; 104 int nclasses; 105 char *title; 106 struct ClassSig *ClassSig; 107 }; 108 109 /* IClass */ 110 111 /*! Holds statistical values for creating histograms and raster maps for one class. 112 113 One class is represented by one category (cat). 114 */ 115 typedef struct 116 { 117 int cat; /*!< class */ 118 const char *name; /*!< signature description (class name) */ 119 const char *color; /*!< class color (RRR:GGG:BBB)*/ 120 int nbands; /*!< number of bands */ 121 122 int ncells; /*!< number of cells in training areas */ 123 124 int *band_min; /*!< minimum value for each band */ 125 int *band_max; /*!< maximum value for each band */ 126 float *band_sum; /*!< sum of values for each band */ 127 float *band_mean; /*!< mean of values for each band */ 128 float *band_stddev; /*!< standard deviation for each band */ 129 130 float **band_product; /*!< sum of products of cell category values of 2 bands */ 131 int **band_histo; /*!< number of cells for cell category value (0-256) for each band */ 132 133 int *band_range_min; /*!< min range of values to create raster map */ 134 int *band_range_max; /*!< max range of values to create raster map */ 135 float nstd; /*!< multiplier of standard deviation */ 136 137 138 } IClass_statistics; 139 140 /* wx.iscatt backend */ 141 142 #define SC_SCATT_DATA 0 143 #define SC_SCATT_CONDITIONS 1 144 145 /*! Holds list of all categories. 146 It can contain selected areas for scatter plots (SC_SCATT_CONDITIONS type) 147 or computed scatter plots (SC_SCATT_DATA type). 148 */ 149 struct scCats 150 { 151 int type; /*!< SC_SCATT_DATA -> computed scatter plots, SC_SCATT_CONDITIONS -> 152 set conditions for scatter plots to be computed */ 153 154 int n_cats; /*!< number of allocated categories */ 155 156 int n_bands; /*!< number of analyzed bands */ 157 int n_scatts; /*!< number of possible scattter plots, which can be created from bands */ 158 159 int n_a_cats; /*!< number of used/active categories */ 160 int * cats_ids; /*!< (cat_idx->cat_id) array index is internal idx (position in cats_arr) 161 and id is saved in it's position*/ 162 int * cats_idxs; /*!< (cat_id->cat_idx) array index is id and internal idx is saved 163 in it's position*/ 164 165 struct scScatts ** cats_arr; /*!< array of pointers to struct scScatts */ 166 }; 167 168 169 /*! Holds list of all scatter plots, which belongs to category. 170 */ 171 struct scScatts 172 { 173 int n_a_scatts; /*!< number of used/active scatter plots*/ 174 175 int * scatts_bands; /*!< array of bands, which represents the scatter plots, 176 every scatter plot has assigned two bads 177 (size of the array is n_a_scatts * 2 -> idx*2)*/ 178 int * scatt_idxs; /*!< (scatt_id->scatt_idx) internal idx of the scatter plot 179 (position in scatts_arr)*/ 180 181 struct scdScattData ** scatts_arr; /*!< array of pointers to scdScattData */ 182 }; 183 184 /*! Holds scatter plot data. 185 */ 186 struct scdScattData 187 { 188 int n_vals; /*!< Number of values in scatter plot 189 (length of b_conds_arr or scatt_vals_arr arrays). */ 190 191 unsigned char * b_conds_arr; /*!< array of selected areas 192 (used for SC_SCATT_CONDITIONS type) otherwise NULL */ 193 unsigned int * scatt_vals_arr; /*!< array of computed areas 194 (used for SC_SCATT_DATA type) otherwise NULL */ 195 }; 196 197 #define SIGNATURE_TYPE_MIXED 1 198 199 #define GROUPFILE "CURGROUP" 200 #define SUBGROUPFILE "CURSUBGROUP" 201 202 #include <grass/defs/imagery.h> 203 204 #endif 205