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