Search band for pixel(s) with search values.
- Parameters
-
band | : the band to query for minimum and maximum pixel values |
exclude_nodata_value | : if non-zero, ignore nodata values |
searchset | : array of values to count |
searchcount | : the number of search values |
pixels | : pixels with the search value |
- Returns
- -1 on error, otherwise number of pixels
Definition at line 1652 of file rt_band.c.
1668 assert(NULL !=
band);
1669 assert(NULL != pixels);
1670 assert(NULL != searchset && searchcount > 0);
1672 if (!
band->hasnodata)
1673 exclude_nodata_value =
FALSE;
1675 else if (exclude_nodata_value &&
band->isnodata) {
1676 RASTER_DEBUG(4,
"Pixels cannot be searched as band is NODATA and excluding NODATA values");
1680 for (
x = 0;
x <
band->width;
x++) {
1681 for (
y = 0;
y <
band->height;
y++) {
1684 rterror(
"rt_band_get_pixel_of_value: Cannot get band pixel");
1687 else if (exclude_nodata_value && isnodata)
1690 for (i = 0; i < searchcount; i++) {
1700 if (*pixels == NULL)
1704 if (*pixels == NULL) {
1705 rterror(
"rt_band_get_pixel_of_value: Could not allocate memory for pixel(s)");
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
#define RASTER_DEBUG(level, msg)
struct rt_pixel_t * rt_pixel
rt_errorstate rt_pixtype_compare_clamped_values(rt_pixtype pixtype, double val, double refval, int *isequal)
Test to see if two values are equal when clamped.
void * rtrealloc(void *mem, size_t size)
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
References ovdump::band, genraster::count, ES_NONE, FALSE, FLT_NEQ, pixval::pixel, pixval::pixval, RASTER_DEBUG, rt_band_get_pixel(), rt_pixtype_compare_clamped_values(), rtalloc(), rterror(), rtrealloc(), pixval::x, and pixval::y.
Referenced by RASTER_pixelOfValue(), and test_band_get_pixel_of_value().