SoFunction
Updated on 2025-03-07

C# Use IRawPixels interface to traverse raster data

The version of AO is 10.2, and the language developed is C#. Raster data source IRasterDataset interface.

IRasterBandCollection pRasterBandCollection = pRasterDataset as IRasterBandCollection;
IRasterBand pRasterBand = (0);
 IRaster pRaster = (pRasterDataset as IRasterDataset2).CreateFullRaster();
IRawPixels pRawPixels = pRasterBand as IRawPixels;
IRasterProps pRasterProps = pRasterBand as IRasterProps;
int dHeight = ;
int dWidth = ; 
IPnt pntSize = new PntClass();
(dHeight, dWidth);
IPnt pPixelBlockOrigin = new PntClass();
(0, 0);
IPixelBlock pixelBlock = (pntSize);
(pPixelBlockOrigin, pixelBlock);
 arr = ()(pixelBlock as IPixelBlock3).get_PixelData(0);
for (int i = 0; i < dHeight;i++ ) 
{
 for (int j = 0; j < dWidth; j++) 
 {
   float number = 0;
   ((i,j).ToString(),out number);     
  }
}

The above is all the content of this article. I hope that the content of this article will help you study or work. I also hope to support me more!