GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
#include <grass/gis.h>
#include <grass/glocale.h>
#include <stdlib.h>
Go to the source code of this file.
Macros | |
#define | LIST struct Histogram_list |
Functions | |
int | G_init_histogram (struct Histogram *histogram) |
initializes the histogram structure More... | |
int | G_read_histogram (const char *name, const char *mapset, struct Histogram *histogram) |
read the histogram information More... | |
int | G_write_histogram (const char *name, const struct Histogram *histogram) |
Writes the histogram information. More... | |
int | G_write_histogram_cs (const char *name, struct Cell_stats *statf) |
Writes the histogram based on cell statistics to file. More... | |
int | G_make_histogram_cs (struct Cell_stats *statf, struct Histogram *histogram) |
Creates histogram based on cell statistics. More... | |
int | G_get_histogram_num (const struct Histogram *histogram) |
Sorts the histogram in ascending order by counts then category. More... | |
CELL | G_get_histogram_cat (int n, const struct Histogram *histogram) |
Returns cat for the nth element in the histogram. More... | |
long | G_get_histogram_count (int n, const struct Histogram *histogram) |
Returns count for the nth element in the histogram. More... | |
int | G_free_histogram (struct Histogram *histogram) |
Frees memory allocated for the histogram. More... | |
int | G_sort_histogram (struct Histogram *histogram) |
Sorts the histogram. More... | |
int | G_sort_histogram_by_count (struct Histogram *histogram) |
Sorts the histogram by counts. More... | |
int | G_remove_histogram (const char *name) |
Removes the histogram. More... | |
int | G_add_histogram (CELL cat, long count, struct Histogram *histogram) |
adds count to the histogram value for cat More... | |
int | G_set_histogram (CELL cat, long count, struct Histogram *histogram) |
sets the histogram value for cat to count More... | |
int | G_extend_histogram (CELL cat, long count, struct Histogram *histogram) |
Extends histogram struct to accomodate a new value. More... | |
int | G_zero_histogram (struct Histogram *histogram) |
Zero out histogram struct. More... | |
#define LIST struct Histogram_list |
Definition at line 6 of file histogram.c.
int G_add_histogram | ( | CELL | cat, |
long | count, | ||
struct Histogram * | histogram | ||
) |
adds count to the histogram value for cat
adds count to the histogram value for cat
cat,: | category |
count | |
histogram,: | struct for histogram |
Definition at line 389 of file histogram.c.
References count, and G_extend_histogram().
Referenced by G_make_histogram_cs().
int G_extend_histogram | ( | CELL | cat, |
long | count, | ||
struct Histogram * | histogram | ||
) |
Extends histogram struct to accomodate a new value.
cat,: | category |
count | |
histogram,: | struct for histogram |
Definition at line 439 of file histogram.c.
References cat, count, and LIST.
Referenced by G_add_histogram(), G_read_histogram(), and G_set_histogram().
int G_free_histogram | ( | struct Histogram * | histogram | ) |
Frees memory allocated for the histogram.
frees the memory allocated for the histogram
histogram,: | struct for histogram |
Definition at line 234 of file histogram.c.
References G_free(), and NULL.
Referenced by G_read_histogram().
CELL G_get_histogram_cat | ( | int | n, |
const struct Histogram * | histogram | ||
) |
Returns cat for the nth element in the histogram.
Returns cat for the nth element in the histogram
histogram,: | struct for histogram |
Definition at line 201 of file histogram.c.
References n.
Referenced by G_histogram_eq().
long G_get_histogram_count | ( | int | n, |
const struct Histogram * | histogram | ||
) |
Returns count for the nth element in the histogram.
Returns count for the nth element in the histogram
n,: | nth element |
histogram,: | struct for histogram |
Definition at line 218 of file histogram.c.
References n.
Referenced by G_histogram_eq().
int G_get_histogram_num | ( | const struct Histogram * | histogram | ) |
Sorts the histogram in ascending order by counts then category.
Sorts the histogram in ascending order by counts then category. No combining is done.
histogram,: | struct for histogram |
Definition at line 188 of file histogram.c.
Referenced by G_histogram_eq().
int G_init_histogram | ( | struct Histogram * | histogram | ) |
initializes the histogram structure
initializes the histogram structure for calls to G_set_histogram() and G_add_histogram()
histogram |
Definition at line 22 of file histogram.c.
References NULL.
Referenced by G_make_histogram_cs(), and G_read_histogram().
int G_make_histogram_cs | ( | struct Cell_stats * | statf, |
struct Histogram * | histogram | ||
) |
Creates histogram based on cell statistics.
statf,: | cell statistics |
histogram,: | raster histogram |
Definition at line 163 of file histogram.c.
References cat, count, G_add_histogram(), G_init_histogram(), G_next_cell_stat(), G_rewind_cell_stats(), and G_sort_histogram().
int G_read_histogram | ( | const char * | name, |
const char * | mapset, | ||
struct Histogram * | histogram | ||
) |
read the histogram information
Reads the histogram information associated with map layer "map" in mapset "mapset" into the structure "histogram".
note: a warning message is printed if the file is missing or incorrect
name,: | name of map |
mapset,: | mapset that map belongs to |
histogram,: | struct for histogram |
Definition at line 46 of file histogram.c.
References buf, cat, count, fclose(), fd, G_extend_histogram(), G_find_file2_misc(), G_fopen_old_misc(), G_free_histogram(), G_init_histogram(), G_sort_histogram(), G_warning(), and NULL.
int G_remove_histogram | ( | const char * | name | ) |
Removes the histogram.
Removes the histogram information associated with map layer "name"
name,: | name of map |
Definition at line 371 of file histogram.c.
References G_remove_misc().
int G_set_histogram | ( | CELL | cat, |
long | count, | ||
struct Histogram * | histogram | ||
) |
sets the histogram value for cat to count
sets the histogram value for cat to count
cat,: | category |
count | |
histogram,: | struct for histogram |
Definition at line 415 of file histogram.c.
References count, and G_extend_histogram().
int G_sort_histogram | ( | struct Histogram * | histogram | ) |
Sorts the histogram.
Sorts the histogram in ascending order by category, combining (by adding) elements that have the same category.
histogram,: | struct for histogram |
Definition at line 253 of file histogram.c.
Referenced by G_make_histogram_cs(), and G_read_histogram().
int G_sort_histogram_by_count | ( | struct Histogram * | histogram | ) |
Sorts the histogram by counts.
Sorts the histogram in ascending order by counts then category. No combining is done.
histogram,: | struct for histogram |
Definition at line 313 of file histogram.c.
References n.
int G_write_histogram | ( | const char * | name, |
const struct Histogram * | histogram | ||
) |
int G_write_histogram_cs | ( | const char * | name, |
struct Cell_stats * | statf | ||
) |
Writes the histogram based on cell statistics to file.
name,: | name of map |
statf,: | cell statistics |
Definition at line 135 of file histogram.c.
References cat, count, fclose(), fd, G_next_cell_stat(), G_rewind_cell_stats(), and NULL.
int G_zero_histogram | ( | struct Histogram * | histogram | ) |
Zero out histogram struct.
histogram,: | struct for histogram |
Definition at line 458 of file histogram.c.