GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
Go to the source code of this file.
Macros | |
#define | LIST struct Histogram_list |
Functions | |
void | Rast_init_histogram (struct Histogram *histogram) |
initializes the histogram structure More... | |
int | Rast_read_histogram (const char *name, const char *mapset, struct Histogram *histogram) |
read the histogram information More... | |
void | Rast_write_histogram (const char *name, const struct Histogram *histogram) |
Writes the histogram information. More... | |
void | Rast_write_histogram_cs (const char *name, struct Cell_stats *statf) |
Writes the histogram based on cell statistics to file. More... | |
void | Rast_make_histogram_cs (struct Cell_stats *statf, struct Histogram *histogram) |
Creates histogram based on cell statistics. More... | |
int | Rast_get_histogram_num (const struct Histogram *histogram) |
Sorts the histogram in ascending order by counts then category. More... | |
CELL | Rast_get_histogram_cat (int n, const struct Histogram *histogram) |
Returns cat for the nth element in the histogram. More... | |
long | Rast_get_histogram_count (int n, const struct Histogram *histogram) |
Returns count for the nth element in the histogram. More... | |
void | Rast_free_histogram (struct Histogram *histogram) |
Frees memory allocated for the histogram. More... | |
int | Rast_sort_histogram (struct Histogram *histogram) |
Sorts the histogram. More... | |
int | Rast_sort_histogram_by_count (struct Histogram *histogram) |
Sorts the histogram by counts. More... | |
void | Rast_remove_histogram (const char *name) |
Removes the histogram. More... | |
int | Rast_add_histogram (CELL cat, long count, struct Histogram *histogram) |
adds count to the histogram value for cat More... | |
int | Rast_set_histogram (CELL cat, long count, struct Histogram *histogram) |
sets the histogram value for cat to count More... | |
void | Rast_extend_histogram (CELL cat, long count, struct Histogram *histogram) |
Extends histogram struct to accommodate a new value. More... | |
void | Rast_zero_histogram (struct Histogram *histogram) |
Zero out histogram struct. More... | |
#define LIST struct Histogram_list |
Definition at line 7 of file histogram.c.
Referenced by Rast_extend_histogram(), Rast_sort_histogram_by_count(), and Rast_write_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 360 of file histogram.c.
References Histogram::Histogram_list::cat, count, Histogram::Histogram_list::count, Histogram::list, Histogram::num, and Rast_extend_histogram().
Referenced by Rast_make_histogram_cs().
Extends histogram struct to accommodate a new value.
cat | category |
count | |
histogram | struct for histogram |
Definition at line 410 of file histogram.c.
References Histogram::Histogram_list::cat, count, Histogram::Histogram_list::count, G_realloc, LIST, Histogram::list, and Histogram::num.
Referenced by Rast_add_histogram(), Rast_read_histogram(), and Rast_set_histogram().
void Rast_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 211 of file histogram.c.
References G_free(), Histogram::list, NULL, and Histogram::num.
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 178 of file histogram.c.
References Histogram::Histogram_list::cat, Histogram::list, and Histogram::num.
long Rast_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 195 of file histogram.c.
References Histogram::Histogram_list::count, Histogram::list, and Histogram::num.
int Rast_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 165 of file histogram.c.
References Histogram::num.
void Rast_init_histogram | ( | struct Histogram * | histogram | ) |
initializes the histogram structure
initializes the histogram structure for calls to Rast_set_histogram() and Rast_add_histogram()
histogram |
Definition at line 23 of file histogram.c.
References Histogram::list, NULL, and Histogram::num.
Referenced by Rast_make_histogram_cs(), and Rast_read_histogram().
void Rast_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 141 of file histogram.c.
References count, Rast_add_histogram(), Rast_init_histogram(), Rast_next_cell_stat(), Rast_rewind_cell_stats(), and Rast_sort_histogram().
int Rast_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 44 of file histogram.c.
References _, count, G_fatal_error(), G_find_file2_misc(), G_fopen_old_misc(), G_warning(), NULL, Histogram::num, Rast_extend_histogram(), Rast_init_histogram(), and Rast_sort_histogram().
void Rast_remove_histogram | ( | const char * | name | ) |
Removes the histogram.
Removes the histogram information associated with map layer "name"
name | name of map |
Definition at line 344 of file histogram.c.
References G_remove_misc().
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 386 of file histogram.c.
References Histogram::Histogram_list::cat, count, Histogram::Histogram_list::count, Histogram::list, Histogram::num, and Rast_extend_histogram().
int Rast_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 228 of file histogram.c.
Referenced by Rast_make_histogram_cs(), and Rast_read_histogram().
int Rast_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 288 of file histogram.c.
References LIST, list, Histogram::list, and Histogram::num.
void Rast_write_histogram | ( | const char * | name, |
const struct Histogram * | histogram | ||
) |
Writes the histogram information.
Writes the histogram information associated with map layer "name"
name | name of map |
histogram | struct for histogram |
Definition at line 90 of file histogram.c.
void Rast_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 116 of file histogram.c.
References count.
void Rast_zero_histogram | ( | struct Histogram * | histogram | ) |
Zero out histogram struct.
histogram | struct for histogram |
Definition at line 426 of file histogram.c.
References Histogram::Histogram_list::count, Histogram::list, and Histogram::num.