Accessing raw pixels from a raster or raster dataset.

Discussion created by steve_piche on Oct 8, 2010
Latest reply on Jan 6, 2013 by avigis
Hello all,

Does anyone know how to access the raw pixels from an image while being able to specify the position (row and column) and the size (width and the height) and a number of bands for the IPixelBlock to retrieve the data through ?

Using the CreatePixelBlock and Read methods from a IRaster object returns data that has been resampled, which is of no use for our purpose.

Casting the IRaster to a IRawBlocks reference, we can access the CreatePixelBlock and ReadBlock methods, however theses interfaces do not provide a way to specify the position and size desired. I also tried modifying the IRasterInfo width's, heigth's and cell size obtained from the IRawBlock, interface but to no avail.

The IRasterCusor interface only provides an iterator over a list of IPixelBlock which again does not meet our requirement.

The IRawPixels interface that can be obtained from a RasterBand would seem to be the best available option. However this means we can only retrieve raw pixels for one band at a time, where as in our case, we need to do for multiple bands.

Any help would be appreciated,

Thanks in advance