GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
#include <grass/gis.h>
#include <stdlib.h>
Go to the source code of this file.
Macros | |
#define | INCR 10 |
#define | SHIFT 6 |
#define | NODE struct Cell_stats_node |
Functions | |
int | G_init_cell_stats (struct Cell_stats *s) |
initialize cell stats More... | |
int | G_update_cell_stats (const CELL *cell, int n, struct Cell_stats *s) |
add data to cell stats More... | |
int | G_find_cell_stat (CELL cat, long *count, const struct Cell_stats *s) |
random query of cell stats More... | |
int | G_rewind_cell_stats (struct Cell_stats *s) |
reset/rewind cell stats More... | |
int | G_next_cell_stat (CELL *cat, long *count, struct Cell_stats *s) |
retrieve sorted cell stats More... | |
int | G_get_stats_for_null_value (long *count, const struct Cell_stats *s) |
Get a number of null values from stats structure. Note: when reporting values which appear in a map using G_next_cell_stats(), to get stats for null, call G_get_stats_for_null_value() first, since G_next_cell_stats() does not report stats for null. More... | |
int | G_free_cell_stats (struct Cell_stats *s) |
free cell stats More... | |
#define INCR 10 |
Definition at line 4 of file cell_stats.c.
Referenced by G_init_cell_stats(), and G_update_cell_stats().
#define NODE struct Cell_stats_node |
Definition at line 9 of file cell_stats.c.
Referenced by G_init_cell_stats(), and G_update_cell_stats().
#define SHIFT 6 |
Definition at line 5 of file cell_stats.c.
Referenced by G_find_cell_stat(), G_next_cell_stat(), and G_update_cell_stats().
int G_find_cell_stat | ( | CELL | cat, |
long * | count, | ||
const struct Cell_stats * | s | ||
) |
random query of cell stats
This routine allows a random query of the Cell_stats structure s. The count associated with the raster value cat is set. The routine returns 1 if cat was found in the structure, 0 otherwise.
cat | |
count | |
s |
Allow finding the count for the NULL-value
Definition at line 204 of file cell_stats.c.
References cat, G_is_c_null_value(), forms::q, and SHIFT.
int G_free_cell_stats | ( | struct Cell_stats * | s | ) |
free cell stats
The memory associated with structure s is freed. This routine may be called any time after callingG_init_cell_stats.
s |
Definition at line 413 of file cell_stats.c.
References G_free().
int G_get_stats_for_null_value | ( | long * | count, |
const struct Cell_stats * | s | ||
) |
Get a number of null values from stats structure. Note: when reporting values which appear in a map using G_next_cell_stats(), to get stats for null, call G_get_stats_for_null_value() first, since G_next_cell_stats() does not report stats for null.
count | |
s |
Definition at line 396 of file cell_stats.c.
int G_init_cell_stats | ( | struct Cell_stats * | s | ) |
initialize cell stats
This routine, which must be called first, initializes the Cell_stats structure s.
s |
Set the count for NULL-values to zero.
Definition at line 34 of file cell_stats.c.
int G_next_cell_stat | ( | CELL * | cat, |
long * | count, | ||
struct Cell_stats * | s | ||
) |
retrieve sorted cell stats
Retrieves the next cat,count combination from the structure s. Returns 0 if there are no more items, non-zero if there are more. For example:
cat | |
count | |
s |
Do not return a record for the NULL-value
Definition at line 338 of file cell_stats.c.
References SHIFT.
Referenced by G_cell_stats_histo_eq(), G_histogram_eq_colors(), G_make_histogram_cs(), G_make_histogram_eq_colors(), G_make_histogram_log_colors(), and G_write_histogram_cs().
int G_rewind_cell_stats | ( | struct Cell_stats * | s | ) |
reset/rewind cell stats
The structure s is rewound (i.e., positioned at the first raster category) so that sorted sequential retrieval can begin.
s |
Definition at line 265 of file cell_stats.c.
References forms::q.
Referenced by G_cell_stats_histo_eq(), G_histogram_eq_colors(), G_make_histogram_cs(), G_make_histogram_eq_colors(), G_make_histogram_log_colors(), and G_write_histogram_cs().
add data to cell stats
The n CELL values in the data array are inserted (and counted) in the Cell_stats structure s.
data | |
n | |
s |
Look for NULLs and update the NULL-value count.
Definition at line 67 of file cell_stats.c.
References cat, G_is_c_null_value(), INCR, N, NODE, forms::q, and SHIFT.
Referenced by G_put_map_row_random().