|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
|
Imagery library - functions for wx.iclass. More...
#include <math.h>#include <grass/imagery.h>#include <grass/glocale.h>#include <grass/colors.h>#include "iclass_local_proto.h"
Go to the source code of this file.
Imagery library - functions for wx.iclass.
Computation based on training areas for supervised classification. Based on i.class module (GRASS 6).
Computation and writing signatures to file.
SPDX-FileCopyrightText: 1999-2007, 2011 GRASS Development Team SPDX-License-Identifier: GPL-2.0-or-later
Computation based on training areas for supervised classification. Based on i.class module (GRASS 6).
Computing statistical values (mean, min, max, ...) from given area perimeters for each band.
SPDX-FileCopyrightText: 1999-2007, 2011 GRASS Development Team SPDX-License-Identifier: GPL-2.0-or-later
Definition in file iclass_statistics.c.
| void alloc_statistics | ( | IClass_statistics * | statistics, |
| int | nbands | ||
| ) |
Allocate space for statistics.
| statistics | pointer to statistics structure |
| nbands | number of band files |
Definition at line 74 of file iclass_statistics.c.
References G_calloc, and G_debug().
Referenced by I_iclass_analysis().
| void band_range | ( | IClass_statistics * | statistics, |
| int | band | ||
| ) |
Helper function for computing min and max range in one band.
Computing min and max range value (distance from mean dependent on number od std ddevs).
| statistics | pointer to statistics structure |
| band | band index |
Definition at line 347 of file iclass_statistics.c.
Referenced by I_iclass_create_raster(), and make_all_statistics().
| void create_raster | ( | IClass_statistics * | statistics, |
| CELL ** | band_buffer, | ||
| int * | band_fd, | ||
| const char * | raster_name | ||
| ) |
Create raster map based on statistics.
| statistics | pointer to statistics structure |
| band_buffer | buffer to read band rows into |
| band_fd | band files descriptors |
| raster_name | name of new raster map |
Definition at line 279 of file iclass_statistics.c.
References b, CELL_TYPE, g, G_mapset(), G_str_to_color(), r, Rast_allocate_c_buf(), Rast_close(), Rast_init_colors(), Rast_open_c_new(), Rast_put_row(), Rast_set_c_color(), Rast_window_cols(), Rast_window_rows(), Rast_write_colors(), and read_band_row().
Referenced by I_iclass_analysis(), and I_iclass_create_raster().
| void I_iclass_free_statistics | ( | IClass_statistics * | statistics | ) |
Free space allocated for statistics attributes.
Frees all allocated arrays in statistics structure.
| statistics | pointer to statistics structure |
Definition at line 105 of file iclass_statistics.c.
References G_debug(), G_free(), and AMI_STREAM< T >::name().
| void I_iclass_init_statistics | ( | IClass_statistics * | statistics, |
| int | category, | ||
| const char * | name, | ||
| const char * | color, | ||
| float | nstd | ||
| ) |
Initialize statistics.
| [out] | statistics | pointer to statistics structure |
| category | category (class) | |
| name | class name | |
| color | class color | |
| nstd | standard deviation |
Definition at line 43 of file iclass_statistics.c.
References G_debug(), G_store(), AMI_STREAM< T >::name(), name, and NULL.
| void I_iclass_statistics_get_cat | ( | IClass_statistics * | statistics, |
| int * | cat | ||
| ) |
Get category (class).
| statistics | pointer to statistics structure | |
| [out] | cat | category |
Definition at line 469 of file iclass_statistics.c.
| void I_iclass_statistics_get_color | ( | IClass_statistics * | statistics, |
| const char ** | color | ||
| ) |
Get category (class) color.
| statistics | pointer to statistics structure | |
| [out] | color | category color |
Definition at line 500 of file iclass_statistics.c.
| int I_iclass_statistics_get_histo | ( | IClass_statistics * | statistics, |
| int | band, | ||
| int | cat, | ||
| int * | value | ||
| ) |
Get histogram value in band.
Each band has one value for each raster cell category. Value is number of cells in category.
| statistics | pointer to statistics structure | |
| band | band index | |
| cat | raster cell category | |
| [out] | value | number of cells in category |
Definition at line 668 of file iclass_statistics.c.
References _, and G_warning().
| int I_iclass_statistics_get_max | ( | IClass_statistics * | statistics, |
| int | band, | ||
| int * | max | ||
| ) |
Get maximum value in band.
| statistics | pointer to statistics structure | |
| band | band index | |
| [out] | max | maximum value |
Definition at line 572 of file iclass_statistics.c.
References _, G_warning(), and max.
| int I_iclass_statistics_get_mean | ( | IClass_statistics * | statistics, |
| int | band, | ||
| float * | mean | ||
| ) |
Get mean of cell category values in band.
| statistics | pointer to statistics structure | |
| band | band index | |
| [out] | mean | mean |
Definition at line 618 of file iclass_statistics.c.
References _, G_warning(), and mean().
| int I_iclass_statistics_get_min | ( | IClass_statistics * | statistics, |
| int | band, | ||
| int * | min | ||
| ) |
Get minimum value in band.
| statistics | pointer to statistics structure | |
| band | band index | |
| [out] | min | minimum value |
Definition at line 549 of file iclass_statistics.c.
References _, G_warning(), and min.
| void I_iclass_statistics_get_name | ( | IClass_statistics * | statistics, |
| const char ** | name | ||
| ) |
Get category (class) name.
| statistics | pointer to statistics structure | |
| [out] | name | category name |
Definition at line 484 of file iclass_statistics.c.
References AMI_STREAM< T >::name(), and name.
| void I_iclass_statistics_get_nbands | ( | IClass_statistics * | statistics, |
| int * | nbands | ||
| ) |
Get number of bands.
| statistics | pointer to statistics structure | |
| [out] | nbands | number of bands |
Definition at line 458 of file iclass_statistics.c.
| void I_iclass_statistics_get_ncells | ( | IClass_statistics * | statistics, |
| int * | ncells | ||
| ) |
Get number of cells in training areas.
| statistics | pointer to statistics structure | |
| [out] | ncells | number of cells |
Definition at line 512 of file iclass_statistics.c.
| void I_iclass_statistics_get_nstd | ( | IClass_statistics * | statistics, |
| float * | nstd | ||
| ) |
Get the multiplier of standard deviation.
| statistics | pointer to statistics structure | |
| [out] | nstd | multiplier of standard deviation |
Definition at line 523 of file iclass_statistics.c.
| int I_iclass_statistics_get_product | ( | IClass_statistics * | statistics, |
| int | band1, | ||
| int | band2, | ||
| float * | value | ||
| ) |
Get product value.
Product value of two bands is sum of products of cell category values of two bands. Only cells from training areas are taken into account.
| statistics | statistics object | |
| band1 | index of first band | |
| band2 | index of second band | |
| [out] | value | product value |
Definition at line 700 of file iclass_statistics.c.
References _, and G_warning().
| int I_iclass_statistics_get_range_max | ( | IClass_statistics * | statistics, |
| int | band, | ||
| int * | max | ||
| ) |
Get maximum cell value based on mean and standard deviation for band.
| statistics | pointer to statistics structure | |
| band | band index | |
| [out] | max | maximum value |
Definition at line 746 of file iclass_statistics.c.
References _, G_warning(), and max.
| int I_iclass_statistics_get_range_min | ( | IClass_statistics * | statistics, |
| int | band, | ||
| int * | min | ||
| ) |
Get minimum cell value based on mean and standard deviation for band.
| statistics | pointer to statistics structure | |
| band | band index | |
| [out] | min | minimum value |
Definition at line 723 of file iclass_statistics.c.
References _, G_warning(), and min.
| int I_iclass_statistics_get_stddev | ( | IClass_statistics * | statistics, |
| int | band, | ||
| float * | stddev | ||
| ) |
Get standard deviation of cell category values in band.
| statistics | pointer to statistics structure | |
| band | band index | |
| [out] | stddev | standard deviation |
Definition at line 641 of file iclass_statistics.c.
References _, G_warning(), and stddev().
| int I_iclass_statistics_get_sum | ( | IClass_statistics * | statistics, |
| int | band, | ||
| float * | sum | ||
| ) |
Get sum of values in band.
| statistics | pointer to statistics structure | |
| band | band index | |
| [out] | sum | sum |
Definition at line 595 of file iclass_statistics.c.
References _, and G_warning().
| void I_iclass_statistics_set_nstd | ( | IClass_statistics * | statistics, |
| float | nstd | ||
| ) |
Set the multiplier of standard deviation.
| statistics | pointer to statistics structure |
| nstd | multiplier of standard deviation |
Definition at line 534 of file iclass_statistics.c.
| int make_all_statistics | ( | IClass_statistics * | statistics, |
| IClass_perimeter_list * | perimeters, | ||
| CELL ** | band_buffer, | ||
| int * | band_fd | ||
| ) |
Calculate statistics for all training areas.
| statistics | pointer to statistics structure |
| perimeters | list of all area perimeters |
| band_buffer | buffer to read band rows into |
| band_fd | band files descriptors |
Definition at line 140 of file iclass_statistics.c.
References b, band_range(), G_debug(), make_statistics(), mean(), and stddev().
Referenced by I_iclass_analysis().
| int make_statistics | ( | IClass_statistics * | statistics, |
| IClass_perimeter * | perimeter, | ||
| CELL ** | band_buffer, | ||
| int * | band_fd | ||
| ) |
Calculate statistics for one training area.
| [out] | statistics | pointer to statistics structure |
| perimeter | area perimeter | |
| band_buffer | buffer to read band rows into | |
| band_fd | band files descriptors |
Definition at line 191 of file iclass_statistics.c.
References _, b, G_debug(), G_warning(), read_band_row(), and x.
Referenced by make_all_statistics().
| float mean | ( | IClass_statistics * | statistics, |
| int | band | ||
| ) |
Helper function for computing mean.
Computing mean value of cell category values in one band within training area.
| statistics | pointer to statistics structure |
| band | band index |
Definition at line 367 of file iclass_statistics.c.
Referenced by Cdhc_anderson_darling(), Cdhc_anderson_darling_exp(), Cdhc_chi_square(), Cdhc_chi_square_exp(), Cdhc_cramer_von_mises(), Cdhc_cramer_von_mises_exp(), Cdhc_dmax(), Cdhc_dmax_exp(), Cdhc_geary_test(), Cdhc_omnibus_moments(), Cdhc_royston(), Cdhc_shapiro_wilk_exp(), Cdhc_watson_u2(), Cdhc_watson_u2_exp(), I_iclass_statistics_get_mean(), make_all_statistics(), N_compute_gradient_field_2d(), N_compute_gradient_field_3d(), P_Mean_Calc(), P_Regular_Points(), P_Sparse_Points(), and var().
| float stddev | ( | IClass_statistics * | statistics, |
| int | band | ||
| ) |
Helper function for standard deviation.
Computing standard deviation of cell category values in one band within training area.
| statistics | pointer to statistics structure |
| band | band index |
Definition at line 383 of file iclass_statistics.c.
References var().
Referenced by I_iclass_statistics_get_stddev(), and make_all_statistics().
| float var | ( | IClass_statistics * | statistics, |
| int | band1, | ||
| int | band2 | ||
| ) |
Helper function for computing variance.
Computing variance of cell category values in one band within training area.
| statistics | pointer to statistics structure |
| band1 | band index |
| band2 | band index |
Definition at line 402 of file iclass_statistics.c.
References mean().
Referenced by c_kurt(), c_stddev(), I_cluster_separation(), stddev(), w_kurt(), and w_stddev().
| float var_signature | ( | IClass_statistics * | statistics, |
| int | band1, | ||
| int | band2 | ||
| ) |
Helper function for computing variance for signature file.
Computing variance of cell category values in one band within training area. Variance is computed in special way.
| statistics | pointer to statistics structure |
| band1 | band index |
| band2 | band index |
Definition at line 435 of file iclass_statistics.c.
Referenced by I_iclass_add_signature().