GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
fpreclass.c
Go to the documentation of this file.
1 
2 /**********************************************************************
3  *
4  * Rast_fpreclass_init (r)
5  *
6  * struct FPReclass *r;
7  *
8  * initializes new reclassification structure. calls
9  * Rast_fpreclass_clear() before it returns.
10  *
11  **********************************************************************
12  *
13  * void
14  * Rast_fpreclass_reset (r)
15  *
16  * struct FPReclass *r;
17  *
18  * resets the number of defined rules to 0 and free's space allocated
19  * for rules. calls Rast_fpreclass_clear ().
20  *
21  **********************************************************************
22  *
23  * void
24  * Rast_fpreclass_clear (r)
25  *
26  * struct FPReclass *r;
27  *
28  * resets the number of defined rules to 0. Resets default Min and Max
29  * to be unknown. (see Rast_fpreclass_set_domain (), Rast_fpreclass_set_range ()).
30  * deactivates default mapping.
31  *
32  **********************************************************************
33  *
34  * void
35  * Rast_fpreclass_set_domain (r, dLow, dHigh)
36  *
37  * struct FPReclass *r;
38  * DCELL dLow, dHigh;
39  *
40  * defines the domain for the default mapping and
41  * activates default mapping. (see G_fpreclass_perform_d ()).
42  *
43  * note: dHigh < dLow is valid.
44  *
45  **********************************************************************
46  *
47  * void
48  * Rast_fpreclass_set_range (r, low, high)
49  *
50  * struct FPReclass *r;
51  * DCELL low, high;
52  *
53  * defines the range for the default mapping. does NOT
54  * activate default mapping. (see G_fpreclass_perform_d ()).
55  *
56  **********************************************************************
57  *
58  * int
59  * Rast_fpreclass_get_limits (r, dMin, dMax, rMin, rmax)
60  *
61  * const struct FPReclass *r;
62  * DCELL *dMin, *dMax;
63  * DCELL *rMin, *rmax;
64  *
65  * returns the minimum and maximum values of all the rules defined.
66  *
67  * returns: -1 if after Rast_fpreclass_init (), or any call to
68  * Rast_fpreclass_clear () or Rast_fpreclass_reset () neither
69  * Rast_fpreclass_add_rule () nor Rast_fpreclass_set_domain () is
70  * used. in this case the returned minimum and maximum
71  * range and domain values are undefined.
72  * 0 if the default rule values are returned.domain values
73  * are identical to those set with Rast_fpreclass_set_domain ().
74  * range values are either reclassification internal default,
75  * or the values set with Rast_fpreclass_set_range ().
76  * 1 otherwise. in this case the values returned correspond
77  * to the extreme values of the defined rules (they need
78  * not be identical to the values set with
79  * Rast_fpreclass_set_domain ()).
80  *
81  **********************************************************************
82  *
83  * int
84  * Rast_fpreclass_nof_rules (r)
85  *
86  * const struct FPReclass *r;
87  *
88  * returns the number of reclassification rules defined. This number does
89  * not include the 2 infinite intervals.
90  *
91  **********************************************************************
92  *
93  * void
94  * Rast_fpreclass_get_ith_rule (r, i, dLow, dHigh, rLow, rHigh)
95  *
96  * const struct FPReclass *r;
97  * int i;
98  * DCELL *dLow, *dHigh;
99  * DCELL *rLow, *rHigh;
100  *
101  * returns the i'th reclassification rule, for
102  * 0 <= i < Rast_fpreclass_nof_rules().
103  * a larger value for i means that the rule has been added later.
104  *
105  **********************************************************************
106  * void
107  * Rast_fpreclass_set_neg_infinite_rule (r, dLeft, c)
108  *
109  * struct FPReclass *r;
110  * DCELL dLeft;
111  * DCELL c;
112  *
113  * defines a rule for values "dLeft" and smaller. values in this range
114  * are mapped to "c" if none of the "finite" reclassification rules applies.
115  *
116  * **********************************************************************
117  *
118  * int
119  * Rast_fpreclass_get_neg_infinite_rule (r, dLeft, c)
120  *
121  * const struct FPReclass *r;
122  * DCELL *dLeft;
123  * DCELL *c;
124  *
125  * returns in "dLeft" and "c" the rule values for the negative infinite
126  * interval (see Rast_fpreclass_set_neg_infinite_rule ()).
127  *
128  * returns: 0 if this rule is not defined
129  * 1 otherwise.
130  *
131  **********************************************************************
132  * void
133  * Rast_fpreclass_set_pos_infinite_rule (r, dRight, c)
134  *
135  * struct FPReclass *r;
136  * DCELL dRight;
137  * DCELL c;
138  *
139  * defines a rule for values "dRight" and larger. values in this range
140  * are mapped to "c" if neither any of the "finite" reclassification
141  * rules nor the negative infinite rule applies.
142  *
143  * **********************************************************************
144  *
145  * int
146  * Rast_fpreclass_get_pos_infinite_rule (r, dRight, c)
147  *
148  * const struct FPReclass *r;
149  * DCELL *dRight;
150  * DCELL *c;
151  *
152  * returns in "dRight" and "c" the rule values for the positive infinite
153  * interval (see Rast_fpreclass_set_pos_infinite_rule ()).
154  *
155  * returns: 0 if this rule is not defined
156  * 1 otherwise.
157  *
158  **********************************************************************
159  *
160  * void
161  * Rast_fpreclass_reverse_rule_order (r)
162  *
163  * struct FPReclass *r;
164  *
165  * reverses the order in which the reclassification rules are stored. (see
166  * also Rast_fpreclass_get_ith_rule () and G_fpreclass_perform_XY ()).
167  *
168  **********************************************************************
169  *
170  * void
171  * Rast_fpreclass_add_rule (r, dLow, dHigh, rLow, rHigh)
172  *
173  * struct FPReclass *r;
174  * DCELL dLow, dHigh;
175  * DCELL rLow, rHigh;
176  *
177  * adds a new rule to the set of reclassification rules. if dLow > dHigh
178  * the rule will be stored with the low and high values interchanged.
179  *
180  * Note: currently no cleanup of rules is performed, i.e. redundant
181  * rules are not removed.
182  *
183  **********************************************************************
184  *
185  * DCELL
186  * Rast_fpreclass_get_cell_value (r, cellValue)
187  *
188  * const struct FPReclass *r;
189  * DCELL *cellValue;
190  *
191  * returns the reclassified value corresponding to "cellValue".
192  *
193  * if several reclassification rules apply for cellValue, the one which has
194  * been inserted latest (i.e. the one of them which is returned by
195  * Rast_fpreclass_get_ith_rule() for the largest i) is used. if no such rule
196  * applies the cellValue is first tested against the negative infinite
197  * rule, and finally against the positive infinite rule. if none of
198  * these rules apply, NO_DATA is returned. the actual value of NO_DATA
199  * is found by calling Rast_set_d_null_value()
200  *
201  * if after Rast_fpreclass_init (), or any call to Rast_fpreclass_clear () or
202  * Rast_fpreclass_reset () neither Rast_fpreclass_add_rule (),
203  * Rast_fpreclass_set_neg_infinite_rule (),
204  * Rast_fpreclass_set_pos_infinite_rule (), * nor Rast_fpreclass_set_domain ()
205  * is used NO_DATA is returned independently of the cellValue.
206  *
207  * if Rast_fpreclass_set_domain () is called but no explicit reclassification
208  * rule is set, the default mapping to the cell range set with
209  * Rast_fpreclass_set_range () or, if the cell range is not set,
210  * to the default CELL range [0,256 - 1] is applied.
211  *
212  **********************************************************************
213  *
214  * void
215  * G_fpreclass_perform_XY (r, xcell, ycell, n)
216  *
217  * const struct FPReclass *r;
218  * XCELL *xcell;
219  * YCELL *ycell;
220  * int n;
221  *
222  * "X" and "Y" in the function name can be any of "d", "f", or "i". These
223  * correspond to "DCELL", "FCELL", and "CELL", respectively, and denote
224  * the type of the domain and range values.
225  *
226  * returns in "ycell" the reclassified YCELL values corresponding to the
227  * XCELL values stored in "xcell". the number of elements reclassified
228  * is n. reclassification is performed by repeated application of
229  * Rast_fpreclass_get_cell_value ().
230  *
231  **********************************************************************/
232 
233 /*--------------------------------------------------------------------------*/
234 
235 /*
236  the reclassification table is stored as a linear array. rules are added
237  starting from index 0. redundant rules are not eliminated. rules are tested
238  from the highest index downto 0. there are two "infinite" rules. support is
239  provided to reverse the order of the rules.
240  */
241 
242 /*--------------------------------------------------------------------------*/
243 
244 #include <grass/gis.h>
245 #include <grass/raster.h>
246 
247 /*--------------------------------------------------------------------------*/
248 
249 #undef MIN
250 #undef MAX
251 #define MIN(a,b) ((a) < (b) ? (a) : (b))
252 #define MAX(a,b) ((a) > (b) ? (a) : (b))
253 
254 #define NO_DEFAULT_RULE (! r->defaultDRuleSet)
255 #define NO_LEFT_INFINITE_RULE (! r->infiniteLeftSet)
256 #define NO_RIGHT_INFINITE_RULE (! r->infiniteRightSet)
257 #define NO_FINITE_RULE (r->nofRules <= 0)
258 #define NO_EXPLICIT_RULE (NO_FINITE_RULE && \
259  NO_LEFT_INFINITE_RULE && NO_RIGHT_INFINITE_RULE)
260 
261 #define DEFAULT_MIN ((DCELL) 1)
262 #define DEFAULT_MAX ((DCELL) 255)
263 
264 /*--------------------------------------------------------------------------*/
265 
267 {
268  r->nofRules = 0;
269  r->defaultDRuleSet = 0;
270  r->defaultRRuleSet = 0;
271  r->infiniteRightSet = r->infiniteLeftSet = 0;
272 }
273 
274 /*--------------------------------------------------------------------------*/
275 
277 {
279 
280  if (r->maxNofRules > 0)
281  G_free(r->table);
282 
283  r->maxNofRules = 0;
284 }
285 
286 /*--------------------------------------------------------------------------*/
287 
289 {
290  r->maxNofRules = 0;
292 }
293 
294 /*--------------------------------------------------------------------------*/
295 
296 void Rast_fpreclass_set_domain(struct FPReclass *r, DCELL dLow, DCELL dHigh)
297 {
298  r->defaultDMin = dLow;
299  r->defaultDMax = dHigh;
300  r->defaultDRuleSet = 1;
301 }
302 
303 /*--------------------------------------------------------------------------*/
304 
306 {
307  r->defaultRMin = low;
308  r->defaultRMax = high;
309  r->defaultRRuleSet = 1;
310 }
311 
312 /*--------------------------------------------------------------------------*/
313 
314 static void fpreclass_set_limits(struct FPReclass *r,
315  DCELL dLow, DCELL dHigh,
316  DCELL rLow, DCELL rHigh)
317 {
318  r->dMin = dLow;
319  r->dMax = dHigh;
320  r->rMin = rLow;
321  r->rMax = rHigh;
322 }
323 
324 /*--------------------------------------------------------------------------*/
325 
326 static void fpreclass_update_limits(struct FPReclass *r,
327  DCELL dLow, DCELL dHigh,
328  DCELL rLow, DCELL rHigh)
329 {
330  if (NO_EXPLICIT_RULE) {
331  fpreclass_set_limits(r, dLow, dHigh, rLow, rHigh);
332  return;
333  }
334 
335  r->dMin = MIN(r->dMin, MIN(dLow, dHigh));
336  r->dMax = MAX(r->dMax, MAX(dLow, dHigh));
337  r->rMin = MIN(r->rMin, MIN(rLow, rHigh));
338  r->rMax = MAX(r->rMax, MAX(rLow, rHigh));
339 }
340 
341 /*--------------------------------------------------------------------------*/
342 
344  DCELL * dMin, DCELL * dMax,
345  DCELL * rMin, DCELL * rMax)
346 {
347  if (NO_EXPLICIT_RULE) {
348  if (NO_DEFAULT_RULE)
349  return -1;
350 
351  *dMin = r->defaultDMin;
352  *dMax = r->defaultDMax;
353 
354  if (r->defaultRRuleSet) {
355  *rMin = r->defaultRMin;
356  *rMax = r->defaultRMax;
357  }
358  else {
359  *rMin = DEFAULT_MIN;
360  *rMax = DEFAULT_MAX;
361  }
362 
363  return 0;
364  }
365 
366  *dMin = r->dMin;
367  *dMax = r->dMax;
368  *rMin = r->rMin;
369  *rMax = r->rMax;
370 
371  return 1;
372 }
373 
374 /*--------------------------------------------------------------------------*/
375 
377 {
378  return r->nofRules;
379 }
380 
381 /*--------------------------------------------------------------------------*/
382 
383 void Rast_fpreclass_get_ith_rule(const struct FPReclass *r, int i,
384  DCELL * dLow, DCELL * dHigh,
385  DCELL * rLow, DCELL * rHigh)
386 {
387  *dLow = r->table[i].dLow;
388  *dHigh = r->table[i].dHigh;
389  *rLow = r->table[i].rLow;
390  *rHigh = r->table[i].rHigh;
391 }
392 
393 /*--------------------------------------------------------------------------*/
394 
395 static void fpreclass_table_increase(struct FPReclass *r)
396 {
397  if (r->nofRules < r->maxNofRules)
398  return;
399 
400  if (r->maxNofRules == 0) {
401  r->maxNofRules = 50;
402  r->table = (struct FPReclass_table *)
403  G_malloc(r->maxNofRules * sizeof(struct FPReclass_table));
404  }
405  else {
406  r->maxNofRules += 50;
407  r->table = (struct FPReclass_table *)
408  G_realloc((char *)r->table,
409  r->maxNofRules * sizeof(struct FPReclass_table));
410  }
411 }
412 
413 /*--------------------------------------------------------------------------*/
414 
415 void
417  DCELL c)
418 {
419  r->infiniteDLeft = dLeft;
420  r->infiniteRLeft = c;
421  fpreclass_update_limits(r, dLeft, dLeft, c, c);
422  r->infiniteLeftSet = 1;
423 }
424 
425 /*--------------------------------------------------------------------------*/
426 
428  DCELL * dLeft, DCELL * c)
429 {
430  if (r->infiniteLeftSet == 0)
431  return 0;
432 
433  *dLeft = r->infiniteDLeft;
434  *c = r->infiniteRLeft;
435 
436  return 1;
437 }
438 
439 /*--------------------------------------------------------------------------*/
440 
442  DCELL c)
443 {
444  r->infiniteDRight = dRight;
445  r->infiniteRRight = c;
446  fpreclass_update_limits(r, dRight, dRight, c, c);
447  r->infiniteRightSet = 1;
448 }
449 
450 /*--------------------------------------------------------------------------*/
451 
453  DCELL * dRight, DCELL * c)
454 {
455  if (r->infiniteRightSet == 0)
456  return 0;
457 
458  *dRight = r->infiniteDRight;
459  *c = r->infiniteRRight;
460 
461  return 1;
462 }
463 
464 /*--------------------------------------------------------------------------*/
465 
468 {
469  int i;
470  struct FPReclass_table *p;
471 
472  fpreclass_table_increase(r);
473 
474  i = r->nofRules;
475 
476  p = &(r->table[i]);
477  if (dHigh >= dLow) {
478  p->dLow = dLow;
479  p->dHigh = dHigh;
480  p->rLow = rLow;
481  p->rHigh = rHigh;
482  }
483  else {
484  p->dLow = dHigh;
485  p->dHigh = dLow;
486  p->rLow = rHigh;
487  p->rHigh = rLow;
488  }
489 
490  fpreclass_update_limits(r, dLow, dHigh, rLow, rHigh);
491 
492  r->nofRules++;
493 }
494 
495 /*--------------------------------------------------------------------------*/
496 
498 {
499  struct FPReclass_table tmp;
500  struct FPReclass_table *pLeft, *pRight;
501 
502  pLeft = r->table;
503  pRight = &(r->table[r->nofRules - 1]);
504 
505  while (pLeft < pRight) {
506  tmp.dLow = pLeft->dLow;
507  tmp.dHigh = pLeft->dHigh;
508  tmp.rLow = pLeft->rLow;
509  tmp.rHigh = pLeft->rHigh;
510 
511  pLeft->dLow = pRight->dLow;
512  pLeft->dHigh = pRight->dHigh;
513  pLeft->rLow = pRight->rLow;
514  pLeft->rHigh = pRight->rHigh;
515 
516  pRight->dLow = tmp.dLow;
517  pRight->dHigh = tmp.dHigh;
518  pRight->rLow = tmp.rLow;
519  pRight->rHigh = tmp.rHigh;
520 
521  pLeft++;
522  pRight--;
523  }
524 }
525 
526 /*--------------------------------------------------------------------------*/
527 
528 static DCELL fpreclass_interpolate(DCELL dLow, DCELL dHigh,
529  DCELL rLow, DCELL rHigh, DCELL dValue)
530 {
531  if (rLow == rHigh)
532  return rLow;
533  if (dLow == dHigh)
534  return rLow;
535 
536  return ((dValue - dLow) / (dHigh - dLow) * (rHigh - rLow) + rLow);
537 }
538 
539 /*--------------------------------------------------------------------------*/
540 
541 static DCELL fpreclass_get_default_cell_value(const struct FPReclass *r,
542  DCELL cellVal)
543 {
544  DCELL tmp;
545 
546  Rast_set_d_null_value(&tmp, 1);
547 
548  if ((cellVal < MIN(r->defaultDMin, r->defaultDMax)) ||
549  (cellVal > MAX(r->defaultDMin, r->defaultDMax)))
550  return tmp;
551 
552  if (r->defaultRRuleSet)
553  return fpreclass_interpolate(r->defaultDMin, r->defaultDMax,
554  r->defaultRMin, r->defaultRMax, cellVal);
555  else
556  return fpreclass_interpolate(r->defaultDMin, r->defaultDMax,
557  DEFAULT_MIN, DEFAULT_MAX, cellVal);
558 }
559 
560 /*--------------------------------------------------------------------------*/
561 
563 {
564  DCELL tmp;
565  const struct FPReclass_table *p;
566 
567  Rast_set_d_null_value(&tmp, 1);
568  if (NO_EXPLICIT_RULE) {
569 
570  if (NO_DEFAULT_RULE)
571  return tmp;
572  return fpreclass_get_default_cell_value(r, cellVal);
573  }
574 
575  if (!NO_FINITE_RULE)
576  for (p = &(r->table[r->nofRules - 1]); p >= r->table; p--)
577  if ((cellVal >= p->dLow) && (cellVal <= p->dHigh))
578  return fpreclass_interpolate(p->dLow, p->dHigh, p->rLow,
579  p->rHigh, cellVal);
580 
581  if ((!NO_LEFT_INFINITE_RULE) && (cellVal <= r->infiniteDLeft))
582  return r->infiniteRLeft;
583 
584  if ((NO_RIGHT_INFINITE_RULE) || (cellVal < r->infiniteDRight))
585  return tmp;
586 
587  return r->infiniteRRight;
588 }
589 
590 /*--------------------------------------------------------------------------*/
591 
593  const DCELL * dcell, CELL * cell, int n)
594 {
595  int i;
596 
597  for (i = 0; i < n; i++, dcell++)
598  if (!Rast_is_d_null_value(dcell))
599  *cell++ = Rast_fpreclass_get_cell_value(r, *dcell);
600  else
601  Rast_set_c_null_value(cell++, 1);
602 }
603 
604 /*--------------------------------------------------------------------------*/
605 
607  const DCELL * dcell, FCELL * cell, int n)
608 {
609  int i;
610 
611  for (i = 0; i < n; i++, dcell++)
612  if (!Rast_is_d_null_value(dcell))
613  *cell++ = Rast_fpreclass_get_cell_value(r, *dcell);
614  else
615  Rast_set_f_null_value(cell++, 1);
616 }
617 
618 /*--------------------------------------------------------------------------*/
619 
621  const DCELL * dcell, DCELL * cell, int n)
622 {
623  int i;
624 
625  for (i = 0; i < n; i++, dcell++)
626  if (!Rast_is_d_null_value(dcell))
627  *cell++ = Rast_fpreclass_get_cell_value(r, *dcell);
628  else
629  Rast_set_d_null_value(cell++, 1);
630 }
631 
632 /*--------------------------------------------------------------------------*/
633 
635  const FCELL * fcell, CELL * cell, int n)
636 {
637  int i;
638 
639  for (i = 0; i < n; i++, fcell++)
640  if (!Rast_is_f_null_value(fcell))
641  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * fcell);
642  else
643  Rast_set_c_null_value(cell++, 1);
644 }
645 
646 /*--------------------------------------------------------------------------*/
647 
649  const FCELL * fcell, FCELL * cell, int n)
650 {
651  int i;
652 
653  for (i = 0; i < n; i++, fcell++)
654  if (!Rast_is_f_null_value(fcell))
655  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * fcell);
656  else
657  Rast_set_f_null_value(cell++, 1);
658 }
659 
660 /*--------------------------------------------------------------------------*/
661 
663  const FCELL * fcell, DCELL * cell, int n)
664 {
665  int i;
666 
667  for (i = 0; i < n; i++, fcell++)
668  if (!Rast_is_f_null_value(fcell))
669  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * fcell);
670  else
671  Rast_set_d_null_value(cell++, 1);
672 }
673 
674 /*--------------------------------------------------------------------------*/
675 
677  const CELL * icell, CELL * cell, int n)
678 {
679  int i;
680 
681  for (i = 0; i < n; i++, icell++)
682  if (!Rast_is_c_null_value(icell))
683  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * icell);
684  else
685  Rast_set_c_null_value(cell++, 1);
686 }
687 
688 /*--------------------------------------------------------------------------*/
689 
691  const CELL * icell, FCELL * cell, int n)
692 {
693  int i;
694 
695  for (i = 0; i < n; i++, icell++)
696  if (!Rast_is_c_null_value(icell))
697  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * icell);
698  else
699  Rast_set_f_null_value(cell++, 1);
700 }
701 
702 /*--------------------------------------------------------------------------*/
703 
705  const CELL * icell, DCELL * cell, int n)
706 {
707  int i;
708 
709  for (i = 0; i < n; i++, icell++)
710  if (!Rast_is_c_null_value(icell))
711  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * icell);
712  else
713  Rast_set_d_null_value(cell++, 1);
714 }
715 
716 /*--------------------------------------------------------------------------*/
717 
718 /*--------------------------------------------------------------------------*/
719 
720 /*--------------------------------------------------------------------------*/
#define DEFAULT_MIN
Definition: fpreclass.c:261
#define G_malloc(n)
Definition: defs/gis.h:112
void Rast_fpreclass_add_rule(struct FPReclass *r, DCELL dLow, DCELL dHigh, DCELL rLow, DCELL rHigh)
Definition: fpreclass.c:466
DCELL rHigh
Definition: raster.h:47
int maxNofRules
Definition: raster.h:59
void Rast_fpreclass_perform_fi(const struct FPReclass *r, const FCELL *fcell, CELL *cell, int n)
Definition: fpreclass.c:634
DCELL defaultDMax
Definition: raster.h:62
void Rast_set_c_null_value(CELL *, int)
To set a number of CELL raster values to NULL.
Definition: null_val.c:124
#define NO_LEFT_INFINITE_RULE
Definition: fpreclass.c:255
int defaultDRuleSet
Definition: raster.h:54
int infiniteRightSet
Definition: raster.h:57
#define Rast_is_d_null_value(dcellVal)
Definition: defs/raster.h:420
void Rast_fpreclass_set_range(struct FPReclass *r, DCELL low, DCELL high)
Definition: fpreclass.c:305
int defaultRRuleSet
Definition: raster.h:55
void Rast_fpreclass_set_neg_infinite_rule(struct FPReclass *r, DCELL dLeft, DCELL c)
Definition: fpreclass.c:416
double DCELL
Definition: gis.h:603
#define NO_FINITE_RULE
Definition: fpreclass.c:257
DCELL infiniteDRight
Definition: raster.h:66
DCELL rMin
Definition: raster.h:71
int Rast_fpreclass_nof_rules(const struct FPReclass *r)
Definition: fpreclass.c:376
void G_free(void *)
Free allocated memory.
Definition: gis/alloc.c:149
void Rast_fpreclass_perform_ff(const struct FPReclass *r, const FCELL *fcell, FCELL *cell, int n)
Definition: fpreclass.c:648
#define NO_DEFAULT_RULE
Definition: fpreclass.c:254
DCELL defaultRMin
Definition: raster.h:63
void Rast_fpreclass_reset(struct FPReclass *r)
Definition: fpreclass.c:276
#define Rast_is_f_null_value(fcellVal)
Definition: defs/raster.h:418
void Rast_fpreclass_init(struct FPReclass *r)
Definition: fpreclass.c:288
void Rast_fpreclass_perform_dd(const struct FPReclass *r, const DCELL *dcell, DCELL *cell, int n)
Definition: fpreclass.c:620
DCELL infiniteDLeft
Definition: raster.h:65
void Rast_fpreclass_perform_id(const struct FPReclass *r, const CELL *icell, DCELL *cell, int n)
Definition: fpreclass.c:704
#define MAX(a, b)
Definition: fpreclass.c:252
void Rast_fpreclass_perform_fd(const struct FPReclass *r, const FCELL *fcell, DCELL *cell, int n)
Definition: fpreclass.c:662
void Rast_set_f_null_value(FCELL *, int)
To set a number of FCELL raster values to NULL.
Definition: null_val.c:138
int Rast_fpreclass_get_pos_infinite_rule(const struct FPReclass *r, DCELL *dRight, DCELL *c)
Definition: fpreclass.c:452
DCELL dLow
Definition: raster.h:44
int nofRules
Definition: raster.h:60
DCELL infiniteRRight
Definition: raster.h:68
DCELL dMin
Definition: raster.h:69
DCELL defaultRMax
Definition: raster.h:64
void Rast_fpreclass_perform_ii(const struct FPReclass *r, const CELL *icell, CELL *cell, int n)
Definition: fpreclass.c:676
DCELL rLow
Definition: raster.h:46
float FCELL
Definition: gis.h:604
void Rast_fpreclass_perform_df(const struct FPReclass *r, const DCELL *dcell, FCELL *cell, int n)
Definition: fpreclass.c:606
#define NO_EXPLICIT_RULE
Definition: fpreclass.c:258
DCELL dMax
Definition: raster.h:70
void Rast_fpreclass_perform_if(const struct FPReclass *r, const CELL *icell, FCELL *cell, int n)
Definition: fpreclass.c:690
#define DEFAULT_MAX
Definition: fpreclass.c:262
int Rast_fpreclass_get_limits(const struct FPReclass *r, DCELL *dMin, DCELL *dMax, DCELL *rMin, DCELL *rMax)
Definition: fpreclass.c:343
DCELL Rast_fpreclass_get_cell_value(const struct FPReclass *r, DCELL cellVal)
Definition: fpreclass.c:562
int CELL
Definition: gis.h:602
DCELL infiniteRLeft
Definition: raster.h:67
void Rast_fpreclass_reverse_rule_order(struct FPReclass *r)
Definition: fpreclass.c:497
#define MIN(a, b)
Definition: fpreclass.c:251
#define G_realloc(p, n)
Definition: defs/gis.h:114
struct FPReclass_table * table
Definition: raster.h:73
int Rast_fpreclass_get_neg_infinite_rule(const struct FPReclass *r, DCELL *dLeft, DCELL *c)
Definition: fpreclass.c:427
DCELL defaultDMin
Definition: raster.h:61
DCELL rMax
Definition: raster.h:72
void Rast_fpreclass_perform_di(const struct FPReclass *r, const DCELL *dcell, CELL *cell, int n)
Definition: fpreclass.c:592
DCELL dHigh
Definition: raster.h:45
void Rast_fpreclass_clear(struct FPReclass *r)
Definition: fpreclass.c:266
void Rast_fpreclass_get_ith_rule(const struct FPReclass *r, int i, DCELL *dLow, DCELL *dHigh, DCELL *rLow, DCELL *rHigh)
Definition: fpreclass.c:383
#define NO_RIGHT_INFINITE_RULE
Definition: fpreclass.c:256
#define Rast_is_c_null_value(cellVal)
Definition: defs/raster.h:416
double r
Definition: r_raster.c:39
int infiniteLeftSet
Definition: raster.h:56
void Rast_set_d_null_value(DCELL *, int)
To set a number of DCELL raster values to NULL.
Definition: null_val.c:155
void Rast_fpreclass_set_pos_infinite_rule(struct FPReclass *r, DCELL dRight, DCELL c)
Definition: fpreclass.c:441
void Rast_fpreclass_set_domain(struct FPReclass *r, DCELL dLow, DCELL dHigh)
Definition: fpreclass.c:296