António Rocha wrote:

> Thanks for the feedback. My problem is not a segmentation issue but a 
> memory-allocation issue. I need to understand how in GRASS (C functions) 
> I can allocate all pixels of a group images to an matrix (array of 
> array) instead of just row-by-row (or column-by-column).

If you want the data interleaved by cell, you'll need to read a row
from each map then interleave the values yourself, e.g.

        DCELL *row_buf = G_malloc(ncols * nbands * sizeof(DCELL));

        for (row = 0; row < nrows; row++) {
            for (band = 0; band < nbands; band++) {
                G_get_d_raster_row(fds[band], bufs[band], row);
                for (col = 0; col < ncols; col++)
                    row_buf[col * nbands + band] = bufs[band][col];
        ...

-- 
Glynn Clements <[email protected]>
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to