#include <stdlib.h>
#include <grass/gis.h>
Go to the source code of this file.
Defines | |
#define | USE_LOOKUP 1 |
#define | MAX_LOOKUP_TABLE_SIZE 2048 |
#define | MIN(a, b) (a < b ? a : b) |
#define | MAX(a, b) (a > b ? a : b) |
#define | NO_DATA (G_set_c_null_value (&tmp, 1), (CELL) tmp) |
#define | NO_LEFT_INFINITE_RULE (! q->infiniteLeftSet) |
#define | NO_RIGHT_INFINITE_RULE (! q->infiniteRightSet) |
#define | NO_FINITE_RULE (q->nofRules <= 0) |
#define | NO_EXPLICIT_RULE |
Functions | |
void | G_quant_clear (struct Quant *q) |
void | G_quant_free (struct Quant *q) |
int | G__quant_organize_fp_lookup (struct Quant *q) |
int | G_quant_init (struct Quant *quant) |
Initializes the q struct. | |
int | G_quant_is_truncate (struct Quant *quant) |
int | G_quant_is_round (struct Quant *quant) |
int | G_quant_truncate (struct Quant *quant) |
sets the quant for q rules to perform simple truncation on floats. | |
int | G_quant_round (struct Quant *quant) |
int | G_quant_get_limits (struct Quant *q, DCELL *dMin, DCELL *dMax, CELL *cMin, CELL *cMax) |
Extracts the minimum and maximum floating-point and integer values from all the rules (except the "infinite" rules) in q into dmin, dmax, cmin, and cmax. Returns 1 if there are any explicit rules. If there are no explicit rules, (this includes cases when q is set to truncate or round map), it returns 0 and sets dmin, dmax, cmin, and cmax to NULL. | |
int | G_quant_nof_rules (struct Quant *q) |
void | G_quant_get_ith_rule (struct Quant *q, int i, DCELL *dLow, DCELL *dHigh, CELL *cLow, CELL *cHigh) |
void | G_quant_set_neg_infinite_rule (struct Quant *q, DCELL dLeft, CELL c) |
int | G_quant_get_neg_infinite_rule (struct Quant *q, DCELL *dLeft, CELL *c) |
void | G_quant_set_pos_infinite_rule (struct Quant *q, DCELL dRight, CELL c) |
int | G_quant_get_pos_infinite_rule (struct Quant *q, DCELL *dRight, CELL *c) |
void | G_quant_add_rule (struct Quant *q, DCELL dLow, DCELL dHigh, CELL cLow, CELL cHigh) |
void | G_quant_reverse_rule_order (struct Quant *q) |
CELL | G_quant_get_cell_value (struct Quant *q, DCELL dcellVal) |
Returns a CELL category for the floating-point value based on the quantization rules in q. The first rule found that applies is used. The rules are searched in the reverse order they are added to q. If no rule is found, the value is first tested against the negative infinite rule, and finally against the positive infinite rule. if none of these rules apply, the NULL-value is returned. NOTE. See G_quant_organize_fp_lookup() for details on how the values are looked up from fp_lookup table when it is active. (Right now fp_lookup is automatically organized during the first call to G_quant_get_cell_value(). | |
void | G_quant_perform_d (struct Quant *q, DCELL *dcell, CELL *cell, int n) |
void | G_quant_perform_f (struct Quant *q, FCELL *fcell, CELL *cell, int n) |
struct Quant_table * | G__quant_get_rule_for_d_raster_val (struct Quant *q, DCELL val) |
#define MAX_LOOKUP_TABLE_SIZE 2048 |
#define NO_DATA (G_set_c_null_value (&tmp, 1), (CELL) tmp) |
Definition at line 295 of file quant.c.
Referenced by G__quant_organize_fp_lookup(), and G_quant_get_cell_value().
#define NO_EXPLICIT_RULE |
Value:
#define USE_LOOKUP 1 |
struct Quant_table* G__quant_get_rule_for_d_raster_val | ( | struct Quant * | q, | |
DCELL | val | |||
) | [read] |
Definition at line 951 of file quant.c.
References NULL.
Referenced by G__quant_organize_fp_lookup(), and G_quant_get_cell_value().
int G__quant_organize_fp_lookup | ( | struct Quant * | q | ) |
Definition at line 331 of file quant.c.
References G__quant_get_rule_for_d_raster_val(), G_calloc(), MAX_LOOKUP_TABLE_SIZE, NO_DATA, NO_FINITE_RULE, NO_LEFT_INFINITE_RULE, and NO_RIGHT_INFINITE_RULE.
Referenced by G_quant_get_cell_value().
void G_quant_add_rule | ( | struct Quant * | q, | |
DCELL | dLow, | |||
DCELL | dHigh, | |||
CELL | cLow, | |||
CELL | cHigh | |||
) |
Definition at line 683 of file quant.c.
References G_free().
Referenced by G_quantize_fp_map_range(), G_set_d_raster_cat(), and G_set_quant_rules().
void G_quant_clear | ( | struct Quant * | q | ) |
void G_quant_free | ( | struct Quant * | q | ) |
Definition at line 314 of file quant.c.
References G_free(), and G_quant_clear().
Referenced by G__quant_import(), and G_free_raster_cats().
CELL G_quant_get_cell_value | ( | struct Quant * | q, | |
DCELL | dcellVal | |||
) |
Returns a CELL category for the floating-point value based on the quantization rules in q. The first rule found that applies is used. The rules are searched in the reverse order they are added to q. If no rule is found, the value is first tested against the negative infinite rule, and finally against the positive infinite rule. if none of these rules apply, the NULL-value is returned. NOTE. See G_quant_organize_fp_lookup() for details on how the values are looked up from fp_lookup table when it is active. (Right now fp_lookup is automatically organized during the first call to G_quant_get_cell_value().
q | ||
value |
Definition at line 792 of file quant.c.
References G__quant_get_rule_for_d_raster_val(), G__quant_organize_fp_lookup(), G_is_d_null_value(), NO_DATA, NO_EXPLICIT_RULE, NO_FINITE_RULE, NO_LEFT_INFINITE_RULE, NO_RIGHT_INFINITE_RULE, and USE_LOOKUP.
Referenced by G_get_raster_cat(), G_mark_raster_cats(), G_quant_perform_d(), and G_quant_perform_f().
void G_quant_get_ith_rule | ( | struct Quant * | q, | |
int | i, | |||
DCELL * | dLow, | |||
DCELL * | dHigh, | |||
CELL * | cLow, | |||
CELL * | cHigh | |||
) |
int G_quant_get_limits | ( | struct Quant * | q, | |
DCELL * | dMin, | |||
DCELL * | dMax, | |||
CELL * | cMin, | |||
CELL * | cMax | |||
) |
Extracts the minimum and maximum floating-point and integer values from all the rules (except the "infinite"
rules) in q into dmin, dmax, cmin, and cmax. Returns 1 if there are any explicit rules. If there are no explicit rules, (this includes cases when q is set to truncate or round map), it returns 0 and sets dmin, dmax, cmin, and cmax to NULL.
q | ||
dmin | ||
dmax | ||
cmin | ||
cmax |
Definition at line 540 of file quant.c.
References G_set_c_null_value(), G_set_d_null_value(), and NO_EXPLICIT_RULE.
Referenced by G_read_range(), and G_write_quant().
int G_quant_get_neg_infinite_rule | ( | struct Quant * | q, | |
DCELL * | dLeft, | |||
CELL * | c | |||
) |
int G_quant_get_pos_infinite_rule | ( | struct Quant * | q, | |
DCELL * | dRight, | |||
CELL * | c | |||
) |
int G_quant_init | ( | struct Quant * | quant | ) |
Initializes the q struct.
q |
Definition at line 424 of file quant.c.
References G_quant_clear().
Referenced by G_init_raster_cats(), G_quantize_fp_map_range(), G_read_quant(), G_round_fp_map(), G_set_quant_rules(), and G_truncate_fp_map().
int G_quant_is_round | ( | struct Quant * | quant | ) |
int G_quant_is_truncate | ( | struct Quant * | quant | ) |
int G_quant_nof_rules | ( | struct Quant * | q | ) |
Definition at line 563 of file quant.c.
Referenced by G__write_cats(), and G_get_next_marked_d_raster_cat().
void G_quant_perform_d | ( | struct Quant * | q, | |
DCELL * | dcell, | |||
CELL * | cell, | |||
int | n | |||
) |
Definition at line 903 of file quant.c.
References G_is_d_null_value(), G_quant_get_cell_value(), and G_set_c_null_value().
void G_quant_perform_f | ( | struct Quant * | q, | |
FCELL * | fcell, | |||
CELL * | cell, | |||
int | n | |||
) |
Definition at line 921 of file quant.c.
References G_is_f_null_value(), G_quant_get_cell_value(), and G_set_c_null_value().
int G_quant_round | ( | struct Quant * | quant | ) |
void G_quant_set_neg_infinite_rule | ( | struct Quant * | q, | |
DCELL | dLeft, | |||
CELL | c | |||
) |
void G_quant_set_pos_infinite_rule | ( | struct Quant * | q, | |
DCELL | dRight, | |||
CELL | c | |||
) |
int G_quant_truncate | ( | struct Quant * | quant | ) |
sets the quant for q rules to perform simple truncation on floats.
q |
q |
Definition at line 473 of file quant.c.
Referenced by G_set_quant_rules(), and G_truncate_fp_map().