430 double values[width][height];
434 GDALDriverH gddrv = NULL;
436 GDALDatasetH gdds = NULL;
439 CU_ASSERT(raster != NULL);
442 CU_ASSERT(band != NULL);
444 for (x = 0; x < width; x++) {
445 for (y = 0; y < height; y++) {
446 values[
x][
y] = (((double) x * y) + (x +
y) + (x + y * x)) / (x + y + 1);
452 CU_ASSERT(gddrv != NULL);
453 CU_ASSERT_EQUAL(destroy, 0);
454 CU_ASSERT(gdds != NULL);
455 CU_ASSERT_EQUAL(GDALGetRasterXSize(gdds), width);
456 CU_ASSERT_EQUAL(GDALGetRasterYSize(gdds), height);
459 CU_ASSERT(rast != NULL);
463 CU_ASSERT(band != NULL);
465 for (x = 0; x < width; x++) {
466 for (y = 0; y < height; y++) {
469 CU_ASSERT_DOUBLE_EQUAL(value, values[x][y], DBL_EPSILON);
481 CU_ASSERT(raster != NULL);
485 CU_ASSERT(band != NULL);
488 for (x = 0; x < width; x++) {
489 for (y = 0; y < height; y++) {
498 CU_ASSERT(gddrv != NULL);
499 CU_ASSERT_EQUAL(destroy, 0);
500 CU_ASSERT(gdds != NULL);
501 CU_ASSERT_EQUAL(GDALGetRasterXSize(gdds), width);
502 CU_ASSERT_EQUAL(GDALGetRasterYSize(gdds), height);
505 CU_ASSERT(rast != NULL);
509 CU_ASSERT(band != NULL);
512 for (x = 0; x < width; x++) {
513 for (y = 0; y < height; y++) {
516 CU_ASSERT_DOUBLE_EQUAL(value, values[x][y], 1.);
int rt_raster_get_num_bands(rt_raster raster)
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
GDALDatasetH rt_raster_to_gdal_mem(rt_raster raster, const char *srs, uint32_t *bandNums, int *excludeNodataValues, int count, GDALDriverH *rtn_drv, int *destroy_rtn_drv)
Return GDAL dataset using GDAL MEM driver from raster.
void cu_free_raster(rt_raster raster)
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
rt_raster rt_raster_from_gdal_dataset(GDALDatasetH ds)
Return a raster from a GDAL dataset.