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 1809 of file rt_band.c.
1825 assert(NULL !=
band);
1826 assert(NULL != pixels);
1827 assert(NULL != searchset && searchcount > 0);
1829 if (!
band->hasnodata)
1830 exclude_nodata_value =
FALSE;
1832 else if (exclude_nodata_value &&
band->isnodata) {
1833 RASTER_DEBUG(4,
"Pixels cannot be searched as band is NODATA and excluding NODATA values");
1837 for (
x = 0;
x <
band->width;
x++) {
1838 for (
y = 0;
y <
band->height;
y++) {
1841 rterror(
"rt_band_get_pixel_of_value: Cannot get band pixel");
1844 else if (exclude_nodata_value && isnodata)
1847 for (i = 0; i < searchcount; i++) {
1857 if (*pixels == NULL)
1861 if (*pixels == NULL) {
1862 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().