band->width = width;
band->height = height;
band->hasnodata = hasnodata;
+ band->isnodata = FALSE; /* we don't know what is in data, so must be FALSE */
band->nodataval = 0;
band->data.mem = data;
band->ownsdata = 0; /* we do NOT own this data!!! */
- band->isnodata = FALSE;
band->raster = NULL;
RASTER_DEBUGF(3, "Created rt_band with dimensions %d x %d", band->width, band->height);
#if POSTGIS_DEBUG_LEVEL > 0
{
double value;
- rt_band_get_pixel(band, x, y, &value);
+ rt_band_get_pixel(band, x, y, &value, NULL);
RASTER_DEBUGF(4, "pixel at (%d, %d) = %f", x, y, value);
}
#endif
* @param band : the band to set nodata value to
* @param x : x ordinate (0-based)
* @param y : x ordinate (0-based)
- * @param *result: result if there is a value
+ * @param *value: pixel value
+ * @param *nodata: flag (0 or 1) indicating if pixel is NODATA
*
* @return 0 on success, -1 on error (value out of valid range).
*/
rt_band_get_pixel(
rt_band band,
int x, int y,
- double *result
+ double *value,
+ int *nodata
) {
- rt_pixtype pixtype = PT_END;
- uint8_t* data = NULL;
- uint32_t offset = 0;
+ rt_pixtype pixtype = PT_END;
+ uint8_t* data = NULL;
+ uint32_t offset = 0;
- assert(NULL != band);
+ assert(NULL != band);
- pixtype = band->pixtype;
+ /* set nodata to 0 */
+ if (nodata != NULL)
+ *nodata = 0;
- if (
- x < 0 || x >= band->width ||
- y < 0 || y >= band->height
- ) {
- rtwarn("Attempting to get pixel value with out of range raster coordinates: (%d, %d)", x, y);
- return -1;
- }
+ if (
+ x < 0 || x >= band->width ||
+ y < 0 || y >= band->height
+ ) {
+ rtwarn("Attempting to get pixel value with out of range raster coordinates: (%d, %d)", x, y);
+ return -1;
+ }
- data = rt_band_get_data(band);
- if (data == NULL) {
- rterror("rt_band_get_pixel: Cannot get band data");
- return -1;
- }
+ /* band is NODATA */
+ if (band->hasnodata && band->isnodata) {
+ rtinfo("Band's isnodata flag is TRUE. Returning NODATA value");
+ *value = band->nodataval;
+ if (nodata != NULL) *nodata = 1;
+ return 0;
+ }
- offset = x + (y * band->width); /* +1 for the nodata value */
+ data = rt_band_get_data(band);
+ if (data == NULL) {
+ rterror("rt_band_get_pixel: Cannot get band data");
+ return -1;
+ }
- switch (pixtype) {
- case PT_1BB:
-#ifdef OPTIMIZE_SPACE
- {
- int byteOffset = offset / 8;
- int bitOffset = offset % 8;
- data += byteOffset;
+ /* +1 for the nodata value */
+ offset = x + (y * band->width);
- /* Bit to set is bitOffset into data */
- *result = getBits(data, val, 1, bitOffset);
- return 0;
- }
-#endif
+ pixtype = band->pixtype;
- case PT_2BUI:
+ switch (pixtype) {
+ case PT_1BB:
#ifdef OPTIMIZE_SPACE
- {
- int byteOffset = offset / 4;
- int bitOffset = offset % 4;
- data += byteOffset;
+ {
+ int byteOffset = offset / 8;
+ int bitOffset = offset % 8;
+ data += byteOffset;
- /* Bits to set start at bitOffset into data */
- *result = getBits(data, val, 2, bitOffset);
- return 0;
- }
+ /* Bit to set is bitOffset into data */
+ *value = getBits(data, val, 1, bitOffset);
+ break;
+ }
#endif
+ case PT_2BUI:
+#ifdef OPTIMIZE_SPACE
+ {
+ int byteOffset = offset / 4;
+ int bitOffset = offset % 4;
+ data += byteOffset;
- case PT_4BUI:
+ /* Bits to set start at bitOffset into data */
+ *value = getBits(data, val, 2, bitOffset);
+ break;
+ }
+#endif
+ case PT_4BUI:
#ifdef OPTIMIZE_SPACE
- {
- int byteOffset = offset / 2;
- int bitOffset = offset % 2;
- data += byteOffset;
+ {
+ int byteOffset = offset / 2;
+ int bitOffset = offset % 2;
+ data += byteOffset;
- /* Bits to set start at bitOffset into data */
- *result = getBits(data, val, 2, bitOffset);
- return 0;
- }
+ /* Bits to set start at bitOffset into data */
+ *value = getBits(data, val, 2, bitOffset);
+ break;
+ }
#endif
+ case PT_8BSI: {
+ int8_t val = data[offset];
+ *value = val;
+ break;
+ }
+ case PT_8BUI: {
+ uint8_t val = data[offset];
+ *value = val;
+ break;
+ }
+ case PT_16BSI: {
+ int16_t *ptr = (int16_t*) data; /* we assume correct alignment */
+ *value = ptr[offset];
+ break;
+ }
+ case PT_16BUI: {
+ uint16_t *ptr = (uint16_t*) data; /* we assume correct alignment */
+ *value = ptr[offset];
+ break;
+ }
+ case PT_32BSI: {
+ int32_t *ptr = (int32_t*) data; /* we assume correct alignment */
+ *value = ptr[offset];
+ break;
+ }
+ case PT_32BUI: {
+ uint32_t *ptr = (uint32_t*) data; /* we assume correct alignment */
+ *value = ptr[offset];
+ break;
+ }
+ case PT_32BF: {
+ float *ptr = (float*) data; /* we assume correct alignment */
+ *value = ptr[offset];
+ break;
+ }
+ case PT_64BF: {
+ double *ptr = (double*) data; /* we assume correct alignment */
+ *value = ptr[offset];
+ break;
+ }
+ default: {
+ rterror("rt_band_get_pixel: Unknown pixeltype %d", pixtype);
+ return -1;
+ }
+ }
- case PT_8BSI:
- {
- int8_t val = data[offset];
- *result = val;
- return 0;
- }
- case PT_8BUI:
- {
- uint8_t val = data[offset];
- *result = val;
- return 0;
- }
- case PT_16BSI:
- {
- int16_t *ptr = (int16_t*) data; /* we assume correct alignment */
- *result = ptr[offset];
- return 0;
- }
- case PT_16BUI:
- {
- uint16_t *ptr = (uint16_t*) data; /* we assume correct alignment */
- *result = ptr[offset];
- return 0;
- }
- case PT_32BSI:
- {
- int32_t *ptr = (int32_t*) data; /* we assume correct alignment */
- *result = ptr[offset];
- return 0;
- }
- case PT_32BUI:
- {
- uint32_t *ptr = (uint32_t*) data; /* we assume correct alignment */
- *result = ptr[offset];
- return 0;
- }
- case PT_32BF:
- {
- float *ptr = (float*) data; /* we assume correct alignment */
- *result = ptr[offset];
- return 0;
- }
- case PT_64BF:
- {
- double *ptr = (double*) data; /* we assume correct alignment */
- *result = ptr[offset];
- return 0;
- }
- default:
- {
- rterror("rt_band_get_pixel: Unknown pixeltype %d", pixtype);
- return -1;
- }
- }
+ /* set NODATA flag */
+ if (band->hasnodata && nodata != NULL) {
+ if (
+ FLT_EQ(*value, band->nodataval) ||
+ rt_band_clamped_value_is_nodata(band, *value) == 1
+ ) {
+ *nodata = 1;
+ }
+ else
+ *nodata = 0;
+ }
+
+ return 0;
}
/**
if (rt_band_get_pixel(
band,
_x, _y,
- &pixval
+ &pixval,
+ NULL
) < 0) {
rterror("rt_band_get_nearest_pixel: Unable to get pixel value");
if (count) rtdealloc(*npixels);
for (x = 0; x < band->width; x++) {
for (y = 0; y < band->height; y++) {
- err = rt_band_get_pixel(band, x, y, &pixval);
+ err = rt_band_get_pixel(band, x, y, &pixval, NULL);
if (err != 0) {
rterror("rt_band_get_pixel_of_value: Cannot get band pixel");
return -1;
/* Check all pixels */
for (i = 0; i < band->width; i++) {
for (j = 0; j < band->height; j++) {
- err = rt_band_get_pixel(band, i, j, &pxValue);
+ err = rt_band_get_pixel(band, i, j, &pxValue, NULL);
if (err != 0) {
rterror("rt_band_check_is_nodata: Cannot get band pixel");
return FALSE;
RASTER_DEBUGF(5, "(x, y, z) = (%d, %d, %d)", x, y, z);
if (y >= band->height || z > sample_per) break;
- rtn = rt_band_get_pixel(band, x, y, &value);
+ rtn = rt_band_get_pixel(band, x, y, &value, NULL);
#if POSTGIS_DEBUG_LEVEL > 0
if (rtn != -1) {
RASTER_DEBUGF(5, "(x, y, value) = (%d,%d, %f)", x, y, value);
RASTER_DEBUGF(5, "(x, y, z) = (%d, %d, %d)", x, y, z);
if (y >= band->height || z > sample_per) break;
- status = rt_band_get_pixel(band, x, y, &value);
+ status = rt_band_get_pixel(band, x, y, &value, NULL);
j++;
if (
for (x = 0; x < band->width; x++) {
for (y = 0; y < band->height; y++) {
- rtn = rt_band_get_pixel(band, x, y, &pxlval);
+ rtn = rt_band_get_pixel(band, x, y, &pxlval, NULL);
/* error getting value, continue */
if (rtn == -1) continue;
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
- rtn = rt_band_get_pixel(srcband, x, y, &ov);
+ rtn = rt_band_get_pixel(srcband, x, y, &ov, NULL);
/* error getting value, skip */
if (rtn == -1) {
iXMax = x + nXValid;
for (iY = y; iY < iYMax; iY++) {
for (iX = x; iX < iXMax; iX++) {
- if (rt_band_get_pixel(rtband, iX, iY, &value) != 0) {
+ if (rt_band_get_pixel(rtband, iX, iY, &value, NULL) != 0) {
rterror("rt_raster_to_gdal_mem: Could not get pixel value to convert from 8BSI to 16BSI");
rtdealloc(values);
if (allocBandNums) rtdealloc(bandNums);
else if (hasnodata1 == FALSE)
val1 = 1;
/* unable to get value at cell */
- else if (rt_band_get_pixel(band1, Qr[pX], Qr[pY], &val1) < 0)
+ else if (rt_band_get_pixel(band1, Qr[pX], Qr[pY], &val1, NULL) < 0)
noval1 = 1;
/* unable to convert point to cell */
else if (hasnodata2 == FALSE)
val2 = 1;
/* unable to get value at cell */
- else if (rt_band_get_pixel(band2, Qr[pX], Qr[pY], &val2) < 0)
+ else if (rt_band_get_pixel(band2, Qr[pX], Qr[pY], &val2, NULL) < 0)
noval2 = 1;
if (!noval1) {
for (row = rowoffset; row < *heightS; row += 3) {
if (hasnodataS == FALSE)
valS = 1;
- else if (rt_band_get_pixel(bandS, col, row, &valS) < 0)
+ else if (rt_band_get_pixel(bandS, col, row, &valS, NULL) < 0)
continue;
if ((hasnodataS == FALSE) || (
if (hasnodataS == FALSE)
valL = 1;
- else if (rt_band_get_pixel(bandL, Qr[pX], Qr[pY], &valL) < 0)
+ else if (rt_band_get_pixel(bandL, Qr[pX], Qr[pY], &valL, NULL) < 0)
continue;
if ((hasnodataL == FALSE) || (
if (rt_band_get_pixel(
_param->band[i],
x, y,
- &value
+ &value,
+ NULL
) < 0) {
rterror("rt_raster_iterator: Unable to get the pixel value of band");
* @param band : the band to get pixel value from
* @param x : x ordinate (0-based)
* @param y : x ordinate (0-based)
- * @param *result: result if there is a value
+ * @param *value: pixel value
+ * @param *nodata: flag (0 or 1) indicating if pixel is NODATA
*
* @return 0 on success, -1 on error (value out of valid range).
*/
int rt_band_get_pixel(
rt_band band,
int x, int y,
- double *result
+ double *value,
+ int *nodata
);
/**
uint16_t height;
int32_t hasnodata; /* a flag indicating if this band contains nodata values */
int32_t isnodata; /* a flag indicating if this band is filled only with
- nodata values */
+ nodata values. flag CANNOT be TRUE if hasnodata is FALSE */
double nodataval; /* int will be converted ... */
int8_t ownsdata; /* 0, externally owned. 1, internally owned. only applies to data.mem */
PG_RETURN_NULL();
}
/* Fetch pixel using 0-based coordinates */
- result = rt_band_get_pixel(band, x - 1, y - 1, &pixvalue);
+ result = rt_band_get_pixel(band, x - 1, y - 1, &pixvalue, NULL);
/* If the result is -1 or the value is nodata and we take nodata into account
* then return nodata = NULL */
for (y = 0; y < arg1->rows; y++) {
for (x = 0; x < arg1->columns; x++) {
/* get pixel */
- if (rt_band_get_pixel(band, x, y, &val) != 0) {
+ if (rt_band_get_pixel(band, x, y, &val, NULL) != 0) {
elog(ERROR, "RASTER_dumpValues: Unable to pixel (%d, %d) of band %d", x, y, arg1->nbands[z] + 1);
rtpg_dumpvalues_arg_destroy(arg1);
rt_raster_destroy(raster);
/* if hasnodata = TRUE and keepnodata = TRUE, inspect pixel value */
if (hasnodata && keepnodata) {
- rtn = rt_band_get_pixel(band, pixval[i].x, pixval[i].y, &val);
+ rtn = rt_band_get_pixel(band, pixval[i].x, pixval[i].y, &val, NULL);
if (rtn != 0) {
elog(ERROR, "Cannot get value of pixel. Returning NULL");
pfree(pixval);
}
/* get pixel value */
- if (rt_band_get_pixel(band, xy[0], xy[1], &value) != 0) {
+ if (rt_band_get_pixel(band, xy[0], xy[1], &value, NULL) != 0) {
elog(ERROR, "RASTER_setPixelValuesGeomval: Unable to get pixel value");
rtpg_setvaluesgv_arg_destroy(arg);
rt_raster_destroy(raster);
/* value, NODATA flag */
if (!noband) {
- if (rt_band_get_pixel(band, x - 1, y - 1, &(pix[pixcount].value)) != 0) {
+ if (rt_band_get_pixel(band, x - 1, y - 1, &(pix[pixcount].value), NULL) != 0) {
elog(ERROR, "RASTER_getPixelPolygons: Could not get pixel value");
for (i = 0; i < pixcount; i++)
(x >= 0 && x < rt_raster_get_width(raster)) &&
(y >= 0 && y < rt_raster_get_height(raster))
) {
- if (rt_band_get_pixel(band, x, y, &value) < 0) {
+ if (rt_band_get_pixel(band, x, y, &value, NULL) < 0) {
elog(ERROR, "RASTER_nearestValue: Unable to get pixel value for band at index %d", bandindex);
rt_raster_destroy(raster);
PG_FREE_IF_COPY(pgraster, 0);
if (rt_band_get_pixel(
band,
_x, _y,
- &pixval
+ &pixval,
+ NULL
) < 0) {
elog(NOTICE, "Unable to get the pixel of band at index %d. Returning NULL", bandindex);
rt_band_destroy(band);
for (x = 0; x < width; x++) {
for(y = 0; y < height; y++) {
- ret = rt_band_get_pixel(band, x, y, &r);
+ ret = rt_band_get_pixel(band, x, y, &r, NULL);
/**
* We compute a value only for the withdata value pixel since the
for (x = 0; x < width; x++) {
for(y = 0; y < height; y++) {
- ret = rt_band_get_pixel(band, x, y, &r);
+ ret = rt_band_get_pixel(band, x, y, &r, NULL);
/**
* We compute a value only for the withdata value pixel since the
(_x >= 0 && _x < _dim[i][0]) &&
(_y >= 0 && _y < _dim[i][1])
) {
- err = rt_band_get_pixel(_band[i], _x, _y, &(_pixel[i]));
+ err = rt_band_get_pixel(_band[i], _x, _y, &(_pixel[i]), NULL);
if (err < 0) {
elog(ERROR, "RASTER_mapAlgebra2: Unable to get pixel of %s raster", (i < 1 ? "FIRST" : "SECOND"));
nNodataOnly = true;
pixelreplace = false;
if (valuereplace) {
- ret = rt_band_get_pixel(band, x, y, &rpix);
+ ret = rt_band_get_pixel(band, x, y, &rpix, NULL);
if (ret != -1 && FLT_NEQ(rpix, newnodatavalue)) {
pixelreplace = true;
}
}
for (u = x - ngbwidth; u <= x + ngbwidth; u++) {
for (v = y - ngbheight; v <= y + ngbheight; v++) {
- ret = rt_band_get_pixel(band, u, v, &r);
+ ret = rt_band_get_pixel(band, u, v, &r, NULL);
if (ret != -1) {
if (FLT_NEQ(r, newnodatavalue)) {
/* If the pixel value for this neighbor cell is not NODATA */
{
failure = rt_band_set_pixel(band, x, y, 1);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
failure = rt_band_set_pixel(band, x, y, 0);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 0);
{
failure = rt_band_set_pixel(band, x, y, 1);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
failure = rt_band_set_pixel(band, x, y, 2);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 2);
failure = rt_band_set_pixel(band, x, y, 3);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 3);
}
{
failure = rt_band_set_pixel(band, x, y, 1);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
failure = rt_band_set_pixel(band, x, y, 3);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 3);
failure = rt_band_set_pixel(band, x, y, 7);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 7);
failure = rt_band_set_pixel(band, x, y, 15);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 15);
}
{
failure = rt_band_set_pixel(band, x, y, 31);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 31);
failure = rt_band_set_pixel(band, x, y, 255);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 255);
failure = rt_band_set_pixel(band, x, y, 1);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
}
{
failure = rt_band_set_pixel(band, x, y, 31);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 31);
failure = rt_band_set_pixel(band, x, y, 1);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
failure = rt_band_set_pixel(band, x, y, -127);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, -127);
failure = rt_band_set_pixel(band, x, y, 127);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 127);
{
failure = rt_band_set_pixel(band, x, y, 255);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 255);
failure = rt_band_set_pixel(band, x, y, 65535);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 65535);
}
{
failure = rt_band_set_pixel(band, x, y, 255);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 255);
failure = rt_band_set_pixel(band, x, y, -32767);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, -32767);
failure = rt_band_set_pixel(band, x, y, 32767);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 32767);
}
{
failure = rt_band_set_pixel(band, x, y, 1);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
failure = rt_band_set_pixel(band, x, y, 0);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 0);
failure = rt_band_set_pixel(band, x, y, 65535);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 65535);
failure = rt_band_set_pixel(band, x, y, 4294967295UL);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 4294967295UL);
}
{
failure = rt_band_set_pixel(band, x, y, 1);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
failure = rt_band_set_pixel(band, x, y, 0);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 0);
failure = rt_band_set_pixel(band, x, y, 65535);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 65535);
failure = rt_band_set_pixel(band, x, y, 2147483647);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 2147483647);
}
{
failure = rt_band_set_pixel(band, x, y, 1);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
failure = rt_band_set_pixel(band, x, y, 0);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 0);
failure = rt_band_set_pixel(band, x, y, 65535.5);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS_DOUBLE(val, 65535.5);
failure = rt_band_set_pixel(band, x, y, 0.006);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS_DOUBLE(val, 0.0060000000521540);
{
failure = rt_band_set_pixel(band, x, y, 1);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
failure = rt_band_set_pixel(band, x, y, 0);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 0);
failure = rt_band_set_pixel(band, x, y, 65535.56);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 65535.56);
failure = rt_band_set_pixel(band, x, y, 0.006);
CHECK(!failure);
- failure = rt_band_get_pixel(band, x, y, &val);
+ failure = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 0.006);
newband = rt_band_reclass(band, PT_8BUI, 0, 0, exprset, cnt);
CHECK(newband);
- rtn = rt_band_get_pixel(newband, 0, 0, &val);
+ rtn = rt_band_get_pixel(newband, 0, 0, &val, NULL);
CHECK((rtn != -1));
CHECK_EQUALS(val, 0);
- rtn = rt_band_get_pixel(newband, 49, 5, &val);
+ rtn = rt_band_get_pixel(newband, 49, 5, &val, NULL);
CHECK((rtn != -1));
CHECK_EQUALS(val, 77);
- rtn = rt_band_get_pixel(newband, 99, 9, &val);
+ rtn = rt_band_get_pixel(newband, 99, 9, &val, NULL);
CHECK((rtn != -1));
CHECK_EQUALS(val, 255);
for (x = 0; x < xmax; x++) {
for (y = 0; y < ymax; y++) {
- rtn = rt_band_get_pixel(band, x, y, &value);
+ rtn = rt_band_get_pixel(band, x, y, &value, NULL);
CHECK((rtn != -1));
CHECK(FLT_EQ(value, values[x][y]));
}
for (x = 0; x < xmax; x++) {
for (y = 0; y < ymax; y++) {
- rtn = rt_band_get_pixel(band, x, y, &value);
+ rtn = rt_band_get_pixel(band, x, y, &value, NULL);
CHECK((rtn != -1));
CHECK(FLT_EQ(value, values[x][y]));
}
CHECK(rt_band_get_hasnodata_flag(band));
CHECK(FLT_EQ(rt_band_get_nodata(band), 0.));
- CHECK(rt_band_get_pixel(band, 0, 0, &value) == 0);
+ CHECK(rt_band_get_pixel(band, 0, 0, &value, NULL) == 0);
CHECK(FLT_EQ(value, 0.));
deepRelease(rast);
for (x = 0; x < maxX; x++) {
for (y = 0; y < maxY; y++) {
- rtn = rt_band_get_pixel(band, x, y, &val);
+ rtn = rt_band_get_pixel(band, x, y, &val, NULL);
CHECK((rtn == 0));
CHECK(FLT_EQ(val, 255));
}
CHECK(!rt_band_is_offline(band));
CHECK(rt_band_get_hasnodata_flag(band));
CHECK_EQUALS(rt_band_get_nodata(band), 0);
- failure = rt_band_get_pixel(band, 0, 0, &val);
+ failure = rt_band_get_pixel(band, 0, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
}
CHECK(rt_band_get_hasnodata_flag(band));
CHECK_EQUALS(rt_band_get_nodata(band), -1);
- failure = rt_band_get_pixel(band, 0, 0, &val);
+ failure = rt_band_get_pixel(band, 0, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, -1);
- failure = rt_band_get_pixel(band, 1, 0, &val);
+ failure = rt_band_get_pixel(band, 1, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 0);
- failure = rt_band_get_pixel(band, 2, 0, &val);
+ failure = rt_band_get_pixel(band, 2, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
- failure = rt_band_get_pixel(band, 0, 1, &val);
+ failure = rt_band_get_pixel(band, 0, 1, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 127);
- failure = rt_band_get_pixel(band, 1, 1, &val);
+ failure = rt_band_get_pixel(band, 1, 1, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 10);
- failure = rt_band_get_pixel(band, 2, 1, &val);
+ failure = rt_band_get_pixel(band, 2, 1, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 2);
}
CHECK(!rt_band_get_hasnodata_flag(band));
CHECK_EQUALS(rt_band_get_nodata(band), -1);
- failure = rt_band_get_pixel(band, 0, 0, &val);
+ failure = rt_band_get_pixel(band, 0, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, -1);
- failure = rt_band_get_pixel(band, 1, 0, &val);
+ failure = rt_band_get_pixel(band, 1, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 0);
- failure = rt_band_get_pixel(band, 2, 0, &val);
+ failure = rt_band_get_pixel(band, 2, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, -16);
- failure = rt_band_get_pixel(band, 0, 1, &val);
+ failure = rt_band_get_pixel(band, 0, 1, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 127);
- failure = rt_band_get_pixel(band, 1, 1, &val);
+ failure = rt_band_get_pixel(band, 1, 1, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 10);
- failure = rt_band_get_pixel(band, 2, 1, &val);
+ failure = rt_band_get_pixel(band, 2, 1, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 2);
}
CHECK(!rt_band_get_hasnodata_flag(band));
CHECK_EQUALS(rt_band_get_nodata(band), -1);
- failure = rt_band_get_pixel(band, 0, 0, &val);
+ failure = rt_band_get_pixel(band, 0, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, -1);
- failure = rt_band_get_pixel(band, 1, 0, &val);
+ failure = rt_band_get_pixel(band, 1, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 0);
- failure = rt_band_get_pixel(band, 2, 0, &val);
+ failure = rt_band_get_pixel(band, 2, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, -16);
- failure = rt_band_get_pixel(band, 0, 1, &val);
+ failure = rt_band_get_pixel(band, 0, 1, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 127);
- failure = rt_band_get_pixel(band, 1, 1, &val);
+ failure = rt_band_get_pixel(band, 1, 1, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 10);
- failure = rt_band_get_pixel(band, 2, 1, &val);
+ failure = rt_band_get_pixel(band, 2, 1, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 2);
}
CHECK(rt_band_get_hasnodata_flag(band));
CHECK_EQUALS(rt_band_get_nodata(band), 1);
- failure = rt_band_get_pixel(band, 0, 0, &val);
+ failure = rt_band_get_pixel(band, 0, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 1);
- failure = rt_band_get_pixel(band, 1, 0, &val);
+ failure = rt_band_get_pixel(band, 1, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 436);
- failure = rt_band_get_pixel(band, 2, 0, &val);
+ failure = rt_band_get_pixel(band, 2, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 431);
}
CHECK(rt_band_get_hasnodata_flag(band));
CHECK_EQUALS(rt_band_get_nodata(band), 0);
- failure = rt_band_get_pixel(band, 0, 0, &val);
+ failure = rt_band_get_pixel(band, 0, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 253);
- failure = rt_band_get_pixel(band, 1, 0, &val);
+ failure = rt_band_get_pixel(band, 1, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 254);
- failure = rt_band_get_pixel(band, 2, 0, &val);
+ failure = rt_band_get_pixel(band, 2, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 253);
- failure = rt_band_get_pixel(band, 3, 0, &val);
+ failure = rt_band_get_pixel(band, 3, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 254);
- failure = rt_band_get_pixel(band, 4, 0, &val);
+ failure = rt_band_get_pixel(band, 4, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 254);
}
CHECK(rt_band_get_hasnodata_flag(band));
CHECK_EQUALS(rt_band_get_nodata(band), 0);
- failure = rt_band_get_pixel(band, 0, 0, &val);
+ failure = rt_band_get_pixel(band, 0, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 78);
- failure = rt_band_get_pixel(band, 1, 0, &val);
+ failure = rt_band_get_pixel(band, 1, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 98);
- failure = rt_band_get_pixel(band, 2, 0, &val);
+ failure = rt_band_get_pixel(band, 2, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 122);
- failure = rt_band_get_pixel(band, 3, 0, &val);
+ failure = rt_band_get_pixel(band, 3, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 173);
- failure = rt_band_get_pixel(band, 4, 0, &val);
+ failure = rt_band_get_pixel(band, 4, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 209);
}
CHECK(rt_band_get_hasnodata_flag(band));
CHECK_EQUALS(rt_band_get_nodata(band), 0);
- failure = rt_band_get_pixel(band, 0, 0, &val);
+ failure = rt_band_get_pixel(band, 0, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 70);
- failure = rt_band_get_pixel(band, 1, 0, &val);
+ failure = rt_band_get_pixel(band, 1, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 86);
- failure = rt_band_get_pixel(band, 2, 0, &val);
+ failure = rt_band_get_pixel(band, 2, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 100);
- failure = rt_band_get_pixel(band, 3, 0, &val);
+ failure = rt_band_get_pixel(band, 3, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 135);
- failure = rt_band_get_pixel(band, 4, 0, &val);
+ failure = rt_band_get_pixel(band, 4, 0, &val, NULL);
CHECK(!failure);
CHECK_EQUALS(val, 161);
}