GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71933
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
imagery.h
Go to the documentation of this file.
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 */
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 
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 */
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;
97  struct SubSig *SubSig;
99 };
100 
101 struct SigSet
102 {
103  int nbands;
104  int nclasses;
105  char *title;
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 
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 */
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
int type
Definition: imagery.h:151
int nclasses
Definition: imagery.h:104
char name[INAME_LEN]
Definition: imagery.h:22
double ** Rinv
Definition: imagery.h:77
#define INAME_LEN
Definition: imagery.h:8
int fd
Definition: imagery.h:15
Definition: imagery.h:71
const char * color
Definition: imagery.h:119
double ** var
Definition: imagery.h:57
int * band_range_min
Definition: imagery.h:133
int n_vals
Definition: imagery.h:188
int n_cats
Definition: imagery.h:154
Definition: imagery.h:26
int npoints
Definition: imagery.h:55
double * z2
Definition: imagery.h:48
char desc[100]
Definition: imagery.h:54
char * title
Definition: imagery.h:105
double pi
Definition: imagery.h:74
double ** x
Definition: imagery.h:86
struct SubSig * SubSig
Definition: imagery.h:97
int * scatts_bands
Definition: imagery.h:175
double * n2
Definition: imagery.h:47
int type
Definition: imagery.h:95
CELL min
Definition: imagery.h:16
float ** band_product
Definition: imagery.h:130
int have_color
Definition: imagery.h:60
char title[100]
Definition: imagery.h:67
int n_scatts
Definition: imagery.h:157
const char * name
Definition: imagery.h:118
float g
Definition: imagery.h:59
int * band_range_max
Definition: imagery.h:134
double * n1
Definition: imagery.h:44
char * title
Definition: imagery.h:93
float * band_stddev
Definition: imagery.h:128
char desc[5][75]
Definition: imagery.h:37
struct ClassSig * ClassSig
Definition: imagery.h:106
double ** R
Definition: imagery.h:76
float b
Definition: imagery.h:59
int nbands
Definition: imagery.h:103
char title[75]
Definition: imagery.h:35
double * means
Definition: imagery.h:75
int n_a_cats
Definition: imagery.h:159
char mapset[INAME_LEN]
Definition: imagery.h:23
int n_a_scatts
Definition: imagery.h:173
int nbands
Definition: imagery.h:65
unsigned char * index
Definition: imagery.h:13
double N
Definition: imagery.h:73
unsigned char * buf
Definition: imagery.h:14
int nsigs
Definition: imagery.h:66
double * z1
Definition: imagery.h:45
struct scdScattData ** scatts_arr
Definition: imagery.h:181
int n_bands
Definition: imagery.h:156
int * status
Definition: imagery.h:49
long classnum
Definition: imagery.h:92
int * cats_ids
Definition: imagery.h:160
int status
Definition: imagery.h:58
int nfiles
Definition: imagery.h:28
int * cats_idxs
Definition: imagery.h:162
unsigned int * scatt_vals_arr
Definition: imagery.h:193
float * band_mean
Definition: imagery.h:127
struct Ref_Files * file
Definition: imagery.h:29
unsigned char * table
Definition: imagery.h:12
double * e2
Definition: imagery.h:46
int ** band_histo
Definition: imagery.h:131
struct Ref_Color red grn blu
Definition: imagery.h:30
CELL max
Definition: imagery.h:16
int CELL
Definition: gis.h:580
int n
Definition: imagery.h:17
struct scScatts ** cats_arr
Definition: imagery.h:165
int npixels
Definition: imagery.h:84
double cnst
Definition: imagery.h:78
int used
Definition: imagery.h:79
double ** p
Definition: imagery.h:87
struct One_Sig * sig
Definition: imagery.h:68
float * band_sum
Definition: imagery.h:126
int * scatt_idxs
Definition: imagery.h:178
int used
Definition: imagery.h:94
double * mean
Definition: imagery.h:56
unsigned char * b_conds_arr
Definition: imagery.h:191
double * e1
Definition: imagery.h:43
int nsubclasses
Definition: imagery.h:96
int count
Definition: imagery.h:85
float r
Definition: imagery.h:59