Definition at line 286 of file rt_pixel.c.
  296         uint32_t dim[2] = {0};
 
  297         double **values = NULL;
 
  298         int **nodatas = NULL;
 
  303         assert(npixel != NULL && 
count > 0);
 
  304         assert(
value != NULL);
 
  305         assert(nodata != NULL);
 
  308         dim[0] = distancex * 2 + 1;
 
  309         dim[1] = distancey * 2 + 1;
 
  314           if (dim[0] != mask->
dimx || dim[1] != mask->
dimy) {
 
  315             rterror(
"rt_pixel_set_array: mask dimensions %d x %d do not match given dims %d x %d", mask->
dimx, mask->
dimy,  dim[0],  dim[1]);
 
  320             rterror(
"rt_pixel_set_array: Invalid mask");
 
  327         values = 
rtalloc(
sizeof(
double *) * dim[1]);
 
  328         nodatas = 
rtalloc(
sizeof(
int *) * dim[1]);
 
  330         if (values == NULL || nodatas == NULL) {
 
  331                 rterror(
"rt_pixel_set_to_array: Could not allocate memory for 2D array");
 
  336         for (i = 0; i < dim[1]; i++) {
 
  337                 values[i] = 
rtalloc(
sizeof(
double) * dim[0]);
 
  338                 nodatas[i] = 
rtalloc(
sizeof(
int) * dim[0]);
 
  340                 if (values[i] == NULL || nodatas[i] == NULL) {
 
  341                         rterror(
"rt_pixel_set_to_array: Could not allocate memory for dimension of 2D array");
 
  343                         if (values[i] == NULL) {
 
  344                                 for (j = 0; j < i; j++) {
 
  350                                 for (j = 0; j <= i; j++) {
 
  364                 memset(values[i], 0, 
sizeof(
double) * dim[0]);
 
  367                 for (j = 0; j < dim[0]; j++)
 
  372         zero[0] = 
x - distancex;
 
  373         zero[1] = 
y - distancey;
 
  376         for (i = 0; i < 
count; i++) {
 
  377                 if (npixel[i].nodata)
 
  380                 _x = npixel[i].
x - zero[0];
 
  381                 _y = npixel[i].
y - zero[1];
 
  388                         values[_y][_x] = npixel[i].
value;
 
  403                                         values[_y][_x] = npixel[i].
value;
 
  410                                 if(mask->
nodata[_y][_x] == 1) {
 
  416                                         values[_y][_x] = npixel[i].
value * mask->
values[_y][_x];
 
  422                 RASTER_DEBUGF(4, 
"(x, y, nodata, value) = (%d, %d, %d, %f)", _x, _y, nodatas[_y][_x], values[_y][_x]);
 
  426         *nodata = &(*nodatas);
 
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
#define RASTER_DEBUGF(level, msg,...)
void rtdealloc(void *mem)
 
References genraster::count, rt_mask_t::dimx, rt_mask_t::dimy, ES_ERROR, ES_NONE, FLT_EQ, rt_mask_t::nodata, RASTER_DEBUGF, rtalloc(), rtdealloc(), rterror(), rt_pixel_t::value, genraster::value, rt_mask_t::values, rt_mask_t::weighted, rt_pixel_t::x, pixval::x, rt_pixel_t::y, and pixval::y.
Referenced by RASTER_neighborhood(), rt_raster_iterator(), test_band_get_nearest_pixel(), and test_pixel_set_to_array().