source: grass/trunk/include/raster.h

Last change on this file was 72772, checked in by mmetz, 6 years ago

libraster: update documentation for Map type ("raster", "reclass", "GDAL-link", or "virtual")

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id
  • Property svn:mime-type set to text/x-chdr
File size: 6.6 KB
Line 
1#ifndef GRASS_RASTER_H
2#define GRASS_RASTER_H
3
4#include <grass/gis.h>
5
6/*** defines ***/
7#define RECLASS_TABLE 1
8#define RECLASS_RULES 2
9#define RECLASS_SCALE 3
10
11#define CELL_TYPE 0
12#define FCELL_TYPE 1
13#define DCELL_TYPE 2
14
15/*! \brief Interpolation methods
16
17 For G_get_raster_sample(), INTERP_TYPE
18*/
19#define INTERP_UNKNOWN 0
20#define INTERP_NEAREST 1 /* nearest neighbor interpolation */
21#define INTERP_BILINEAR 2 /* bilinear interpolation */
22#define INTERP_BICUBIC 3 /* bicubic interpolation */
23
24/*** typedefs ***/
25typedef int RASTER_MAP_TYPE;
26
27/* for G_get_raster_sample() */
28typedef int INTERP_TYPE;
29
30/*** structures ***/
31struct Reclass
32{
33 char *name; /* name of raster map being reclassed */
34 char *mapset; /* mapset in which "name" is found */
35 int type; /* type of reclass */
36 int num; /* size of reclass table */
37 CELL min; /* table min */
38 CELL max; /* table max */
39 CELL *table; /* reclass table */
40};
41
42struct FPReclass_table
43{
44 DCELL dLow; /* domain low */
45 DCELL dHigh; /* domain high */
46 DCELL rLow; /* range low */
47 DCELL rHigh; /* range high */
48};
49
50/* reclass structure from double to double used by r.recode to reclass */
51/* between types: int to double, float to int,... */
52struct FPReclass
53{
54 int defaultDRuleSet; /* 1 if default domain rule set */
55 int defaultRRuleSet; /* 1 if default range rule set */
56 int infiniteLeftSet; /* 1 if negative infinite interval rule exists */
57 int infiniteRightSet; /* 1 if positive infinite interval rule exists */
58 int rRangeSet; /* 1 if range range (i.e. interval) is set */
59 int maxNofRules;
60 int nofRules;
61 DCELL defaultDMin; /* default domain minimum value */
62 DCELL defaultDMax; /* default domain maximum value */
63 DCELL defaultRMin; /* default range minimum value */
64 DCELL defaultRMax; /* default range maximum value */
65 DCELL infiniteDLeft; /* neg infinite rule */
66 DCELL infiniteDRight; /* neg infinite rule */
67 DCELL infiniteRLeft; /* pos infinite rule */
68 DCELL infiniteRRight; /* pos infinite rule */
69 DCELL dMin; /* minimum domain values in rules */
70 DCELL dMax; /* maximum domain values in rules */
71 DCELL rMin; /* minimum range values in rules */
72 DCELL rMax; /* maximum range values in rules */
73 struct FPReclass_table *table;
74};
75
76struct Quant_table
77{
78 DCELL dLow;
79 DCELL dHigh;
80 CELL cLow;
81 CELL cHigh;
82};
83
84struct Quant
85{
86 int truncate_only;
87 int round_only;
88 int defaultDRuleSet;
89 int defaultCRuleSet;
90 int infiniteLeftSet;
91 int infiniteRightSet;
92 int cRangeSet;
93 int maxNofRules;
94 int nofRules;
95 DCELL defaultDMin;
96 DCELL defaultDMax;
97 CELL defaultCMin;
98 CELL defaultCMax;
99 DCELL infiniteDLeft;
100 DCELL infiniteDRight;
101 CELL infiniteCLeft;
102 CELL infiniteCRight;
103 DCELL dMin;
104 DCELL dMax;
105 CELL cMin;
106 CELL cMax;
107 struct Quant_table *table;
108
109 struct
110 {
111 DCELL *vals;
112
113 /* pointers to quant rules corresponding to the intervals btwn vals */
114 struct Quant_table **rules;
115 int nalloc;
116 int active;
117 DCELL inf_dmin;
118 DCELL inf_dmax;
119 CELL inf_min;
120 CELL inf_max;
121 /* all values smaller than inf_dmin become inf_min */
122 /* all values larger than inf_dmax become inf_max */
123 /* inf_min and/or inf_max can be NULL if there are no inf rules */
124 } fp_lookup;
125};
126
127struct Categories
128{
129 CELL ncats; /* total number of categories */
130 CELL num; /* the highest cell values. Only exists
131 for backwards compatibility = (CELL)
132 max_fp_values in quant rules */
133 char *title; /* name of data layer */
134 char *fmt; /* printf-like format to generate labels */
135 float m1; /* Multiplication coefficient 1 */
136 float a1; /* Addition coefficient 1 */
137 float m2; /* Multiplication coefficient 2 */
138 float a2; /* Addition coefficient 2 */
139 struct Quant q; /* rules mapping cell values to index in
140 list of labels */
141 char **labels; /* array of labels of size num */
142 int *marks; /* was the value with this label was used? */
143 int nalloc;
144 int last_marked_rule;
145 /* NOTE: to get a rule corresponfing to cats.labels[i], use */
146 /* G_get_ith_c/f/d_raster_cat (pcats, i, val1, val2) */
147 /* it calls */
148 /* G_quant_get_ith_rule(&cats->q, i, val1, val2, &index, &index); */
149 /* and idex ==i, because rule is added at the same time as a */
150 /* label, and quant rules are never reordered. Olga apr,95 */
151};
152
153/*! \brief Raster history info (metadata)
154
155 See History structure for implementation issues.
156*/
157enum History_field
158{
159 /*! \brief Raster name */
160 HIST_MAPID,
161 /*! \brief Raster title */
162 HIST_TITLE,
163 /*! \brief Raster mapset */
164 HIST_MAPSET,
165 /*! \brief User who creater raster map */
166 HIST_CREATOR,
167 /*! \brief Map type ("raster", "reclass", "GDAL-link", or "virtual") */
168 HIST_MAPTYPE,
169 /*! \brief Description of original data source (two lines) */
170 HIST_DATSRC_1,
171 HIST_DATSRC_2,
172 /*! \brief One-line data description */
173 HIST_KEYWRD,
174
175 /*! \brief Number of fields to be defined in History structure */
176 HIST_NUM_FIELDS
177};
178
179/*! \brief Raster history info (metadata) */
180struct History
181{
182 /*! \brief Array of fields (see \ref History_field for details) */
183 char *fields[HIST_NUM_FIELDS];
184 /*! \brief Number of lines in lines array */
185 int nlines;
186 /*! \brief Lines array */
187 char **lines;
188};
189
190struct Cell_stats
191{
192 struct Cell_stats_node
193 {
194 int idx;
195 long *count;
196 int left;
197 int right;
198 } *node; /* tree of values */
199
200 int tlen; /* allocated tree size */
201 int N; /* number of actual nodes in tree */
202 int curp;
203 long null_data_count;
204 int curoffset;
205};
206
207struct Histogram
208{
209 int num;
210
211 struct Histogram_list
212 {
213 CELL cat;
214 long count;
215 } *list;
216};
217
218struct R_stats
219{
220 DCELL sum;
221 DCELL sumsq;
222 grass_int64 count;
223};
224
225struct Range
226{
227 CELL min;
228 CELL max;
229 int first_time; /* whether or not range was updated */
230 struct R_stats rstats;
231};
232
233struct FPRange
234{
235 DCELL min;
236 DCELL max;
237 int first_time; /* whether or not range was updated */
238 struct R_stats rstats;
239};
240
241struct FP_stats {
242 int geometric;
243 int geom_abs;
244 int flip;
245 int count;
246 DCELL min, max;
247 unsigned long *stats;
248 unsigned long total;
249};
250
251struct GDAL_link;
252struct R_vrt;
253
254/*** prototypes ***/
255#include <grass/defs/raster.h>
256
257#endif /* GRASS_RASTER_H */
Note: See TracBrowser for help on using the repository browser.