GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
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 #define NO_DEFAULT_RULE (! r->defaultDRuleSet)
250 #define NO_LEFT_INFINITE_RULE (! r->infiniteLeftSet)
251 #define NO_RIGHT_INFINITE_RULE (! r->infiniteRightSet)
252 #define NO_FINITE_RULE (r->nofRules <= 0)
253 #define NO_EXPLICIT_RULE (NO_FINITE_RULE && \
254  NO_LEFT_INFINITE_RULE && NO_RIGHT_INFINITE_RULE)
255 
256 #define DEFAULT_MIN ((DCELL) 1)
257 #define DEFAULT_MAX ((DCELL) 255)
258 
259 /*--------------------------------------------------------------------------*/
260 
262 {
263  r->nofRules = 0;
264  r->defaultDRuleSet = 0;
265  r->defaultRRuleSet = 0;
266  r->infiniteRightSet = r->infiniteLeftSet = 0;
267 }
268 
269 /*--------------------------------------------------------------------------*/
270 
272 {
274 
275  if (r->maxNofRules > 0)
276  G_free(r->table);
277 
278  r->maxNofRules = 0;
279 }
280 
281 /*--------------------------------------------------------------------------*/
282 
284 {
285  r->maxNofRules = 0;
287 }
288 
289 /*--------------------------------------------------------------------------*/
290 
291 void Rast_fpreclass_set_domain(struct FPReclass *r, DCELL dLow, DCELL dHigh)
292 {
293  r->defaultDMin = dLow;
294  r->defaultDMax = dHigh;
295  r->defaultDRuleSet = 1;
296 }
297 
298 /*--------------------------------------------------------------------------*/
299 
301 {
302  r->defaultRMin = low;
303  r->defaultRMax = high;
304  r->defaultRRuleSet = 1;
305 }
306 
307 /*--------------------------------------------------------------------------*/
308 
309 static void fpreclass_set_limits(struct FPReclass *r,
310  DCELL dLow, DCELL dHigh,
311  DCELL rLow, DCELL rHigh)
312 {
313  r->dMin = dLow;
314  r->dMax = dHigh;
315  r->rMin = rLow;
316  r->rMax = rHigh;
317 }
318 
319 /*--------------------------------------------------------------------------*/
320 
321 static void fpreclass_update_limits(struct FPReclass *r,
322  DCELL dLow, DCELL dHigh,
323  DCELL rLow, DCELL rHigh)
324 {
325  if (NO_EXPLICIT_RULE) {
326  fpreclass_set_limits(r, dLow, dHigh, rLow, rHigh);
327  return;
328  }
329 
330  r->dMin = MIN(r->dMin, MIN(dLow, dHigh));
331  r->dMax = MAX(r->dMax, MAX(dLow, dHigh));
332  r->rMin = MIN(r->rMin, MIN(rLow, rHigh));
333  r->rMax = MAX(r->rMax, MAX(rLow, rHigh));
334 }
335 
336 /*--------------------------------------------------------------------------*/
337 
339  DCELL * dMin, DCELL * dMax,
340  DCELL * rMin, DCELL * rMax)
341 {
342  if (NO_EXPLICIT_RULE) {
343  if (NO_DEFAULT_RULE)
344  return -1;
345 
346  *dMin = r->defaultDMin;
347  *dMax = r->defaultDMax;
348 
349  if (r->defaultRRuleSet) {
350  *rMin = r->defaultRMin;
351  *rMax = r->defaultRMax;
352  }
353  else {
354  *rMin = DEFAULT_MIN;
355  *rMax = DEFAULT_MAX;
356  }
357 
358  return 0;
359  }
360 
361  *dMin = r->dMin;
362  *dMax = r->dMax;
363  *rMin = r->rMin;
364  *rMax = r->rMax;
365 
366  return 1;
367 }
368 
369 /*--------------------------------------------------------------------------*/
370 
372 {
373  return r->nofRules;
374 }
375 
376 /*--------------------------------------------------------------------------*/
377 
378 void Rast_fpreclass_get_ith_rule(const struct FPReclass *r, int i,
379  DCELL * dLow, DCELL * dHigh,
380  DCELL * rLow, DCELL * rHigh)
381 {
382  *dLow = r->table[i].dLow;
383  *dHigh = r->table[i].dHigh;
384  *rLow = r->table[i].rLow;
385  *rHigh = r->table[i].rHigh;
386 }
387 
388 /*--------------------------------------------------------------------------*/
389 
390 static void fpreclass_table_increase(struct FPReclass *r)
391 {
392  if (r->nofRules < r->maxNofRules)
393  return;
394 
395  if (r->maxNofRules == 0) {
396  r->maxNofRules = 50;
397  r->table = (struct FPReclass_table *)
398  G_malloc(r->maxNofRules * sizeof(struct FPReclass_table));
399  }
400  else {
401  r->maxNofRules += 50;
402  r->table = (struct FPReclass_table *)
403  G_realloc((char *)r->table,
404  r->maxNofRules * sizeof(struct FPReclass_table));
405  }
406 }
407 
408 /*--------------------------------------------------------------------------*/
409 
410 void
412  DCELL c)
413 {
414  r->infiniteDLeft = dLeft;
415  r->infiniteRLeft = c;
416  fpreclass_update_limits(r, dLeft, dLeft, c, c);
417  r->infiniteLeftSet = 1;
418 }
419 
420 /*--------------------------------------------------------------------------*/
421 
423  DCELL * dLeft, DCELL * c)
424 {
425  if (r->infiniteLeftSet == 0)
426  return 0;
427 
428  *dLeft = r->infiniteDLeft;
429  *c = r->infiniteRLeft;
430 
431  return 1;
432 }
433 
434 /*--------------------------------------------------------------------------*/
435 
437  DCELL c)
438 {
439  r->infiniteDRight = dRight;
440  r->infiniteRRight = c;
441  fpreclass_update_limits(r, dRight, dRight, c, c);
442  r->infiniteRightSet = 1;
443 }
444 
445 /*--------------------------------------------------------------------------*/
446 
448  DCELL * dRight, DCELL * c)
449 {
450  if (r->infiniteRightSet == 0)
451  return 0;
452 
453  *dRight = r->infiniteDRight;
454  *c = r->infiniteRRight;
455 
456  return 1;
457 }
458 
459 /*--------------------------------------------------------------------------*/
460 
463 {
464  int i;
465  struct FPReclass_table *p;
466 
467  fpreclass_table_increase(r);
468 
469  i = r->nofRules;
470 
471  p = &(r->table[i]);
472  if (dHigh >= dLow) {
473  p->dLow = dLow;
474  p->dHigh = dHigh;
475  p->rLow = rLow;
476  p->rHigh = rHigh;
477  }
478  else {
479  p->dLow = dHigh;
480  p->dHigh = dLow;
481  p->rLow = rHigh;
482  p->rHigh = rLow;
483  }
484 
485  fpreclass_update_limits(r, dLow, dHigh, rLow, rHigh);
486 
487  r->nofRules++;
488 }
489 
490 /*--------------------------------------------------------------------------*/
491 
493 {
494  struct FPReclass_table tmp;
495  struct FPReclass_table *pLeft, *pRight;
496 
497  pLeft = r->table;
498  pRight = &(r->table[r->nofRules - 1]);
499 
500  while (pLeft < pRight) {
501  tmp.dLow = pLeft->dLow;
502  tmp.dHigh = pLeft->dHigh;
503  tmp.rLow = pLeft->rLow;
504  tmp.rHigh = pLeft->rHigh;
505 
506  pLeft->dLow = pRight->dLow;
507  pLeft->dHigh = pRight->dHigh;
508  pLeft->rLow = pRight->rLow;
509  pLeft->rHigh = pRight->rHigh;
510 
511  pRight->dLow = tmp.dLow;
512  pRight->dHigh = tmp.dHigh;
513  pRight->rLow = tmp.rLow;
514  pRight->rHigh = tmp.rHigh;
515 
516  pLeft++;
517  pRight--;
518  }
519 }
520 
521 /*--------------------------------------------------------------------------*/
522 
523 static DCELL fpreclass_interpolate(DCELL dLow, DCELL dHigh,
524  DCELL rLow, DCELL rHigh, DCELL dValue)
525 {
526  if (rLow == rHigh)
527  return rLow;
528  if (dLow == dHigh)
529  return rLow;
530 
531  return ((dValue - dLow) / (dHigh - dLow) * (rHigh - rLow) + rLow);
532 }
533 
534 /*--------------------------------------------------------------------------*/
535 
536 static DCELL fpreclass_get_default_cell_value(const struct FPReclass *r,
537  DCELL cellVal)
538 {
539  DCELL tmp;
540 
541  Rast_set_d_null_value(&tmp, 1);
542 
543  if ((cellVal < MIN(r->defaultDMin, r->defaultDMax)) ||
544  (cellVal > MAX(r->defaultDMin, r->defaultDMax)))
545  return tmp;
546 
547  if (r->defaultRRuleSet)
548  return fpreclass_interpolate(r->defaultDMin, r->defaultDMax,
549  r->defaultRMin, r->defaultRMax, cellVal);
550  else
551  return fpreclass_interpolate(r->defaultDMin, r->defaultDMax,
552  DEFAULT_MIN, DEFAULT_MAX, cellVal);
553 }
554 
555 /*--------------------------------------------------------------------------*/
556 
558 {
559  DCELL tmp;
560  const struct FPReclass_table *p;
561 
562  Rast_set_d_null_value(&tmp, 1);
563  if (NO_EXPLICIT_RULE) {
564 
565  if (NO_DEFAULT_RULE)
566  return tmp;
567  return fpreclass_get_default_cell_value(r, cellVal);
568  }
569 
570  if (!NO_FINITE_RULE)
571  for (p = &(r->table[r->nofRules - 1]); p >= r->table; p--)
572  if ((cellVal >= p->dLow) && (cellVal <= p->dHigh))
573  return fpreclass_interpolate(p->dLow, p->dHigh, p->rLow,
574  p->rHigh, cellVal);
575 
576  if ((!NO_LEFT_INFINITE_RULE) && (cellVal <= r->infiniteDLeft))
577  return r->infiniteRLeft;
578 
579  if ((NO_RIGHT_INFINITE_RULE) || (cellVal < r->infiniteDRight))
580  return tmp;
581 
582  return r->infiniteRRight;
583 }
584 
585 /*--------------------------------------------------------------------------*/
586 
588  const DCELL * dcell, CELL * cell, int n)
589 {
590  int i;
591 
592  for (i = 0; i < n; i++, dcell++)
593  if (!Rast_is_d_null_value(dcell))
594  *cell++ = Rast_fpreclass_get_cell_value(r, *dcell);
595  else
596  Rast_set_c_null_value(cell++, 1);
597 }
598 
599 /*--------------------------------------------------------------------------*/
600 
602  const DCELL * dcell, FCELL * cell, int n)
603 {
604  int i;
605 
606  for (i = 0; i < n; i++, dcell++)
607  if (!Rast_is_d_null_value(dcell))
608  *cell++ = Rast_fpreclass_get_cell_value(r, *dcell);
609  else
610  Rast_set_f_null_value(cell++, 1);
611 }
612 
613 /*--------------------------------------------------------------------------*/
614 
616  const DCELL * dcell, DCELL * cell, int n)
617 {
618  int i;
619 
620  for (i = 0; i < n; i++, dcell++)
621  if (!Rast_is_d_null_value(dcell))
622  *cell++ = Rast_fpreclass_get_cell_value(r, *dcell);
623  else
624  Rast_set_d_null_value(cell++, 1);
625 }
626 
627 /*--------------------------------------------------------------------------*/
628 
630  const FCELL * fcell, CELL * cell, int n)
631 {
632  int i;
633 
634  for (i = 0; i < n; i++, fcell++)
635  if (!Rast_is_f_null_value(fcell))
636  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * fcell);
637  else
638  Rast_set_c_null_value(cell++, 1);
639 }
640 
641 /*--------------------------------------------------------------------------*/
642 
644  const FCELL * fcell, FCELL * cell, int n)
645 {
646  int i;
647 
648  for (i = 0; i < n; i++, fcell++)
649  if (!Rast_is_f_null_value(fcell))
650  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * fcell);
651  else
652  Rast_set_f_null_value(cell++, 1);
653 }
654 
655 /*--------------------------------------------------------------------------*/
656 
658  const FCELL * fcell, DCELL * cell, int n)
659 {
660  int i;
661 
662  for (i = 0; i < n; i++, fcell++)
663  if (!Rast_is_f_null_value(fcell))
664  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * fcell);
665  else
666  Rast_set_d_null_value(cell++, 1);
667 }
668 
669 /*--------------------------------------------------------------------------*/
670 
672  const CELL * icell, CELL * cell, int n)
673 {
674  int i;
675 
676  for (i = 0; i < n; i++, icell++)
677  if (!Rast_is_c_null_value(icell))
678  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * icell);
679  else
680  Rast_set_c_null_value(cell++, 1);
681 }
682 
683 /*--------------------------------------------------------------------------*/
684 
686  const CELL * icell, FCELL * cell, int n)
687 {
688  int i;
689 
690  for (i = 0; i < n; i++, icell++)
691  if (!Rast_is_c_null_value(icell))
692  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * icell);
693  else
694  Rast_set_f_null_value(cell++, 1);
695 }
696 
697 /*--------------------------------------------------------------------------*/
698 
700  const CELL * icell, DCELL * cell, int n)
701 {
702  int i;
703 
704  for (i = 0; i < n; i++, icell++)
705  if (!Rast_is_c_null_value(icell))
706  *cell++ = Rast_fpreclass_get_cell_value(r, (DCELL) * icell);
707  else
708  Rast_set_d_null_value(cell++, 1);
709 }
710 
711 /*--------------------------------------------------------------------------*/
712 
713 /*--------------------------------------------------------------------------*/
714 
715 /*--------------------------------------------------------------------------*/
#define DEFAULT_MIN
Definition: fpreclass.c:256
#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:461
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:629
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:250
int defaultDRuleSet
Definition: raster.h:54
int infiniteRightSet
Definition: raster.h:57
#define Rast_is_d_null_value(dcellVal)
Definition: defs/raster.h:414
void Rast_fpreclass_set_range(struct FPReclass *r, DCELL low, DCELL high)
Definition: fpreclass.c:300
int defaultRRuleSet
Definition: raster.h:55
void Rast_fpreclass_set_neg_infinite_rule(struct FPReclass *r, DCELL dLeft, DCELL c)
Definition: fpreclass.c:411
double DCELL
Definition: gis.h:614
#define NO_FINITE_RULE
Definition: fpreclass.c:252
DCELL infiniteDRight
Definition: raster.h:66
DCELL rMin
Definition: raster.h:71
int Rast_fpreclass_nof_rules(const struct FPReclass *r)
Definition: fpreclass.c:371
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:643
#define NO_DEFAULT_RULE
Definition: fpreclass.c:249
DCELL defaultRMin
Definition: raster.h:63
void Rast_fpreclass_reset(struct FPReclass *r)
Definition: fpreclass.c:271
#define Rast_is_f_null_value(fcellVal)
Definition: defs/raster.h:412
void Rast_fpreclass_init(struct FPReclass *r)
Definition: fpreclass.c:283
void Rast_fpreclass_perform_dd(const struct FPReclass *r, const DCELL *dcell, DCELL *cell, int n)
Definition: fpreclass.c:615
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:699
#define MIN(a, b)
Definition: gis.h:140
void Rast_fpreclass_perform_fd(const struct FPReclass *r, const FCELL *fcell, DCELL *cell, int n)
Definition: fpreclass.c:657
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:447
DCELL dLow
Definition: raster.h:44
int nofRules
Definition: raster.h:60
#define MAX(a, b)
Definition: gis.h:135
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:671
DCELL rLow
Definition: raster.h:46
float FCELL
Definition: gis.h:615
void Rast_fpreclass_perform_df(const struct FPReclass *r, const DCELL *dcell, FCELL *cell, int n)
Definition: fpreclass.c:601
#define NO_EXPLICIT_RULE
Definition: fpreclass.c:253
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:685
#define DEFAULT_MAX
Definition: fpreclass.c:257
int Rast_fpreclass_get_limits(const struct FPReclass *r, DCELL *dMin, DCELL *dMax, DCELL *rMin, DCELL *rMax)
Definition: fpreclass.c:338
DCELL Rast_fpreclass_get_cell_value(const struct FPReclass *r, DCELL cellVal)
Definition: fpreclass.c:557
int CELL
Definition: gis.h:613
DCELL infiniteRLeft
Definition: raster.h:67
void Rast_fpreclass_reverse_rule_order(struct FPReclass *r)
Definition: fpreclass.c:492
#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:422
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:587
DCELL dHigh
Definition: raster.h:45
void Rast_fpreclass_clear(struct FPReclass *r)
Definition: fpreclass.c:261
void Rast_fpreclass_get_ith_rule(const struct FPReclass *r, int i, DCELL *dLow, DCELL *dHigh, DCELL *rLow, DCELL *rHigh)
Definition: fpreclass.c:378
#define NO_RIGHT_INFINITE_RULE
Definition: fpreclass.c:251
#define Rast_is_c_null_value(cellVal)
Definition: defs/raster.h:410
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:436
void Rast_fpreclass_set_domain(struct FPReclass *r, DCELL dLow, DCELL dHigh)
Definition: fpreclass.c:291