GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-bea8435a9e
|
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.
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 348 of file histogram.c.
References Histogram::Histogram_list::cat, Histogram::Histogram_list::count, 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 396 of file histogram.c.
References Histogram::Histogram_list::cat, Histogram::Histogram_list::count, count, G_realloc, Histogram::list, 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 202 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 171 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 187 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 159 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 22 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 136 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 42 of file histogram.c.
References _, count, G_fatal_error(), G_find_file2_misc(), G_fopen_old_misc(), G_warning(), name, 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 333 of file histogram.c.
References G_remove_misc(), and name.
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 373 of file histogram.c.
References Histogram::Histogram_list::cat, Histogram::Histogram_list::count, 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 219 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 278 of file histogram.c.
References Histogram::list, list, 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 87 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 112 of file histogram.c.
References count.
void Rast_zero_histogram | ( | struct Histogram * | histogram | ) |
Zero out histogram struct.
histogram | struct for histogram |
Definition at line 411 of file histogram.c.
References Histogram::Histogram_list::count, Histogram::list, and Histogram::num.